1 dnl $Id: pam-check.m4,v 1.6 2010-01-11 13:06:02 franklahm Exp $
4 AC_DEFUN([AC_PATH_PAM], [
5 AC_ARG_WITH(pam, [ --with-pam[[=PATH]] specify path to PAM installation [[auto]]],
8 if test "x$withval" = "xno"; then
11 elif test "x$withval" = "xyes"; then
17 [PAMDIR="NONE";require_pam="no"]
20 AC_MSG_CHECKING([for PAM installation directory])
21 if test "$host_os" != "solaris"; then
22 if test "x$PAMDIR" = "xNONE" -a "x$require_pam" != "xnever"; then
24 pam_paths="/ /usr/ /usr/local/"
25 for path in $pam_paths; do
26 if test -d "${path}etc/pam.d"; then
33 if test "x$PAMDIR" != "xNONE"; then
34 AC_MSG_RESULT([yes (path: ${PAMDIR}etc/pam.d)])
39 AC_MSG_RESULT([/etc/pam.conf (solaris)])
43 if test "x$require_pam" != "xnever"; then
46 savedLDFLAGS="$LDFLAGS"
49 if test "x$PAMDIR" != "xNONE" -a "x$PAMDIR" != "x/"; then
50 PAM_CFLAGS="-I${PAMDIR}include"
51 PAM_LDFLAGS="-L${PAMDIR}lib"
52 LDFLAGS="$LDFLAGS $PAM_LDFLAGS"
53 CFLAGS="$CFLAGS $PAM_CFLAGS"
56 AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h)
58 if test x"$ac_cv_header_security_pam_appl_h" = x"no" -a x"$ac_cv_header_pam_pam_appl_h" = x"no"; then
61 AC_CHECK_LIB(pam, pam_set_item, [
62 PAM_LIBS="$PAM_LDFLAGS -lpam"
67 LDFLAGS="$savedLDFLAGS"
71 netatalk_cv_install_pam=yes
72 if test x"$pam_found" = "xyes" -a "x$PAMDIR" = "xNONE"; then
73 AC_MSG_WARN([PAM support can be compiled, but the install location for the netatalk.pamd file could not be determined. Either install this file by hand or specify the install path.])
74 netatalk_cv_install_pam=no
76 dnl Check for some system|common auth file
77 AC_MSG_CHECKING([for includable common PAM config])
78 pampath="${PAMDIR}etc/pam.d"
80 if test -f "$pampath/common-auth" ; then
83 PAM_ACCOUNT=common-account
84 PAM_PASSWORD=common-password
85 PAM_SESSION=common-session
87 elif test -f "$pampath/system-auth" ; then
90 PAM_ACCOUNT=system-auth
91 PAM_PASSWORD=system-auth
92 PAM_SESSION=system-auth
94 elif test -f "$pampath/system" ; then
102 PAM_DIRECTIVE=required
104 PAM_ACCOUNT=pam_unix.so
105 PAM_PASSWORD="pam_unix.so use_authtok"
106 PAM_SESSION=pam_unix.so
109 if test "x$PAM_DIRECTIVE" != "xrequired" ; then
110 AC_MSG_RESULT([yes ($PAM_DIRECTIVE $PAM_AUTH)])
112 AC_MSG_RESULT([no (using defaut pam_unix.so)])
116 AC_MSG_CHECKING([whether to enable PAM support])
117 if test "x$pam_found" = "xno"; then
118 netatalk_cv_install_pam=no
119 if test "x$require_pam" = "xyes"; then
120 AC_MSG_ERROR([PAM support missing])
124 ifelse([$2], , :, [$2])
127 ifelse([$1], , :, [$1])
130 LIB_REMOVE_USR_LIB(PAM_LIBS)
131 CFLAGS_REMOVE_USR_INCLUDE(PAM_CFLAGS)
135 AC_SUBST(PAM_DIRECTIVE)
137 AC_SUBST(PAM_ACCOUNT)
138 AC_SUBST(PAM_PASSWORD)
139 AC_SUBST(PAM_SESSION)