Use -Wno-format-zero-length if GCC version supports it
authorKen Raeburn <raeburn@mit.edu>
Thu, 23 Aug 2007 07:11:21 +0000 (07:11 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 23 Aug 2007 07:11:21 +0000 (07:11 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19848 dc483132-0cff-0310-8789-dd5450dbe970

src/aclocal.m4

index 8cdbc478888608daecc096cb6e4252e8d544984b..f29446a1fefdf045391da282f535311d19c98bd8 100644 (file)
@@ -625,6 +625,19 @@ if test "$GCC" = yes ; then
     else
       CFLAGS="$CFLAGS -pedantic"
     fi
+    AC_CACHE_CHECK([if GCC supports -Wno-format-zero-length],
+                  krb5_cv_gcc_Wno_format_zero_length,
+    [# first try without, then with
+    AC_TRY_COMPILE([], 1;,
+      [old_cflags="$CFLAGS"
+       CFLAGS="$CFLAGS -Wno-format-zero-length"
+       AC_TRY_COMPILE([], 1;, krb5_cv_gcc_Wno_format_zero_length=yes,
+       krb5_cv_gcc_Wno_format_zero_length=no)
+       CFLAGS="$old_cflags"],
+      [AC_MSG_ERROR(compiling simple test program with $CFLAGS failed)])])
+    if test "$krb5_cv_gcc_Wno_format_zero_length" = yes; then
+      CFLAGS="$CFLAGS -Wno-format-zero-length"
+    fi
   fi
   if test "`uname -s`" = Darwin ; then
     # Someday this should be a feature test.