]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-pam.m4
Fix PAM module detection and add support for the "common-*" includes used on
[thirdparty/cups.git] / config-scripts / cups-pam.m4
CommitLineData
ef416fc2 1dnl
503b54c9 2dnl PAM stuff for CUPS.
ef416fc2 3dnl
105922ec 4dnl Copyright 2007-2017 by Apple Inc.
5a1d7a17 5dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
ef416fc2 6dnl
e3101897 7dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
ef416fc2 8dnl
9
bf3816c7 10AC_ARG_ENABLE(pam, [ --disable-pam disable PAM support])
6eda776e 11AC_ARG_WITH(pam_module, [ --with-pam-module set the PAM module to use])
ef416fc2 12
ef416fc2 13PAMDIR=""
18ecb428 14PAMFILE="pam.std"
ef416fc2 15PAMLIBS=""
16PAMMOD="pam_unknown.so"
18ecb428 17PAMMODAUTH="pam_unknown.so"
ef416fc2 18
19if test x$enable_pam != xno; then
20 SAVELIBS="$LIBS"
21
22 AC_CHECK_LIB(dl,dlopen)
23 AC_CHECK_LIB(pam,pam_start)
a4924f6c 24 AC_CHECK_LIB(pam,pam_set_item,AC_DEFINE(HAVE_PAM_SET_ITEM))
ee571f26 25 AC_CHECK_LIB(pam,pam_setcred,AC_DEFINE(HAVE_PAM_SETCRED))
ef416fc2 26 AC_CHECK_HEADER(security/pam_appl.h)
27 if test x$ac_cv_header_security_pam_appl_h != xyes; then
28 AC_CHECK_HEADER(pam/pam_appl.h,
29 AC_DEFINE(HAVE_PAM_PAM_APPL_H))
30 fi
31
32 if test x$ac_cv_lib_pam_pam_start != xno; then
33 # Set the necessary libraries for PAM...
34 if test x$ac_cv_lib_dl_dlopen != xno; then
35 PAMLIBS="-lpam -ldl"
36 else
37 PAMLIBS="-lpam"
38 fi
39
40 # Find the PAM configuration directory, if any...
41 for dir in /private/etc/pam.d /etc/pam.d; do
42 if test -d $dir; then
43 PAMDIR=$dir
44 break;
45 fi
46 done
47 fi
48
49 LIBS="$SAVELIBS"
50
105922ec 51 case "$host_os_name" in
8d7d268f 52 darwin*)
8072030b 53 # Darwin/macOS
b19ccc9e
MS
54 if test "x$with_pam_module" != x; then
55 PAMFILE="pam.$with_pam_module"
d1c13e16 56 elif test -f /usr/lib/pam/pam_opendirectory.so.2; then
b19ccc9e
MS
57 PAMFILE="pam.opendirectory"
58 else
59 PAMFILE="pam.securityserver"
60 fi
ef416fc2 61 ;;
b19ccc9e 62
ef416fc2 63 *)
64 # All others; this test might need to be updated
65 # as Linux distributors move things around...
b19ccc9e
MS
66 if test "x$with_pam_module" != x; then
67 PAMMOD="pam_${with_pam_module}.so"
ac05c630
MS
68 elif test -f /etc/pam.d/common-auth; then
69 PAMFILE="pam.common"
70 else
71 moddir=""
72 for dir in /lib/security /lib64/security /lib/x86_64-linux-gnu/security /var/lib/pam; do
73 if test -d $dir; then
74 moddir=$dir
75 break;
76 fi
77 done
78
79 if test -f $moddir/pam_unix2.so; then
80 PAMMOD="pam_unix2.so"
81 elif test -f $moddir/pam_unix.so; then
82 PAMMOD="pam_unix.so"
83 fi
b19ccc9e 84 fi
ef416fc2 85
18ecb428
MS
86 if test "x$PAMMOD" = xpam_unix.so; then
87 PAMMODAUTH="$PAMMOD shadow nodelay"
88 else
89 PAMMODAUTH="$PAMMOD nodelay"
90 fi
ef416fc2 91 ;;
92 esac
93fi
94
95AC_SUBST(PAMDIR)
96AC_SUBST(PAMFILE)
97AC_SUBST(PAMLIBS)
98AC_SUBST(PAMMOD)
18ecb428 99AC_SUBST(PAMMODAUTH)