aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-06-27 00:45:39 +0000
committerGuy Harris <guy@alum.mit.edu>2013-06-27 00:45:39 +0000
commit04cc1e2fb5ded745000c90897ba73e8d11599cc1 (patch)
treed37e758f866026a18d154c30cddcc550313aa8e5 /acinclude.m4
parenteaf5e3fd1f296131e22b72e8f9986c6b3e1dcc56 (diff)
downloadwireshark-04cc1e2fb5ded745000c90897ba73e8d11599cc1.tar.gz
wireshark-04cc1e2fb5ded745000c90897ba73e8d11599cc1.tar.bz2
wireshark-04cc1e2fb5ded745000c90897ba73e8d11599cc1.zip
Don't assume that compilers not named "clang" will, by default, report
an error, or not issue warnings, by default if you give them an unknown -f flag. Instead, test that flag with all compilers, and use -Werror to force it to error out. As with C/C++ flags, so with C++-only flags. svn path=/trunk/; revision=50178
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m427
1 files changed, 22 insertions, 5 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index a3c47fce18..3bef361b1b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1650,13 +1650,27 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then
if test "$2" != CXX ; then
#
# Not C++-only; if this can be added to the C compiler flags, add them.
- # Add $ac_wireshark_unknown_warning_option_error to make sure that
+ #
+ # If the option begins with "-W", add
+ # $ac_wireshark_unknown_warning_option_error to make sure that
# we'll get an error if it's an unknown warning option; not all
# compilers treat unknown warning options as errors (I'm looking at
# you, clang).
#
+ # If the option begins with "-f", add -Werror to make sure that
+ # we'll get an error if we get "argument unused during compilation"
+ # warnings, as those will either cause a failure for files compiled
+ # with -Werror or annoying noise for files compiled without it.
+ # (Yeah, you, clang.)
+ #
CFLAGS_saved="$CFLAGS"
- CFLAGS="$CFLAGS $ac_wireshark_unknown_warning_option_error $GCC_OPTION"
+ if expr "$GCC_OPTION" : "-W.*" >/dev/null
+ then
+ CFLAGS="$CFLAGS $ac_wireshark_unknown_warning_option_error $GCC_OPTION"
+ elif expr "$GCC_OPTION" : "-f.*" >/dev/null
+ then
+ CFLAGS="$CFLAGS -Werror $GCC_OPTION"
+ fi
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([[
int foo;
@@ -1729,9 +1743,12 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then
# C++-only; if this can be added to the C++ compiler flags, add them.
#
CXXFLAGS_saved="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $GCC_OPTION"
- if test "x$CC" = "xclang" ; then
- CXXFLAGS="$CXXFLAGS -Werror=unknown-warning-option"
+ if expr "$GCC_OPTION" : "-W.*" >/dev/null
+ then
+ CXXFLAGS="$CXXFLAGS $ac_wireshark_unknown_warning_option_error $GCC_OPTION"
+ elif expr "$GCC_OPTION" : "-f.*" >/dev/null
+ then
+ CXXFLAGS="$CXXFLAGS -Werror $GCC_OPTION"
fi
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([