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.
This commit is contained in:
Jef Driesen 2021-03-09 23:01:20 +01:00
parent 007a2bc835
commit a4d771956a

View File

@ -177,6 +177,7 @@ AC_CHECK_FUNCS([clock_gettime mach_absolute_time])
AC_CHECK_FUNCS([getopt_long]) AC_CHECK_FUNCS([getopt_long])
# Checks for supported compiler options. # Checks for supported compiler options.
AX_APPEND_COMPILE_FLAGS([-Werror=unknown-warning-option],[ERROR_CFLAGS])
AX_APPEND_COMPILE_FLAGS([ \ AX_APPEND_COMPILE_FLAGS([ \
-pedantic \ -pedantic \
-Wall \ -Wall \
@ -192,7 +193,7 @@ AX_APPEND_COMPILE_FLAGS([ \
-Wmissing-declarations \ -Wmissing-declarations \
-Wno-unused-parameter \ -Wno-unused-parameter \
-fmacro-prefix-map='$(top_srcdir)/'= \ -fmacro-prefix-map='$(top_srcdir)/'= \
]) ],,[$ERROR_CFLAGS])
# Windows specific compiler options. # Windows specific compiler options.
AS_IF([test "$platform" = "windows"], [ AS_IF([test "$platform" = "windows"], [