From: Amos Jeffries Date: Sat, 4 May 2013 06:34:24 +0000 (-0600) Subject: autoconf: upgrade all helper config.test to M4 scriptlets X-Git-Tag: SQUID_3_4_0_1~175 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5eabe4b410e369b90c81f5ad2315cadea5143b05;p=thirdparty%2Fsquid.git autoconf: upgrade all helper config.test to M4 scriptlets This carries on from the success of basic auth heleprs upgrade to perform the update on all helpers bundled with Squid. It also polishes some of the basic auth M4 macro tests a little. TODO: * Convert the duplicate code in the modules.m4 files into a macro for simpler management. * Update the tests. This patch replaces all config.test tests with an equivalent autoconf macro. There are some helpers which could be extended with better tests now. --- diff --git a/configure.ac b/configure.ac index 87fc3ed468..c314a03e4b 100644 --- a/configure.ac +++ b/configure.ac @@ -1737,38 +1737,7 @@ AC_ARG_ENABLE(auth-ntlm, To enable but build no helpers, specify "none". To see available helpers, see the helpers/ntlm_auth directory. ]),[ ]) -if test "x$enable_auth_ntlm" = "x"; then - enable_auth_ntlm=$enable_auth -fi -#conflicts with global -if test "x$enable_auth_ntlm" != "xno" -a "x$enable_auth" = "xno" ; then - AC_MSG_ERROR([NTLM auth requested but auth disabled]) -fi -#define list of modules to build -if test "x$enable_auth_ntlm" = "xyes" ; then - SQUID_LOOK_FOR_MODULES([$srcdir/helpers/ntlm_auth],[enable_auth_ntlm]) -fi -#handle the "none" special case -if test "x$enable_auth_ntlm" = "xnone" ; then - enable_auth_ntlm="" -fi -NTLM_AUTH_HELPERS="" -enable_auth_ntlm="`echo $enable_auth_ntlm| sed -e 's/,/ /g;s/ */ /g'`" -if test "x$enable_auth_ntlm" != "xno" ; then - AUTH_MODULES="$AUTH_MODULES ntlm" - AC_DEFINE([HAVE_AUTH_MODULE_NTLM],1,[NTLM auth module is built]) - for helper in $enable_auth_ntlm ; do - dir="$srcdir/helpers/ntlm_auth/$helper" - if test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then - NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper" - elif test -d "$srcdir/helpers/ntlm_auth/$helper" ; then - AC_MSG_NOTICE([NTLM auth helper $helper ... found but cannot be built]) - fi - done -fi -AC_MSG_NOTICE([NTLM auth helpers built: $NTLM_AUTH_HELPERS]) -AM_CONDITIONAL(ENABLE_AUTH_NTLM, test "x$enable_auth_ntlm" != "xno") -AC_SUBST(NTLM_AUTH_HELPERS) +m4_include([helpers/ntlm_auth/modules.m4]) AC_ARG_ENABLE(auth-negotiate, AS_HELP_STRING([--enable-auth-negotiate="list of helpers"], @@ -1782,38 +1751,7 @@ AC_ARG_ENABLE(auth-negotiate, To see available helpers, see the helpers/negotiate_auth directory. ]),[ #nothing to do, really ]) -if test "x$enable_auth_negotiate" = "x"; then - enable_auth_negotiate=$enable_auth -fi -#conflicts with global -if test "x$enable_auth_negotiate" != "xno" -a "x$enable_auth" = "xno" ; then - AC_MSG_ERROR([Negotiate auth requested but auth disabled]) -fi -#define list of modules to build -if test "x$enable_auth_negotiate" = "xyes" ; then - SQUID_LOOK_FOR_MODULES([$srcdir/helpers/negotiate_auth],[enable_auth_negotiate]) -fi -#handle the "none" special case -if test "x$enable_auth_negotiate" = "xnone" ; then - enable_auth_negotiate="" -fi -NEGOTIATE_AUTH_HELPERS="" -enable_auth_negotiate="`echo $enable_auth_negotiate| sed -e 's/,/ /g;s/ */ /g'`" -if test "x$enable_auth_negotiate" != "xno" ; then - AUTH_MODULES="$AUTH_MODULES negotiate" - AC_DEFINE([HAVE_AUTH_MODULE_NEGOTIATE],1,[Negotiate auth module is built]) - for helper in $enable_auth_negotiate ; do - dir="$srcdir/helpers/negotiate_auth/$helper" - if test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then - NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $helper" - elif test -d "$srcdir/helpers/negotiate_auth/$helper" ; then - AC_MSG_NOTICE([Negotiate auth helper $helper ... found but cannot be built]) - fi - done -fi -AC_MSG_NOTICE([Negotiate auth helpers built: $NEGOTIATE_AUTH_HELPERS]) -AM_CONDITIONAL(ENABLE_AUTH_NEGOTIATE, test "x$enable_auth_negotiate" != "xno") -AC_SUBST(NEGOTIATE_AUTH_HELPERS) +m4_include([helpers/negotiate_auth/modules.m4]) AC_ARG_ENABLE(auth-digest, AS_HELP_STRING([--enable-auth-digest="list of helpers"], @@ -1825,38 +1763,7 @@ AC_ARG_ENABLE(auth-digest, To see available helpers, see the helpers/digest_auth directory. ]),[ #nothing to do, really ]) -if test "x$enable_auth_digest" = "x"; then - enable_auth_digest=$enable_auth -fi -#conflicts with global -if test "x$enable_auth_digest" != "xno" -a "x$enable_auth" = "xno" ; then - AC_MSG_ERROR([Digest auth requested but auth disabled]) -fi -#define list of modules to build -if test "x$enable_auth_digest" = "xyes" ; then - SQUID_LOOK_FOR_MODULES([$srcdir/helpers/digest_auth],[enable_auth_digest]) -fi -#handle the "none" special case -if test "x$enable_auth_digest" = "xnone" ; then - enable_auth_digest="" -fi -DIGEST_AUTH_HELPERS="" -enable_auth_digest="`echo $enable_auth_digest| sed -e 's/,/ /g;s/ */ /g'`" -if test "x$enable_auth_digest" != "xno" ; then - AUTH_MODULES="$AUTH_MODULES digest" - AC_DEFINE([HAVE_AUTH_MODULE_DIGEST],1,[Digest auth module is built]) - for helper in $enable_auth_digest ; do - dir="$srcdir/helpers/digest_auth/$helper" - if test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then - DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper" - elif test -d "$srcdir/helpers/digest_auth/$helper" ; then - AC_MSG_NOTICE([Digest auth helper $helper ... found but cannot be built]) - fi - done -fi -AC_MSG_NOTICE([Digest auth helpers built: $DIGEST_AUTH_HELPERS]) -AM_CONDITIONAL(ENABLE_AUTH_DIGEST, test "x$enable_auth_digest" != "xno") -AC_SUBST(DIGEST_AUTH_HELPERS) +m4_include([helpers/digest_auth/modules.m4]) dnl Authentication libraries to build dnl This list will not be needed when each auth library has its own Makefile @@ -1882,20 +1789,7 @@ case "$enableval" in *) squid_opt_logdaemon_helpers="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`" ;; esac ]) -if test "x$squid_opt_logdaemon_helpers" = "xauto" ; then - squid_opt_logdaemon_helpers="" - SQUID_LOOK_FOR_MODULES([$srcdir/helpers/log_daemon],[squid_opt_logdaemon_helpers]) -fi -for helper in $squid_opt_logdaemon_helpers ; do - dir="$srcdir/helpers/log_daemon/$helper" - if test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then - LOG_DAEMON_HELPERS="$LOG_DAEMON_HELPERS $helper" - elif test -d "$srcdir/helpers/log_daemon/$helper" ; then - AC_MSG_NOTICE([Log daemon helper $helper ... found but cannot be built]) - fi -done -AC_MSG_NOTICE([Log daemon helpers built: $LOG_DAEMON_HELPERS]) -AC_SUBST(LOG_DAEMON_HELPERS) +m4_include([helpers/log_daemon/modules.m4]) dnl dnl Check Kerberos/GSSAPI/SPNEGO @@ -2042,33 +1936,7 @@ AC_ARG_ENABLE(external-acl-helpers, directory]), [ #nothing to do, really ]) -if test "x${enable_external_acl_helpers:=yes}" = "xyes" ;then - SQUID_LOOK_FOR_MODULES([$srcdir/helpers/external_acl], - [enable_external_acl_helpers]) -fi -if test "x$enable_external_acl_helpers" = "xnone" ; then - enable_external_acl_helpers="" -fi -EXTERNAL_ACL_HELPERS="" -enable_external_acl_helpers="`echo $enable_external_acl_helpers| sed -e 's/,/ /g;s/ */ /g'`" -if test "x$enable_external_acl_helpers" != "xno" ; then - for helper in $enable_external_acl_helpers ; do - dir="$srcdir/helpers/external_acl/$helper" - if test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then - EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper" - # special case - if test "x$helper" = "xkerberos_ldap_group" ; then - SQUID_CHECK_SASL - fi - else - AC_MSG_NOTICE([external acl helper $helper ... found but cannot be built]) - fi - done -fi -AC_MSG_NOTICE([External acl helpers built: $EXTERNAL_ACL_HELPERS]) -AC_SUBST(EXTERNAL_ACL_HELPERS) - - +m4_include([helpers/external_acl/modules.m4]) dnl Select url_rewrite helpers to build AC_ARG_ENABLE(url-rewrite-helpers, @@ -2080,28 +1948,7 @@ AC_ARG_ENABLE(url-rewrite-helpers, For a list of available helpers see the helpers/url_rewrite directory.]),[ ]) -if test "x${enable_url_rewrite_helpers:=yes}" = "xyes" ; then - SQUID_LOOK_FOR_MODULES([$srcdir/helpers/url_rewrite], - [enable_url_rewrite_helpers]) -fi -enable_url_rewrite_helpers="`echo $enable_url_rewrite_helpers| sed -e 's/,/ /g;s/ */ /g'`" -AC_MSG_NOTICE([URL rewrite helper candidates: $enable_url_rewrite_helpers]) -URL_REWRITE_HELPERS="" -if test "x$enable_url_rewrite_helpers" != "xno" ; then - for helper in $enable_url_rewrite_helpers; do - dir="$srcdir/helpers/url_rewrite/$helper" - if test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then - URL_REWRITE_HELPERS="$URL_REWRITE_HELPERS $helper" - elif test -d "$srcdir/helpers/ntlm_auth/$helper" ; then - AC_MSG_NOTICE([URL rewrite helper $helper ... found but cannot be built]) - else - AC_MSG_NOTICE([URL rewrite helper $helper ... not found]) - fi - done -fi -AC_MSG_NOTICE([URL rewrite helpers built: $URL_REWRITE_HELPERS]) -AC_SUBST(URL_REWRITE_HELPERS) - +m4_include([helpers/url_rewrite/modules.m4]) AC_ARG_WITH(valgrind-debug, AS_HELP_STRING([--with-valgrind-debug], diff --git a/helpers/basic_auth/SMB/required.m4 b/helpers/basic_auth/SMB/required.m4 index 0e7ae2c483..af2c4b5d14 100755 --- a/helpers/basic_auth/SMB/required.m4 +++ b/helpers/basic_auth/SMB/required.m4 @@ -1,13 +1,9 @@ # -## TODO: This can be done far better I'm sure +# The shell script helper require smbclient to be in the environment PATH. +# We can install anyway, but warn if smbclient not found already # -for prefix in /usr/local /opt /opt/samba /usr/local/samba /usr -do - if [ -x ${prefix}/bin/smbclient ]; then - BUILD_HELPER="SMB" - fi -done -if test "x$BUILD_HELPER" = "x"; then +AC_PATH_PROG(SMBCLIENT, smbclient) +if test "x$SMBCLIENT" = "x"; then AC_MSG_WARN([Samba smbclient not found in default location. basic_smb_auth may not work on this machine]) fi # allow script install anyway. diff --git a/helpers/basic_auth/modules.m4 b/helpers/basic_auth/modules.m4 index 8fc63ade3c..763b7b822d 100644 --- a/helpers/basic_auth/modules.m4 +++ b/helpers/basic_auth/modules.m4 @@ -26,9 +26,8 @@ enable_auth_basic="`echo $enable_auth_basic| sed -e 's/,/ /g;s/ */ /g'`" if test "x$enable_auth_basic" != "xno" ; then AUTH_MODULES="$AUTH_MODULES basic" AC_DEFINE([HAVE_AUTH_MODULE_BASIC],1,[Basic auth module is built]) - for helper in $enable_auth_basic - do - dir="$srcdir/helpers/basic_auth/$helper" + for helper in $enable_auth_basic; do + dir="$srcdir/helpers/basic_auth/$helper" # modules converted to autoconf macros already # NP: we only need this list because m4_include() does not accept variables @@ -83,7 +82,7 @@ if test "x$enable_auth_basic" != "xno" ; then BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $BUILD_HELPER" fi else - AC_MSG_ERROR([Basic auth helper $helper ... not found]) + AC_MSG_ERROR([Basic auth helper $helper ... not found]) fi done fi diff --git a/helpers/digest_auth/LDAP/Makefile.am b/helpers/digest_auth/LDAP/Makefile.am index de75cf58eb..fe746c5b1f 100644 --- a/helpers/digest_auth/LDAP/Makefile.am +++ b/helpers/digest_auth/LDAP/Makefile.am @@ -18,4 +18,4 @@ digest_ldap_auth_LDADD = \ $(SSLLIB) \ $(XTRA_LIBS) -EXTRA_DIST = config.test +EXTRA_DIST = required.m4 diff --git a/helpers/digest_auth/LDAP/config.test b/helpers/digest_auth/LDAP/config.test deleted file mode 100755 index 4326b7c931..0000000000 --- a/helpers/digest_auth/LDAP/config.test +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -if [ -f /usr/include/ldap.h -o -f /usr/local/include/ldap.h ]; then - exit 0 -fi -if [ -f /usr/include/winldap.h ]; then - exit 0 -fi -exit 1 diff --git a/helpers/digest_auth/LDAP/required.m4 b/helpers/digest_auth/LDAP/required.m4 new file mode 100755 index 0000000000..c534c12785 --- /dev/null +++ b/helpers/digest_auth/LDAP/required.m4 @@ -0,0 +1 @@ +AC_CHECK_HEADERS([ldap.h winldap.h],[BUILD_HELPER="LDAP"]) diff --git a/helpers/digest_auth/Makefile.am b/helpers/digest_auth/Makefile.am index 89e7bbda56..04d9d0bc68 100644 --- a/helpers/digest_auth/Makefile.am +++ b/helpers/digest_auth/Makefile.am @@ -5,3 +5,5 @@ DIST_SUBDIRS= \ LDAP SUBDIRS= $(DIGEST_AUTH_HELPERS) + +EXTRA_DIST = modules.m4 diff --git a/helpers/digest_auth/eDirectory/Makefile.am b/helpers/digest_auth/eDirectory/Makefile.am index 49ac644ba3..9e52f2b2be 100644 --- a/helpers/digest_auth/eDirectory/Makefile.am +++ b/helpers/digest_auth/eDirectory/Makefile.am @@ -21,4 +21,4 @@ digest_edirectory_auth_LDADD = \ $(SSLLIB) \ $(XTRA_LIBS) -EXTRA_DIST = config.test +EXTRA_DIST = required.m4 diff --git a/helpers/digest_auth/eDirectory/config.test b/helpers/digest_auth/eDirectory/config.test deleted file mode 100755 index 4326b7c931..0000000000 --- a/helpers/digest_auth/eDirectory/config.test +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -if [ -f /usr/include/ldap.h -o -f /usr/local/include/ldap.h ]; then - exit 0 -fi -if [ -f /usr/include/winldap.h ]; then - exit 0 -fi -exit 1 diff --git a/helpers/digest_auth/eDirectory/required.m4 b/helpers/digest_auth/eDirectory/required.m4 new file mode 100755 index 0000000000..c534c12785 --- /dev/null +++ b/helpers/digest_auth/eDirectory/required.m4 @@ -0,0 +1 @@ +AC_CHECK_HEADERS([ldap.h winldap.h],[BUILD_HELPER="LDAP"]) diff --git a/helpers/digest_auth/file/Makefile.am b/helpers/digest_auth/file/Makefile.am index 9ed0c15445..dd12852063 100644 --- a/helpers/digest_auth/file/Makefile.am +++ b/helpers/digest_auth/file/Makefile.am @@ -18,4 +18,4 @@ LDADD = \ $(SSLLIB) \ $(XTRA_LIBS) -EXTRA_DIST = digest_file_auth.8 config.test +EXTRA_DIST = digest_file_auth.8 required.m4 diff --git a/helpers/digest_auth/file/config.test b/helpers/digest_auth/file/config.test deleted file mode 100755 index 039e4d0069..0000000000 --- a/helpers/digest_auth/file/config.test +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 0 diff --git a/helpers/digest_auth/file/required.m4 b/helpers/digest_auth/file/required.m4 new file mode 100755 index 0000000000..9b9a8eca60 --- /dev/null +++ b/helpers/digest_auth/file/required.m4 @@ -0,0 +1 @@ +BUILD_HELPER="file" diff --git a/helpers/digest_auth/modules.m4 b/helpers/digest_auth/modules.m4 new file mode 100644 index 0000000000..8543dbd450 --- /dev/null +++ b/helpers/digest_auth/modules.m4 @@ -0,0 +1,60 @@ +# This file is supposed to run all the tests required to identify which +# configured modules are able to be built in this environment + +# FIXME: de-duplicate $enable_auth_digest list containing double entries. + +#not specified. Inherit global +if test "x$enable_auth_digest" = "x"; then + enable_auth_digest=$enable_auth +fi +#conflicts with global +if test "x$enable_auth_digest" != "xno" -a "x$enable_auth" = "xno" ; then + AC_MSG_ERROR([Digest auth requested but auth disabled]) +fi +#define list of modules to build +if test "x$enable_auth_digest" = "xyes" ; then + SQUID_LOOK_FOR_MODULES([$srcdir/helpers/digest_auth],[enable_auth_digest]) +fi +#handle the "none" special case +if test "x$enable_auth_digest" = "xnone" ; then + enable_auth_digest="" +fi + +DIGEST_AUTH_HELPERS="" +enable_auth_digest="`echo $enable_auth_digest| sed -e 's/,/ /g;s/ */ /g'`" +if test "x$enable_auth_digest" != "xno" ; then + AUTH_MODULES="$AUTH_MODULES digest" + AC_DEFINE([HAVE_AUTH_MODULE_DIGEST],1,[Digest auth module is built]) + for helper in $enable_auth_digest; do + dir="$srcdir/helpers/digest_auth/$helper" + + # modules converted to autoconf macros already + # NP: we only need this list because m4_include() does not accept variables + if test "x$helper" = "xLDAP" ; then + m4_include([helpers/digest_auth/LDAP/required.m4]) + + elif test "x$helper" = "xeDirectory" ; then + m4_include([helpers/digest_auth/eDirectory/required.m4]) + + elif test "x$helper" = "xfile" ; then + m4_include([helpers/digest_auth/file/required.m4]) + + # modules not yet converted to autoconf macros (or third party drop-in's) + elif test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then + BUILD_HELPER="$helper" + fi + + if test -d "$srcdir/helpers/digest_auth/$helper"; then + if test "$BUILD_HELPER" != "$helper"; then + AC_MSG_NOTICE([Digest auth helper $helper ... found but cannot be built]) + else + DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $BUILD_HELPER" + fi + else + AC_MSG_ERROR([Digest auth helper $helper ... not found]) + fi + done +fi +AC_MSG_NOTICE([Digest auth helpers to be built: $DIGEST_AUTH_HELPERS]) +AM_CONDITIONAL(ENABLE_AUTH_DIGEST, test "x$enable_auth_digest" != "xno") +AC_SUBST(DIGEST_AUTH_HELPERS) diff --git a/helpers/external_acl/AD_group/Makefile.am b/helpers/external_acl/AD_group/Makefile.am index af421957bb..d03d0ad0f1 100644 --- a/helpers/external_acl/AD_group/Makefile.am +++ b/helpers/external_acl/AD_group/Makefile.am @@ -8,6 +8,7 @@ man_MANS = ext_ad_group_acl.8 # Currently activeds and adsiid libraries are not available on MinGW or Cygwin, # so the following library list is just a placeholder for future MinGW/Cygwin releases. # This helper can be compiled only using Microsoft Visual Studio. +# TODO: test for these libraries in required.m4 # LDADD = \ $(COMPAT_LIB) \ @@ -20,4 +21,4 @@ LDADD = \ -ladsiid \ $(XTRA_LIBS) -EXTRA_DIST = config.test ext_ad_group_acl.8 +EXTRA_DIST = required.m4 ext_ad_group_acl.8 diff --git a/helpers/external_acl/AD_group/config.test b/helpers/external_acl/AD_group/config.test deleted file mode 100755 index aa0616759a..0000000000 --- a/helpers/external_acl/AD_group/config.test +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -if [ -f /usr/include/w32api/dsrole.h ]; then - if grep -q DsRoleGetPrimaryDomainInformation /usr/include/w32api/dsrole.h; then - exit 0 - fi -fi -if [ -f /usr/include/dsrole.h ]; then - if grep -q DsRoleGetPrimaryDomainInformation /usr/include/dsrole.h; then - exit 0 - fi -fi -exit 1 diff --git a/helpers/external_acl/AD_group/required.m4 b/helpers/external_acl/AD_group/required.m4 new file mode 100755 index 0000000000..79d8d81eb0 --- /dev/null +++ b/helpers/external_acl/AD_group/required.m4 @@ -0,0 +1,6 @@ +# +## TODO: make a AC_COMPILE check instead +# +for hdr in w32api/dsrole.h dsrole.h; do + AC_EGREP_HEADER(/usr/include/$hdr,[DsRoleGetPrimaryDomainInformation],[BUILD_HELPER="AD_group"]) +done diff --git a/helpers/external_acl/LDAP_group/Makefile.am b/helpers/external_acl/LDAP_group/Makefile.am index 2f4ca6e686..98d0b2af59 100644 --- a/helpers/external_acl/LDAP_group/Makefile.am +++ b/helpers/external_acl/LDAP_group/Makefile.am @@ -4,7 +4,7 @@ libexec_PROGRAMS = ext_ldap_group_acl ext_ldap_group_acl_SOURCES = ext_ldap_group_acl.cc man_MANS = ext_ldap_group_acl.8 -EXTRA_DIST = ext_ldap_group_acl.8 config.test +EXTRA_DIST = ext_ldap_group_acl.8 required.m4 LDADD = \ $(top_builddir)/lib/libmiscencoding.la \ diff --git a/helpers/external_acl/LDAP_group/config.test b/helpers/external_acl/LDAP_group/config.test deleted file mode 100755 index 4326b7c931..0000000000 --- a/helpers/external_acl/LDAP_group/config.test +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -if [ -f /usr/include/ldap.h -o -f /usr/local/include/ldap.h ]; then - exit 0 -fi -if [ -f /usr/include/winldap.h ]; then - exit 0 -fi -exit 1 diff --git a/helpers/external_acl/LDAP_group/required.m4 b/helpers/external_acl/LDAP_group/required.m4 new file mode 100755 index 0000000000..d32d028603 --- /dev/null +++ b/helpers/external_acl/LDAP_group/required.m4 @@ -0,0 +1 @@ +AC_CHECK_HEADERS([ldap.h winldap.h],[BUILD_HELPER="LDAP_group"]) diff --git a/helpers/external_acl/LM_group/Makefile.am b/helpers/external_acl/LM_group/Makefile.am index 5e60d00425..aba5045112 100644 --- a/helpers/external_acl/LM_group/Makefile.am +++ b/helpers/external_acl/LM_group/Makefile.am @@ -12,4 +12,4 @@ LDADD = \ man_MANS = ext_lm_group_acl.8 -EXTRA_DIST = config.test ext_lm_group_acl.8 +EXTRA_DIST = required.m4 ext_lm_group_acl.8 diff --git a/helpers/external_acl/LM_group/config.test b/helpers/external_acl/LM_group/config.test deleted file mode 100755 index b303426be5..0000000000 --- a/helpers/external_acl/LM_group/config.test +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# Only build this helper on Windows -# -if test "$1" = "mingw"; then - exit 0 -fi -if [ -f /usr/include/w32api/windows.h ]; then - exit 0 -fi -if [ -f /usr/include/windows.h ]; then - exit 0 -fi -exit 1 diff --git a/helpers/external_acl/LM_group/required.m4 b/helpers/external_acl/LM_group/required.m4 new file mode 100755 index 0000000000..0f031822a2 --- /dev/null +++ b/helpers/external_acl/LM_group/required.m4 @@ -0,0 +1,4 @@ +# +# Only build this helper on Windows +# +AC_CHECK_HEADERS([w32api/windows.h windows.h],[BUILD_HELPER="LM_group"]) diff --git a/helpers/external_acl/SQL_session/Makefile.am b/helpers/external_acl/SQL_session/Makefile.am index 20b5cbc11e..78f3ebc6e9 100644 --- a/helpers/external_acl/SQL_session/Makefile.am +++ b/helpers/external_acl/SQL_session/Makefile.am @@ -6,7 +6,7 @@ man_MANS = ext_sql_session_acl.8 EXTRA_DIST= \ ext_sql_session_acl.8 \ ext_sql_session_acl.pl.in \ - config.test + required.m4 ext_sql_session_acl.8: ext_sql_session_acl pod2man ext_sql_session_acl ext_sql_session_acl.8 diff --git a/helpers/external_acl/SQL_session/config.test b/helpers/external_acl/SQL_session/config.test deleted file mode 100755 index 387b7b1185..0000000000 --- a/helpers/external_acl/SQL_session/config.test +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -## Test: do we have perl to build the helper scripts? -## Test: do we have pod2man to build the manual? -perl --version >/dev/null && echo | pod2man >/dev/null - -exit $? diff --git a/helpers/external_acl/SQL_session/required.m4 b/helpers/external_acl/SQL_session/required.m4 new file mode 100755 index 0000000000..a075ad5ca3 --- /dev/null +++ b/helpers/external_acl/SQL_session/required.m4 @@ -0,0 +1,3 @@ +if test "x$PERL" != "x" -a "x$POD2MAN" != "x"; then + BUILD_HELPER="SQL_session" +fi diff --git a/helpers/external_acl/eDirectory_userip/Makefile.am b/helpers/external_acl/eDirectory_userip/Makefile.am index abb6e1c88d..a06326636d 100644 --- a/helpers/external_acl/eDirectory_userip/Makefile.am +++ b/helpers/external_acl/eDirectory_userip/Makefile.am @@ -13,4 +13,4 @@ ext_edirectory_userip_acl_LDADD = \ man_MANS = ext_edirectory_userip_acl.8 -EXTRA_DIST = config.test ext_edirectory_userip_acl.8 +EXTRA_DIST = required.m4 ext_edirectory_userip_acl.8 diff --git a/helpers/external_acl/eDirectory_userip/config.test b/helpers/external_acl/eDirectory_userip/config.test deleted file mode 100644 index accfd32d9c..0000000000 --- a/helpers/external_acl/eDirectory_userip/config.test +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -if [ -f /usr/include/ldap.h -o -f /usr/local/include/ldap.h ]; then - exit 0 -fi -if [ -f /usr/include/winldap.h ]; then - exit 0 -fi -exit 1 diff --git a/helpers/external_acl/eDirectory_userip/required.m4 b/helpers/external_acl/eDirectory_userip/required.m4 new file mode 100644 index 0000000000..86c8cfe390 --- /dev/null +++ b/helpers/external_acl/eDirectory_userip/required.m4 @@ -0,0 +1 @@ +AC_CHECK_HEADERS([ldap.h winldap.h],[BUILD_HELPER="eDirectory_userip"]) diff --git a/helpers/external_acl/file_userip/Makefile.am b/helpers/external_acl/file_userip/Makefile.am index 90c915d374..ab6bb0aa86 100644 --- a/helpers/external_acl/file_userip/Makefile.am +++ b/helpers/external_acl/file_userip/Makefile.am @@ -8,7 +8,7 @@ EXTRA_DIST = \ example.conf \ example-deny_all_but.conf \ ext_file_userip_acl.8 \ - config.test + required.m4 LDADD = \ $(top_builddir)/lib/libmiscencoding.la \ diff --git a/helpers/external_acl/file_userip/config.test b/helpers/external_acl/file_userip/config.test deleted file mode 100755 index edc5104643..0000000000 --- a/helpers/external_acl/file_userip/config.test +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -if [ -f /usr/include/sys/socket.h ]; then - exit 0 -fi -exit 1 diff --git a/helpers/external_acl/file_userip/required.m4 b/helpers/external_acl/file_userip/required.m4 new file mode 100755 index 0000000000..7916beccf5 --- /dev/null +++ b/helpers/external_acl/file_userip/required.m4 @@ -0,0 +1 @@ +AC_CHECK_HEADERS([sys/socket.h],[BUILD_HELPER="file_userip"]) diff --git a/helpers/external_acl/kerberos_ldap_group/Makefile.am b/helpers/external_acl/kerberos_ldap_group/Makefile.am index 794311bc66..4b82ac10b4 100644 --- a/helpers/external_acl/kerberos_ldap_group/Makefile.am +++ b/helpers/external_acl/kerberos_ldap_group/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/src/Common.am -EXTRA_DIST = README config.test cert_tool ext_kerberos_ldap_group_acl.8 +EXTRA_DIST = README required.m4 cert_tool ext_kerberos_ldap_group_acl.8 SUBDIRS = AM_CPPFLAGS = $(INCLUDES) -I$(srcdir) diff --git a/helpers/external_acl/kerberos_ldap_group/config.test b/helpers/external_acl/kerberos_ldap_group/config.test deleted file mode 100644 index dcf1b93ef5..0000000000 --- a/helpers/external_acl/kerberos_ldap_group/config.test +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Don't build without gssapi.h -if [ -f /usr/include/ldap.h -o -f /usr/local/include/ldap.h ]; then - # Won't link without SASL as well - if [ -f /usr/include/sasl.h -o -f /usr/include/sasl/sasl.h -o -f /usr/local/include/sasl.h -o -f /usr/local/include/sasl/sasl.h ]; then - if [ -f /usr/lib/libsasl.a -o -f /usr/lib/libsasl2.a ]; then - exit 0 - fi - if [ -f /usr/lib/libsasl.la -o -f /usr/lib/libsasl2.la ]; then - exit 0 - fi - if [ -f /usr/lib/libsasl.so -o -f /usr/lib/libsasl2.so ]; then - exit 0 - fi - if [ -f /usr/lib64/libsasl.so -o -f /usr/lib64/libsasl2.so ]; then - exit 0 - fi - if [ -f /usr/local/lib/libsasl.so -o -f /usr/local/lib/libsasl2.so ]; then - exit 0 - fi - fi -fi -exit 1 diff --git a/helpers/external_acl/kerberos_ldap_group/required.m4 b/helpers/external_acl/kerberos_ldap_group/required.m4 new file mode 100644 index 0000000000..b8414053a3 --- /dev/null +++ b/helpers/external_acl/kerberos_ldap_group/required.m4 @@ -0,0 +1,2 @@ +AC_CHECK_HEADERS([ldap.h],[BUILD_HELPER="kerberos_ldap_group"]) +SQUID_CHECK_SASL diff --git a/helpers/external_acl/modules.m4 b/helpers/external_acl/modules.m4 new file mode 100644 index 0000000000..4a4f30bc35 --- /dev/null +++ b/helpers/external_acl/modules.m4 @@ -0,0 +1,71 @@ +# This file is supposed to run all the tests required to identify which +# configured modules are able to be built in this environment + +# FIXME: de-duplicate $enable_external_acl_helpers list containing double entries. + +#define list of modules to build +if test "x${enable_external_acl_helpers:=yes}" = "xyes" ;then + SQUID_LOOK_FOR_MODULES([$srcdir/helpers/external_acl],[enable_external_acl_helpers]) +fi +if test "x$enable_external_acl_helpers" = "xnone" ; then + enable_external_acl_helpers="" +fi +EXTERNAL_ACL_HELPERS="" +enable_external_acl_helpers="`echo $enable_external_acl_helpers| sed -e 's/,/ /g;s/ */ /g'`" +if test "x$enable_external_acl_helpers" != "xno" ; then + for helper in $enable_external_acl_helpers ; do + dir="$srcdir/helpers/external_acl/$helper" + + # modules converted to autoconf macros already + # NP: we only need this list because m4_include() does not accept variables + if test "x$helper" = "xAD_group" ; then + m4_include([helpers/external_acl/AD_group/required.m4]) + + elif test "x$helper" = "xLDAP_group" ; then + m4_include([helpers/external_acl/LDAP_group/required.m4]) + + elif test "x$helper" = "xLM_group" ; then + m4_include([helpers/external_acl/LM_group/required.m4]) + + elif test "x$helper" = "xSQL_session" ; then + m4_include([helpers/external_acl/SQL_session/required.m4]) + + elif test "x$helper" = "xeDirectory_userip" ; then + m4_include([helpers/external_acl/eDirectory_userip/required.m4]) + + elif test "x$helper" = "xfile_userip" ; then + m4_include([helpers/external_acl/file_userip/required.m4]) + + elif test "x$helper" = "xkerberos_ldap_group" ; then + m4_include([helpers/external_acl/kerberos_ldap_group/required.m4]) + + elif test "x$helper" = "xsession" ; then + m4_include([helpers/external_acl/session/required.m4]) + + elif test "x$helper" = "xtime_quota" ; then + m4_include([helpers/external_acl/time_quota/required.m4]) + + elif test "x$helper" = "xunix_group" ; then + m4_include([helpers/external_acl/unix_group/required.m4]) + + elif test "x$helper" = "xwbinfo_group" ; then + m4_include([helpers/external_acl/wbinfo_group/required.m4]) + + # modules not yet converted to autoconf macros (or third party drop-in's) + elif test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then + BUILD_HELPER="$helper" + fi + + if test -d "$srcdir/helpers/external_acl/$helper"; then + if test "$BUILD_HELPER" != "$helper"; then + AC_MSG_NOTICE([external acl helper $helper ... found but cannot be built]) + else + EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $BUILD_HELPER" + fi + else + AC_MSG_ERROR([external acl helper $helper ... not found]) + fi + done +fi +AC_MSG_NOTICE([External acl helpers to be built: $EXTERNAL_ACL_HELPERS]) +AC_SUBST(EXTERNAL_ACL_HELPERS) diff --git a/helpers/external_acl/session/Makefile.am b/helpers/external_acl/session/Makefile.am index 1797431974..e11b26a315 100644 --- a/helpers/external_acl/session/Makefile.am +++ b/helpers/external_acl/session/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/src/Common.am libexec_PROGRAMS = ext_session_acl man_MANS = ext_session_acl.8 -EXTRA_DIST = ext_session_acl.8 config.test +EXTRA_DIST = ext_session_acl.8 required.m4 ext_session_acl_SOURCES = ext_session_acl.cc LDADD = \ diff --git a/helpers/external_acl/session/config.test b/helpers/external_acl/session/config.test deleted file mode 100755 index 5407fe3999..0000000000 --- a/helpers/external_acl/session/config.test +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -if [ -f /usr/include/db.h ] && grep db_env_create /usr/include/db.h; then - exit 0 -fi -exit 1 diff --git a/helpers/external_acl/session/required.m4 b/helpers/external_acl/session/required.m4 new file mode 100755 index 0000000000..6543ccb7c0 --- /dev/null +++ b/helpers/external_acl/session/required.m4 @@ -0,0 +1 @@ +AC_EGREP_HEADER(/usr/include/db.h,db_env_create,[BUILD_HELPER="session"]) diff --git a/helpers/external_acl/time_quota/Makefile.am b/helpers/external_acl/time_quota/Makefile.am index a7bc65fce8..02190d3bdf 100644 --- a/helpers/external_acl/time_quota/Makefile.am +++ b/helpers/external_acl/time_quota/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/src/Common.am libexec_PROGRAMS = ext_time_quota_acl man_MANS = ext_time_quota_acl.8 -EXTRA_DIST = ext_time_quota_acl.8 config.test +EXTRA_DIST = ext_time_quota_acl.8 required.m4 ext_time_quota_acl_SOURCES = ext_time_quota_acl.cc DEFS += -DDEFAULT_QUOTA_DB=\"$(localstatedir)/ext_time_quota.db\" diff --git a/helpers/external_acl/time_quota/config.test b/helpers/external_acl/time_quota/config.test deleted file mode 100644 index 83b0f99047..0000000000 --- a/helpers/external_acl/time_quota/config.test +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Actual intended test -if [ -f /usr/include/db_185.h ]; then - exit 0 -fi -if [ -f /usr/include/db.h ] && grep dbopen /usr/include/db.h; then - exit 0 -fi -exit 1 diff --git a/helpers/external_acl/time_quota/required.m4 b/helpers/external_acl/time_quota/required.m4 new file mode 100644 index 0000000000..ff127310c7 --- /dev/null +++ b/helpers/external_acl/time_quota/required.m4 @@ -0,0 +1,2 @@ +AC_CHECK_HEADERS([db_185.h],[BUILD_HELPER="time_quota"]) +AC_EGREP_HEADER(/usr/include/db.h,dbopen,[BUILD_HELPER="time_quota"]) diff --git a/helpers/external_acl/unix_group/Makefile.am b/helpers/external_acl/unix_group/Makefile.am index 16c7dbc6ef..dde497ec5f 100644 --- a/helpers/external_acl/unix_group/Makefile.am +++ b/helpers/external_acl/unix_group/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/src/Common.am libexec_PROGRAMS = ext_unix_group_acl man_MANS = ext_unix_group_acl.8 -EXTRA_DIST = ext_unix_group_acl.8 config.test +EXTRA_DIST = ext_unix_group_acl.8 required.m4 ext_unix_group_acl_SOURCES = check_group.cc LDADD = \ diff --git a/helpers/external_acl/unix_group/config.test b/helpers/external_acl/unix_group/config.test deleted file mode 100755 index 85112208bb..0000000000 --- a/helpers/external_acl/unix_group/config.test +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -if [ -f /usr/include/pwd.h ]; then - exit 0 -fi -exit 1 diff --git a/helpers/external_acl/unix_group/required.m4 b/helpers/external_acl/unix_group/required.m4 new file mode 100755 index 0000000000..1eddf76009 --- /dev/null +++ b/helpers/external_acl/unix_group/required.m4 @@ -0,0 +1 @@ +AC_CHECK_HEADERS([pwd.h],[BUILD_HELPER="unix_group"]) diff --git a/helpers/external_acl/wbinfo_group/Makefile.am b/helpers/external_acl/wbinfo_group/Makefile.am index bf3b39da4f..3558260874 100644 --- a/helpers/external_acl/wbinfo_group/Makefile.am +++ b/helpers/external_acl/wbinfo_group/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/src/Common.am libexec_SCRIPTS = ext_wbinfo_group_acl -EXTRA_DIST = ext_wbinfo_group_acl.pl.in config.test +EXTRA_DIST = ext_wbinfo_group_acl.pl.in required.m4 ext_wbinfo_group_acl: ext_wbinfo_group_acl.pl.in $(subst_perlshell) diff --git a/helpers/external_acl/wbinfo_group/config.test b/helpers/external_acl/wbinfo_group/config.test deleted file mode 100755 index ea9995da34..0000000000 --- a/helpers/external_acl/wbinfo_group/config.test +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -samba_found="no" -for sambaprefix in /usr/local /opt /opt/samba /usr/local/samba /usr -do - if [ -x $sambaprefix/bin/wbinfo ]; then - samba_found="yes" - fi -done -if test "$samba_found" = "no"; then - echo "WARNING: Samba wbinfo not found in default location. ext_wbinfo_group_acl may not work on this machine" -fi -for perlprefix in /usr /usr/local /opt /opt/perl -do - if [ -x $perlprefix/bin/perl ]; then - exit 0 - fi -done -exit 1 diff --git a/helpers/external_acl/wbinfo_group/required.m4 b/helpers/external_acl/wbinfo_group/required.m4 new file mode 100755 index 0000000000..698ce35447 --- /dev/null +++ b/helpers/external_acl/wbinfo_group/required.m4 @@ -0,0 +1,13 @@ +# +# The shell script helper requires wbinfo to be in the environment PATH. +# We can install anyway, but warn if the tool is missing +# +AC_PATH_PROG(WBINFO, wbinfo) +if test "x$WBINFO" = "x"; then + AC_MSG_WARN([Samba wbinfo not found in default location. ext_wbinfo_group_acl may not work on this machine]) +fi + +# allow script install anyway when perl is present +if test "x$PERL" != "x" -a "x$POD2MAN" != "x"; then + BUILD_HELPER="wbinfo_group" +fi diff --git a/helpers/log_daemon/DB/Makefile.am b/helpers/log_daemon/DB/Makefile.am index 25a9b088e6..8365397c35 100644 --- a/helpers/log_daemon/DB/Makefile.am +++ b/helpers/log_daemon/DB/Makefile.am @@ -4,7 +4,7 @@ libexec_SCRIPTS = log_db_daemon CLEANFILES += log_db_daemon log_db_daemon.8 man_MANS = log_db_daemon.8 EXTRA_DIST= \ - config.test \ + required.m4 \ doc/views.sql \ doc/date_day_column.sql \ log_db_daemon.8 \ diff --git a/helpers/log_daemon/DB/config.test b/helpers/log_daemon/DB/config.test deleted file mode 100755 index 387b7b1185..0000000000 --- a/helpers/log_daemon/DB/config.test +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -## Test: do we have perl to build the helper scripts? -## Test: do we have pod2man to build the manual? -perl --version >/dev/null && echo | pod2man >/dev/null - -exit $? diff --git a/helpers/log_daemon/DB/required.m4 b/helpers/log_daemon/DB/required.m4 new file mode 100755 index 0000000000..00f761f5cc --- /dev/null +++ b/helpers/log_daemon/DB/required.m4 @@ -0,0 +1,3 @@ +if test "x$PERL" != "x" -a "x$POD2MAN" != "x"; then + BUILD_HELPER="DB" +fi diff --git a/helpers/log_daemon/Makefile.am b/helpers/log_daemon/Makefile.am index 2526de06be..1fd21f22c4 100644 --- a/helpers/log_daemon/Makefile.am +++ b/helpers/log_daemon/Makefile.am @@ -4,3 +4,4 @@ DIST_SUBDIRS = \ file SUBDIRS = $(LOG_DAEMON_HELPERS) +EXTRA_DIST = modules.m4 diff --git a/helpers/log_daemon/file/Makefile.am b/helpers/log_daemon/file/Makefile.am index e30f224dcb..3bda260b1c 100644 --- a/helpers/log_daemon/file/Makefile.am +++ b/helpers/log_daemon/file/Makefile.am @@ -5,4 +5,4 @@ log_file_daemon_SOURCES = log_file_daemon.cc log_file_daemon_LDADD = \ -L$(top_builddir)/lib $(COMPAT_LIB) \ $(XTRA_LIBS) -EXTRA_DIST = config.test +EXTRA_DIST = required.m4 diff --git a/helpers/log_daemon/file/config.test b/helpers/log_daemon/file/config.test deleted file mode 100755 index 039e4d0069..0000000000 --- a/helpers/log_daemon/file/config.test +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 0 diff --git a/helpers/log_daemon/file/required.m4 b/helpers/log_daemon/file/required.m4 new file mode 100755 index 0000000000..9b9a8eca60 --- /dev/null +++ b/helpers/log_daemon/file/required.m4 @@ -0,0 +1 @@ +BUILD_HELPER="file" diff --git a/helpers/log_daemon/modules.m4 b/helpers/log_daemon/modules.m4 new file mode 100644 index 0000000000..72f89dc2a0 --- /dev/null +++ b/helpers/log_daemon/modules.m4 @@ -0,0 +1,43 @@ +# This file is supposed to run all the tests required to identify which +# configured modules are able to be built in this environment + +# FIXME: de-duplicate $squid_opt_logdaemon_helpers list containing double entries. + +#define list of modules to build +if test "x$squid_opt_logdaemon_helpers" = "xauto" ; then + squid_opt_logdaemon_helpers="" + SQUID_LOOK_FOR_MODULES([$srcdir/helpers/log_daemon],[squid_opt_logdaemon_helpers]) +fi + +LOG_DAEMON_HELPERS="" +squid_opt_logdaemon_helpers="`echo $squid_opt_logdaemon_helpers| sed -e 's/,/ /g;s/ */ /g'`" +if test "x$squid_opt_logdaemon_helpers" = "x"; then + for helper in $squid_opt_logdaemon_helpers ; do + dir="$srcdir/helpers/log_daemon/$helper" + + # modules converted to autoconf macros already + # NP: we only need this list because m4_include() does not accept variables + if test "x$helper" = "xDB" ; then + m4_include([helpers/log_daemon/DB/required.m4]) + + elif test "x$helper" = "xfile" ; then + m4_include([helpers/log_daemon/file/required.m4]) + + # modules not yet converted to autoconf macros (or third party drop-in's) + elif test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then + BUILD_HELPER="$helper" + fi + + if test -d "$srcdir/helpers/log_daemon/$helper"; then + if test "$BUILD_HELPER" != "$helper"; then + AC_MSG_NOTICE([Log daemon helper $helper ... found but cannot be built]) + else + LOG_DAEMON_HELPERS="$LOG_DAEMON_HELPERS $BUILD_HELPER" + fi + else + AC_MSG_ERROR([Log daemon helper $helper ... not found]) + fi + done +fi +AC_MSG_NOTICE([Log daemon helpers to be built: $LOG_DAEMON_HELPERS]) +AC_SUBST(LOG_DAEMON_HELPERS) diff --git a/helpers/negotiate_auth/SSPI/Makefile.am b/helpers/negotiate_auth/SSPI/Makefile.am index c54cfb449a..d91a166010 100644 --- a/helpers/negotiate_auth/SSPI/Makefile.am +++ b/helpers/negotiate_auth/SSPI/Makefile.am @@ -10,4 +10,4 @@ LDADD = \ -ladvapi32 \ $(XTRA_LIBS) -EXTRA_DIST = readme.txt config.test +EXTRA_DIST = readme.txt required.m4 diff --git a/helpers/negotiate_auth/SSPI/config.test b/helpers/negotiate_auth/SSPI/config.test deleted file mode 100755 index b303426be5..0000000000 --- a/helpers/negotiate_auth/SSPI/config.test +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# Only build this helper on Windows -# -if test "$1" = "mingw"; then - exit 0 -fi -if [ -f /usr/include/w32api/windows.h ]; then - exit 0 -fi -if [ -f /usr/include/windows.h ]; then - exit 0 -fi -exit 1 diff --git a/helpers/negotiate_auth/SSPI/required.m4 b/helpers/negotiate_auth/SSPI/required.m4 new file mode 100755 index 0000000000..f1ed8ba246 --- /dev/null +++ b/helpers/negotiate_auth/SSPI/required.m4 @@ -0,0 +1,4 @@ +# +# Only build this helper on Windows +# +AC_CHECK_HEADERS([w32api/windows.h windows.h],[BUILD_HELPER="SSPI"]) diff --git a/helpers/negotiate_auth/kerberos/Makefile.am b/helpers/negotiate_auth/kerberos/Makefile.am index ce0c02c406..4d6f4e8e9a 100644 --- a/helpers/negotiate_auth/kerberos/Makefile.am +++ b/helpers/negotiate_auth/kerberos/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/src/Common.am -EXTRA_DIST = README COPYING config.test negotiate_kerberos_auth.8 +EXTRA_DIST = README COPYING required.m4 negotiate_kerberos_auth.8 SUBDIRS = libexec_PROGRAMS = negotiate_kerberos_auth negotiate_kerberos_auth_test diff --git a/helpers/negotiate_auth/kerberos/config.test b/helpers/negotiate_auth/kerberos/config.test deleted file mode 100755 index d3bd9a99dc..0000000000 --- a/helpers/negotiate_auth/kerberos/config.test +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# Don't build without gssapi.h -if test -f /usr/include/gssapi/gssapi.h || test -f /usr/include/gssapi.h || test -f /usr/include/kerberosV/gssapi.h ; then - exit 0 -fi -exit 1 diff --git a/helpers/negotiate_auth/kerberos/required.m4 b/helpers/negotiate_auth/kerberos/required.m4 new file mode 100755 index 0000000000..3191a8ea1c --- /dev/null +++ b/helpers/negotiate_auth/kerberos/required.m4 @@ -0,0 +1,2 @@ +# FIXME: use other kerberos library checks from main configure.ac +AC_CHECK_HEADERS([gssapi/gssapi.h gssapi.h kerberosV/gssapi.h],[BUILD_HELPER="kerberos"]) diff --git a/helpers/negotiate_auth/modules.m4 b/helpers/negotiate_auth/modules.m4 new file mode 100644 index 0000000000..bd44839a95 --- /dev/null +++ b/helpers/negotiate_auth/modules.m4 @@ -0,0 +1,61 @@ +# This file is supposed to run all the tests required to identify which +# configured modules are able to be built in this environment + +# FIXME: de-duplicate $enable_auth_negotiate list containing double entries. + +#not specified. Inherit global +if test "x$enable_auth_negotiate" = "x"; then + enable_auth_negotiate=$enable_auth +fi +#conflicts with global +if test "x$enable_auth_negotiate" != "xno" -a "x$enable_auth" = "xno" ; then + AC_MSG_ERROR([Negotiate auth requested but auth disabled]) +fi +#define list of modules to build +if test "x$enable_auth_negotiate" = "xyes" ; then + SQUID_LOOK_FOR_MODULES([$srcdir/helpers/negotiate_auth],[enable_auth_negotiate]) +fi +#handle the "none" special case +if test "x$enable_auth_negotiate" = "xnone" ; then + enable_auth_negotiate="" +fi + +NEGOTIATE_AUTH_HELPERS="" +enable_auth_negotiate="`echo $enable_auth_negotiate| sed -e 's/,/ /g;s/ */ /g'`" +if test "x$enable_auth_negotiate" != "xno" ; then + AUTH_MODULES="$AUTH_MODULES negotiate" + AC_DEFINE([HAVE_AUTH_MODULE_NEGOTIATE],1,[Negotiate auth module is built]) + for helper in $enable_auth_negotiate; do + dir="$srcdir/helpers/negotiate_auth/$helper" + + # modules converted to autoconf macros already + # NP: we only need this list because m4_include() does not accept variables + if test "x$helper" = "xSSPI" ; then + m4_include([helpers/negotiate_auth/SSPI/required.m4]) + + elif test "x$helper" = "xkerberos" ; then + m4_include([helpers/negotiate_auth/kerberos/required.m4]) + + elif test "x$helper" = "xwrapper" ; then + m4_include([helpers/negotiate_auth/wrapper/required.m4]) + + # modules not yet converted to autoconf macros (or third party drop-in's) + elif test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then + BUILD_HELPER="$helper" + fi + + if test -d "$srcdir/helpers/negotiate_auth/$helper"; then + if test "$BUILD_HELPER" != "$helper"; then + AC_MSG_NOTICE([Negotiate auth helper $helper ... found but cannot be built]) + else + NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $BUILD_HELPER" + fi + else + AC_MSG_ERROR([Negotiate auth helper $helper ... not found]) + fi + done +fi + +AC_MSG_NOTICE([Negotiate auth helpers to be built: $NEGOTIATE_AUTH_HELPERS]) +AM_CONDITIONAL(ENABLE_AUTH_NEGOTIATE, test "x$enable_auth_negotiate" != "xno") +AC_SUBST(NEGOTIATE_AUTH_HELPERS) diff --git a/helpers/negotiate_auth/wrapper/Makefile.am b/helpers/negotiate_auth/wrapper/Makefile.am index c2544fef4b..870edbe455 100644 --- a/helpers/negotiate_auth/wrapper/Makefile.am +++ b/helpers/negotiate_auth/wrapper/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/src/Common.am -EXTRA_DIST = config.test +EXTRA_DIST = required.m4 libexec_PROGRAMS = negotiate_wrapper_auth diff --git a/helpers/negotiate_auth/wrapper/config.test b/helpers/negotiate_auth/wrapper/config.test deleted file mode 100755 index 039e4d0069..0000000000 --- a/helpers/negotiate_auth/wrapper/config.test +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 0 diff --git a/helpers/negotiate_auth/wrapper/required.m4 b/helpers/negotiate_auth/wrapper/required.m4 new file mode 100755 index 0000000000..a8c7aa1652 --- /dev/null +++ b/helpers/negotiate_auth/wrapper/required.m4 @@ -0,0 +1 @@ +BUILD_HELPER="wrapper" diff --git a/helpers/ntlm_auth/Makefile.am b/helpers/ntlm_auth/Makefile.am index 0806e12f9e..f90d2e0c31 100644 --- a/helpers/ntlm_auth/Makefile.am +++ b/helpers/ntlm_auth/Makefile.am @@ -1,2 +1,3 @@ DIST_SUBDIRS = fake smb_lm SSPI SUBDIRS = $(NTLM_AUTH_HELPERS) +EXTRA_DIST = modules.m4 diff --git a/helpers/ntlm_auth/SSPI/Makefile.am b/helpers/ntlm_auth/SSPI/Makefile.am index c56fe6bc67..be6fdcd95c 100644 --- a/helpers/ntlm_auth/SSPI/Makefile.am +++ b/helpers/ntlm_auth/SSPI/Makefile.am @@ -14,4 +14,4 @@ LDADD = \ -ladvapi32 \ $(XTRA_LIBS) -EXTRA_DIST = ntlm_sspi_auth.8 config.test +EXTRA_DIST = ntlm_sspi_auth.8 required.m4 diff --git a/helpers/ntlm_auth/SSPI/config.test b/helpers/ntlm_auth/SSPI/config.test deleted file mode 100755 index b303426be5..0000000000 --- a/helpers/ntlm_auth/SSPI/config.test +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# Only build this helper on Windows -# -if test "$1" = "mingw"; then - exit 0 -fi -if [ -f /usr/include/w32api/windows.h ]; then - exit 0 -fi -if [ -f /usr/include/windows.h ]; then - exit 0 -fi -exit 1 diff --git a/helpers/ntlm_auth/SSPI/required.m4 b/helpers/ntlm_auth/SSPI/required.m4 new file mode 100755 index 0000000000..f1ed8ba246 --- /dev/null +++ b/helpers/ntlm_auth/SSPI/required.m4 @@ -0,0 +1,4 @@ +# +# Only build this helper on Windows +# +AC_CHECK_HEADERS([w32api/windows.h windows.h],[BUILD_HELPER="SSPI"]) diff --git a/helpers/ntlm_auth/fake/Makefile.am b/helpers/ntlm_auth/fake/Makefile.am index 97d198e41b..804e633753 100644 --- a/helpers/ntlm_auth/fake/Makefile.am +++ b/helpers/ntlm_auth/fake/Makefile.am @@ -16,5 +16,5 @@ INCLUDES += -I$(top_srcdir)/lib ## ntlm_fake_auth.pl: ntlm_fake_auth.pl.in ## $(subst_perlshell) -EXTRA_DIST = config.test \ +EXTRA_DIST = required.m4 \ ntlm_fake_auth.pl.in diff --git a/helpers/ntlm_auth/fake/config.test b/helpers/ntlm_auth/fake/config.test deleted file mode 100755 index 039e4d0069..0000000000 --- a/helpers/ntlm_auth/fake/config.test +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 0 diff --git a/helpers/ntlm_auth/fake/required.m4 b/helpers/ntlm_auth/fake/required.m4 new file mode 100755 index 0000000000..5261ae5a22 --- /dev/null +++ b/helpers/ntlm_auth/fake/required.m4 @@ -0,0 +1 @@ +BUILD_HELPER="fake" diff --git a/helpers/ntlm_auth/modules.m4 b/helpers/ntlm_auth/modules.m4 new file mode 100644 index 0000000000..a62af48551 --- /dev/null +++ b/helpers/ntlm_auth/modules.m4 @@ -0,0 +1,61 @@ +# This file is supposed to run all the tests required to identify which +# configured modules are able to be built in this environment + +# FIXME: de-duplicate $enable_auth_ntlm list containing double entries. + +#not specified. Inherit global +if test "x$enable_auth_ntlm" = "x"; then + enable_auth_ntlm=$enable_auth +fi +#conflicts with global +if test "x$enable_auth_ntlm" != "xno" -a "x$enable_auth" = "xno" ; then + AC_MSG_ERROR([NTLM auth requested but auth disabled]) +fi +#define list of modules to build +if test "x$enable_auth_ntlm" = "xyes" ; then + SQUID_LOOK_FOR_MODULES([$srcdir/helpers/ntlm_auth],[enable_auth_ntlm]) +fi +#handle the "none" special case +if test "x$enable_auth_ntlm" = "xnone" ; then + enable_auth_ntlm="" +fi + +NTLM_AUTH_HELPERS="" +#enable_auth_ntlm contains either "no" or the list of modules to be built +enable_auth_ntlm="`echo $enable_auth_ntlm| sed -e 's/,/ /g;s/ */ /g'`" +if test "x$enable_auth_ntlm" != "xno" ; then + AUTH_MODULES="$AUTH_MODULES ntlm" + AC_DEFINE([HAVE_AUTH_MODULE_NTLM],1,[NTLM auth module is built]) + for helper in $enable_auth_ntlm; do + dir="$srcdir/helpers/ntlm_auth/$helper" + + # modules converted to autoconf macros already + # NP: we only need this list because m4_include() does not accept variables + if test "x$helper" = "xfake" ; then + m4_include([helpers/ntlm_auth/fake/required.m4]) + + elif test "x$helper" = "xSSPI" ; then + m4_include([helpers/ntlm_auth/SSPI/required.m4]) + + elif test "x$helper" = "xsmb_lm" ; then + m4_include([helpers/ntlm_auth/smb_lm/required.m4]) + + # modules not yet converted to autoconf macros (or third party drop-in's) + elif test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then + BUILD_HELPER="$helper" + fi + + if test -d "$srcdir/helpers/ntlm_auth/$helper"; then + if test "$BUILD_HELPER" != "$helper"; then + AC_MSG_NOTICE([NTLM auth helper $helper ... found but cannot be built]) + else + NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $BUILD_HELPER" + fi + else + AC_MSG_ERROR([NTLM auth helper $helper ... not found]) + fi + done +fi +AC_MSG_NOTICE([NTLM auth helpers to be built: $NTLM_AUTH_HELPERS]) +AM_CONDITIONAL(ENABLE_AUTH_NTLM, test "x$enable_auth_ntlm" != "xno") +AC_SUBST(NTLM_AUTH_HELPERS) diff --git a/helpers/ntlm_auth/smb_lm/Makefile.am b/helpers/ntlm_auth/smb_lm/Makefile.am index 5f60194623..dd0b5fccf0 100644 --- a/helpers/ntlm_auth/smb_lm/Makefile.am +++ b/helpers/ntlm_auth/smb_lm/Makefile.am @@ -14,4 +14,4 @@ ntlm_smb_lm_auth_LDADD = \ INCLUDES += -I$(top_srcdir)/lib -EXTRA_DIST = config.test +EXTRA_DIST = required.m4 diff --git a/helpers/ntlm_auth/smb_lm/config.test b/helpers/ntlm_auth/smb_lm/config.test deleted file mode 100755 index f75f12e2b2..0000000000 --- a/helpers/ntlm_auth/smb_lm/config.test +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# Don't build this helper on Windows -# -if test "$1" = "mingw"; then - exit 1 -fi -if [ -f /usr/include/w32api/windows.h ]; then - exit 1 -fi -if [ -f /usr/include/windows.h ]; then - exit 1 -fi -exit 0 diff --git a/helpers/ntlm_auth/smb_lm/required.m4 b/helpers/ntlm_auth/smb_lm/required.m4 new file mode 100755 index 0000000000..a93b5cbaa8 --- /dev/null +++ b/helpers/ntlm_auth/smb_lm/required.m4 @@ -0,0 +1,8 @@ +# +# DONT build this helper on Windows +# +# XXX: do we really need the mingw check? +if test "$squid_host_os" != "mingw"; then + BUILD_HELPER="smb_lm" + AC_CHECK_HEADERS([w32api/windows.h windows.h],[BUILD_HELPER=""]) +fi diff --git a/helpers/url_rewrite/fake/Makefile.am b/helpers/url_rewrite/fake/Makefile.am index 988cc4b0dc..c7342b0151 100644 --- a/helpers/url_rewrite/fake/Makefile.am +++ b/helpers/url_rewrite/fake/Makefile.am @@ -7,4 +7,4 @@ url_fake_rewrite_LDADD = $(COMPAT_LIB) libexec_SCRIPTS = url_fake_rewrite.sh -EXTRA_DIST = url_fake_rewrite.sh config.test +EXTRA_DIST = url_fake_rewrite.sh required.m4 diff --git a/helpers/url_rewrite/fake/config.test b/helpers/url_rewrite/fake/config.test deleted file mode 100755 index 039e4d0069..0000000000 --- a/helpers/url_rewrite/fake/config.test +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 0 diff --git a/helpers/url_rewrite/fake/required.m4 b/helpers/url_rewrite/fake/required.m4 new file mode 100755 index 0000000000..5261ae5a22 --- /dev/null +++ b/helpers/url_rewrite/fake/required.m4 @@ -0,0 +1 @@ +BUILD_HELPER="fake" diff --git a/helpers/url_rewrite/modules.m4 b/helpers/url_rewrite/modules.m4 new file mode 100644 index 0000000000..9db9ac7ed9 --- /dev/null +++ b/helpers/url_rewrite/modules.m4 @@ -0,0 +1,40 @@ +# This file is supposed to run all the tests required to identify which +# configured modules are able to be built in this environment + +# FIXME: de-duplicate $enable_url_rewrite_helpers list containing double entries. + +#define list of modules to build +if test "x${enable_url_rewrite_helpers:=yes}" = "xyes" ; then + SQUID_LOOK_FOR_MODULES([$srcdir/helpers/url_rewrite],[enable_url_rewrite_helpers]) +fi + +enable_url_rewrite_helpers="`echo $enable_url_rewrite_helpers| sed -e 's/,/ /g;s/ */ /g'`" +AC_MSG_NOTICE([URL rewrite helper candidates: $enable_url_rewrite_helpers]) +URL_REWRITE_HELPERS="" +if test "x$enable_url_rewrite_helpers" != "xno" ; then + for helper in $enable_url_rewrite_helpers; do + dir="$srcdir/helpers/url_rewrite/$helper" + + # modules converted to autoconf macros already + # NP: we only need this list because m4_include() does not accept variables + if test "x$helper" = "xfake" ; then + m4_include([helpers/url_rewrite/fake/required.m4]) + + # modules not yet converted to autoconf macros (or third party drop-in's) + elif test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then + BUILD_HELPER="$helper" + fi + + if test -d "$srcdir/helpers/url_rewrite/$helper"; then + if test "$BUILD_HELPER" != "$helper"; then + AC_MSG_NOTICE([URL rewrite helper $helper ... found but cannot be built]) + else + URL_REWRITE_HELPERS="$URL_REWRITE_HELPERS $BUILD_HELPER" + fi + else + AC_MSG_ERROR([URL rewrite helper $helper ... not found]) + fi + done +fi +AC_MSG_NOTICE([URL rewrite helpers to be built: $URL_REWRITE_HELPERS]) +AC_SUBST(URL_REWRITE_HELPERS)