From: Carlo Marcelo Arenas Belón Date: Mon, 11 Apr 2022 08:22:31 +0000 (+0100) Subject: Upstream patch: fix build for Hurd (#52) (closes: #1009066) X-Git-Tag: archive/raspbian/10.45-1+rpi1~1^2~34 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6ae6027b9fdc1682521ebb7d6d5e56b24189b56d;p=pcre2.git Upstream patch: fix build for Hurd (#52) (closes: #1009066) Since d5a61ee8 (Patch to detect (and ignore) symlink loops in pcre2grep., 2021-08-28), there is optional code that depends on readlink and PATH_MAX but that had only detection added for the first. GNU Hurd doesn't have the later so it fails to build. Improve the detection to include both dependencies in autotools and cmake to fix that. Signed-off-by: Carlo Marcelo Arenas Belón Signed-off-by: Matthew Vernon --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8010497..542fe0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,10 +142,16 @@ CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H) CHECK_SYMBOL_EXISTS(bcopy "strings.h" HAVE_BCOPY) CHECK_SYMBOL_EXISTS(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE) CHECK_SYMBOL_EXISTS(memmove "string.h" HAVE_MEMMOVE) -CHECK_SYMBOL_EXISTS(realpath "stdlib.h" HAVE_REALPATH) CHECK_SYMBOL_EXISTS(secure_getenv "stdlib.h" HAVE_SECURE_GETENV) CHECK_SYMBOL_EXISTS(strerror "string.h" HAVE_STRERROR) +CHECK_C_SOURCE_COMPILES( + "#include + #include + int main(int c, char *v[]) { char buf[PATH_MAX]; realpath(v[1], buf); return 0; }" + HAVE_REALPATH +) + set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") CHECK_C_SOURCE_COMPILES( diff --git a/configure.ac b/configure.ac index d3721c2..86bf3ca 100644 --- a/configure.ac +++ b/configure.ac @@ -512,7 +512,20 @@ AC_TYPE_SIZE_T # Checks for library functions. -AC_CHECK_FUNCS(bcopy memfd_create memmove mkostemp realpath secure_getenv strerror) +AC_CHECK_FUNCS(bcopy memfd_create memmove mkostemp secure_getenv strerror) +AC_MSG_CHECKING([for realpath]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#include +]],[[ +char buffer[PATH_MAX]; +realpath(".", buffer); +]])], +[AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_REALPATH], 1, + [Define to 1 if you have the `realpath' function.]) +], +AC_MSG_RESULT([no])) # Check for the availability of libz (aka zlib)