HAVE_TIMEZONE and cygwin

Billinghurst, David (CRTS) David.Billinghurst@riotinto.com
Wed May 1 22:29:00 GMT 2002

Here is an untested patch for configure.in (trunk).  I have autoconf version
problems, so this will have to do at present.  The code fragments do the right 

Compiling this fails
#include <time.h>
void i(){long z2 = 2*timezone;}

but this is OK
#include <time.h>
long z2 = _timezone;

2002-05-02  David Billinghurst <David.Billinghurst@riotinto.com>

	* configure.in: Adjust test for HAVE_TIMEZONE so it fails
	on cygwin.  Add test HAVE_UNDERSCORE_TIMEZONE.

Index: configure.in
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.129
diff -u -r1.129 configure.in
--- configure.in        21 Apr 2002 09:37:48 -0000      1.129
+++ configure.in        2 May 2002 05:19:36 -0000
@@ -852,10 +852,17 @@
    dnl FIXME: we don't want a link check here because that won't work
    dnl when cross-compiling.  So instead we make an assumption that
    dnl the header file will mention timezone if it exists.
-   AC_TRY_COMPILE([#include <time.h>], [long z2 = timezone;],
+   dnl Don't find the win32 function timezone
+   AC_TRY_COMPILE([#include <time.h>], [void i(){long z2 = 2*timezone;}],
-     [AC_MSG_RESULT(no)])])
+     [AC_MSG_RESULT(no)
+       AC_MSG_CHECKING([for global _timezone variable])
+       dnl FIXME: As above, don't want link check
+       AC_TRY_COMPILE([#include <time.h>], [long z2 = _timezone;],
+          AC_MSG_RESULT(yes)],
+          [AC_MSG_RESULT(no)])])])


-----Original Message-----
From: Billinghurst, David (CRTS) 
Sent: Thursday, 2 May 2002 2:18 
To: java@gcc.gnu.org
Subject: HAVE_TIMEZONE and cygwin

The cygwin patch for natSystem.cc
probably should read something like

   tzoffset = _timezone;
   // timezone is secs WEST of UTC.
   tzoffset = timezone;	
   // FIXME: there must be another global if neither
tm_gmtoff nor timezone
   // is available, esp. if tzname is valid.

To do this we need to add to libjava/configure.in 
a test something like

   AC_TRY_COMPILE([#include <time.h>], [long z2 = _timezone;],

and preferably get the existing test    

   AC_TRY_COMPILE([#include <time.h>], [long z2 = timezone;],

to fail for the cygwin <time.h> which has
  char *_EXFUN(timezone, (void));

More information about the Java mailing list