conftools: Fix regression with detection of -Wstrict-prototypes

The issue was that the code generated by AC_LANG_PROGRAM
produces warnings, and hence -Werror makes detection fail:

$ gcc -x c -Werror -Wstrict-prototypes - <<<'int main() {}'; echo $?
<stdin>:1:5: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
cc1: all warnings being treated as errors
1
This commit is contained in:
Sebastian Pipping 2020-03-17 19:45:13 +01:00
parent 21381bf35e
commit 8829f5c3fd

View file

@ -9,7 +9,7 @@
# DESCRIPTION
#
# Check whether the given FLAG plus -Werror works with the current
# language's compiler or gives an error.
# language's compiler — C or C++ — or gives an error.
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
@ -56,7 +56,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 5
#serial 6
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
@ -64,7 +64,9 @@ AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 -Werror $1"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
AC_COMPILE_IFELSE([m4_default([$5],
[AC_LANG_SOURCE(
[[int main(void) { return 0; }]])])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])