From: Francesco Chemolli Date: Wed, 25 Nov 2009 17:12:10 +0000 (+0100) Subject: Expanded role of SQUID_CC_GUESS_OPTIONS to also more guessed command line options. X-Git-Tag: SQUID_3_2_0_1~310^2~55 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa6307ae0ec1d67be22c736c31ce76e91c994f33;p=thirdparty%2Fsquid.git Expanded role of SQUID_CC_GUESS_OPTIONS to also more guessed command line options. --- diff --git a/acinclude/compiler-flags.m4 b/acinclude/compiler-flags.m4 index 04819c4c2c..843049dd04 100644 --- a/acinclude/compiler-flags.m4 +++ b/acinclude/compiler-flags.m4 @@ -31,7 +31,7 @@ dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. # first argument is the variable containing the result # (will be set to "yes" or "no") # second argument is the flag to be tested, verbatim - +# AC_DEFUN([SQUID_CC_CHECK_ARGUMENT],[ AC_CACHE_CHECK([whether compiler accepts $2],[$1], [{ @@ -49,6 +49,7 @@ AC_DEFUN([SQUID_CC_CHECK_ARGUMENT],[ # check if the c++ compiler supports the -fhuge-objects flag # sets the variable squid_cv_cxx_arg_fhugeobjects to either "yes" or "no" +# AC_DEFUN([SQUID_CXX_CHECK_ARG_FHUGEOBJECTS],[ AC_LANG_PUSH([C++]) if test "$GCC" = "yes"; then @@ -65,6 +66,7 @@ AC_DEFUN([SQUID_CXX_CHECK_ARG_FHUGEOBJECTS],[ # - gcc # - sunstudio # - none (undetected) +# AC_DEFUN([SQUID_CC_GUESS_VARIANT], [ AC_CACHE_CHECK([what kind of compiler we're using],[squid_cv_compiler], [ @@ -93,16 +95,33 @@ AC_DEFUN([SQUID_CC_GUESS_VARIANT], [ # define the flag to use to have the compiler treat warnings as errors # requirs SQUID_CC_GUESS_VARIANT -# sets the variable squid_cv_cc_option_werror to the right flag -# or to an empty string if it can't be detected. +# Sets a few variables to contain some compiler-dependent command line +# options, or to empty strings if the compiler doesn't support those +# options +# They are (with their GCC equivalent): +# squid_cv_cc_option_werror (-Werror) +# squid_cv_cc_option_wall (-Wall) +# squid_cv_cc_option_optimize (-O3) # -AC_DEFUN([SQUID_CC_GUESS_OPTION_WERROR], [ +AC_DEFUN([SQUID_CC_GUESS_OPTIONS], [ AC_REQUIRE([SQUID_CC_GUESS_VARIANT]) AC_MSG_CHECKING([for compiler warnings-are-errors flag]) case "$squid_cv_compiler" in - gcc) squid_cv_cc_option_werror="-Werror" ;; - sunstudio) squid_cv_cc_option_werror="-errwarn=%all" ;; - *) squid_cv_cc_option_werror="" ;; + gcc) + squid_cv_cc_option_werror="-Werror" + squid_cv_cc_option_wall="-Wall" + squid_cv_cc_option_optimize="-O3" + ;; + sunstudio) + squid_cv_cc_option_werror="-errwarn=%all" + squid_cv_cc_option_wall="+w" + squid_cv_cc_option_optimize="-fast" + ;; + *) + squid_cv_cc_option_werror="" + squid_cv_cc_option_wall="" + squid_cv_cc_option_optimize="" + ;; esac AC_MSG_RESULT([$squid_cv_cc_option_werror]) ]) diff --git a/configure.in b/configure.in index 749a427a1e..f1b44fa554 100644 --- a/configure.in +++ b/configure.in @@ -70,10 +70,9 @@ AC_SUBST(AR_R) AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false) dnl Make the squid top srcdir available to sub-packages as --with-squid=PATH -new_configure_args="$ac_configure_args --with-squid=$ac_abs_confdir" -ac_configure_args="$new_configure_args" +ac_configure_args="$ac_configure_args --with-squid=$ac_abs_confdir" -squid_disable_werror="no" +squid_opt_enable_werror="yes" # default 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 enbled. @@ -81,7 +80,7 @@ AC_ARG_ENABLE(strict-error-checking, [ if test "${enableval}" = "no" then - squid_disable_werror="yes" + squid_opt_enable_werror="no" fi ]) @@ -139,7 +138,7 @@ fi dnl ********************************* KK *********************** SQUID_CC_GUESS_VARIANT -SQUID_CC_GUESS_OPTION_WERROR +SQUID_CC_GUESS_OPTIONS REGEXLIB='' # -lregex @@ -281,18 +280,18 @@ if test -z "$PRESET_CFLAGS"; then CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'` ;; *) - CFLAGS="-Wall $CFLAGS" + CFLAGS="$squid_cv_cc_option_wall $CFLAGS" ;; esac else case "$host" in *mips-sgi-irix6.*) # suggested by Rafael Seidl - CFLAGS="-O3 -OPT:Olimit=0:space=OFF \ + CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \ -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \ -Wl,-woff,85,-woff,84,-woff,134 \ -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS" - CXXFLAGS="-O3 -OPT:Olimit=0:space=OFF \ + CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \ -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \ -Wl,-woff,85,-woff,84,-woff,134 \ -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS" @@ -300,7 +299,7 @@ if test -z "$PRESET_CFLAGS"; then alpha-dec-osf4.*) # Mogul says DEC compilers take both -g and -O2 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'` - CFLAGS="-O2 $CFLAGS" + CFLAGS="$squid_cv_cc_option_optimize $CFLAGS" ;; *) ;; @@ -316,19 +315,19 @@ dnl -Werror -Wmissing-prototypes -Wmissing-declarations dnl TODO: check if the problem will be present in any other newer MinGW release. case "$host_os" in mingw|mingw32) - SQUID_CFLAGS="-Wall -Wpointer-arith -Wwrite-strings -Wcomments" + SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments" ;; *) - SQUID_CFLAGS="-Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments" + SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments" ;; esac - SQUID_CXXFLAGS="-Wall -Wpointer-arith -Wwrite-strings -Wcomments" + SQUID_CXXFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments" else SQUID_CFLAGS= SQUID_CXXFLAGS= fi -if test "$squid_disable_werror" = "no" +if test "$squid_opt_enable_werror" = "no" then SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror" SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_option_werror"