diff --git a/configure b/configure
index f5a4dcf6e626192205b825c4dc0ea0e25f2cf96c..5c7ad4f5a3de3fd6d771c463ec74975ed7aa53fb 100755
--- a/configure
+++ b/configure
@@ -1029,6 +1029,17 @@ if $cc -msse -o $TMPO $TMPC 2> /dev/null ; then
   builtin_vector=yes
 fi
 
+# Probe for -Wdeclaration-after-statement
+if test "$cc" == "gcc"; then
+  cat > $TMPC << EOF
+  int main( void ) { return 0; }
+EOF
+
+  if $cc -Wdeclaration-after-statement -Werror -o $TMPE $TMPC 2> /dev/null ; then
+    CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+  fi
+fi
+
 # dlopen/dlfcn.h probing
 
 cat > $TMPC << EOF