From 88eef2d7fec7a3380f495d768c72d1292260ea18 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 20 Feb 2001 07:42:03 +0000 Subject: * configure.in: add check for negative time_t for gmtime(3). * time.c (time_new_internal): no positive check if gmtime(3) can handle negative time_t. * time.c (time_timeval): ditto. * bignum.c (rb_big2long): should not raise RangeError for Bignum LONG_MIN value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- configure.in | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 0c4f0ad94a..9d42330a2a 100644 --- a/configure.in +++ b/configure.in @@ -261,6 +261,42 @@ AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight, if test "$rb_cv_have_daylight" = yes; then AC_DEFINE(HAVE_DAYLIGHT) fi +AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t, + [AC_TRY_RUN([ +#include + +void +check(tm, y, m, d, h, s) + struct tm *tm; + int y, m, d, h, s; +{ + if (tm->tm_year != y || + tm->tm_mon != m-1 || + tm->tm_mday != d || + tm->tm_hour != h || + tm->tm_sec != s) { + exit(1); + } +} + +int +main() +{ + time_t t = -1; + struct tm *tm; + + check(gmtime(&t), 69, 12, 31, 23, 59); + t = -0x80000000; + check(gmtime(&t), 1, 12, 13, 20, 52); + return 0; +} +], + rb_cv_negative_time_t=yes, + rb_cv_negative_time_t=no, + rb_cv_negative_time_t=yes)]) +if test "$rb_cv_negative_time_t" = yes; then + AC_DEFINE(NEGATIVE_TIME_T) +fi if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then AC_DEFINE(POSIX_SIGNAL) -- cgit v1.2.3