------------------------------------------------------------ revno: 13343 revision-id: squid3@treenet.co.nz-20140408130947-tv17k5hrrqu419db parent: squid3@treenet.co.nz-20140406070804-6mlnwwbmdh1rlmrt committer: Amos Jeffries branch nick: trunk timestamp: Tue 2014-04-08 06:09:47 -0700 message: Fix OpenSSL detection when an explicit path is given The previous OpenSSL detection was skipping the library checks when an explicit path was presented. Resulting in no -lssl flag being passed to the linker. Rational for this fix: pkg-config presents location-neutral details. The explicit checks are likewise neutral provided the LIBS environment variable has been set with the explicit path. User presented path must be used regardless of which the library checks are used in detection. So... Always perform the checks with optionally set LIBS and keep the user provided path explicitly separate from the pkg-config *_LIBS variable. Only assemble the parts into SSLLIB once all have been identified. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20140408130947-tv17k5hrrqu419db # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 4dc675a2fbc61c51b11abcbd6a8424c85f80ca9f # timestamp: 2014-04-08 13:53:51 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20140406070804-\ # 6mlnwwbmdh1rlmrt # # Begin patch === modified file 'configure.ac' --- configure.ac 2014-03-31 09:15:02 +0000 +++ configure.ac 2014-04-08 13:09:47 +0000 @@ -1219,7 +1219,7 @@ if test ! -d "$withval" ; then AC_MSG_ERROR([--with-openssl path does not point to a directory]) fi - LIBOPENSSL_LIBS="-L$with_openssl/lib" + LIBOPENSSL_PATH="-L$with_openssl/lib" CPPFLAGS="-I$with_openssl/include $CPPFLAGS" with_openssl=yes esac @@ -1238,38 +1238,39 @@ ) # User may have provided a custom location for OpenSSL. Otherwise... - if test "x$LIBOPENSSL_LIBS" = "x" ; then - # auto-detect using pkg-config - PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[ - ## For some OS pkg-config is broken or unavailable. - ## Detect libraries the hard way. - - # Windows MinGW has some special libraries ... - if test "x$squid_host_os" = "xmingw" ; then - LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS' - AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32]) - fi - - AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[ - AC_MSG_ERROR([library 'crypto' is required for OpenSSL]) - ]) - AC_CHECK_LIB(ssl,[SSL_library_init],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[ - AC_MSG_ERROR([library 'ssl' is required for OpenSSL]) - ]) - - ]) - - # This is a workaround for RedHat 9 brain damage.. - if test -d /usr/kerberos/include -a -f /usr/include/openssl/kssl.h; then - AC_MSG_NOTICE([OpenSSL depends on Kerberos]) - LIBOPENSSL_LIBS="-L/usr/kerberos/lib $LIBOPENSSL_LIBS" - CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include" + SQUID_STATE_SAVE(squid_openssl_state) + LIBS="$LIBS $LIBOPENSSL_PATH" + + # auto-detect using pkg-config + PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[ + ## For some OS pkg-config is broken or unavailable. + ## Detect libraries the hard way. + + # Windows MinGW has some special libraries ... + if test "x$squid_host_os" = "xmingw" ; then + LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS' + AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32]) fi + + AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[ + AC_MSG_ERROR([library 'crypto' is required for OpenSSL]) + ]) + AC_CHECK_LIB(ssl,[SSL_library_init],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[ + AC_MSG_ERROR([library 'ssl' is required for OpenSSL]) + ]) + ]) + + # This is a workaround for RedHat 9 brain damage.. + if test -d /usr/kerberos/include -a -f /usr/include/openssl/kssl.h; then + AC_MSG_NOTICE([OpenSSL depends on Kerberos]) + LIBOPENSSL_LIBS="-L/usr/kerberos/lib $LIBOPENSSL_LIBS" + CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include" fi + SQUID_STATE_ROLLBACK(squid_openssl_state) #de-pollute LIBS if test "x$LIBOPENSSL_LIBS" != "x"; then CXXFLAGS="$LIBOPENSSL_CFLAGS $CXXFLAGS" - SSLLIB="$LIBOPENSSL_LIBS $SSLLIB" + SSLLIB="$LIBOPENSSL_PATH $LIBOPENSSL_LIBS $SSLLIB" AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available]) # check for other specific broken implementations @@ -1281,7 +1282,7 @@ AC_MSG_ERROR([Required OpenSSL library not found]) fi fi -AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_LIBS}]) +AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_PATH} ${LIBOPENSSL_LIBS}]) AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ]) AC_SUBST(SSLLIB)