1From a15958a37a06f71c42c690278f9c958b93b7ee20 Mon Sep 17 00:00:00 2001 2From: Yann Ylavic <ylavic@apache.org> 3Date: Thu, 11 Mar 2021 14:10:21 +0000 4Subject: [PATCH] Merge r1887279 from trunk: 5 6build/apr_common.m4: avoid explicit inclusion of "confdefs.h" 7 8The failure is observed on `autoconf-2.69d` (soon to be released 9as `autoconf-2.70`). There `int64_t` detection fails as: 10 11$ autoreconf && ./configure 12checking whether int64_t and int use fmt %d... no 13checking whether int64_t and long use fmt %ld... no 14checking whether int64_t and long long use fmt %lld... no 15configure: error: could not determine the string function for int64_t 16``` 17 18This happens because `./configure` always stumbles on warning: 19 20configure:3350: gcc -c -g -O2 -Werror conftest.c >&5 21In file included from conftest.c:31: 22confdefs.h:22: error: "__STDC_WANT_IEC_60559_ATTRIBS_EXT__" redefined [-Werror] 23 22 | #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 24 | 25 26It's triggered by double inclusion of `"confdefs.h"` contents: 27explicitly in `APR_TRY_COMPILE_NO_WARNING` macro and implicitly 28via `AC_LANG_SOURCE` use. 29 30To fix it and avoid having to define `main()` declaration the change 31uses `AC_LANG_PROGRAM` instead. 32 33Tested on both `autoconf-2.69` and `autoconf-2.69d`. 34 35 36Github: closes #25 37Submitted by: Sergei Trofimovich <slyfox gentoo.org> 38Reviewed by: ylavic 39 40 41git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1887485 13f79535-47bb-0310-9956-ffa450edef68 42 43[Retrieved from: 44https://github.com/apache/apr/commit/0a763c5e500f4304b7c534fae0fad430d64982e8] 45Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 46--- 47 build/apr_common.m4 | 8 ++------ 48 1 file changed, 2 insertions(+), 6 deletions(-) 49 50diff --git a/build/apr_common.m4 b/build/apr_common.m4 51index 297dd32cf75..b67a8608abe 100644 52--- a/build/apr_common.m4 53+++ b/build/apr_common.m4 54@@ -467,13 +467,9 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING], 55 CFLAGS="$CFLAGS -Werror" 56 fi 57 AC_COMPILE_IFELSE( 58- [AC_LANG_SOURCE( 59- [#include "confdefs.h" 60- ] 61- [[$1]] 62- [int main(int argc, const char *const *argv) {] 63+ [AC_LANG_PROGRAM( 64+ [[$1]], 65 [[$2]] 66- [ return 0; }] 67 )], [CFLAGS=$apr_save_CFLAGS 68 $3], [CFLAGS=$apr_save_CFLAGS 69 $4]) 70