$OpenBSD: patch-configure_ac,v 1.1 2010/07/06 17:17:50 sthen Exp $
--- configure.ac.orig	Tue Jul  6 08:56:41 2010
+++ configure.ac	Tue Jul  6 08:57:51 2010
@@ -548,7 +548,17 @@ AM_CONDITIONAL(CHECK_WITH_FASTCGI, test "x$fastcgi_fou
 
 dnl check for extra compiler options (warning options)
 if test "${GCC}" = "yes"; then
-    CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic -std=gnu99"
+    CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic"
+
+    # Use std=gnu99 if we have new enough GCC
+    old_cflags=${CFLAGS}
+    CFLAGS="-std=gnu99"
+    AC_TRY_COMPILE([
+    ],, [
+      CFLAGS="${CFLAGS} $old_cflags"
+    ], [
+      CFLAGS="${old_cflags}"
+    ])
 fi
 
 AC_ARG_ENABLE(extra-warnings,
