+ AC_CACHE_CHECK([whether it is safe to use -Wformat],
+ [ac_cv_safe_to_use_wformat_],
+ [save_CFLAGS="$CFLAGS"
+ dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
+ dnl conversion warnings to all the tarball folks
+ CFLAGS="-Wformat -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+#include <stdio.h>
+#include <stdint.h>
+#include <inttypes.h>
+void foo();
+void foo()
+{
+ uint64_t test_u= 0;
+ printf("This is a %" PRIu64 "test\n", test_u);
+}
+ ]],[[
+foo();
+ ]])],
+ [ac_cv_safe_to_use_wformat_=yes],
+ [ac_cv_safe_to_use_wformat_=no])
+ CFLAGS="$save_CFLAGS"])
+ AS_IF([test "$ac_cv_safe_to_use_wformat_" = "yes"],[
+ BASE_WARNINGS="${BASE_WARNINGS} -Wformat -Wno-format-nonliteral -Wformat-security"
+ BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wformat=2 -Wno-format-nonliteral -Wformat-security"
+ ],[
+ BASE_WARNINGS="${BASE_WARNINGS} -Wno-format"
+ BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wno-format"
+ ])
+
+
+
+ AC_CACHE_CHECK([whether it is safe to use -Wconversion],
+ [ac_cv_safe_to_use_wconversion_],
+ [save_CFLAGS="$CFLAGS"
+ dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
+ dnl conversion warnings to all the tarball folks
+ CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+#include <stdbool.h>
+void foo(bool a)
+{
+ (void)a;
+}
+ ]],[[
+foo(0);
+ ]])],
+ [ac_cv_safe_to_use_wconversion_=yes],
+ [ac_cv_safe_to_use_wconversion_=no])
+ CFLAGS="$save_CFLAGS"])
+
+ AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"],
+ [W_CONVERSION="-Wconversion"
+ AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
+ [ac_cv_safe_to_use_Wconversion_],
+ [save_CFLAGS="$CFLAGS"
+ dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
+ dnl conversion warnings to all the tarball folks
+ CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <netinet/in.h>
+ ]],[[
+uint16_t x= htons(80);
+ ]])],
+ [ac_cv_safe_to_use_Wconversion_=yes],
+ [ac_cv_safe_to_use_Wconversion_=no])
+ CFLAGS="$save_CFLAGS"])
+
+ AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"],
+ [NO_CONVERSION="-Wno-conversion"])
+ ])
+
+ CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wsign-compare ${CC_WARNINGS_FULL}"
+ CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long -Wsign-compare ${CXX_WARNINGS_FULL}"