aboutsummaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorSebastien Tandel <sebastien@tandel.be>2007-04-22 09:27:21 +0000
committerSebastien Tandel <sebastien@tandel.be>2007-04-22 09:27:21 +0000
commit706627f882078eda3937374183766e0a8e3017df (patch)
tree517d1907bb773519676d82bb0b40a60e387d34c9 /configure.in
parent23faf81799bbbf4c68f4d16fe5ef5ad3962f7321 (diff)
adding AC_(WIRESHARK|WIRETAP)_GCC_CFLAGS_OPTION macro to test whether gcc
supports the options passed as arguments. If the options are supported, they are added to CFLAGS. svn path=/trunk/; revision=21493
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in72
1 files changed, 25 insertions, 47 deletions
diff --git a/configure.in b/configure.in
index fcf4da6e52..71f65cfa9f 100644
--- a/configure.in
+++ b/configure.in
@@ -148,14 +148,7 @@ AC_WIRESHARK_RPM_CHECK
AC_SUBST(HAVE_RPM)
#
-# If we're running gcc, add '-Wall -Wpointer-arith -W' to CFLAGS, and add
-# '-D_U_="__attribute__((unused))"' as well, so we can use _U_ to
-# flag unused function arguments and not get warnings about them.
-# If "--with-extra-gcc-checks" was specified, add some additional
-# warning checks.
-#
-# Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
-# argument will compile with non-GCC compilers.
+# Try to add some additional gcc checks to CFLAGS
#
AC_ARG_ENABLE(extra-gcc-checks,
AC_HELP_STRING( [--enable-extra-gcc-checks],
@@ -163,52 +156,37 @@ AC_ARG_ENABLE(extra-gcc-checks,
[
if test $enableval != no
then
- wireshark_extra_gcc_flags=" -Wcast-qual -Wcast-align -Wbad-function-cast -pedantic -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings"
+ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-qual)
+ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align)
+ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wbad-function-cast)
+ AC_WIRESHARK_GCC_CFLAGS_CHECK(-pedantic)
+ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wstrict-prototypes)
+ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-declarations)
+ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wwrite-strings)
fi
],)
-AC_MSG_CHECKING(whether we can add '-Wall -Wpointer-arith -W$wireshark_extra_gcc_flags' to CFLAGS)
-if test "x$GCC" = "xyes" ; then
- CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -Wpointer-arith -W $wireshark_extra_gcc_flags $CFLAGS"
- AC_MSG_RESULT(yes)
-else
- CFLAGS="-D_U_=\"\" $CFLAGS"
- AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(whether we can add '-Wdeclaration-after-statement' to CFLAGS)
-if test "x$GCC" = "xyes" ; then
- # some versions of GCC support this directive
- rm -rf conftest*
- echo "int foo;" >>conftest.c
- if $CC -c -o conftest.o conftest.c -Wdeclaration-after-statement > /dev/null 2>&1 ; then
- CFLAGS="$CFLAGS -Wdeclaration-after-statement"
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-else
- # non-gcc compilers do not support this directive
- AC_MSG_RESULT(no)
-fi
-rm -rf conftest*
+AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wall -W)
+AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpointer-arith)
+AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wdeclaration-after-statement)
+AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-pointer-sign)
-AC_MSG_CHECKING(whether we can add '-Wno-pointer-sign' to CFLAGS)
+#
+# If we're running gcc add '-D_U_="__attribute__((unused))"' to CFLAGS as well,
+# so we can use _U_ to flag unused function arguments and not get warnings
+# about them. Otherwise, add '-D_U_=""', so that _U_ used to flag an unused
+# function argument will compile with non-GCC compilers.
+#
if test "x$GCC" = "xyes" ; then
- # some versions of GCC support this directive
- rm -rf conftest*
- echo "int foo;" >>conftest.c
- if $CC -c -o conftest.o conftest.c -Wno-pointer-sign > /dev/null 2>&1 ; then
- CFLAGS="$CFLAGS -Wno-pointer-sign"
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
+ CFLAGS="-D_U_=\"__attribute__((unused))\" $CFLAGS"
else
- # non-gcc compilers do not support this directive
- AC_MSG_RESULT(no)
+ CFLAGS="-D_U_=\"\" $CFLAGS"
fi
-rm -rf conftest*
+#
+# If we're running gcc, will enable a barrier "stop on warning".
+# This barrier is set for a very large part of the code. However, it is
+# typically not set for "generated" code (lex, ans2wrs, idl2wrs, ...)
+#
AC_MSG_CHECKING(whether we should treat compiler warnings as errors)
AC_ARG_ENABLE(warnings-as-errors,
AC_HELP_STRING( [--enable-warnings-as-errors],