change the script to automatically stop on warning if compiling with gcc.

svn path=/trunk/; revision=21421
This commit is contained in:
Sebastien Tandel 2007-04-13 22:52:33 +00:00
parent 63692e83f8
commit 7098b76ee0
1 changed files with 20 additions and 17 deletions

View File

@ -158,15 +158,16 @@ AC_SUBST(HAVE_RPM)
# argument will compile with non-GCC compilers.
#
AC_ARG_WITH(extra-gcc-checks,
[ --with-extra-gcc-checks Do additional -W checks in GCC. [default=no]],
AC_HELP_STRING( [--with-extra-gcc-checks],
[Do additional -W checks in GCC. [default=no]]),
[
if test $withval != no
then
wireshark_extra_gcc_flags=" -Wcast-qual -Wcast-align -Wbad-function-cast -pedantic -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings"
fi
],)
AC_MSG_CHECKING(to see if we can add '-Wall -W$wireshark_extra_gcc_flags' to CFLAGS)
if test x$GCC != x ; then
AC_MSG_CHECKING(whether we can add '-Wall -W$wireshark_extra_gcc_flags' to CFLAGS)
if test "x$GCC" != "x" ; then
CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -Wpointer-arith -W $wireshark_extra_gcc_flags $CFLAGS"
AC_MSG_RESULT(yes)
else
@ -174,8 +175,8 @@ else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(to see if we can add '-Wdeclaration-after-statement' to CFLAGS)
if test x$GCC == xyes ; then
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
@ -191,8 +192,8 @@ else
fi
rm -rf conftest*
AC_MSG_CHECKING(to see if we can add '-Wno-pointer-sign' to CFLAGS)
if test x$GCC == xyes ; then
AC_MSG_CHECKING(whether we can add '-Wno-pointer-sign' to CFLAGS)
if test "x$GCC" = "xyes" ; then
# some versions of GCC support this directive
rm -rf conftest*
echo "int foo;" >>conftest.c
@ -209,17 +210,19 @@ fi
rm -rf conftest*
AC_ARG_WITH(warnings-as-errors,
[ --with-warnings-as-errors Treat warnings as errors (if using gcc). [default=no]],
[
if test "x$GCC" != "x"; then
if test "x$withval" != "xno"; then
with_warnings_as_errors="yes"
fi
else
with_warnings_as_errors="no"
AC_HELP_STRING( [--without-warnings-as-errors],
[Don't treat warnings as errors (only for gcc). [default=yes]]),
[
without_warnings_as_errors="no"
if test "x$GCC" != "x" && test "x$withval" = "xno"; then
without_warnings_as_errors="yes"
fi
],)
AM_CONDITIONAL(HAVE_WARNINGS_AS_ERRORS, test "x$with_warnings_as_errors" = "xyes")
],
if test "x$GCC" != "x"; then
without_warnings_as_errors="no"
fi
)
AM_CONDITIONAL(HAVE_WARNINGS_AS_ERRORS, test "x$without_warnings_as_errors" = "xno")
#
# Add any platform-specific compiler flags needed.