aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-06-17 21:27:31 -0700
committerGuy Harris <guy@alum.mit.edu>2014-06-18 04:27:59 +0000
commit4cebb0686f85ad3ba6f21558419455b1877c78fa (patch)
tree4444327ae34166b138eaa064ea460bd7054cecc2 /acinclude.m4
parent237669a35deacbead9346234019c2e50544c8534 (diff)
Add -Werror when testing -m compiler flags.
As with -f flags, some compilers need -Werror to force the compiler to fail when passed an unknown -m flag. Also, if it's not a -W or -f or -m flag, don't forget to add it to CFLAGS and/or CXXFLAGS. And propagate a comment to the C++ flag testing. Change-Id: I53e0e59b34b10b9477c60ddd4f2e047b3b8be77f Reviewed-on: https://code.wireshark.org/review/2361 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m420
1 files changed, 18 insertions, 2 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 7ab46c76bc..2a6c669b7a 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1712,8 +1712,8 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then
# 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"
+ # If the option begins with "-f" or "-m", 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.)
@@ -1726,6 +1726,11 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then
elif expr "x$GCC_OPTION" : "x-f.*" >/dev/null
then
CFLAGS="$CFLAGS -Werror $GCC_OPTION"
+ elif expr "x$GCC_OPTION" : "x-m.*" >/dev/null
+ then
+ CFLAGS="$CFLAGS -Werror $GCC_OPTION"
+ else
+ CFLAGS="$CFLAGS $GCC_OPTION"
fi
AC_COMPILE_IFELSE(
[
@@ -1797,6 +1802,12 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then
# warning about it can be a Good Idea with C, but it's not obvious to
# me).
#
+ # If the option begins with "-f" or "-m", 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++.)
+ #
AC_MSG_CHECKING(whether we can add $GCC_OPTION to CXXFLAGS)
CXXFLAGS_saved="$CXXFLAGS"
if expr "x$GCC_OPTION" : "x-W.*" >/dev/null
@@ -1805,6 +1816,11 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then
elif expr "x$GCC_OPTION" : "x-f.*" >/dev/null
then
CXXFLAGS="$CXXFLAGS -Werror $GCC_OPTION"
+ elif expr "x$GCC_OPTION" : "x-m.*" >/dev/null
+ then
+ CXXFLAGS="$CXXFLAGS -Werror $GCC_OPTION"
+ else
+ CXXFLAGS="$CXXFLAGS $GCC_OPTION"
fi
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(