summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2016-09-19 03:10:04 +0200
committerGravatar Nikias Bassen2016-09-19 03:10:04 +0200
commit8d34de3078469aba636846a15bad08198f66fdc8 (patch)
treedb97f8ccb45f35f28348b7e2bffc070b87297089 /configure.ac
parent912cb45928f03355ca162a2f1286ca49eb58155c (diff)
downloadlibplist-8d34de3078469aba636846a15bad08198f66fdc8.tar.gz
libplist-8d34de3078469aba636846a15bad08198f66fdc8.tar.bz2
Use time64 implementation by Michael G Schwern to extend allowed date/time range
The main benefit of this is to allow date/time values outside of the 32bit time_t range which is very important on 32bit platforms. But there are also some other issues that will be fixed with this, for example on macOS, mktime() will not work for dates < 1902 despite time_t being 64bit. In the same run this commit will also use a reentrant version of gmtime64_r that should help in multithreaded scenarios. Original code taken from: https://github.com/evalEmpire/y2038
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac28
1 files changed, 27 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 8394997..5f99d95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,7 +56,7 @@ AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
# Checks for library functions.
-AC_CHECK_FUNCS([asprintf strcasecmp strdup strerror strndup stpcpy vasprintf])
+AC_CHECK_FUNCS([asprintf strcasecmp strdup strerror strndup stpcpy vasprintf gmtime_r localtime_r timegm])
# Checking endianness
AC_C_BIGENDIAN([AC_DEFINE([__BIG_ENDIAN__], [1], [big endian])],
@@ -78,6 +78,32 @@ case ${host_os} in
esac
AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
+# Check if struct tm has a tm_gmtoff member
+AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
+ AC_TRY_COMPILE([
+ #include <time.h>
+ ], [
+ struct tm tm;
+ tm.tm_gmtoff = 1;
+ ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
+
+if (test "$ac_cv_struct_tm_gmtoff" = "yes"); then
+ AC_DEFINE(HAVE_TM_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff member])
+fi
+
+# Check if struct tm has a tm_zone member
+AC_CACHE_CHECK(for tm_zone in struct tm, ac_cv_struct_tm_zone,
+ AC_TRY_COMPILE([
+ #include <time.h>
+ ], [
+ struct tm tm;
+ tm.tm_zone = 1;
+ ], ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no))
+
+if (test "$ac_cv_struct_tm_zone" = "yes"); then
+ AC_DEFINE(HAVE_TM_TM_ZONE, 1, [Define if struct tm has a tm_zone member])
+fi
+
# Cython Python Bindings
AC_ARG_WITH([cython],
[AS_HELP_STRING([--without-cython],