[前][次][番号順一覧][スレッド一覧]

ruby-changes:40116

From: nobu <ko1@a...>
Date: Tue, 20 Oct 2015 01:29:42 +0900 (JST)
Subject: [ruby-changes:40116] nobu:r52197 (trunk): check INFINITY and NAN without C99 option

nobu	2015-10-20 01:29:31 +0900 (Tue, 20 Oct 2015)

  New Revision: 52197

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52197

  Log:
    check INFINITY and NAN without C99 option
    
    * configure.in: check INFINITY and NAN without an option for C99
      so that rb_infinity and rb_nan are respectively available
      regardless that option if they may be used.

  Modified files:
    trunk/configure.in
    trunk/ext/date/extconf.rb
    trunk/include/ruby/missing.h
Index: include/ruby/missing.h
===================================================================
--- include/ruby/missing.h	(revision 52196)
+++ include/ruby/missing.h	(revision 52197)
@@ -143,17 +143,13 @@ union bytesequence4_or_float { https://github.com/ruby/ruby/blob/trunk/include/ruby/missing.h#L143
 };
 #endif
 
-#ifdef INFINITY
-# define HAVE_INFINITY
-#else
+#ifndef INFINITY
 /** @internal */
 RUBY_EXTERN const union bytesequence4_or_float rb_infinity;
 # define INFINITY (rb_infinity.float_value)
 #endif
 
-#ifdef NAN
-# define HAVE_NAN
-#else
+#ifndef NAN
 /** @internal */
 RUBY_EXTERN const union bytesequence4_or_float rb_nan;
 # define NAN (rb_nan.float_value)
Index: configure.in
===================================================================
--- configure.in	(revision 52196)
+++ configure.in	(revision 52197)
@@ -839,6 +839,20 @@ if test "$GCC:${warnflags+set}:no" = yes https://github.com/ruby/ruby/blob/trunk/configure.in#L839
 fi
 RUBY_TRY_CFLAGS(-Qunused-arguments, [RUBY_APPEND_OPTIONS(rb_cv_wsuppress_flags, -Qunused-arguments)])
 
+for n in infinity nan; do
+    m=AS_TR_CPP($n)
+    AC_CACHE_CHECK([whether $m is available without C99 option], rb_cv_$n,
+	[AC_COMPILE_IFELSE(
+	    [AC_LANG_BOOL_COMPILE_TRY(AC_INCLUDES_DEFAULT([@%:@include <math.h>
+@%:@ifndef $m
+@%:@error no $m
+@%:@endif
+]), [1])], [eval rb_cv_$n=yes], [eval rb_cv_$n=no])])
+    if eval test '"$rb_cv_'$n'"' = yes; then
+	AC_DEFINE_UNQUOTED([HAVE_]$m)
+    fi
+done
+
 if test "$GCC" = yes; then
     # NaCl's glibc build generates undefined references to __memset_chk.
     # TODO(sbc): Remove this once NaCl's glibc is fixed.
Index: ext/date/extconf.rb
===================================================================
--- ext/date/extconf.rb	(revision 52196)
+++ ext/date/extconf.rb	(revision 52197)
@@ -1,3 +1,2 @@ https://github.com/ruby/ruby/blob/trunk/ext/date/extconf.rb#L1
 require 'mkmf'
-append_cflags("-std=iso9899:1999")
 create_makefile('date_core')

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]