ruby-changes:2732
From: ko1@a...
Date: 14 Dec 2007 11:20:00 +0900
Subject: [ruby-changes:2732] nobu - Ruby:r14223 (ruby_1_8, trunk): * configure.in (RUBY_CHECK_VARTYPE): check if a variable is defined
nobu 2007-12-14 10:01:42 +0900 (Fri, 14 Dec 2007)
New Revision: 14223
Modified files:
branches/ruby_1_8/ChangeLog
branches/ruby_1_8/configure.in
branches/ruby_1_8/missing/strftime.c
branches/ruby_1_8/version.h
trunk/ChangeLog
trunk/configure.in
trunk/missing/strftime.c
Log:
* configure.in (RUBY_CHECK_VARTYPE): check if a variable is defined
and its type.
* configure.in (timezone, altzone): check for recent cygwin.
* missing/strftime.c (strftime): fix for timezone. [ruby-dev:32536]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/missing/strftime.c?r1=14223&r2=14222
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/configure.in?r1=14223&r2=14222
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=14223&r2=14222
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14223&r2=14222
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/missing/strftime.c?r1=14223&r2=14222
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=14223&r2=14222
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/configure.in?r1=14223&r2=14222
Index: configure.in
===================================================================
--- configure.in (revision 14222)
+++ configure.in (revision 14223)
@@ -608,7 +608,7 @@
dlopen sigprocmask sigaction _setjmp vsnprintf snprintf\
setsid telldir seekdir fchmod cosh sinh tanh log2 round\
setuid setgid daemon select_large_fdset setenv unsetenv\
- mktime timegm clock_gettime)
+ mktime timegm clock_gettime gettimeofday)
AC_ARG_ENABLE(setreuid,
[ --enable-setreuid use setreuid()/setregid() according to need even if obsolete.],
[use_setreuid=$enableval])
@@ -634,6 +634,30 @@
if test "$rb_cv_have_daylight" = yes; then
AC_DEFINE(HAVE_DAYLIGHT)
fi
+AC_DEFUN([RUBY_CHECK_VARTYPE], [dnl
+AC_CACHE_CHECK([for external $1], rb_cv_var_$1,
+ [rb_cv_var_$1=no
+ AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
+ $2
+ void *t;],
+ [t = &(&$1)[0];],
+ [for t in $3; do
+ AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
+ $2
+ extern $t $1;],
+ [void *t = &(&$1)[0];],
+ [rb_cv_var_$1=$t; break])
+ done])])
+if test "[$rb_cv_var_]$1" != no; then
+ AC_DEFINE([HAVE_VAR_]m4_toupper($1))
+ AC_DEFINE_UNQUOTED([TYPEOF_VAR_]m4_toupper($1), $rb_cv_var_$1)
+fi])
+RUBY_CHECK_VARTYPE(timezone, [#include <time.h>], [long int])
+RUBY_CHECK_VARTYPE(altzone, [#include <time.h>], [long int])
+if test "$rb_cv_var_timezone" = no; then
+ AC_CHECK_FUNCS(timezone)
+fi
+
AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t,
[AC_TRY_RUN([
#include <time.h>
@@ -1213,7 +1237,7 @@
human*)
AC_CHECK_LIB(signal, _harderr)
AC_CHECK_LIB(hmem, hmemset)
- AC_CHECK_FUNCS(select gettimeofday)
+ AC_CHECK_FUNCS(select)
AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
rb_cv_missing__dtos18,
[AC_TRY_RUN(
Index: ChangeLog
===================================================================
--- ChangeLog (revision 14222)
+++ ChangeLog (revision 14223)
@@ -1,3 +1,12 @@
+Fri Dec 14 10:01:40 2007 Nobuyoshi Nakada <nobu@r...>
+
+ * configure.in (RUBY_CHECK_VARTYPE): check if a variable is defined
+ and its type.
+
+ * configure.in (timezone, altzone): check for recent cygwin.
+
+ * missing/strftime.c (strftime): fix for timezone. [ruby-dev:32536]
+
Fri Dec 14 08:17:24 2007 Tanaka Akira <akr@f...>
* eval.c (rb_protect): restore root_jmpbuf even if proc exits by
Index: missing/strftime.c
===================================================================
--- missing/strftime.c (revision 14222)
+++ missing/strftime.c (revision 14223)
@@ -115,19 +115,24 @@
#define range(low, item, hi) max(low, min(item, hi))
+#ifdef __CYGWIN__
+#define DLL_IMPORT __declspec(dllimport)
+#endif
+#ifdef __WIN32__
+#define DLL_IMPORT __declspec(dllimport)
+#endif
#if !defined(OS2) && !defined(MSDOS) && defined(HAVE_TZNAME)
-extern char *tzname[2];
-extern int daylight;
-#ifdef SOLARIS
-extern long timezone, altzone;
-#else
-#ifdef __hpux
-extern long timezone;
-#else
-extern int timezone, altzone;
+extern DLL_IMPORT char *tzname[2];
+#ifdef HAVE_DAYLIGHT
+extern DLL_IMPORT int daylight;
#endif
+#ifdef HAVE_VAR_TIMEZONE
+extern DLL_IMPORT TYPEOF_VAR_TIMEZONE timezone;
#endif
+#ifdef HAVE_VAR_ALTZONE
+extern DLL_IMPORT TYPEOF_VAR_ALTZONE altzone;
#endif
+#endif
#undef min /* just in case */
@@ -189,16 +194,8 @@
#endif /* POSIX_SEMANTICS */
#ifndef HAVE_TM_ZONE
#ifndef HAVE_TM_NAME
-#ifndef HAVE_TZNAME
- extern char *timezone();
struct timeval tv;
struct timezone zone;
-#else
-#ifdef __hpux
- struct timeval tv;
- struct timezone zone;
-#endif
-#endif /* HAVE_TZNAME */
#endif /* HAVE_TM_NAME */
#endif /* HAVE_TM_ZONE */
@@ -422,21 +419,18 @@
*/
off = timeptr->tm_gmtoff / 60;
#else /* !HAVE_TM_ZONE */
-#if HAVE_TZNAME
- /*
- * Systems with tzname[] probably have timezone as
- * secs west of GMT. Convert to mins east of GMT.
- */
-#ifdef __hpux
+#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&tv, &zone);
off = -zone.tz_minuteswest;
#else
+#if HAVE_VAR_TIMEZONE
+#if HAVE_VAR_ALTZONE
off = -(daylight ? timezone : altzone) / 60;
+#else
+ off = -timezone / 60;
#endif
-#else /* !HAVE_TZNAME */
- gettimeofday(&tv, &zone);
- off = -zone.tz_minuteswest;
-#endif /* !HAVE_TZNAME */
+#endif
+#endif
#endif /* !HAVE_TM_ZONE */
#endif /* !HAVE_TM_NAME */
if (off < 0) {
@@ -460,13 +454,15 @@
#ifdef HAVE_TM_NAME
strcpy(tbuf, timeptr->tm_name);
#else
+#ifdef HAVE_TIMEZONE
gettimeofday(& tv, & zone);
-#ifdef __CYGWIN__
+#ifdef TIMEZONE_VOID
strcpy(tbuf, timezone());
#else
strcpy(tbuf, timezone(zone.tz_minuteswest,
timeptr->tm_isdst > 0));
-#endif
+#endif /* TIMEZONE_VOID */
+#endif /* HAVE_TIMEZONE */
#endif /* HAVE_TM_NAME */
#endif /* HAVE_TM_ZONE */
#endif /* HAVE_TZNAME */
@@ -645,7 +641,7 @@
* main body of the standard. Thus it requires week 53.
*/
- int weeknum, jan1day, diff;
+ int weeknum, jan1day;
/* get week number, Monday as first day of the week */
weeknum = weeknumber(timeptr, 1);
Index: ruby_1_8/configure.in
===================================================================
--- ruby_1_8/configure.in (revision 14222)
+++ ruby_1_8/configure.in (revision 14223)
@@ -544,7 +544,8 @@
lchown lchmod getpgrp setpgrp getpgid setpgid initgroups\
getgroups setgroups getpriority getrlimit setrlimit sysconf\
group_member dlopen sigprocmask\
- sigaction _setjmp setsid telldir seekdir fchmod mktime timegm\
+ sigaction _setjmp setsid telldir seekdir fchmod\
+ mktime timegm gettimeofday\
cosh sinh tanh round setuid setgid setenv unsetenv)
AC_ARG_ENABLE(setreuid,
[ --enable-setreuid use setreuid()/setregid() according to need even if obsolete.],
@@ -571,6 +572,30 @@
if test "$rb_cv_have_daylight" = yes; then
AC_DEFINE(HAVE_DAYLIGHT)
fi
+AC_DEFUN([RUBY_CHECK_VARTYPE], [dnl
+AC_CACHE_CHECK([for external $1], rb_cv_var_$1,
+ [rb_cv_var_$1=no
+ AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
+ $2
+ void *t;],
+ [t = &(&$1)[0];],
+ [for t in $3; do
+ AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
+ $2
+ extern $t $1;],
+ [void *t = &(&$1)[0];],
+ [rb_cv_var_$1=$t; break])
+ done])])
+if test "[$rb_cv_var_]$1" != no; then
+ AC_DEFINE([HAVE_VAR_]m4_toupper($1))
+ AC_DEFINE_UNQUOTED([TYPEOF_VAR_]m4_toupper($1), $rb_cv_var_$1)
+fi])
+RUBY_CHECK_VARTYPE(timezone, [#include <time.h>], [long int])
+RUBY_CHECK_VARTYPE(altzone, [#include <time.h>], [long int])
+if test "$rb_cv_var_timezone" = no; then
+ AC_CHECK_FUNCS(timezone)
+fi
+
AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t,
[AC_TRY_RUN([
#include <time.h>
@@ -1203,7 +1228,7 @@
human*)
AC_CHECK_LIB(signal, _harderr)
AC_CHECK_LIB(hmem, hmemset)
- AC_CHECK_FUNCS(select gettimeofday)
+ AC_CHECK_FUNCS(select)
AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
rb_cv_missing__dtos18,
[AC_TRY_RUN(
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog (revision 14222)
+++ ruby_1_8/ChangeLog (revision 14223)
@@ -1,3 +1,12 @@
+Fri Dec 14 10:01:40 2007 Nobuyoshi Nakada <nobu@r...>
+
+ * configure.in (RUBY_CHECK_VARTYPE): check if a variable is defined
+ and its type.
+
+ * configure.in (timezone, altzone): check for recent cygwin.
+
+ * missing/strftime.c (strftime): fix for timezone. [ruby-dev:32536]
+
Tue Dec 11 00:04:05 2007 Akinori MUSHA <knu@i...>
* array.c (rb_ary_slice_bang): If an invalid negative index (<
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h (revision 14222)
+++ ruby_1_8/version.h (revision 14223)
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.6"
-#define RUBY_RELEASE_DATE "2007-12-11"
+#define RUBY_RELEASE_DATE "2007-12-14"
#define RUBY_VERSION_CODE 186
-#define RUBY_RELEASE_CODE 20071211
+#define RUBY_RELEASE_CODE 20071214
#define RUBY_PATCHLEVEL 5000
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 6
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 12
-#define RUBY_RELEASE_DAY 11
+#define RUBY_RELEASE_DAY 14
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8/missing/strftime.c
===================================================================
--- ruby_1_8/missing/strftime.c (revision 14222)
+++ ruby_1_8/missing/strftime.c (revision 14223)
@@ -115,19 +115,24 @@
#define range(low, item, hi) max(low, min(item, hi))
+#ifdef __CYGWIN__
+#define DLL_IMPORT __declspec(dllimport)
+#endif
+#ifdef __WIN32__
+#define DLL_IMPORT __declspec(dllimport)
+#endif
#if !defined(OS2) && !defined(MSDOS) && defined(HAVE_TZNAME)
-extern char *tzname[2];
-extern int daylight;
-#ifdef SOLARIS
-extern long timezone, altzone;
-#else
-#ifdef __hpux
-extern long timezone;
-#else
-extern int timezone, altzone;
+extern DLL_IMPORT char *tzname[2];
+#ifdef HAVE_DAYLIGHT
+extern DLL_IMPORT int daylight;
#endif
+#ifdef HAVE_VAR_TIMEZONE
+extern DLL_IMPORT TYPEOF_VAR_TIMEZONE timezone;
#endif
+#ifdef HAVE_VAR_ALTZONE
+extern DLL_IMPORT TYPEOF_VAR_ALTZONE altzone;
#endif
+#endif
#undef min /* just in case */
@@ -189,16 +194,8 @@
#endif /* POSIX_SEMANTICS */
#ifndef HAVE_TM_ZONE
#ifndef HAVE_TM_NAME
-#ifndef HAVE_TZNAME
- extern char *timezone();
struct timeval tv;
struct timezone zone;
-#else
-#ifdef __hpux
- struct timeval tv;
- struct timezone zone;
-#endif
-#endif /* HAVE_TZNAME */
#endif /* HAVE_TM_NAME */
#endif /* HAVE_TM_ZONE */
@@ -422,21 +419,18 @@
*/
off = timeptr->tm_gmtoff / 60;
#else /* !HAVE_TM_ZONE */
-#if HAVE_TZNAME
- /*
- * Systems with tzname[] probably have timezone as
- * secs west of GMT. Convert to mins east of GMT.
- */
-#ifdef __hpux
+#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&tv, &zone);
off = -zone.tz_minuteswest;
#else
+#if HAVE_VAR_TIMEZONE
+#if HAVE_VAR_ALTZONE
off = -(daylight ? timezone : altzone) / 60;
+#else
+ off = -timezone / 60;
#endif
-#else /* !HAVE_TZNAME */
- gettimeofday(&tv, &zone);
- off = -zone.tz_minuteswest;
-#endif /* !HAVE_TZNAME */
+#endif
+#endif
#endif /* !HAVE_TM_ZONE */
#endif /* !HAVE_TM_NAME */
if (off < 0) {
@@ -460,13 +454,15 @@
#ifdef HAVE_TM_NAME
strcpy(tbuf, timeptr->tm_name);
#else
+#ifdef HAVE_TIMEZONE
gettimeofday(& tv, & zone);
-#ifdef __CYGWIN__
+#ifdef TIMEZONE_VOID
strcpy(tbuf, timezone());
#else
strcpy(tbuf, timezone(zone.tz_minuteswest,
timeptr->tm_isdst > 0));
-#endif
+#endif /* TIMEZONE_VOID */
+#endif /* HAVE_TIMEZONE */
#endif /* HAVE_TM_NAME */
#endif /* HAVE_TM_ZONE */
#endif /* HAVE_TZNAME */
@@ -645,7 +641,7 @@
* main body of the standard. Thus it requires week 53.
*/
- int weeknum, jan1day, diff;
+ int weeknum, jan1day;
/* get week number, Monday as first day of the week */
weeknum = weeknumber(timeptr, 1);
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml