configure/genstamp: check for struct tm.tm_gmtoff
[citadel.git] / citadel / acinclude.m4
1 # CIT_STRUCT_TM
2 # ------------------
3 # Figure out how to get the current GMT offset.  If `struct tm' has a
4 # `tm_gmtoff' member, define `HAVE_STRUCT_TM_TM_GMTOFF'.  Otherwise, if the
5 # external variable `timezone' is found, define `HAVE_TIMEZONE'.
6 AC_DEFUN([CIT_STRUCT_TM],
7 [AC_REQUIRE([AC_STRUCT_TM])dnl
8 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <sys/types.h>
9 #include <$ac_cv_struct_tm>
10 ])
11 if test "$ac_cv_member_struct_tm_tm_gmtoff" != yes; then
12   AC_CACHE_CHECK(for timezone, ac_cv_var_timezone,
13 [AC_TRY_LINK(
14 [#include <time.h>],
15 [printf("%ld", (long)timezone);], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)])
16   if test $ac_cv_var_timezone = yes; then
17     AC_DEFINE(HAVE_TIMEZONE, 1,
18               [Define if you don't have `tm_gmtoff' but do have the external
19                variable `timezone'.])
20   fi
21 fi
22 ])# CIT_STRUCT_TM