From 6ecf2ccc7b1406b9af000a4d01e6c70737b1fe3e Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 26 Mar 2007 06:52:04 +0000 Subject: older versions of gcc do not check -W parameters when only running the preprocessor. change the test for whether -Wdeclaration-after-statement so that it also works for ancient gcc svn path=/trunk/; revision=21205 --- configure.in | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index a5eb2119a5..afc9ae885f 100644 --- a/configure.in +++ b/configure.in @@ -175,12 +175,22 @@ else fi AC_MSG_CHECKING(to see if we can add '-Wdeclaration-after-statement' to CFLAGS) -if test x$GCC != x && echo yes | $CC -E -Wdeclaration-after-statement - 2>&1 | grep yes > /dev/null ; then +if test x$GCC == xyes ; then + # some versions of GCC support this directive + rm -rf conftest* + echo "int foo;" >>conftest.c + $CC -c -o conftest.o conftest.c -Wdeclaration-after-statement + if [ $? == 0 ] ; 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_ARG_WITH(warnings-as-errors, [ --with-warnings-as-errors Treat warnings as errors (if using gcc). [default=no]], -- cgit v1.2.1