+# check if compiler supports format warnings
+AT_DATA([fmt.c],
+[[#include <config.h>
+#include <glib.h>
+
+void foo(const char *, ...) G_GNUC_PRINTF(1, 2);
+void bar(void) {
+#line 99 "VERIFY"
+foo("%s", 0);
+}
+]])
+AT_DATA([fmt.awk],
+[[BEGIN { pass=0; FS=":"; }
+/%s/ && $1 == "VERIFY" && $2 == 99 { pass=1; }
+END { exit(!pass); }
+]])
+
+fmt_warnings=false
+set x $CPPFLAGS $CFLAGS $LIBGOBJECT_CFLAGS; shift
+AS_IF([$CC "$@" -c fmt.c 1>/dev/null 2>out && $AWK -f fmt.awk out],
+ [fmt_warnings=:],
+ [AS_IF([$CC "$@" -Wformat -c fmt.c 1>/dev/null 2>out && $AWK -f fmt.awk out],
+ [CFLAGS="$CFLAGS -Wformat" fmt_warnings=:])])
+