kumquat-buildroot/package/xml-security-c/0001-autoconf-variable-cache-option-for-getcwd-test.patch

51 lines
1.6 KiB
Diff
Raw Normal View History

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