]> TLD Linux GIT Repositories - packages/apr.git/blob - apr-autoconf.patch
488c3c59321d6b5b4a5b0586d2d15bec7032469d
[packages/apr.git] / apr-autoconf.patch
1 From 5593f23e8e062da108ed585535e7281b87346ee1 Mon Sep 17 00:00:00 2001
2 From: Sergei Trofimovich <slyfox@gentoo.org>
3 Date: Wed, 25 Nov 2020 09:36:25 +0000
4 Subject: [PATCH] build/apr_common.m4: avoid explicit inclusion of
5  '"confdefs.h"'
6
7 The failure is observed on `autoconf-2.69d` (soon to be released
8 as `autoconf-2.70`). There `int64_t` detection fails as:
9
10 ```
11 $ autoreconf && ./configure
12 ...
13 checking whether int64_t and int use fmt %d... no
14 checking whether int64_t and long use fmt %ld... no
15 checking whether int64_t and long long use fmt %lld... no
16 configure: error: could not determine the string function for int64_t
17 ```
18
19 This happens because `./configure` always stumbles on warning:
20
21 ```
22 configure:3350: gcc -c -g -O2 -Werror  conftest.c >&5
23 In file included from conftest.c:31:
24 confdefs.h:22: error: "__STDC_WANT_IEC_60559_ATTRIBS_EXT__" redefined [-Werror]
25    22 | #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
26       |
27 ```
28
29 It's triggered by double inclusion of `"confdefs.h"` contents:
30 explicitly in `APR_TRY_COMPILE_NO_WARNING` macro and implicitly
31 via `AC_LANG_SOURCE` use.
32
33 To fix it and avoid having to define `main()` declaration the change
34 uses `AC_LANG_PROGRAM` instead.
35
36 Tested on both `autoconf-2.69` and `autoconf-2.69d`.
37
38 Bug: https://bugs.gentoo.org/738156
39 Bug: https://bugs.gentoo.org/750353
40 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
41 ---
42  build/apr_common.m4 | 8 ++------
43  1 file changed, 2 insertions(+), 6 deletions(-)
44
45 diff --git a/build/apr_common.m4 b/build/apr_common.m4
46 index f4e2dfd0a7..6f5782e674 100644
47 --- a/build/apr_common.m4
48 +++ b/build/apr_common.m4
49 @@ -504,13 +504,9 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
50     CFLAGS="$CFLAGS -Werror"
51   fi
52   AC_COMPILE_IFELSE(
53 -  [AC_LANG_SOURCE(
54 -   [#include "confdefs.h"
55 -   ]
56 -   [[$1]]
57 -   [int main(int argc, const char *const *argv) {]
58 +  [AC_LANG_PROGRAM(
59 +   [[$1]],
60     [[$2]]
61 -   [   return 0; }]
62    )], [CFLAGS=$apr_save_CFLAGS
63  $3],  [CFLAGS=$apr_save_CFLAGS
64  $4])