]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Expanded role of SQUID_CC_GUESS_OPTIONS to also more guessed command line options.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 25 Nov 2009 17:12:10 +0000 (18:12 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 25 Nov 2009 17:12:10 +0000 (18:12 +0100)
acinclude/compiler-flags.m4
configure.in

index 04819c4c2ce7a4f9fb704ad0d2daa081f67fe438..843049dd048821339416884a46ce7ee539695850 100644 (file)
@@ -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])
 ])
index 749a427a1edf24a703bbdb6d76d6a5ddb5479956..f1b44fa554ed01dd5853d430cbba021b362bdd59 100644 (file)
@@ -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 <rafaels@cthulhu.engr.sgi.com>
-           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"