From 4883e291377d6ae90b5be662e8a6b80f0e140576 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Thu, 22 Dec 2022 09:07:49 +0100
Subject: [PATCH] Port configure script to C99

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
---
 apr-util-configure-c99.patch | 39 ++++++++++++++++++++++++++++++++++++
 apr-util.spec                |  7 ++++++-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 apr-util-configure-c99.patch

diff --git a/apr-util-configure-c99.patch b/apr-util-configure-c99.patch
new file mode 100644
index 0000000..2c0f2cf
--- /dev/null
+++ b/apr-util-configure-c99.patch
@@ -0,0 +1,39 @@
+Avoid implicit ints for improved C99 compatibility.
+
+Submitted upstream: <https://bz.apache.org/bugzilla/show_bug.cgi?id=66396>
+
+diff --git a/build/apr_common.m4 b/build/apr_common.m4
+index 6b5c0f033b9e2aca..26607b8479d9be78 100644
+--- a/build/apr_common.m4
++++ b/build/apr_common.m4
+@@ -473,7 +473,7 @@ $1
+ #else
+ #define binmode
+ #endif
+-main()
++int main(void)
+ {
+   FILE *f=fopen("conftestval", "w" binmode);
+   if (!f) exit(1);
+@@ -531,7 +531,7 @@ AC_TRY_RUN([
+ #include <errno.h>
+ #include <string.h>
+ #include <stdio.h>
+-main()
++int main(void)
+ {
+   char buf[1024];
+   if (strerror_r(ERANGE, buf, sizeof buf) < 1) {
+diff --git a/build/dbm.m4 b/build/dbm.m4
+index 57bd131fc3b74099..e8c51b5dc2c92b68 100644
+--- a/build/dbm.m4
++++ b/build/dbm.m4
+@@ -235,7 +235,7 @@ AC_DEFUN([APU_TRY_BERKELEY_DB],
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <$apu_try_berkeley_db_header>
+-main ()
++int main (void)
+ {
+   int major, minor, patch;
+ 
diff --git a/apr-util.spec b/apr-util.spec
index c10ae3d..69b7fb3 100644
--- a/apr-util.spec
+++ b/apr-util.spec
@@ -25,7 +25,7 @@
 Summary: Apache Portable Runtime Utility library
 Name: apr-util
 Version: 1.6.1
-Release: 22%{?dist}
+Release: 23%{?dist}
 License: ASL 2.0
 URL: https://apr.apache.org/
 Source0: https://www.apache.org/dist/apr/%{name}-%{version}.tar.bz2
@@ -33,6 +33,7 @@ Patch1: apr-util-1.2.7-pkgconf.patch
 Patch2: apr-util-1.6.1-r1894933.patch
 Patch4: apr-util-1.4.1-private.patch
 Patch5: apr-util-mariadb-upstream.patch
+Patch6: apr-util-configure-c99.patch
 BuildRequires: gcc
 BuildRequires: autoconf, apr-devel >= 1.3.0
 BuildRequires: %{dbdep}, expat-devel, libuuid-devel
@@ -137,6 +138,7 @@ This package provides the NSS crypto support for the apr-util.
 %patch2 -p1 -b .r1894933
 %patch4 -p1 -b .private
 %patch5 -p1 -b .maria
+%patch6 -p1
 
 : Configured for LDAP library: %{ldaplib}
 
@@ -234,6 +236,9 @@ export LD_LIBRARY_PATH=%{buildroot}/%{_libdir}/apr-util-%{apuver}
 %{_datadir}/aclocal/*.m4
 
 %changelog
+* Thu Dec 22 2022 Florian Weimer <fweimer@redhat.com> - 1.6.1-23
+- Port configure script to C99
+
 * Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.1-22
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild