- fix build with newer autoconf and gcc
authorMarcin Krol <hawk@tld-linux.org>
Mon, 4 Apr 2022 17:16:37 +0000 (19:16 +0200)
committerMarcin Krol <hawk@tld-linux.org>
Mon, 4 Apr 2022 17:16:37 +0000 (19:16 +0200)
apr-autoconf.patch [new file with mode: 0644]
apr.spec

diff --git a/apr-autoconf.patch b/apr-autoconf.patch
new file mode 100644 (file)
index 0000000..488c3c5
--- /dev/null
@@ -0,0 +1,64 @@
+From 5593f23e8e062da108ed585535e7281b87346ee1 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Wed, 25 Nov 2020 09:36:25 +0000
+Subject: [PATCH] build/apr_common.m4: avoid explicit inclusion of
+ '"confdefs.h"'
+
+The failure is observed on `autoconf-2.69d` (soon to be released
+as `autoconf-2.70`). There `int64_t` detection fails as:
+
+```
+$ autoreconf && ./configure
+...
+checking whether int64_t and int use fmt %d... no
+checking whether int64_t and long use fmt %ld... no
+checking whether int64_t and long long use fmt %lld... no
+configure: error: could not determine the string function for int64_t
+```
+
+This happens because `./configure` always stumbles on warning:
+
+```
+configure:3350: gcc -c -g -O2 -Werror  conftest.c >&5
+In file included from conftest.c:31:
+confdefs.h:22: error: "__STDC_WANT_IEC_60559_ATTRIBS_EXT__" redefined [-Werror]
+   22 | #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
+      |
+```
+
+It's triggered by double inclusion of `"confdefs.h"` contents:
+explicitly in `APR_TRY_COMPILE_NO_WARNING` macro and implicitly
+via `AC_LANG_SOURCE` use.
+
+To fix it and avoid having to define `main()` declaration the change
+uses `AC_LANG_PROGRAM` instead.
+
+Tested on both `autoconf-2.69` and `autoconf-2.69d`.
+
+Bug: https://bugs.gentoo.org/738156
+Bug: https://bugs.gentoo.org/750353
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ build/apr_common.m4 | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/build/apr_common.m4 b/build/apr_common.m4
+index f4e2dfd0a7..6f5782e674 100644
+--- a/build/apr_common.m4
++++ b/build/apr_common.m4
+@@ -504,13 +504,9 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
+    CFLAGS="$CFLAGS -Werror"
+  fi
+  AC_COMPILE_IFELSE(
+-  [AC_LANG_SOURCE(
+-   [#include "confdefs.h"
+-   ]
+-   [[$1]]
+-   [int main(int argc, const char *const *argv) {]
++  [AC_LANG_PROGRAM(
++   [[$1]],
+    [[$2]]
+-   [   return 0; }]
+   )], [CFLAGS=$apr_save_CFLAGS
+ $3],  [CFLAGS=$apr_save_CFLAGS
+ $4])
index 8784328dbb0376946f9552fcdb37123e593b73bc..bb1806a1cc6134cee15151ab01db145864a9672c 100644 (file)
--- a/apr.spec
+++ b/apr.spec
@@ -6,7 +6,7 @@ Summary:        Apache Portable Runtime
 Summary(pl.UTF-8):     Apache Portable Runtime - przenoĊ›na biblioteka uruchomieniowa
 Name:          apr
 Version:       1.7.0
-Release:       2
+Release:       3
 Epoch:         1
 License:       Apache v2.0
 Group:         Libraries
@@ -16,13 +16,14 @@ Patch0:             %{name}-link.patch
 Patch1:                %{name}-libtool.patch
 # disable some things that require recent kernel
 Patch2:                %{name}-disable-features.patch
+Patch3:                %{name}-autoconf.patch
 URL:           http://apr.apache.org/
 BuildRequires: autoconf >= 2.59
 BuildRequires: automake
 BuildRequires: glibc-devel >= 6:2.9
 BuildRequires: libtool >= 2:2.2
 BuildRequires: libuuid-devel
-BuildRequires: python
+BuildRequires: python3
 BuildRequires: rpm >= 4.4.9-56
 BuildRequires: rpm-pythonprov
 BuildRequires: sed >= 4.0
@@ -66,7 +67,7 @@ Requires:     %{name} = %{epoch}:%{version}-%{release}
 Requires:      automake
 Requires:      libtool >= 2:2.2
 Requires:      libuuid-devel
-Requires:      python-modules
+Requires:      python3-modules
 
 %description devel
 Header files and development documentation for apr.
@@ -91,6 +92,7 @@ Statyczna biblioteka apr.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 cat >> config.layout <<'EOF'
 <Layout TLD>