aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-09-09 17:33:50 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-09-09 17:36:38 +0900
commit4a587fab94508271e2d6dc8370e1afe0974c7dab (patch)
tree1fc45d1cb3189b717db265b6a72c2495d5b7bd8a
parent28362876f2c342f89cf404cee9e5a8bebd538871 (diff)
downloadruby-wip/cleanup-configure.tar.gz
configure.in, date: move ext/date-specific existence checkwip/cleanup-configure
ext/date does not care of the type of timezone and altzone; just use have_var provided by mkmf.
-rw-r--r--configure.in29
-rw-r--r--ext/date/date_core.c4
-rw-r--r--ext/date/extconf.rb5
3 files changed, 7 insertions, 31 deletions
diff --git a/configure.in b/configure.in
index fab31b8..bd6c12d 100644
--- a/configure.in
+++ b/configure.in
@@ -2696,35 +2696,6 @@ AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
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([
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 6ac4ffa..bad86ff 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -7708,8 +7708,8 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass)
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;
diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb
index a4f243e..8938df1 100644
--- a/ext/date/extconf.rb
+++ b/ext/date/extconf.rb
@@ -1,4 +1,9 @@
# 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')