+dnl ------------------------------------------------------------------------
+dnl time/date functions
+dnl ------------------------------------------------------------------------
+
+if test "$wxUSE_TIMEDATE" = "yes"; then
+ 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_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 (POSIX), gettimeofday (SVr4, BSD 4.3) and ftime
+ dnl (V7, BSD 4.3)
+ AC_CHECK_FUNCS(localtime gettimeofday ftime, break)
+
+ 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
+ AC_DEFINE(WX_GMTOFF_IN_TM)
+ ],
+ wx_cv_struct_tm_has_gmtoff=no
+ )
+ ])
+ elif 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;
+ struct timezone tz;
+ gettimeofday(&tv, &tz);
+ ],
+ 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,
+ 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
+