ruby-changes:47821
From: rhe <ko1@a...>
Date: Sun, 17 Sep 2017 13:26:56 +0900 (JST)
Subject: [ruby-changes:47821] rhe:r59939 (trunk): ext/date/extconf.rb: check for timezone and altzone
rhe 2017-09-17 13:26:51 +0900 (Sun, 17 Sep 2017) New Revision: 59939 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59939 Log: ext/date/extconf.rb: check for timezone and altzone Instead of in configure.in. As of r28592 the HAVE_VAR_TIMEZONE and HAVE_VAR_ALTZONE macros are only used by ext/date. ext/date doesn't care whether they are int or long, so just check for the existence. Modified files: trunk/configure.in trunk/ext/date/date_core.c trunk/ext/date/extconf.rb Index: ext/date/date_core.c =================================================================== --- ext/date/date_core.c (revision 59938) +++ ext/date/date_core.c (revision 59939) @@ -7710,8 +7710,8 @@ datetime_s_now(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L7710 s = 59; #ifdef HAVE_STRUCT_TM_TM_GMTOFF of = tm.tm_gmtoff; -#elif defined(HAVE_VAR_TIMEZONE) -#ifdef HAVE_VAR_ALTZONE +#elif defined(HAVE_TIMEZONE) +#ifdef HAVE_ALTZONE of = (long)-((tm.tm_isdst > 0) ? altzone : timezone); #else of = (long)-timezone; Index: ext/date/extconf.rb =================================================================== --- ext/date/extconf.rb (revision 59938) +++ ext/date/extconf.rb (revision 59939) @@ -1,4 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ext/date/extconf.rb#L1 # frozen_string_literal: true require 'mkmf' + config_string("strict_warnflags") {|w| $warnflags += " #{w}"} + +have_var("timezone", "time.h") +have_var("altzone", "time.h") + create_makefile('date_core') Index: configure.in =================================================================== --- configure.in (revision 59938) +++ configure.in (revision 59939) @@ -2805,35 +2805,6 @@ AC_CACHE_CHECK(for external int daylight https://github.com/ruby/ruby/blob/trunk/configure.in#L2805 AS_IF([test "$rb_cv_have_daylight" = yes], [ AC_DEFINE(HAVE_DAYLIGHT) ]) -AC_DEFUN([RUBY_CHECK_VARTYPE], [dnl -AC_CACHE_CHECK([for external $1], AS_TR_SH(rb_cv_var_$1), - [AS_TR_SH(rb_cv_var_$1)=no - AC_TRY_COMPILE([ -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 1 -#endif -$2 -; -const volatile void *volatile t;], - [t = &(&$1)[0];], - [for t in $3; do - AC_TRY_COMPILE([ -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 1 -#endif -$2 -; -extern $t $1; -const volatile void *volatile t;], - [t = &(&$1)[0];], - [AS_TR_SH(rb_cv_var_$1)=$t; break]) - done])]) -AS_IF([test "${AS_TR_SH(rb_cv_var_$1)}" != no], [ - AC_DEFINE(AS_TR_CPP(HAVE_VAR_$1)) - AC_DEFINE_UNQUOTED(AS_TR_CPP(TYPEOF_VAR_$1), ${AS_TR_SH(rb_cv_var_$1)}) -])]) -RUBY_CHECK_VARTYPE(timezone, [@%:@include <time.h>], [long int]) -RUBY_CHECK_VARTYPE(altzone, [@%:@include <time.h>], [long int]) AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t, [AC_TRY_RUN([ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/