configure: fix -pedantic-errors for GCC 5 and later

If --enable-werror is used.

Follow-up to d5c0351055 which added it too early in the configure
script before $compiler_num was set correctly and thus this option was
never used.

Reported-by: Stepan Efremov
Fixes #5067
Closes #5068
This commit is contained in:
Daniel Stenberg 2020-03-10 13:55:44 +01:00
parent f0f3952f55
commit 77b62fe6e1
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 13 additions and 13 deletions

View File

@ -59,19 +59,6 @@ XC_CHECK_PATH_SEPARATOR
CONFIGURE_OPTIONS="\"$ac_configure_args\"" CONFIGURE_OPTIONS="\"$ac_configure_args\""
AC_SUBST(CONFIGURE_OPTIONS) AC_SUBST(CONFIGURE_OPTIONS)
CURL_CFLAG_EXTRAS=""
if test X"$want_werror" = Xyes; then
CURL_CFLAG_EXTRAS="-Werror"
if test "$compiler_id" = "GNU_C"; then
dnl enable -pedantic-errors for GCC 5 and later,
dnl as before that it was the same as -Werror=pedantic
if test "$compiler_num" -ge "500"; then
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
fi
fi
fi
AC_SUBST(CURL_CFLAG_EXTRAS)
dnl SED is mandatory for configure process and libtool. dnl SED is mandatory for configure process and libtool.
dnl Set it now, allowing it to be changed later. dnl Set it now, allowing it to be changed later.
if test -z "$SED"; then if test -z "$SED"; then
@ -286,6 +273,19 @@ if test "$compiler_id" = "INTEL_UNIX_C"; then
# #
fi fi
CURL_CFLAG_EXTRAS=""
if test X"$want_werror" = Xyes; then
CURL_CFLAG_EXTRAS="-Werror"
if test "$compiler_id" = "GNU_C"; then
dnl enable -pedantic-errors for GCC 5 and later,
dnl as before that it was the same as -Werror=pedantic
if test "$compiler_num" -ge "500"; then
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
fi
fi
fi
AC_SUBST(CURL_CFLAG_EXTRAS)
CURL_CHECK_COMPILER_HALT_ON_ERROR CURL_CHECK_COMPILER_HALT_ON_ERROR
CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH