+dnl ---------------------------------------------------------------------------
+dnl time/date functions
+dnl ------------------------------------------------------------------------
+
+if test "$wxUSE_DATETIME" = "yes"; then
+ dnl check for strptime
+ AC_CHECK_FUNCS(strptime)
+
+ dnl check for timezone variable
+ AC_CACHE_CHECK(for timezone variable in <time.h>,
+ wx_cv_var_timezone,
+ [
+ AC_TRY_COMPILE(
+ [
+ #include <time.h>
+ ],
+ [
+ int tz;
+ tz = timezone;
+ ],
+ [
+ wx_cv_var_timezone=timezone
+ ],
+ [
+ AC_TRY_COMPILE(
+ [
+ #include <time.h>
+ ],
+ [
+ int tz;
+ tz = _timezone;
+ ],
+ [
+ wx_cv_var_timezone=_timezone
+ ],
+ [
+ AC_TRY_COMPILE(
+ [
+ #include <time.h>
+ ],
+ [
+ int tz;
+ tz = __timezone;
+ ],
+ [
+ wx_cv_var_timezone=__timezone
+ ],
+ AC_MSG_ERROR(no timezone variable)
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+
+ dnl as we want $wx_cv_var_timezone to be expanded, use AC_DEFINE_UNQUOTED
+ AC_DEFINE_UNQUOTED(WX_TIMEZONE, $wx_cv_var_timezone)
+
+ dnl check for localtime (it's POSIX, but the check can do no harm...)
+ AC_CHECK_FUNCS(localtime)
+
+ if test "$ac_cv_func_localtime" = "yes"; then
+ AC_CACHE_CHECK(for tm_gmtoff in struct tm,
+ wx_cv_struct_tm_has_gmtoff,
+ [
+ AC_TRY_COMPILE(
+ [
+ #include <time.h>
+ ],
+ [
+ struct tm tm;
+ tm.tm_gmtoff++;
+ ],
+ [
+ wx_cv_struct_tm_has_gmtoff=yes
+ ],
+ wx_cv_struct_tm_has_gmtoff=no
+ )
+ ])
+ fi
+
+ if test "$wx_cv_struct_tm_has_gmtoff" = "yes"; then
+ AC_DEFINE(WX_GMTOFF_IN_TM)
+ fi
+
+ dnl check for gettimeofday (SVr4, BSD 4.3) and ftime (V7, BSD 4.3) for the
+ dnl function to be used for high resolution timers
+ AC_CHECK_FUNCS(gettimeofday ftime, break)
+
+ if test "$ac_cv_func_gettimeofday" = "yes"; then
+ AC_CACHE_CHECK([whether gettimeofday takes two arguments],
+ wx_cv_func_gettimeofday_has_2_args,
+ [
+ dnl on some _really_ old systems it takes only 1 argument
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ AC_TRY_COMPILE(
+ [
+ #include <sys/time.h>
+ #include <unistd.h>
+ ],
+ [
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ ],
+ wx_cv_func_gettimeofday_has_2_args=yes,
+ AC_TRY_COMPILE(
+ [
+ #include <sys/time.h>
+ #include <unistd.h>
+ ],
+ [
+ struct timeval tv;
+ gettimeofday(&tv);
+ ],
+ wx_cv_func_gettimeofday_has_2_args=no,
+ [
+ AC_MSG_WARN([failed to determine number of gettimeofday() arguments])
+ wx_cv_func_gettimeofday_has_2_args=unknown
+ ]
+ )
+ )
+ AC_LANG_RESTORE
+ ])
+
+ if test "$wx_cv_func_gettimeofday_has_2_args" != "yes"; then
+ AC_DEFINE(WX_GETTIMEOFDAY_NO_TZ)
+ fi
+ fi
+
+ AC_DEFINE(wxUSE_TIMEDATE)
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS typetest"
+fi
+
+dnl ------------------------------------------------------------------------
+dnl wxSocket
+dnl ------------------------------------------------------------------------
+
+dnl under MSW we always have sockets
+if test "$TOOLKIT" != "MSW"; then
+
+if test "$wxUSE_SOCKETS" = "yes"; then
+ dnl under Solaris, socket functions live in -lsocket
+ AC_CHECK_FUNC(socket,,
+ AC_CHECK_LIB(socket, socket,
+ INET_LINK="$INET_LINK -lsocket",
+ [
+ AC_MSG_WARN([socket library not found - sockets will be disabled])
+ wxUSE_SOCKETS=no
+ ]
+ )
+ )
+fi
+
+dnl this test may be appropriate if building under cygwin
+dnl right now I'm assuming it also uses the winsock stuff
+dnl like mingw does.. -- RL
+
+if test "$wxUSE_SOCKETS" = "yes" ; then
+ dnl determine the type of third argument for getsockname
+ AC_CACHE_CHECK([what is the type of the third argument of getsockname],
+ wx_cv_type_getsockname3,
+ [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ AC_TRY_COMPILE(
+ [
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ ],
+ [
+ socklen_t len;
+ getsockname(0, 0, &len);
+ ],
+ wx_cv_type_getsockname3=socklen_t,
+ AC_TRY_COMPILE(
+ [
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ ],
+ [
+ size_t len;
+ getsockname(0, 0, &len);
+ ],
+ wx_cv_type_getsockname3=size_t,
+ AC_TRY_COMPILE(
+ [
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ ],
+ [
+ int len;
+ getsockname(0, 0, &len);
+ ],
+ wx_cv_type_getsockname3=int,
+ wx_cv_type_getsockname3=unknown
+ )
+ )
+ )
+
+ AC_LANG_RESTORE
+ ])
+
+ if test "$wx_cv_type_getsockname3" = "unknown"; then
+ wxUSE_SOCKETS=no
+ AC_MSG_WARN([Couldn't find socklen_t synonym for this system])
+ else
+ AC_DEFINE_UNQUOTED(SOCKLEN_T, $wx_cv_type_getsockname3)
+ fi