From: Nathan Bryant Date: Fri, 4 Jan 2002 20:43:26 +0000 (+0000) Subject: configure/genstamp: check for struct tm.tm_gmtoff X-Git-Tag: v7.86~6637 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=32691b8512463ead219f35773371e04acfde3b03 configure/genstamp: check for struct tm.tm_gmtoff --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index ef338a241..2b1d8bad6 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 590.34 2002/01/04 20:43:26 nbryant + configure/genstamp: check for struct tm.tm_gmtoff + Revision 590.33 2002/01/03 22:01:17 ajc * Fixed mail to "sysop" @@ -3061,3 +3064,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/Makefile.in b/citadel/Makefile.in index d80c7d447..e27d5475b 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -68,6 +68,7 @@ INSTALL=@INSTALL@ INSTALL_DATA=@INSTALL_DATA@ SHELL=/bin/sh AUTOCONF=@AUTOCONF@ +ACLOCAL=@ACLOCAL@ YACC=@YACC@ DATABASE=@DATABASE@ @@ -324,6 +325,9 @@ config.status: $(srcdir)/configure $(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4 cd $(srcdir) && $(AUTOCONF) +$(srcdir)/aclocal.m4: $(srcdir)/acinclude.m4 + cd $(srcdir) && $(ACLOCAL) + weekly: $(srcdir)/weekly.in config.status CONFIG_FILES=weekly CONFIG_HEADERS= $(SHELL) ./config.status diff --git a/citadel/acinclude.m4 b/citadel/acinclude.m4 new file mode 100644 index 000000000..ae541a64b --- /dev/null +++ b/citadel/acinclude.m4 @@ -0,0 +1,22 @@ +# CIT_STRUCT_TM +# ------------------ +# Figure out how to get the current GMT offset. If `struct tm' has a +# `tm_gmtoff' member, define `HAVE_STRUCT_TM_TM_GMTOFF'. Otherwise, if the +# external variable `timezone' is found, define `HAVE_TIMEZONE'. +AC_DEFUN([CIT_STRUCT_TM], +[AC_REQUIRE([AC_STRUCT_TM])dnl +AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include +#include <$ac_cv_struct_tm> +]) +if test "$ac_cv_member_struct_tm_tm_gmtoff" != yes; then + AC_CACHE_CHECK(for timezone, ac_cv_var_timezone, +[AC_TRY_LINK( +[#include ], +[printf("%ld", (long)timezone);], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)]) + if test $ac_cv_var_timezone = yes; then + AC_DEFINE(HAVE_TIMEZONE, 1, + [Define if you don't have `tm_gmtoff' but do have the external + variable `timezone'.]) + fi +fi +])# CIT_STRUCT_TM diff --git a/citadel/configure.ac b/citadel/configure.ac index 1f3cf24b0..df039663c 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -116,6 +116,7 @@ AC_PROG_INSTALL AC_PROG_YACC missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) dnl Checks for system services. @@ -366,7 +367,9 @@ AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME -AC_STRUCT_TM + +dnl defined in acinclude.m4: +CIT_STRUCT_TM dnl Check the size of various builtin types; see typesize.h (error) AC_CHECK_SIZEOF(char, 0) diff --git a/citadel/genstamp.c b/citadel/genstamp.c index 8915afa88..5048ca670 100644 --- a/citadel/genstamp.c +++ b/citadel/genstamp.c @@ -51,7 +51,11 @@ void datestring(char *buf, time_t xtime, int which_format) { t = localtime(&xtime); /* Convert "seconds west of GMT" to "hours/minutes offset" */ +#ifdef HAVE_STRUCT_TM_TM_GMTOFF offset = t->tm_gmtoff; +#else + offset = timezone; +#endif if (offset > 0) { offsign = '-'; }