1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
dnl We need the threadsafe variants of localtime
AC_DEFUN([CHECK_THREADSAFE_LOCALTIME],
[
AC_CHECK_FUNCS(localtime_r, [], [
AC_MSG_CHECKING([for localtime_s])
dnl Checking for localtime_s is a bit more complex as it is a macro
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <time.h>
]], [[
time_t t;
struct tm m;
localtime_s(&m, &t);
return 0;
]])
], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_LOCALTIME_S], [1], [localtime_s can be used])
], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([No threadsafe variant of localtime found])
])
])
])
dnl We need the threadsafe variants of gmtime
AC_DEFUN([CHECK_THREADSAFE_GMTIME], [
AC_CHECK_FUNCS(gmtime_r, [], [
AC_MSG_CHECKING([for gmtime_s])
dnl Checking for gmtime_s is a bit more complex as it is a macro
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])
AC_MSG_ERROR([No threadsafe variant of gmtime found])
])
])
])
dnl We need an inverse for gmtime, either timegm or _mkgmtime
AC_DEFUN([CHECK_INVERSE_GMTIME], [
# We need an inverse for gmtime, either timegm or _mkgmtime
AC_CHECK_FUNCS(timegm, [], [
if ! echo "${host_os}" | grep 'cygwin\|mingw\|^msys$' > /dev/null 2>&1; then
AC_MSG_ERROR([No inverse function for gmtime was found])
fi
])
])
|