build: Detect gmtime_* definitions via configure
This improves the portability of the codebase and fixes compilation with mingw-w64 7.0+. Co-authored-by: fanquake <fanquake@gmail.com> Zcash: We do not yet have FormatISO8601DateTime or FormatISO8601Date, so those parts of the backport are omitted. (cherry-picked from commit bitcoin/bitcoin@a46484c8b3)
This commit is contained in:
parent
e03b964abf
commit
66725e686c
17
configure.ac
17
configure.ac
|
@ -686,6 +686,22 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
|
|||
[ AC_MSG_RESULT(no)]
|
||||
)
|
||||
|
||||
dnl check for gmtime_r(), fallback to gmtime_s() if that is unavailable
|
||||
dnl fail if neither are available.
|
||||
AC_MSG_CHECKING(for gmtime_r)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ctime>]],
|
||||
[[ gmtime_r((const time_t *) nullptr, (struct tm *) nullptr); ]])],
|
||||
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_GMTIME_R, 1, [Define this symbol if gmtime_r is available]) ],
|
||||
[ AC_MSG_RESULT(no);
|
||||
AC_MSG_CHECKING(for gmtime_s);
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ctime>]],
|
||||
[[ gmtime_s((struct tm *) nullptr, (const time_t *) nullptr); ]])],
|
||||
[ AC_MSG_RESULT(yes)],
|
||||
[ AC_MSG_RESULT(no); AC_MSG_ERROR(Both gmtime_r and gmtime_s are unavailable) ]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for visibility attribute])
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
||||
int foo_def( void ) __attribute__((visibility("default")));
|
||||
|
@ -1008,6 +1024,7 @@ AC_SUBST(LEVELDB_TARGET_FLAGS)
|
|||
AC_SUBST(EVENT_LIBS)
|
||||
AC_SUBST(EVENT_PTHREADS_LIBS)
|
||||
AC_SUBST(ZMQ_LIBS)
|
||||
AC_SUBST(HAVE_GMTIME_R)
|
||||
AC_SUBST(LIBZCASH_LIBS)
|
||||
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile src/test/buildenv.py])
|
||||
AC_CONFIG_FILES([qa/pull-tester/tests_config.ini],[chmod +x qa/pull-tester/tests_config.ini])
|
||||
|
|
Loading…
Reference in New Issue