hc
2024-11-01 a01b5c9f91adaee088a817861603a5dbe14775c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From 9d14fad412a497fe83cfc6ab594ddc612512f02a Mon Sep 17 00:00:00 2001
From: Matt Weber <matthew.weber@rockwellcollins.com>
Date: Thu, 4 Jun 2020 20:34:11 -0500
Subject: [PATCH] autoconf variable cache option for getcwd test
 
The cached variable allows cross compiled builds to successfully set the
desired default for this value without invoking a test.
 
Fixes:
https://issues.apache.org/jira/browse/SANTUARIO-549
 
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
---
 configure.ac | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
 
diff --git a/configure.ac b/configure.ac
index b43d7a5..c3d4489 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,14 +74,18 @@ AC_CHECK_FUNCS([strcasecmp])
 
 # Check whether getcwd can dynamically allocate memory.
 AC_MSG_CHECKING([whether getcwd(NULL, 0) works])
-AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdlib.h>
-     #include <unistd.h>],
-[char *cwd = getcwd(NULL, 0);
-return (cwd != NULL) ? EXIT_SUCCESS : EXIT_FAILURE;])],
-     [AC_MSG_RESULT(yes)
-      AC_DEFINE([XSEC_HAVE_GETCWD_DYN], [1],
-         [Define to 1 if getcwd(NULL, 0) works])],
-     [AC_MSG_RESULT(no)])
+AC_CACHE_VAL([xml_cv_func_getcwd_null],
+[AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
+     #include <unistd.h>
+     char *cwd = getcwd(NULL, 0);
+     return (cwd != NULL) ? EXIT_SUCCESS : EXIT_FAILURE;]])],
+  [xml_cv_func_getcwd_null=yes],
+  [xml_cv_func_getcwd_null=no])])
+AC_MSG_RESULT([$xml_cv_func_getcwd_null])
+if test $xml_cv_func_getcwd_null = yes; then
+AC_DEFINE([XSEC_HAVE_GETCWD_DYN], [1],
+  [Define to 1 if getcwd(NULL, 0) works])
+fi
 
 AC_LANG(C++)
 
-- 
2.17.1