summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2006-08-08 15:36:59 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2006-08-08 15:36:59 +0000
commit2c8baa07088ab00731274bd151135208e3a92779 (patch)
treef3dbc521aad39603e095f4a47c61a3f2b155a9c9
parent222bd07e9df5e3b5a367d1282b43fd3a827a7552 (diff)
* confifure.in: add a GCC flag check for -Wdeclaration-after-statement
so we still compile on older gcc (patch from Frederic Peters <fpeters at 0d dot be>
-rw-r--r--ChangeLog6
-rw-r--r--configure.in19
2 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9d58a6a3..387d3579 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-08 John (J5) Palmieri <johnp@redhat.com>
+
+ * confifure.in: add a GCC flag check for -Wdeclaration-after-statement
+ so we still compile on older gcc (patch from Frederic Peters
+ <fpeters at 0d dot be>
+
2006-08-04 Havoc Pennington <hp@redhat.com>
* configure.in: add -Wdeclaration-after-statement
diff --git a/configure.in b/configure.in
index dfad86ed..65570d62 100644
--- a/configure.in
+++ b/configure.in
@@ -91,6 +91,20 @@ fi
#### gcc warning flags
+cc_supports_flag() {
+ AC_MSG_CHECKING(whether $CC supports "$@")
+ Cfile=/tmp/foo${$}
+ touch ${Cfile}.c
+ $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1
+ rc=$?
+ rm -f ${Cfile}.c ${Cfile}.o
+ case $rc in
+ 0) AC_MSG_RESULT(yes);;
+ *) AC_MSG_RESULT(no);;
+ esac
+ return $rc
+}
+
if test "x$GCC" = "xyes"; then
changequote(,)dnl
case " $CFLAGS " in
@@ -140,7 +154,10 @@ if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wdeclaration-after-statement[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wdeclaration-after-statement" ;;
+ *) if cc_supports_flag -Wdeclaration-after-statement; then
+ CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+ fi
+ ;;
esac
if test "x$enable_ansi" = "xyes"; then