# 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],
[{
# 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
# - gcc
# - sunstudio
# - none (undetected)
+#
AC_DEFUN([SQUID_CC_GUESS_VARIANT], [
AC_CACHE_CHECK([what kind of compiler we're using],[squid_cv_compiler],
[
# 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])
])
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.
[
if test "${enableval}" = "no"
then
- squid_disable_werror="yes"
+ squid_opt_enable_werror="no"
fi
])
dnl ********************************* KK ***********************
SQUID_CC_GUESS_VARIANT
-SQUID_CC_GUESS_OPTION_WERROR
+SQUID_CC_GUESS_OPTIONS
REGEXLIB='' # -lregex
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"
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"
;;
*)
;;
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"