mirror of
https://github.com/paulusmack/ppp.git
synced 2024-11-23 02:13:28 +08:00
Use pkg-config to detect PAM when possible (#479)
This fixes a link error on Gentoo Linux by not putting -L/usr/lib in the link command on 64-bit systems. The correct path is -L/usr/lib64, and this is the default path used by GCC and clang. Users may override pkg-config by setting PAM_CFLAGS and PAM_LDFLAGS in the environment before calling configure. This is standard behavior for the PKG_CHECK_MODULES macro. The legacy detection logic is maintained when a path is given as an argument to --with-pam. Note that this logic is broken when libdir is not "lib". Signed-off-by: Mike Gilbert <floppym@gentoo.org>
This commit is contained in:
parent
100afafa36
commit
9c5701cb40
@ -25,35 +25,33 @@
|
||||
|
||||
AC_DEFUN([AX_CHECK_PAM], [
|
||||
AC_ARG_WITH([pam],
|
||||
[AS_HELP_STRING([--with-pam=DIR],
|
||||
[With libpam support, see ftp.redhat.com:/pub/pam])],
|
||||
[
|
||||
case "$withval" in
|
||||
"" | y | ye | yes)
|
||||
pamdirs="/usr/local /usr/lib /usr"
|
||||
;;
|
||||
n | no)
|
||||
with_pam="no"
|
||||
;;
|
||||
*)
|
||||
pamdirs="$withval"
|
||||
;;
|
||||
esac
|
||||
])
|
||||
[AS_HELP_STRING([--with-pam=yes|no|DIR],
|
||||
[With libpam support, see ftp.redhat.com:/pub/pam])])
|
||||
|
||||
AS_CASE(["$with_pam"],
|
||||
[ye|y], [with_pam=yes],
|
||||
[n], [with_pam=no])
|
||||
|
||||
if [ test "x${with_pam}" != "xno" ] ; then
|
||||
PAM_LIBS="-lpam"
|
||||
for pamdir in $pamdirs; do
|
||||
AC_MSG_CHECKING([for pam_appl.h in $pamdir])
|
||||
if test -f "$pamdir/include/security/pam_appl.h"; then
|
||||
PAM_CFLAGS="-I$pamdir/include"
|
||||
PAM_LDFLAGS="-L$pamdir/lib"
|
||||
AC_MSG_RESULT([yes])
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
AS_IF([test "x$with_pam" != "xno"], [
|
||||
AS_CASE(["$with_pam"],
|
||||
[""|yes], [PKG_CHECK_MODULES([PAM], [pam], [pamdirs=],
|
||||
[pamdirs="/usr/local /usr/lib /usr"])],
|
||||
[pamdirs="$with_pam"])
|
||||
|
||||
AS_IF([test -n "$pamdirs"], [
|
||||
PAM_LIBS="-lpam"
|
||||
for pamdir in $pamdirs; do
|
||||
AC_MSG_CHECKING([for pam_appl.h in $pamdir])
|
||||
if test -f "$pamdir/include/security/pam_appl.h"; then
|
||||
PAM_CFLAGS="-I$pamdir/include"
|
||||
PAM_LDFLAGS="-L$pamdir/lib"
|
||||
AC_MSG_RESULT([yes])
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
])
|
||||
|
||||
# try the preprocessor and linker with our new flags,
|
||||
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
|
||||
@ -87,7 +85,7 @@ AC_DEFUN([AX_CHECK_PAM], [
|
||||
AC_SUBST([PAM_CFLAGS])
|
||||
AC_SUBST([PAM_LIBS])
|
||||
AC_SUBST([PAM_LDFLAGS])
|
||||
fi
|
||||
])
|
||||
AM_CONDITIONAL(WITH_LIBPAM, test "x${with_pam}" != "xno")
|
||||
])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user