https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119550

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I wonder if the problem is that newlib only defined tm.tm_zone conditionally:

struct tm
{
  int   tm_sec;
  int   tm_min;
  int   tm_hour;
  int   tm_mday;
  int   tm_mon;
  int   tm_year;
  int   tm_wday;
  int   tm_yday;
  int   tm_isdst;
#ifdef __TM_GMTOFF
  long  __TM_GMTOFF;
#endif
#ifdef __TM_ZONE
  const char *__TM_ZONE;
#endif
};

And the AC_STRUCT_TIMEZONE macro will first check to tm.tm_zone, which doesn't
need link tests, and if that's not found it will look for the global tzname,
which probably does require linking.

So depending on your newlib configuration, you might be missing tm_zone and
require a link test for tzname.

If necessary we can replace the use of AC_STRUCT_TIMEZONE with a custom check
that doesn't need to link. Libstdc++ doesn't care about tzname, only about
tm.tm_zone.

I thought it made sense to use the pre-existing autoconf macro, but it turns
out to be not very useful. It detects that BSD systems provide tm.tm_zone but
they're not actually compatible with the definition in Glibc, newlib, and
POSIX, because BSD uses a non-const char*.

Reply via email to