Add autoconf test for localtime_r

This commit is contained in:
Jay Berkenbilt 2021-02-11 06:20:31 -05:00
parent 2538d84413
commit df067c9ab6
5 changed files with 15 additions and 21 deletions

View File

@ -1,6 +1,6 @@
715dae6d625977752bf7ddf7e386a2dc6ada04b8e56c6f0e7a3f7dcc9bad3209 configure.ac
cabe87703520d63bbb0ea3e069c3488fd8b43667ae29c2ee5bffffaf20321002 configure.ac
d3f9ee6f6f0846888d9a10fd3dad2e4b1258be84205426cf04d7cef02d61dad7 aclocal.m4
d12e9b7b928e7b2b9d4ffbc2af170392421376e60e40d07bdeee6a7252be8f6e libqpdf/qpdf/qpdf-config.h.in
3ed561073f0d5c9899e2120e006a7da5ec6bffb80268da1b962cd4f893b89982 libqpdf/qpdf/qpdf-config.h.in
5297971a0ef90bcd5563eb3f7127a032bb76d3ae2af7258bf13479caf8983a60 m4/ax_cxx_compile_stdcxx.m4
35bc5c645dc42d47f2daeea06f8f3e767c8a1aee6a35eb2b4854fd2ce66c3413 m4/ax_random_device.m4
1451e63710701b5f00a668f3a79b435015ef2e63547f0ad0ce8c8c062d53b599 m4/libtool.m4

21
configure vendored
View File

@ -17474,24 +17474,13 @@ $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
fi
for ac_func in fseeko64
for ac_func in fseeko64 random localtime_r
do :
ac_fn_c_check_func "$LINENO" "fseeko64" "ac_cv_func_fseeko64"
if test "x$ac_cv_func_fseeko64" = xyes; then :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_FSEEKO64 1
_ACEOF
fi
done
for ac_func in random
do :
ac_fn_c_check_func "$LINENO" "random" "ac_cv_func_random"
if test "x$ac_cv_func_random" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_RANDOM 1
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi

View File

@ -310,9 +310,7 @@ AC_ARG_WITH(large-file-test-path,
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
AC_CHECK_FUNCS([fseeko64])
AC_CHECK_FUNCS(random)
AC_CHECK_FUNCS([fseeko64 random localtime_r])
# Check if LD supports linker scripts, and define conditional
# HAVE_LD_VERSION_SCRIPT if so. This functionality is currently

View File

@ -844,7 +844,11 @@ QUtil::get_current_qpdf_time()
struct tm ltime;
time_t now = time(0);
tzset();
#ifdef HAVE_LOCALTIME_R
localtime_r(&now, &ltime);
#else
ltime = *localtime(&now);
#endif
return QPDFTime(static_cast<int>(ltime.tm_year + 1900),
static_cast<int>(ltime.tm_mon + 1),
static_cast<int>(ltime.tm_mday),

View File

@ -21,6 +21,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H