1 dnl $Id: pam-check.m4,v 1.6 2010-01-11 13:06:02 franklahm Exp $
4 AC_DEFUN([AC_NETATALK_PATH_PAM], [
6 AC_ARG_WITH(pam, [ --with-pam[[=PATH]] specify path to PAM installation [[auto]]],
9 if test "x$withval" = "xno"; then
12 elif test "x$withval" = "xyes"; then
18 [PAMDIR="NONE";require_pam="no"]
21 AC_MSG_CHECKING([for PAM installation directory])
22 if test "$host_os" != "solaris"; then
23 if test "x$PAMDIR" = "xNONE" -a "x$require_pam" != "xnever"; then
25 pam_paths="/ /usr/ /usr/local/"
26 for path in $pam_paths; do
27 if test -d "${path}etc/pam.d"; then
34 if test "x$PAMDIR" != "xNONE"; then
35 AC_MSG_RESULT([yes (path: ${PAMDIR}etc/pam.d)])
40 AC_MSG_RESULT([/etc/pam.conf (solaris)])
44 if test "x$require_pam" != "xnever"; then
47 savedLDFLAGS="$LDFLAGS"
50 if test "x$PAMDIR" != "xNONE" -a "x$PAMDIR" != "x/"; then
51 PAM_CFLAGS="-I${PAMDIR}include"
52 PAM_LDFLAGS="-L${PAMDIR}lib"
53 LDFLAGS="$LDFLAGS $PAM_LDFLAGS"
54 CFLAGS="$CFLAGS $PAM_CFLAGS"
57 AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h)
59 if test x"$ac_cv_header_security_pam_appl_h" = x"no" -a x"$ac_cv_header_pam_pam_appl_h" = x"no"; then
62 AC_CHECK_LIB(pam, pam_set_item, [
63 PAM_LIBS="$PAM_LDFLAGS -lpam"
68 LDFLAGS="$savedLDFLAGS"
72 netatalk_cv_install_pam=yes
73 if test x"$pam_found" = "xyes" -a "x$PAMDIR" = "xNONE"; then
74 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.])
75 netatalk_cv_install_pam=no
77 dnl Check for some system|common auth file
78 AC_MSG_CHECKING([for includable common PAM config])
79 pampath="${PAMDIR}etc/pam.d"
81 if test -f "$pampath/common-auth" ; then
84 PAM_ACCOUNT=common-account
85 PAM_PASSWORD=common-password
86 PAM_SESSION=common-session
88 elif test -f "$pampath/system-auth" ; then
91 PAM_ACCOUNT=system-auth
92 PAM_PASSWORD=system-auth
93 PAM_SESSION=system-auth
95 elif test -f "$pampath/system" ; then
103 PAM_DIRECTIVE=required
105 PAM_ACCOUNT=pam_unix.so
106 PAM_PASSWORD="pam_unix.so use_authtok"
107 PAM_SESSION=pam_unix.so
110 if test "x$PAM_DIRECTIVE" != "xrequired" ; then
111 AC_MSG_RESULT([yes ($PAM_DIRECTIVE $PAM_AUTH)])
113 AC_MSG_RESULT([no (using defaut pam_unix.so)])
117 AC_MSG_CHECKING([whether to enable PAM support])
118 if test "x$pam_found" = "xno"; then
119 netatalk_cv_install_pam=no
120 if test "x$require_pam" = "xyes"; then
121 AC_MSG_ERROR([PAM support missing])
125 ifelse([$2], , :, [$2])
128 ifelse([$1], , :, [$1])
131 netatalk_cv_use_pam=yes
132 AC_DEFINE(USE_PAM, 1, [Define to enable PAM support])
135 LIB_REMOVE_USR_LIB(PAM_LIBS)
136 CFLAGS_REMOVE_USR_INCLUDE(PAM_CFLAGS)
140 AC_SUBST(PAM_DIRECTIVE)
142 AC_SUBST(PAM_ACCOUNT)
143 AC_SUBST(PAM_PASSWORD)
144 AC_SUBST(PAM_SESSION)