From a4d771956aaaabfe03e647f863dcff86a845275a Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 9 Mar 2021 23:01:20 +0100 Subject: [PATCH] Fix the clang compiler flag detection The clang compiler accepts *any* compiler flags, and just reports an annoying warning instead: warning: unknown warning option '-Wsomething' [-Wunknown-warning-option] Use -Werror=unknown-warning-option to change this warning into an error, and detect the unsupported flag. Since this is a clang specific option, it can't be used unconditionally with other compilers. The option is also only used for checking the compiler flags, and not for compiling the code. --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c9462ff..5e84ad0 100644 --- a/configure.ac +++ b/configure.ac @@ -177,6 +177,7 @@ AC_CHECK_FUNCS([clock_gettime mach_absolute_time]) AC_CHECK_FUNCS([getopt_long]) # Checks for supported compiler options. +AX_APPEND_COMPILE_FLAGS([-Werror=unknown-warning-option],[ERROR_CFLAGS]) AX_APPEND_COMPILE_FLAGS([ \ -pedantic \ -Wall \ @@ -192,7 +193,7 @@ AX_APPEND_COMPILE_FLAGS([ \ -Wmissing-declarations \ -Wno-unused-parameter \ -fmacro-prefix-map='$(top_srcdir)/'= \ -]) +],,[$ERROR_CFLAGS]) # Windows specific compiler options. AS_IF([test "$platform" = "windows"], [