[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AC_STRUCT_TIMEZONE tzname on mingw
From: |
Kevin Ryde |
Subject: |
AC_STRUCT_TIMEZONE tzname on mingw |
Date: |
Thu, 25 Mar 2004 08:51:20 +1000 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux) |
* lib/autoconf/types.m4 (AC_STRUCT_TIMEZONE): Test for tzname with
AC_CHECK_DECL before giving own declaration in test program. Fixes
detection of tzname on mingw. On mingw an explicit "extern char
*tzname[];" overrides import directives in <time.h>, making the test
fail to link and (wrongly) imply tzname doesn't exist.
This is a bit of a case of autoconf not following its own advice about
giving explicit "extern" declarations. :-)
I've only actually tried this with recent debian packaged mingw cross
tools, so maybe someone with an actual mingw can confirm.
The sort of thing the test program uses,
#include <time.h>
extern char *tzname[];
int
main (void)
{
atoi (*tzname);
return 0;
}
gets errors
Info: resolving _tzname by linking to __imp__tzname (auto-import)
fu000001.o(.idata$3+0xc): undefined reference to `libmoldname_a_iname'
nmth000000.o(.idata$4+0x0): undefined reference to `_nm__tzname'
whereas the following links successfully
#include <time.h>
int
main (void)
{
atoi (*tzname);
return 0;
}
(both just as "i586-mingw32msvc-gcc foo.c").
--- types.m4.~1.26.~ 2004-03-25 08:44:51.000000000 +1000
+++ types.m4 2004-03-25 08:44:59.000000000 +1000
@@ -614,10 +614,14 @@
[Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
`HAVE_STRUCT_TM_TM_ZONE' instead.])
else
+ # On SGI, apparently tzname is a #define, but that's ok, AC_CHECK_DECL will
+ # consider it declared and we won't give our own extern.
+ AC_CHECK_DECL(tzname, ac_tzname_decl_test=1, ac_tzname_decl_test=0,
+ [#include <time.h>])
AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
[AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <time.h>
-#ifndef tzname /* For SGI. */
+#if ! $ac_tzname_decl_test
extern char *tzname[]; /* RS6000 and others reject char **tzname. */
#endif
]],
- AC_STRUCT_TIMEZONE tzname on mingw,
Kevin Ryde <=