PKG_NAME:=apr
PKG_VERSION:=1.7.0
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@APACHE/apr/
--- /dev/null
+From 374210c50ee9f4dbf265f0172dcf2d45b97d0550
+From: Graham Leggett <minfrin@apache.org>
+Date: Thu, 26 Dec 2019 01:18:53 +0000
+Subject: [PATCH] Use AC_CHECK_SIZEOF, so as to support cross compiling. PR
+ 56053.
+
+git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1871980 13f79535-47bb-0310-9956-ffa450edef68
+---
+ build/apr_common.m4 | 37 -------------------------------------
+ configure.in | 14 +++++++-------
+ 2 files changed, 7 insertions(+), 44 deletions(-)
+
+--- a/build/apr_common.m4
++++ b/build/apr_common.m4
+@@ -452,43 +452,6 @@ fi
+
+
+ dnl
+-dnl APR_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE])
+-dnl
+-dnl A variant of AC_CHECK_SIZEOF which allows the checking of
+-dnl sizes of non-builtin types
+-dnl
+-AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED],
+-[changequote(<<, >>)dnl
+-dnl The name to #define.
+-define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl
+-dnl The cache variable name.
+-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl
+-changequote([, ])dnl
+-AC_MSG_CHECKING(size of $2)
+-AC_CACHE_VAL(AC_CV_NAME,
+-[AC_TRY_RUN([#include <stdio.h>
+-$1
+-#ifdef WIN32
+-#define binmode "b"
+-#else
+-#define binmode
+-#endif
+-main()
+-{
+- FILE *f=fopen("conftestval", "w" binmode);
+- if (!f) exit(1);
+- fprintf(f, "%d\n", sizeof($2));
+- exit(0);
+-}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,,
+-AC_CV_NAME=$3))])dnl
+-AC_MSG_RESULT($AC_CV_NAME)
+-AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2)
+-undefine([AC_TYPE_NAME])dnl
+-undefine([AC_CV_NAME])dnl
+-])
+-
+-
+-dnl
+ dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY,
+ dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS])
+ dnl
+--- a/configure.in
++++ b/configure.in
+@@ -1798,7 +1798,7 @@ else
+ socklen_t_value="int"
+ fi
+
+-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], pid_t, 8)
++AC_CHECK_SIZEOF(pid_t)
+
+ if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then
+ pid_t_fmt='#define APR_PID_T_FMT "hd"'
+@@ -1870,7 +1870,7 @@ APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, u
+ APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned int, u, [size_t_fmt="u"])
+ ])
+
+-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
++AC_CHECK_SIZEOF(ssize_t)
+
+ dnl the else cases below should no longer occur;
+ AC_MSG_CHECKING([which format to use for apr_ssize_t])
+@@ -1888,7 +1888,7 @@ fi
+
+ ssize_t_fmt="#define APR_SSIZE_T_FMT \"$ssize_t_fmt\""
+
+-APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
++AC_CHECK_SIZEOF(size_t)
+
+ # else cases below should no longer occur;
+ AC_MSG_CHECKING([which format to use for apr_size_t])
+@@ -1906,7 +1906,7 @@ fi
+
+ size_t_fmt="#define APR_SIZE_T_FMT \"$size_t_fmt\""
+
+-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
++AC_CHECK_SIZEOF(off_t)
+
+ if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
+ # Enable LFS
+@@ -2000,7 +2000,7 @@ case $host in
+ ;;
+ *)
+ ino_t_value=ino_t
+- APR_CHECK_SIZEOF_EXTENDED(AC_INCLUDES_DEFAULT, ino_t, $ac_cv_sizeof_long)
++ AC_CHECK_SIZEOF(ino_t)
+ if test $ac_cv_sizeof_ino_t = 4; then
+ if test $ac_cv_sizeof_long = 4; then
+ ino_t_value="unsigned long"
+@@ -2020,8 +2020,8 @@ else
+ bigendian=0
+ fi
+
+-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>
+-#include <sys/uio.h>],struct iovec,0)
++AC_CHECK_SIZEOF(struct iovec,,[AC_INCLUDES_DEFAULT
++#include <sys/uio.h>])
+ if test "$ac_cv_sizeof_struct_iovec" = "0"; then
+ have_iovec=0
+ else
--- /dev/null
+From 5fd2568c34a8d5c8159d9a5e0f5601f9e8902166
+From: Graham Leggett <minfrin@apache.org>
+Date: Tue, 10 Mar 2020 22:38:59 +0000
+Subject: [PATCH] APR's configure script uses AC_TRY_RUN to detect whether the
+ return type of strerror_r is int. When cross-compiling this defaults to no.
+
+This commit adds an AC_CACHE_CHECK so users who cross-compile APR may
+influence the outcome with a configure variable.
+
+
+git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1875065 13f79535-47bb-0310-9956-ffa450edef68
+---
+ CHANGES | 7 +++++++ (OPENWRT REMOVED)
+ build/apr_common.m4 | 11 ++++-------
+ 2 files changed, 11 insertions(+), 7 deletions(-)
+
+--- a/build/apr_common.m4
++++ b/build/apr_common.m4
+@@ -489,8 +489,9 @@ dnl string.
+ dnl
+ dnl
+ AC_DEFUN([APR_CHECK_STRERROR_R_RC], [
+-AC_MSG_CHECKING(for type of return code from strerror_r)
+-AC_TRY_RUN([
++AC_CACHE_CHECK([whether return code from strerror_r has type int],
++[ac_cv_strerror_r_rc_int],
++[AC_TRY_RUN([
+ #include <errno.h>
+ #include <string.h>
+ #include <stdio.h>
+@@ -506,14 +507,10 @@ main()
+ }], [
+ ac_cv_strerror_r_rc_int=yes ], [
+ ac_cv_strerror_r_rc_int=no ], [
+- ac_cv_strerror_r_rc_int=no ] )
++ ac_cv_strerror_r_rc_int=no ] ) ] )
+ if test "x$ac_cv_strerror_r_rc_int" = xyes; then
+ AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
+- msg="int"
+-else
+- msg="pointer"
+ fi
+-AC_MSG_RESULT([$msg])
+ ] )
+
+ dnl
--- /dev/null
+From 9d9c6990afaa7ad8eea0be524481bb48a5dd1b09
+From: Jim Jagielski <jim@apache.org>
+Date: Thu, 29 Oct 2020 20:16:55 +0000
+Subject: [PATCH] calls to exit() require stdlib.h or else we get
+ -Werror,-Wimplicit-function-declaration
+
+git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1882979 13f79535-47bb-0310-9956-ffa450edef68
+---
+ build/apr_common.m4 | 3 +++
+ build/apr_network.m4 | 15 +++++++++++++++
+ configure.in | 6 +++++-
+ 3 files changed, 23 insertions(+), 1 deletion(-)
+
+--- a/build/apr_common.m4
++++ b/build/apr_common.m4
+@@ -495,6 +495,9 @@ AC_CACHE_CHECK([whether return code from
+ #include <errno.h>
+ #include <string.h>
+ #include <stdio.h>
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
+ main()
+ {
+ char buf[1024];
+--- a/build/apr_network.m4
++++ b/build/apr_network.m4
+@@ -63,6 +63,9 @@ AC_DEFUN([APR_CHECK_WORKING_GETADDRINFO]
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
+
+ int main(void) {
+ struct addrinfo hints, *ai;
+@@ -151,6 +154,9 @@ AC_DEFUN([APR_CHECK_WORKING_GETNAMEINFO]
+ #ifdef HAVE_NETINET_IN_H
+ #include <netinet/in.h>
+ #endif
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
+
+ int main(void) {
+ struct sockaddr_in sa;
+@@ -194,6 +200,9 @@ AC_DEFUN([APR_CHECK_NEGATIVE_EAI], [
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
+
+ int main(void) {
+ if (EAI_ADDRFAMILY < 0) {
+@@ -403,6 +412,9 @@ AC_DEFUN([APR_CHECK_TCP_NODELAY_INHERITE
+ #ifndef HAVE_SOCKLEN_T
+ typedef int socklen_t;
+ #endif
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
+ int main(void) {
+ int listen_s, connected_s, client_s;
+ int listen_port, rc;
+@@ -588,6 +600,9 @@ typedef int socklen_t;
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
+ int main(void) {
+ int listen_s, connected_s, client_s;
+ int listen_port, rc;
+--- a/configure.in
++++ b/configure.in
+@@ -2208,6 +2208,7 @@ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
++#include <stdlib.h>
+ main()
+ {
+ struct rlimit limit;
+@@ -2307,6 +2308,7 @@ if test "$threads" = "1"; then
+ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <pthread.h>
++#include <stdlib.h>
+ int main()
+ {
+ pthread_mutex_t mutex;
+@@ -2430,7 +2432,9 @@ AC_TRY_RUN([
+ #endif
+ #include <fcntl.h>
+ #include <errno.h>
+-
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
+ int fd;
+ struct flock proc_mutex_lock_it = {0};
+ const char *fname = "conftest.fcntl";
--- /dev/null
+From 0a763c5e500f4304b7c534fae0fad430d64982e8
+From: Yann Ylavic <ylavic@apache.org>
+Date: Sat, 6 Mar 2021 22:20:59 +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`.
+
+
+Github: closes #25
+Submitted by: Sergei Trofimovich <slyfox gentoo.org>
+Reviewed by: ylavic
+
+
+git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887279 13f79535-47bb-0310-9956-ffa450edef68
+---
+ build/apr_common.m4 | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+--- a/build/apr_common.m4
++++ b/build/apr_common.m4
+@@ -467,13 +467,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])
--- /dev/null
+From ea9344182b7559b12aa523548bb6d37d0e009028
+From: Yann Ylavic <ylavic@apache.org>
+Date: Wed, 24 Mar 2021 15:02:52 +0000
+Subject: [PATCH] Follow up to r1887279: fix new APR_TRY_COMPILE_NO_WARNING.
+
+AC_LANG_PROGRAM generates an "int main()" prototype which some compilers warn
+about. Restore AC_LANG_SOURCE to manually set the correct main() but do not
+#include "confdefs.h" if it is inlined already by AC_LANG_SOURCE (i.e.
+check whether PACKAGE_NAME is already defined).
+
+Github: closes #25
+
+
+git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1888017 13f79535-47bb-0310-9956-ffa450edef68
+---
+ build/apr_common.m4 | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+--- a/build/apr_common.m4
++++ b/build/apr_common.m4
+@@ -467,9 +467,16 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ AC_COMPILE_IFELSE(
+- [AC_LANG_PROGRAM(
+- [[$1]],
++ [AC_LANG_SOURCE(
++ [
++#ifndef PACKAGE_NAME
++#include "confdefs.h"
++#endif
++ ]
++ [[$1]]
++ [int main(int argc, const char *const *argv) {]
+ [[$2]]
++ [ return 0; }]
+ )], [CFLAGS=$apr_save_CFLAGS
+ $3], [CFLAGS=$apr_save_CFLAGS
+ $4])
+++ /dev/null
-From f4d6e45ed5d2ccffd1af4c2ccdf7099ba0dce137 Mon Sep 17 00:00:00 2001
-From: Dengke Du <dengke.du@windriver.com>
-Date: Wed, 14 Dec 2016 18:13:08 +0800
-Subject: [PATCH 6/7] apr: fix off_t size doesn't match in glibc when cross
- compiling
-
-In configure.in, it contains the following:
-
- APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
-
-the macro "APR_CHECK_SIZEOF_EXTENDED" was defined in build/apr_common.m4,
-it use the "AC_TRY_RUN" macro, this macro let the off_t to 8, when cross
-compiling enable.
-
-So it was hardcoded for cross compiling, we should detect it dynamic based on
-the sysroot's glibc. We change it to the following:
-
- AC_CHECK_SIZEOF(off_t)
-
-The same for the following hardcoded types for cross compiling:
-
- pid_t 8
- ssize_t 8
- size_t 8
- off_t 8
-
-Change the above correspondingly.
-
-Signed-off-by: Dengke Du <dengke.du@windriver.com>
-
-Upstream-Status: Pending
----
- configure.in | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
---- a/configure.in
-+++ b/configure.in
-@@ -1809,7 +1809,7 @@ else
- socklen_t_value="int"
- fi
-
--APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], pid_t, 8)
-+AC_CHECK_SIZEOF(pid_t)
-
- if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then
- pid_t_fmt='#define APR_PID_T_FMT "hd"'
-@@ -1881,7 +1881,7 @@ APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, u
- APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned int, u, [size_t_fmt="u"])
- ])
-
--APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
-+AC_CHECK_SIZEOF(ssize_t)
-
- dnl the else cases below should no longer occur;
- AC_MSG_CHECKING([which format to use for apr_ssize_t])
-@@ -1899,7 +1899,7 @@ fi
-
- ssize_t_fmt="#define APR_SSIZE_T_FMT \"$ssize_t_fmt\""
-
--APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
-+AC_CHECK_SIZEOF(size_t)
-
- # else cases below should no longer occur;
- AC_MSG_CHECKING([which format to use for apr_size_t])
-@@ -1917,7 +1917,7 @@ fi
-
- size_t_fmt="#define APR_SIZE_T_FMT \"$size_t_fmt\""
-
--APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
-+AC_CHECK_SIZEOF(off_t)
-
- if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
- # Enable LFS
+++ /dev/null
---- a/build/apr_common.m4
-+++ b/build/apr_common.m4
-@@ -526,8 +526,9 @@ dnl string.
- dnl
- dnl
- AC_DEFUN([APR_CHECK_STRERROR_R_RC], [
--AC_MSG_CHECKING(for type of return code from strerror_r)
--AC_TRY_RUN([
-+AC_CACHE_CHECK([whether return code from strerror_r has type int],
-+[ac_cv_strerror_r_rc_int],
-+[AC_TRY_RUN([
- #include <errno.h>
- #include <string.h>
- #include <stdio.h>
-@@ -543,14 +544,10 @@ main()
- }], [
- ac_cv_strerror_r_rc_int=yes ], [
- ac_cv_strerror_r_rc_int=no ], [
-- ac_cv_strerror_r_rc_int=no ] )
-+ ac_cv_strerror_r_rc_int=no ] ) ] )
- if test "x$ac_cv_strerror_r_rc_int" = xyes; then
- AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
-- msg="int"
--else
-- msg="pointer"
- fi
--AC_MSG_RESULT([$msg])
- ] )
-
- dnl