configure: fix check for valid compiler flags with Clang

By default Clang reports unknown compiler flags as warnings
thus the valid compiler flags check fails to work properly.
Clang needs to have -Werror passed.
This commit is contained in:
Brad Smith 2024-05-09 22:02:01 -04:00
parent dd49e975a0
commit 0da8ba2e8c

View File

@ -156,12 +156,12 @@ if test -n "${MAINTAINER_MODE_FALSE}"; then
fi
all_desired_work=false
AS_COMPILER_FLAG([$DESIRED_FLAGS], [all_desired_work=true])
AS_COMPILER_FLAG([-Werror $DESIRED_FLAGS], [all_desired_work=true])
if $all_desired_work ; then
CFLAGS="$CFLAGS $DESIRED_FLAGS"
else
for flag in $DESIRED_FLAGS; do
AS_COMPILER_FLAG([$flag], [CFLAGS="$CFLAGS $flag"])
AS_COMPILER_FLAG([-Werror $flag], [CFLAGS="$CFLAGS $flag"])
done
fi