+ [enable_gcc_warnings=no])
+AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
+if test "$enable_gcc_warnings" = yes; then
+ warn_common='-Wall-Wextra -Wno-sign-compare -Wcast-align -Wdocumentation
+ -Wformat -Wpointer-arith -Wwrite-strings'
+ warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
+ warn_cxx='-Wnoexcept'
+ # Warnings for the test suite only.
+ #
+ # -fno-color-diagnostics: Clang's use of colors in the error
+ # messages is confusing the tests looking at the compiler's output
+ # (e.g., synclines.at).
+ warn_tests='-Wundef -pedantic -Wsign-compare -fno-color-diagnostics'
+
+ AC_LANG_PUSH([C])
+ # Clang supports many of GCC's -W options, but only issues warnings
+ # on the ones it does not recognize. In that case, gl_WARN_ADD
+ # thinks the option is supported, and unknown options are then added
+ # to CFLAGS. But then, when -Werror is added in the test suite for
+ # instance, the warning about the unknown option turns into an
+ # error.
+ #
+ # This should be addressed by gnulib's gl_WARN_ADD, but in the
+ # meanwhile, turn warnings about unknown options into errors in
+ # CFLAGS, and restore CFLAGS after the tests.
+ save_CFLAGS=$CFLAGS
+ gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
+ for i in $warn_common $warn_c;
+ do
+ gl_WARN_ADD([$i], [WARN_CFLAGS])
+ done