From e6babc96d7ce2931429ae7b1522163d2f6baaaee Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 21 Apr 2020 16:54:46 +0100 Subject: [PATCH] Check for localtime_s() only on Windows. Solaris has it too, but with the arguments reversed. Yay! Signed-off-by: David Woodhouse --- configure.ac | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index cd95d25c..80aad9eb 100644 --- a/configure.ac +++ b/configure.ac @@ -197,15 +197,6 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([ ]) CFLAGS="$oldCFLAGS" -AC_MSG_CHECKING([For localtime_s]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ],[[ - struct tm tm; - time_t t = 0; - localtime_s(&tm, (time_t)0);]])], - [AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_LOCALTIME_S, 1, [Have localtime_s() function])], - [AC_MSG_RESULT([no])]) - AC_MSG_CHECKING([For localtime_r]) AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ],[[ struct tm tm; @@ -218,6 +209,14 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ],[[ if test "$have_win" = yes; then # Checking "properly" for __attribute__((dllimport,stdcall)) functions is non-trivial LIBS="$LIBS -lws2_32 -lshlwapi -lsecur32 -liphlpapi" + AC_MSG_CHECKING([For localtime_s]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ],[[ + struct tm tm; + time_t t = 0; + localtime_s(&tm, (time_t)0);]])], + [AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_LOCALTIME_S, 1, [Have localtime_s() function])], + [AC_MSG_RESULT([no])]) else AC_CHECK_FUNC(socket, [], AC_CHECK_LIB(socket, socket, [], AC_ERROR(Cannot find socket() function))) fi -- 2.50.1