Added detection of platforms which don't have external timezone and

daylight variables, and emulation of these variables.
oldstable
Phil Krylov 2005-05-24 11:52:46 +00:00 committed by Alexandre Julliard
parent 31f718b8bf
commit 6618b0355c
4 changed files with 163 additions and 0 deletions

123
configure vendored
View File

@ -19760,6 +19760,129 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for timezone variable" >&5
echo $ECHO_N "checking for timezone variable... $ECHO_C" >&6
if test "${ac_cv_have_timezone+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <time.h>
int
main ()
{
timezone;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_have_timezone="yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_have_timezone="no"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_have_timezone" >&5
echo "${ECHO_T}$ac_cv_have_timezone" >&6
if test "$ac_cv_have_timezone" = "yes"
then
cat >>confdefs.h <<\_ACEOF
#define HAVE_TIMEZONE 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for daylight variable" >&5
echo $ECHO_N "checking for daylight variable... $ECHO_C" >&6
if test "${ac_cv_have_daylight+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <time.h>
int
main ()
{
daylight;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_have_daylight="yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_have_daylight="no"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_have_daylight" >&5
echo "${ECHO_T}$ac_cv_have_daylight" >&6
if test "$ac_cv_have_daylight" = "yes"
then
cat >>confdefs.h <<\_ACEOF
#define HAVE_DAYLIGHT 1
_ACEOF
fi
case $host_cpu in
*i[3456789]86*) echo "$as_me:$LINENO: checking whether we need to define __i386__" >&5

View File

@ -1474,6 +1474,22 @@ AC_CHECK_MEMBERS([struct option.name],,,
dnl Check for stat.st_blocks
AC_CHECK_MEMBERS([struct stat.st_blocks])
dnl Check for the external timezone variables timezone and daylight
AC_CACHE_CHECK([for timezone variable], ac_cv_have_timezone,
AC_TRY_LINK([#include <time.h>],[timezone;],
ac_cv_have_timezone="yes", ac_cv_have_timezone="no"))
if test "$ac_cv_have_timezone" = "yes"
then
AC_DEFINE(HAVE_TIMEZONE, 1, [Define if you have the timezone variable])
fi
AC_CACHE_CHECK([for daylight variable], ac_cv_have_daylight,
AC_TRY_LINK([#include <time.h>],[daylight;],
ac_cv_have_daylight="yes", ac_cv_have_daylight="no"))
if test "$ac_cv_have_daylight" = "yes"
then
AC_DEFINE(HAVE_DAYLIGHT, 1, [Define if you have the daylight variable])
fi
dnl *** check for the need to define platform-specific symbols
case $host_cpu in

View File

@ -348,8 +348,26 @@ char **__p__tzname(void)
void MSVCRT__tzset(void)
{
tzset();
#if defined(HAVE_TIMEZONE) && defined(HAVE_DAYLIGHT)
MSVCRT___daylight = daylight;
MSVCRT___timezone = timezone;
#else
{
static const time_t seconds_in_year = (365 * 24 + 6) * 3600;
time_t t;
struct tm *tmp;
long zone_january, zone_july;
t = (time((time_t *)0) / seconds_in_year) * seconds_in_year;
tmp = localtime(&t);
zone_january = -tmp->tm_gmtoff;
t += seconds_in_year / 2;
tmp = localtime(&t);
zone_july = -tmp->tm_gmtoff;
MSVCRT___daylight = (zone_january != zone_july);
MSVCRT___timezone = max(zone_january, zone_july);
}
#endif
lstrcpynA(tzname_std, tzname[0], sizeof(tzname_std));
tzname_std[sizeof(tzname_std) - 1] = '\0';
lstrcpynA(tzname_dst, tzname[1], sizeof(tzname_dst));

View File

@ -71,6 +71,9 @@
/* Define to 1 if you have the <curses.h> header file. */
#undef HAVE_CURSES_H
/* Define if you have the daylight variable */
#undef HAVE_DAYLIGHT
/* Define to 1 if you have the <direct.h> header file. */
#undef HAVE_DIRECT_H
@ -740,6 +743,9 @@
/* Define to 1 if you have the `timegm' function. */
#undef HAVE_TIMEGM
/* Define if you have the timezone variable */
#undef HAVE_TIMEZONE
/* Define to 1 if you have the <ucontext.h> header file. */
#undef HAVE_UCONTEXT_H