$OpenBSD: patch-configure_ac,v 1.2 2010/08/18 11:16:55 sthen Exp $
--- configure.ac.orig	Sat Aug  7 05:31:29 2010
+++ configure.ac	Sun Aug  8 22:18:59 2010
@@ -585,7 +585,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,
