3 # AX_CHECK_PAM([action-if-found[, action-if-not-found]])
7 # Look for libpam in a number of default locations, or in a provided location
8 # (via --with-pam=). Sets
13 # and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
17 # Copyright (c) 2021 Eivind Naess <eivnaes@yahoo.com>
19 # Copying and distribution of this file, with or without modification, are
20 # permitted in any medium without royalty provided the copyright notice
21 # and this notice are preserved. This file is offered as-is, without any
26 AC_DEFUN([AX_CHECK_PAM], [
28 [AS_HELP_STRING([--with-pam=DIR],
29 [With libpam support, see ftp.redhat.com:/pub/pam])],
33 pamdirs="/usr/local /usr/lib /usr"
44 if [ test "x${with_pam}" != "xno" ] ; then
46 for pamdir in $pamdirs; do
47 AC_MSG_CHECKING([for pam_appl.h in $pamdir])
48 if test -f "$pamdir/include/security/pam_appl.h"; then
49 PAM_CFLAGS="-I$pamdir/include"
50 PAM_LDFLAGS="-L$pamdir/lib"
58 # try the preprocessor and linker with our new flags,
59 # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
61 AC_MSG_CHECKING([if compiling and linking against libpam works])
64 save_LDFLAGS="$LDFLAGS"
65 save_CPPFLAGS="$CPPFLAGS"
66 LDFLAGS="$LDFLAGS $PAM_LDFLAGS"
67 LIBS="$PAM_LIBS $LIBS"
68 CPPFLAGS="$PAM_CFLAGS $CPPFLAGS"
71 [#include <security/pam_appl.h>
73 [pam_authenticate(NULL, 0);])],
83 CPPFLAGS="$save_CPPFLAGS"
84 LDFLAGS="$save_LDFLAGS"
87 AC_SUBST([PAM_CFLAGS])
89 AC_SUBST([PAM_LDFLAGS])
91 AM_CONDITIONAL(WITH_LIBPAM, test "x${with_pam}" != "xno")