From: Francesco Chemolli Date: Tue, 3 Aug 2010 08:17:29 +0000 (+0200) Subject: Shuffled system library checks into acinclude/lib-checks.m4 X-Git-Tag: take1~402^2~2^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=73862432eafa07396a90fc525c8aa0cc03b1f010;p=thirdparty%2Fsquid.git Shuffled system library checks into acinclude/lib-checks.m4 Fixed some indentation. Fixed issue with loadable modules variable initialization Refactored loadable modules configuration. Refactored inlining configuration. Moved inline keyword definition out of configure and into config.h Fixed libTrie inlining configuration. --- diff --git a/acinclude/lib-checks.m4 b/acinclude/lib-checks.m4 new file mode 100644 index 0000000000..eca0a38466 --- /dev/null +++ b/acinclude/lib-checks.m4 @@ -0,0 +1,74 @@ +dnl +dnl AUTHOR: Squid Web Cache team +dnl +dnl SQUID Web Proxy Cache http://www.squid-cache.org/ +dnl ---------------------------------------------------------- +dnl Squid is the result of efforts by numerous individuals from +dnl the Internet community; see the CONTRIBUTORS file for full +dnl details. Many organizations have provided support for Squid's +dnl development; see the SPONSORS file for full details. Squid is +dnl Copyrighted (C) 2001 by the Regents of the University of +dnl California; see the COPYRIGHT file for full details. Squid +dnl incorporates software developed and/or copyrighted by other +dnl sources; see the CREDITS file for full details. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + + +dnl checks whether dbopen needs -ldb to be added to libs +dnl sets ac_cv_dbopen_libdb to either "yes" or "no" + +AC_DEFUN([SQUID_CHECK_DBOPEN_NEEDS_LIBDB],[ + AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [ + SQUID_STATE_SAVE(dbopen_libdb) + LIBS="$LIBS -ldb" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_LIMITS_H +#include +#endif +#if HAVE_DB_185_H +#include +#elif HAVE_DB_H +#include +#endif]], +[[dbopen("", 0, 0, DB_HASH, (void *)0L)]])], + [ac_cv_dbopen_libdb="yes"], + [ac_cv_dbopen_libdb="no"]) + SQUID_STATE_ROLLBACK(dbopen_libdb) + ]) +]) + + +dnl check whether regex works by actually compiling one +dnl sets squid_cv_regex_works to either yes or no + +AC_DEFUN([SQUID_CHECK_REGEX_WORKS],[ + AC_CACHE_CHECK([if the system-supplied regex lib actually works],squid_cv_regex_works,[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_REGEX_H +#include +#endif +]], [[ +regex_t t; regcomp(&t,"",0);]])], + [ squid_cv_regex_works=yes ], + [ squid_cv_regex_works=no ]) + ]) +]) diff --git a/configure.in b/configure.in index f931bff0e0..77209a8427 100644 --- a/configure.in +++ b/configure.in @@ -27,7 +27,7 @@ PRESET_LDFLAGS="$LDFLAGS" dnl Set default LDFLAGS if test "x$LDFLAGS" = "x" ; then - LDFLAGS="-g" + LDFLAGS="-g" fi # Check for GNU cc @@ -78,37 +78,28 @@ squid_opt_enable_werror="yes" AC_ARG_ENABLE(strict-error-checking, AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled with all possible static compiler error-checks enabled. - This flag disables the behavior]), -[ + This flag disables the behavior]), [ if test "x${enableval}" = "xno" then squid_opt_enable_werror="no" fi ]) -use_loadable_modules=1 AC_MSG_CHECKING(whether to use loadable modules) AC_ARG_ENABLE(loadable-modules, - AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , [ - case "${enableval}" in - yes) use_loadable_modules=yes ;; - no) use_loadable_modules=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-loadable-modules) ;; - esac - AC_MSG_RESULT([$use_loadable_modules, explicitly]) - ], [ - use_loadable_modules=yes; - AC_MSG_RESULT([$use_loadable_modules, implicitly]) - ]) - -AM_CONDITIONAL(USE_LOADABLE_MODULES, test "s$use_loadable_modules" = "xyes") + AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , [ + SQUID_YESNO([$enableval], + [Unrecognized argument to --disable-loadable-modules: $enableval]) +]) +AM_CONDITIONAL(USE_LOADABLE_MODULES, test "x${enable_loadable_modules:=yes}" = "xyes") +AC_MSG_RESULT([$enable_loadable_modules]) -if test "x$use_loadable_modules" = "xyes"; +if test "x$enable_loadable_modules" = "xyes"; then - AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules]) - AC_ENABLE_SHARED + AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules]) + AC_ENABLE_SHARED else - AC_DISABLE_SHARED + AC_DISABLE_SHARED fi LT_INIT([dlopen]) @@ -121,11 +112,11 @@ LT_LIB_DLLOAD AC_SUBST(INCLTDL) AC_SUBST(LIBLTDL) -if test "x$use_loadable_modules" = "xyes"; +if test "x$enable_loadable_modules" = "xyes"; then - # Why is this needed? Should not LT_INIT (or LT_LIB_DLLOAD) from libtool do that? - LIBADD_DL=${lt_cv_dlopen_libs} - AC_SUBST([LIBADD_DL]) + # Why is this needed? Should not LT_INIT (or LT_LIB_DLLOAD) from libtool do that? + LIBADD_DL=${lt_cv_dlopen_libs} + AC_SUBST([LIBADD_DL]) fi SQUID_CC_GUESS_VARIANT @@ -194,15 +185,16 @@ AC_SUBST(CACHE_EFFECTIVE_USER) DEFAULT_LOG_DIR="$localstatedir/logs" AC_ARG_WITH(logdir, - AS_HELP_STRING([--with-logdir=PATH],[Default location for squid logs. default: $DEFAULT_LOG_DIR]), - [ case $withval in - yes|no) - AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH ) - ;; - *) - DEFAULT_LOG_DIR="$withval" - ;; - esac + AS_HELP_STRING([--with-logdir=PATH], + [Default location for squid logs. default: $DEFAULT_LOG_DIR]), [ +case $withval in + yes|no) + AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH ) + ;; + *) + DEFAULT_LOG_DIR="$withval" + ;; +esac ] ) AC_SUBST(DEFAULT_LOG_DIR) @@ -210,15 +202,15 @@ AC_SUBST(DEFAULT_LOG_DIR) DEFAULT_PIDFILE="$localstatedir/run/squid.pid" AC_ARG_WITH(pidfile, AS_HELP_STRING([--with-pidfile=PATH], - [Default location for squid PID file. default: PREFIX/var/run/squid.pid]), -[case $withval in - yes|no) - AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH ) - ;; - *) - DEFAULT_PIDFILE="$withval" - ;; - esac + [Default location for squid PID file. default: PREFIX/var/run/squid.pid]), [ +case $withval in + yes|no) + AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH ) + ;; + *) + DEFAULT_PIDFILE="$withval" + ;; + esac ]) AC_SUBST(DEFAULT_PIDFILE) @@ -228,7 +220,8 @@ if test "x$GCC" = "xyes"; then case "$host" in i386-*-freebsd*) if test $GCCVER2 -lt 300 ; then - AC_MSG_FAILURE([GCC $GCCVER causes a coredump on $host. Try a more recent GCC version]) + AC_MSG_FAILURE([GCC $GCCVER causes a coredump on $host. + Please use a more recent GCC version]) fi ;; esac @@ -307,8 +300,7 @@ fi SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe" SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe" -SquidInline="yes" - +enable_inline="yes" AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--disable-optimizations], [Do not compile Squid with compiler optimizations enabled. @@ -321,7 +313,7 @@ if test "x$enableval" = "xno" ; then AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)]) CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`" CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`" - SquidInline="no" + enable_inline="no" fi ]) @@ -336,22 +328,15 @@ AC_ARG_ENABLE(inline, allow incremental builds to be quick. For production builds, or load tests, use --enable-inline to have squid make all trivial - methods inlinable by the compiler.]), [ -if test "x$enableval" = "xno" ; then - SquidInline="no" -fi + methods inlinable by the compiler.]), [ +SQUID_YESNO([$enableval], + [Unrecognized argument to --disable-inline: $enableval]) ]) - -if test "x$SquidInline" = "xyes" ; then - AC_DEFINE(_SQUID_INLINE_, inline, - [Keyword used by squid for inlining methods]) - AC_DEFINE(_USE_INLINE_, 1 , - [Include inline methods into header file]) -else - AC_MSG_NOTICE([Inlining optimization disabled]) - AC_DEFINE(_SQUID_INLINE_,[], - [Keyword used by squid for inlining methods]) -fi +AC_MSG_NOTICE([inlining optimizations enabled: $enable_inline]) +SQUID_DEFINE_BOOL(_USE_INLINE_,$enable_inline, + [Include inline methods into header file]) +# to be used by sub-commands +export enable_inline AC_ARG_ENABLE(debug-cbdata, AS_HELP_STRING([--enable-debug-cbdata], @@ -886,7 +871,7 @@ ECAPLIB="" if test "x$squid_opt_use_ecap" = "xyes"; then dnl eCAP support requires loadable modules, which are enabled by default - if test "x$use_loadable_modules" != "xyes" + if test "x$enable_loadable_modules" != "xyes" then AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.]); fi diff --git a/include/config.h b/include/config.h index 7b3817bac3..90ad4a2ca3 100644 --- a/include/config.h +++ b/include/config.h @@ -49,6 +49,12 @@ #define SQUIDCEXTERN extern #endif +#if _USE_INLINE_ +#define _SQUID_INLINE_ inline +#else +#define _SQUID_INLINE_ +#endif + /**************************************************************************** *--------------------------------------------------------------------------* * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...* diff --git a/lib/libTrie/configure.in b/lib/libTrie/configure.in index 51eea58129..806cb06838 100644 --- a/lib/libTrie/configure.in +++ b/lib/libTrie/configure.in @@ -4,27 +4,26 @@ AC_CONFIG_SRCDIR([src/Trie.cc]) AM_CONFIG_HEADER([config.h]) AC_CONFIG_AUX_DIR(cfgaux) -SquidInline="yes" - +enable_inline=${enable_inine:=yes} AC_ARG_ENABLE(optimizations, AC_HELP_STRING([--disable-optimizations], - [Don't compile Squid with compiler optimizations enabled. + [Do not compile Squid with compiler optimizations enabled. Optimization is good for production builds, but not good for debugging. During development, use --disable-optimizations to reduce compilation times and allow easier debugging. This option implicitly - also enabled --disable-inline]), -[ if test "$enableval" = "no" ; then + also enabled --disable-inline]), [ +if test "x$enableval" = "xno" ; then AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)]) CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`" CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`" - SquidInline="no" + enable_inline="no" fi ]) AC_ARG_ENABLE(inline, AC_HELP_STRING([--disable-inline], - [Don't compile trivial methods as inline. Squid + [Do not compile trivial methods as inline. Squid is coded with much of the code able to be inlined. Inlining is good for production builds, but not good for development. During development, use @@ -32,18 +31,17 @@ AC_ARG_ENABLE(inline, allow incremental builds to be quick. For production builds, or load tests, use --enable-inline to have squid make all trivial - methods inlinable by the compiler.]), -[ if test "$enableval" = "no" ; then - SquidInline="no" - fi + methods inlinable by the compiler.]), [ ]) -if test "$SquidInline" = "yes" ; then - AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods]) - AC_DEFINE(_USE_INLINE_,, [Include inline methods into header file]) +if test "$enable_inline" = "yes" ; then + AC_DEFINE(_SQUID_INLINE_, inline, + [Keyword used by squid for inlining methods]) + AC_DEFINE(_USE_INLINE_, 1, [Include inline methods into header file]) else AC_MSG_NOTICE([Inlining optimization disabled]) - AC_DEFINE(_SQUID_INLINE_,, [Keyword used by squid for inlining methods]) + AC_DEFINE(_SQUID_INLINE_, [] , [Keyword used by squid for inlining methods]) + AC_DEFINE(_USE_INLINE_, 0, [Include inline methods into header file]) fi diff --git a/lib/libTrie/include/Trie.h b/lib/libTrie/include/Trie.h index a794c06814..0c33c44465 100644 --- a/lib/libTrie/include/Trie.h +++ b/lib/libTrie/include/Trie.h @@ -93,7 +93,7 @@ private: #endif /* __cplusplus */ -#ifdef _USE_INLINE_ +#if _USE_INLINE_ #include "Trie.cci" #endif diff --git a/lib/libTrie/include/TrieNode.h b/lib/libTrie/include/TrieNode.h index a1cbe5a6ab..b113ae3a57 100644 --- a/lib/libTrie/include/TrieNode.h +++ b/lib/libTrie/include/TrieNode.h @@ -88,7 +88,7 @@ private: #endif /* __cplusplus */ -#ifdef _USE_INLINE_ +#if _USE_INLINE_ #include "TrieNode.cci" #endif