On Mon, Jan 4, 2016 at 6:38 AM, Amos Jeffries <squ...@treenet.co.nz> wrote:
> The auto-conf design for using custom directories (such as these /opt > areas) is that the builder supplies the pth parameter > (--with-gnutls=/opt/local/gnutls) when such local customized installs > are to be used. There is a problem with this: our automated tests do not allow for setting these parameters, except by going through some hoops. The code is already in configure.ac, just documented as '--without-gnutls'. But I believe I found the actual issue, fixed by the attached patch. There's two problems: - headers are checked before PKG_CHECK_MODULES - PKG_CHECK_MODULES sets include-related flags in CFLAGS, but then AC_CHECK_HEADERS uses CPPFLAGS, not CFLAGS. The patch addresses both by: - calling PKG_CHECK_MODULES before AC_CHECK_HEADERS - extending SQUID_STATE_* macros to also cover CPPFLAGS - manually setting CPPFLAGS for the benefit of AC_CHECK_HEADERS (and rolling it back once the check is done). -- Francesco
=== modified file 'acinclude/squid-util.m4' --- acinclude/squid-util.m4 2016-01-01 00:12:18 +0000 +++ acinclude/squid-util.m4 2016-01-04 09:48:31 +0000 @@ -1,88 +1,91 @@ ## Copyright (C) 1996-2016 The Squid Software Foundation and contributors ## ## Squid software is distributed under GPLv2+ license and includes ## contributions from numerous individuals and organizations. ## Please see the COPYING and CONTRIBUTORS files for details. ## dnl save main environment variables to variables to the namespace defined by the dnl first argument (prefix) dnl e.g. SQUID_SAVEFLAGS([foo]) will save CFLAGS to foo_CFLAGS etc. dnl Saved variables are: dnl CFLAGS, CXXFLAGS, LDFLAGS, LIBS plus any variables specified as dnl second argument AC_DEFUN([SQUID_STATE_SAVE],[ # save state, key is $1 $1_CFLAGS="${CFLAGS}" $1_CXXFLAGS="${CXXFLAGS}" $1_LDFLAGS="${LDFLAGS}" $1_LIBS="${LIBS}" $1_CC="${CC}" $1_CXX="${CXX}" +$1_CPPFLAGS="${CPPFLAGS}" $1_squid_saved_vars="$2" for squid_util_var_tosave in $$1_squid_saved_vars do squid_util_var_tosave2="$1_${squid_util_var_tosave}" eval "${squid_util_var_tosave2}=\"${squid_util_var_tosave}\"" done ]) dnl commit the state changes: deleting the temporary state defined in SQUID_STATE_SAVE dnl with the same prefix. It's not necessary to specify the extra variables passed dnl to SQUID_STATE_SAVE again, they will be automatically reclaimed. AC_DEFUN([SQUID_STATE_COMMIT],[ # commit state, key is $1 unset $1_CFLAGS unset $1_CXXFLAGS unset $1_LDFLAGS unset $1_LIBS unset $1_CC unset $1_CXX +unset $1_CPPFLAGS for squid_util_var_tosave in $$1_squid_saved_vars do unset ${squid_util_var_tosave} done ]) dnl rollback state to the call of SQUID_STATE_SAVE with the same namespace argument. dnl all temporary state will be cleared, including the custom variables specified dnl at call time. It's not necessary to explicitly name them, they will be automatically dnl cleared. AC_DEFUN([SQUID_STATE_ROLLBACK],[ # rollback state, key is $1 CFLAGS="${$1_CFLAGS}" CXXFLAGS="${$1_CXXFLAGS}" LDFLAGS="${$1_LDFLAGS}" LIBS="${$1_LIBS}" CC="${$1_CC}" CXX="${$1_CXX}" +CPPFLAGS="${$1_CPPFLAGS}" for squid_util_var_tosave in $$1_squid_saved_vars do squid_util_var_tosave2="\$$1_${squid_util_var_tosave}" eval "$squid_util_var_tosave=\"${squid_util_var_tosave2}\"" done SQUID_STATE_COMMIT($1) ]) dnl look for modules in the base-directory supplied as argument. dnl fill-in the variable pointed-to by the second argument with the dnl space-separated list of modules AC_DEFUN([SQUID_LOOK_FOR_MODULES],[ $2="" for dir in $1/*; do module="`basename $dir`" if test -d "$dir" && test "$module" != CVS; then $2="$$2 $module" fi done ]) dnl remove duplicates out of a list. dnl dnl argument is the name of a variable to be checked and cleaned up AC_DEFUN([SQUID_CLEANUP_MODULES_LIST],[ squid_cleanup_tmp_outlist="" for squid_cleanup_tmp in $$1 do squid_cleanup_tmp_dupe=0 for squid_cleanup_tmp2 in $squid_cleanup_tmp_outlist === modified file 'configure.ac' --- configure.ac 2016-01-03 10:45:27 +0000 +++ configure.ac 2016-01-04 09:48:37 +0000 @@ -1210,73 +1210,75 @@ 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) SSLLIB="" dnl User may want to disable GnuTLS AC_ARG_WITH(gnutls, AS_HELP_STRING([--without-gnutls], [Do not use GnuTLS for SSL. Default: auto-detect]), [ case "$with_gnutls" in yes|no) : # Nothing special to do here ;; *) if test ! -d "$withval" ; then AC_MSG_ERROR([--with-gnutls path does not point to a directory]) fi LIBGNUTLS_PATH="-L$with_gnutls/lib" CPPFLAGS="-I$with_gnutls/include $CPPFLAGS" esac ]) AH_TEMPLATE(USE_GNUTLS,[GnuTLS support is available]) if test "x$with_gnutls" != "xno"; then - AC_CHECK_HEADERS(gnutls/gnutls.h gnutls/x509.h) + SQUID_STATE_SAVE(squid_gnutls_state) # User may have provided a custom location for GnuTLS. Otherwise... - SQUID_STATE_SAVE(squid_gnutls_state) LIBS="$LIBS $LIBGNUTLS_PATH" # auto-detect using pkg-config - PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.1.5],,[ + PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.1.5],[ + CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS" + ],[ ## find the package without pkg-config ## check that the library is actually new enough. ## by testing for a 3.1.5+ function which we use AC_CHECK_LIB(gnutls,gnutls_certificate_verify_peers3,[LIBGNUTLS_LIBS="-lgnutls"]) ]) + AC_CHECK_HEADERS(gnutls/gnutls.h gnutls/x509.h) SQUID_STATE_ROLLBACK(squid_gnutls_state) #de-pollute LIBS if test "x$with_gnutls" = "xyes" -a "x$LIBGNUTLS_LIBS" = "x"; then AC_MSG_ERROR([Required GnuTLS library not found]) fi if test "x$LIBGNUTLS_LIBS" != "x" ; then CXXFLAGS="$LIBGNUTLS_CFLAGS $CXXFLAGS" SSLLIB="$LIBGNUTLS_PATH $LIBGNUTLS_LIBS $SSLLIB" AC_DEFINE(USE_GNUTLS,1,[GnuTLS support is available]) else with_gnutls=no fi fi AC_MSG_NOTICE([GnuTLS library support: ${with_gnutls:=auto} ${LIBGNUTLS_PATH} ${LIBGNUTLS_LIBS}]) dnl User may specify OpenSSL is needed from a non-standard location AC_ARG_WITH(openssl, AS_HELP_STRING([--with-openssl=PATH], [Compile with the OpenSSL libraries. The path to the OpenSSL development libraries and headers installation can be specified if outside of the system standard directories]), [ case "$with_openssl" in yes|no) : # Nothing special to do here ;; *) if test ! -d "$withval" ; then AC_MSG_ERROR([--with-openssl path does not point to a directory])
_______________________________________________ squid-dev mailing list squid-dev@lists.squid-cache.org http://lists.squid-cache.org/listinfo/squid-dev