From 8829f5c3fd53f8c4cc057d77856dfd66aed6b354 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Tue, 17 Mar 2020 19:45:13 +0100 Subject: [PATCH] conftools: Fix regression with detection of -Wstrict-prototypes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 $? :1:5: error: function declaration isn’t a prototype [-Werror=strict-prototypes] cc1: all warnings being treated as errors 1 --- expat/conftools/ax-check-compile-flag.m4 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/expat/conftools/ax-check-compile-flag.m4 b/expat/conftools/ax-check-compile-flag.m4 index d9a0ef06..172e2965 100644 --- a/expat/conftools/ax-check-compile-flag.m4 +++ b/expat/conftools/ax-check-compile-flag.m4 @@ -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])