From: Amos Jeffries Date: Tue, 8 Apr 2014 15:35:12 +0000 (+1200) Subject: Cleanup: Make crypt(3) detection dependent on the helpers that use it X-Git-Tag: SQUID_3_5_0_1~301 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e59a64d780fe2dfdd065bc0c3809edad49862244;p=thirdparty%2Fsquid.git Cleanup: Make crypt(3) detection dependent on the helpers that use it Only run detection for crypt(3) support when the NCSA and getpwnam helpers which use it are to be built. Also, move shadow.h detection to depend on getpwnam helper which is the only code using it. Also, shuffle the libcrypt and libmd5 detection up into the section with other crypto libraries so they are known in advance of helper detections which may require libcrypt. --- diff --git a/configure.ac b/configure.ac index 508561c400..35ad685614 100644 --- a/configure.ac +++ b/configure.ac @@ -1204,6 +1204,15 @@ fi AC_MSG_NOTICE([Using Nettle cryptographic library: ${with_nettle:=yes}]) AC_SUBST(NETTLELIB) +dnl Check for libcrypt +CRYPTLIB= +dnl Some of our helpers use crypt(3) which may be in libc, or in +dnl libcrypt (eg FreeBSD) +AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"]) +dnl Solaris10 provides MD5 natively through libmd5 +AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"]) +AC_SUBST(CRYPTLIB) + dnl User may specify OpenSSL is needed from a non-standard location AC_ARG_WITH(openssl, AS_HELP_STRING([--with-openssl=PATH], @@ -2197,7 +2206,6 @@ AC_CHECK_HEADERS( \ paths.h \ poll.h \ pwd.h \ - shadow.h \ regex.h \ sched.h \ siginfo.h \ @@ -2562,22 +2570,6 @@ SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN -dnl Check for libcrypt -CRYPTLIB= -dnl Some of our helpers use crypt(3) which may be in libc, or in -dnl libcrypt (eg FreeBSD) -AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"]) -dnl Solaris10 provides MD5 natively through libmd5 -AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"]) -AC_SUBST(CRYPTLIB) - -# check for crypt, may require -lcrypt -SAVED_LIBS="$LIBS" -LIBS="$LIBS $CRYPTLIB" -AC_CHECK_FUNCS(crypt) -LIBS="$SAVED_LIBS" - - dnl Check for libdl, used by auth_modules/PAM if test "x$with_dl" = "xyes"; then AC_CHECK_LIB(dl, dlopen) diff --git a/helpers/basic_auth/NCSA/required.m4 b/helpers/basic_auth/NCSA/required.m4 index 0eddea8ca1..ad602278b8 100755 --- a/helpers/basic_auth/NCSA/required.m4 +++ b/helpers/basic_auth/NCSA/required.m4 @@ -1 +1,7 @@ BUILD_HELPER="NCSA" + +# check for optional crypt(3), may require -lcrypt +SQUID_STATE_SAVE(ncsa_helper) +LIBS="$LIBS $CRYPTLIB" +AC_CHECK_FUNCS(crypt) +SQUID_STATE_ROLLBACK(ncsa_helper) diff --git a/helpers/basic_auth/getpwnam/required.m4 b/helpers/basic_auth/getpwnam/required.m4 index a97648124a..581803c8b5 100755 --- a/helpers/basic_auth/getpwnam/required.m4 +++ b/helpers/basic_auth/getpwnam/required.m4 @@ -1 +1,14 @@ -AC_CHECK_HEADERS([pwd.h],[BUILD_HELPER="getpwnam"]) +AC_CHECK_HEADERS([pwd.h],[ + # check for crypt(3), may require -lcrypt + SQUID_STATE_SAVE(getpwnam_helper) + LIBS="$LIBS $CRYPTLIB" + AC_CHECK_FUNCS(crypt) + SQUID_STATE_ROLLBACK(getpwnam_helper) + + # unconditionally requires crypt(3), for now + if test "x$cv_ac_func_crypt" != "x"; then + AC_CHECK_HEADERS(unistd.h crypt.h shadow.h) + + BUILD_HELPER="getpwnam" + fi +])