summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in12
1 files changed, 11 insertions, 1 deletions
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]],