blob: d0a9bd9129ca61d501ff2555cb0c9302a221dc37 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From 8ca3c3306f1a149e51a3be6a4b1e47e9aee88262 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 23 Aug 2022 22:42:03 -0700
4Subject: [PATCH] add AC_CACHE_CHECK for strerror_r return type
5
6APR's configure script uses AC_TRY_RUN to detect whether the return type
7of strerror_r is int. When cross-compiling this defaults to no.
8
9This commit adds an AC_CACHE_CHECK so users who cross-compile APR may
10influence the outcome with a configure variable.
11
12Upstream-Status: Backport [https://svn.apache.org/viewvc?view=revision&revision=1875065]
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 build/apr_common.m4 | 11 ++++-------
16 1 file changed, 4 insertions(+), 7 deletions(-)
17
18diff --git a/build/apr_common.m4 b/build/apr_common.m4
19index cbf2a4c..42e75cf 100644
20--- a/build/apr_common.m4
21+++ b/build/apr_common.m4
22@@ -525,8 +525,9 @@ dnl string.
23 dnl
24 dnl
25 AC_DEFUN([APR_CHECK_STRERROR_R_RC], [
26-AC_MSG_CHECKING(for type of return code from strerror_r)
27-AC_TRY_RUN([
28+AC_CACHE_CHECK([whether return code from strerror_r has type int],
29+[ac_cv_strerror_r_rc_int],
30+[AC_TRY_RUN([
31 #include <errno.h>
32 #include <string.h>
33 #include <stdio.h>
34@@ -542,14 +543,10 @@ main()
35 }], [
36 ac_cv_strerror_r_rc_int=yes ], [
37 ac_cv_strerror_r_rc_int=no ], [
38- ac_cv_strerror_r_rc_int=no ] )
39+ ac_cv_strerror_r_rc_int=no ] ) ] )
40 if test "x$ac_cv_strerror_r_rc_int" = xyes; then
41 AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
42- msg="int"
43-else
44- msg="pointer"
45 fi
46-AC_MSG_RESULT([$msg])
47 ] )
48
49 dnl
50--
512.37.2
52