]> arthur.barton.de Git - netatalk.git/blob - macros/pam-check.m4
Forward-Ports from the stabilizing branch.
[netatalk.git] / macros / pam-check.m4
1 dnl $Id: pam-check.m4,v 1.2 2001-11-25 21:48:01 srittau Exp $
2 dnl PAM finding macro
3
4 AC_DEFUN([AC_PATH_PAM], [
5         AC_MSG_CHECKING([for PAM])
6         AC_ARG_WITH(pam, [  --with-pam=PATH         specify path to PAM installation],
7                 [
8                         require_pam="yes"
9                         if test "x$withval" = "xno"; then
10                                 PAMDIR="NONE"
11                                 require_pam="never"
12                         elif test "x$withval" = "xyes"; then
13                                 PAMDIR="NONE"
14                         else
15                                 PAMDIR="$withval"
16                         fi
17                 ],
18                 [PAMDIR="NONE";require_pam="no"]
19         )
20
21         if test "x$PAMDIR" = "xNONE" -a "x$require_pam" != "xnever"; then
22                 dnl Test for PAM
23                 pam_paths="/ /usr /usr/local"
24                 for path in $pam_paths; do
25                         if test -d "$path/etc/pam.d"; then
26                                 PAMDIR="$path"
27                                 break
28                         fi
29                 done
30         fi
31
32         PAM_CFLAGS=""
33         PAM_LIBS=""
34
35         pam_found="no"
36         if test "x$PAMDIR" != "xNONE"; then
37                 AC_MSG_RESULT([yes (path: $PAMDIR)])
38                 AC_CHECK_HEADER([security/pam_appl.h],[
39                         AC_CHECK_LIB(pam, pam_set_item, [
40                                 PAM_CFLAGS="-I$PAMDIR/include"
41                                 PAM_LIBS="-L$PAMDIR/lib -lpam"
42                                 pam_found="yes"
43                         ])
44                 ])
45         else
46                 AC_MSG_RESULT([no])
47         fi
48
49         if test "x$pam_found" = "xno"; then
50                 if test "x$require_pam" = "xyes"; then
51                         AC_MSG_ERROR([PAM support missing])
52                 fi
53                 ifelse([$2], , :, [$2])
54         else
55                 ifelse([$1], , :, [$1])
56         fi
57
58         AC_SUBST(PAMDIR)
59         AC_SUBST(PAM_CFLAGS)
60         AC_SUBST(PAM_LIBS)
61 ])