]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Check for localtime_s() only on Windows.
authorDavid Woodhouse <dwmw2@infradead.org>
Tue, 21 Apr 2020 15:54:46 +0000 (16:54 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Tue, 21 Apr 2020 15:54:46 +0000 (16:54 +0100)
Solaris has it too, but with the arguments reversed. Yay!

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
configure.ac

index cd95d25c2d339a0ff112e53f9f5439b32672d507..80aad9eb6b32318c451b3f60d1c5acfa2f52f658 100644 (file)
@@ -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 <time.h>],[[
-       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 <time.h>],[[
        struct tm tm;
@@ -218,6 +209,14 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>],[[
 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 <time.h>],[[
+       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