void-packages/srcpkgs/libzen/files/proper-mt-fix.patch

42 lines
1.5 KiB
Diff

Upstream: yes
Fix checks for gmtime_r and localtime_r availability.
Also fix Http_Cookies where gmtime() was still being used.
diff --git a/Project/CMake/CMakeLists.txt b/Project/CMake/CMakeLists.txt
index 8e431b5..6a25aee 100644
--- a/Project/CMake/CMakeLists.txt
+++ b/Project/CMake/CMakeLists.txt
@@ -133,6 +133,16 @@ if((LONG_SIZE GREATER 4) AND (SIZE_T_SIZE EQUAL LONG_SIZE))
target_compile_definitions(zen PUBLIC SIZE_T_IS_LONG)
endif()
+include(CheckSymbolExists)
+check_symbol_exists(gmtime_r time.h HAVE_GMTIME_R)
+if(HAVE_GMTIME_R)
+ target_compile_definitions(zen PUBLIC HAVE_GMTIME_R)
+endif()
+check_symbol_exists(localtime_r time.h HAVE_LOCALTIME_R)
+if(HAVE_LOCALTIME_R)
+ target_compile_definitions(zen PUBLIC HAVE_LOCALTIME_R)
+endif()
+
target_include_directories(zen PUBLIC
$<BUILD_INTERFACE:${ZenLib_SOURCES_PATH}>
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>)
diff --git a/Project/GNU/Library/configure.ac b/Project/GNU/Library/configure.ac
index c0ff266..62a1bf5 100644
--- a/Project/GNU/Library/configure.ac
+++ b/Project/GNU/Library/configure.ac
@@ -268,6 +268,11 @@ dnl External libs
dnl
LDFLAGS="$LDFLAGS -lpthread -lstdc++"
+dnl -------------------------------------------------------------------------
+dnl Check if thread safe variants of time functions are available
+dnl
+AC_CHECK_FUNCS(gmtime_r localtime_r)
+
dnl #########################################################################
dnl ### Output
dnl #########################################################################