Revert manifest to default one
[external/cups.git] / config-scripts / cups-pam.m4
1 dnl
2 dnl "$Id: cups-pam.m4 9771 2011-05-12 05:21:56Z mike $"
3 dnl
4 dnl   PAM stuff for CUPS.
5 dnl
6 dnl   Copyright 2007-2011 by Apple Inc.
7 dnl   Copyright 1997-2005 by Easy Software Products, all rights reserved.
8 dnl
9 dnl   These coded instructions, statements, and computer programs are the
10 dnl   property of Apple Inc. and are protected by Federal copyright
11 dnl   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
12 dnl   which should have been included with this file.  If this file is
13 dnl   file is missing or damaged, see the license at "http://www.cups.org/".
14 dnl
15
16 AC_ARG_ENABLE(pam, [  --disable-pam           disable PAM support])
17 AC_ARG_WITH(pam_module, [  --with-pam-module       specify the PAM module to use])
18
19 dnl Don't use PAM with AIX...
20 if test $uname = AIX; then
21         enable_pam=no
22 fi
23
24 PAMDIR=""
25 PAMFILE="pam.std"
26 PAMLIBS=""
27 PAMMOD="pam_unknown.so"
28 PAMMODAUTH="pam_unknown.so"
29
30 if test x$enable_pam != xno; then
31         SAVELIBS="$LIBS"
32
33         AC_CHECK_LIB(dl,dlopen)
34         AC_CHECK_LIB(pam,pam_start)
35         AC_CHECK_LIB(pam,pam_set_item,AC_DEFINE(HAVE_PAM_SET_ITEM))
36         AC_CHECK_LIB(pam,pam_setcred,AC_DEFINE(HAVE_PAM_SETCRED))
37         AC_CHECK_HEADER(security/pam_appl.h)
38         if test x$ac_cv_header_security_pam_appl_h != xyes; then
39                 AC_CHECK_HEADER(pam/pam_appl.h,
40                         AC_DEFINE(HAVE_PAM_PAM_APPL_H))
41         fi
42
43         if test x$ac_cv_lib_pam_pam_start != xno; then
44                 # Set the necessary libraries for PAM...
45                 if test x$ac_cv_lib_dl_dlopen != xno; then
46                         PAMLIBS="-lpam -ldl"
47                 else
48                         PAMLIBS="-lpam"
49                 fi
50
51                 # Find the PAM configuration directory, if any...
52                 for dir in /private/etc/pam.d /etc/pam.d; do
53                         if test -d $dir; then
54                                 PAMDIR=$dir
55                                 break;
56                         fi
57                 done
58         fi
59
60         LIBS="$SAVELIBS"
61
62         case "$uname" in
63                 Darwin*)
64                         # Darwin/Mac OS X
65                         if test "x$with_pam_module" != x; then
66                                 PAMFILE="pam.$with_pam_module"
67                         elif test -f /usr/lib/pam/pam_opendirectory.so.2; then
68                                 PAMFILE="pam.opendirectory"
69                         else
70                                 PAMFILE="pam.securityserver"
71                         fi
72                         ;;
73
74                 *)
75                         # All others; this test might need to be updated
76                         # as Linux distributors move things around...
77                         if test "x$with_pam_module" != x; then
78                                 PAMMOD="pam_${with_pam_module}.so"
79                         elif test -f /lib/security/pam_unix2.so; then
80                                 PAMMOD="pam_unix2.so"
81                         elif test -f /lib/security/pam_unix.so; then
82                                 PAMMOD="pam_unix.so"
83                         fi
84
85                         if test "x$PAMMOD" = xpam_unix.so; then
86                                 PAMMODAUTH="$PAMMOD shadow nodelay"
87                         else
88                                 PAMMODAUTH="$PAMMOD nodelay"
89                         fi
90                         ;;
91         esac
92 fi
93
94 AC_SUBST(PAMDIR)
95 AC_SUBST(PAMFILE)
96 AC_SUBST(PAMLIBS)
97 AC_SUBST(PAMMOD)
98 AC_SUBST(PAMMODAUTH)
99
100 dnl
101 dnl End of "$Id: cups-pam.m4 9771 2011-05-12 05:21:56Z mike $".
102 dnl