summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorKleis Auke Wolthuizen <github@kleisauke.nl>2021-07-14 16:14:27 +0200
committerKleis Auke Wolthuizen <github@kleisauke.nl>2021-07-14 16:58:07 +0200
commit68ee2ffca663f2b705dc84614f37b179a81b826c (patch)
treefe60c0113f11d71ce8dff0175077a0b5d5ca63ec /configure.ac
parentbcd0f282e71de26e267ce61de27fb4d493cbda56 (diff)
downloadlcms2-68ee2ffca663f2b705dc84614f37b179a81b826c.tar.gz
Prefer to use gmtime_s instead
MinGW-w64 defines _gmtime64_s on both i686 and x86_64 targets. Prefer to use the gmtime_s macro to avoid that _gmtime64_s is being called on Windows 32-bit, which will not work. This commit also generally ensures that a threadsafe alternative is provided for toolchains targeting Windows i686.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac17
1 files changed, 15 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index e3aae27..32b3979 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,8 +81,21 @@ AX_APPEND_COMPILE_FLAGS(["-fvisibility=hidden"])
# Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'.
AC_C_BIGENDIAN
-# Check for functions that some compilers lack (or name differently)
-AC_CHECK_FUNCS([gmtime_r _gmtime64_s])
+# Check for threadsafe variants of gmtime
+# Note: check for gmtime_s is a bit more complex as it is implemented as a macro
+AC_CHECK_FUNCS(gmtime_r, [], [
+ AC_MSG_CHECKING([for gmtime_s])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[#include <time.h>]], [[
+ time_t t;
+ struct tm m;
+ gmtime_s(&m, &t);
+ return 0;
+ ]])],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_GMTIME_S], [1], [gmtime_s can be used])],
+ [AC_MSG_RESULT([no])]
+ )])
# Point to JPEG installed in DIR or disable JPEG with --without-jpeg.
AC_ARG_WITH(jpeg,