diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-19 16:29:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-19 16:29:31 +0000 |
commit | 603cdc271042ab32461ef9d4311352496483f639 (patch) | |
tree | eeda414df6ef00fddfd2ccd3c8317f09e0cb0a0c | |
parent | 9949407fd90c1c5bfe332141c75db995a9b867aa (diff) | |
download | ruby-603cdc271042ab32461ef9d4311352496483f639.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | configure.in | 14 | ||||
-rw-r--r-- | ext/date/extconf.rb | 1 | ||||
-rw-r--r-- | include/ruby/missing.h | 8 |
3 files changed, 16 insertions, 7 deletions
diff --git a/configure.in b/configure.in index df4e0014bc..6cb013aa1f 100644 --- a/configure.in +++ b/configure.in @@ -839,6 +839,20 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then 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. diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb index a0c30fa948..9f7d3e8f0b 100644 --- a/ext/date/extconf.rb +++ b/ext/date/extconf.rb @@ -1,3 +1,2 @@ require 'mkmf' -append_cflags("-std=iso9899:1999") create_makefile('date_core') diff --git a/include/ruby/missing.h b/include/ruby/missing.h index f9e9daed3a..e81ad2769d 100644 --- a/include/ruby/missing.h +++ b/include/ruby/missing.h @@ -143,17 +143,13 @@ union bytesequence4_or_float { }; #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) |