]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: Make crypt(3) detection dependent on the helpers that use it
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 8 Apr 2014 15:35:12 +0000 (03:35 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 8 Apr 2014 15:35:12 +0000 (03:35 +1200)
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.

configure.ac
helpers/basic_auth/NCSA/required.m4
helpers/basic_auth/getpwnam/required.m4

index 508561c400f3f9b8dd93a66bbde6636e8fb6a622..35ad68561436a418b9fba6909c28deea479c283a 100644 (file)
@@ -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)
index 0eddea8ca1facdb688c2008f75373a74a6bea0df..ad602278b81fe8ffb6b985cbca26c80aec4c14d0 100755 (executable)
@@ -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)
index a97648124a1ddde3b09c618105ac608f9b8e8fd5..581803c8b57605166490b276f79a0782f7091fac 100755 (executable)
@@ -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
+])