summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac14
-rw-r--r--include/ruby/missing.h4
-rw-r--r--numeric.c4
3 files changed, 5 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index bc593016c2..352a8140ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -520,20 +520,6 @@ AS_IF([test "$GCC:${warnflags+set}:no" = yes::no], [
])
RUBY_TRY_CFLAGS(-Qunused-arguments, [RUBY_APPEND_OPTIONS(rb_cv_wsuppress_flags, -Qunused-arguments)])
-for n in huge_val 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])])
- AS_IF([eval test '"$rb_cv_'$n'"' = yes], [
- AC_DEFINE_UNQUOTED([HAVE_]$m)
- ])
-done
-
AC_ARG_WITH(compress-debug-sections,
AS_HELP_STRING([--with-compress-debug-sections=type],
[enable debug section compression]),
diff --git a/include/ruby/missing.h b/include/ruby/missing.h
index 68a90aeb96..dc3fd502b5 100644
--- a/include/ruby/missing.h
+++ b/include/ruby/missing.h
@@ -136,7 +136,7 @@ RUBY_EXTERN double lgamma_r(double, int *);
RUBY_EXTERN double cbrt(double);
#endif
-#if !defined(HAVE_INFINITY) || !defined(HAVE_NAN)
+#if !defined(INFINITY) || !defined(NAN)
union bytesequence4_or_float {
unsigned char bytesequence[4];
float float_value;
@@ -147,12 +147,14 @@ union bytesequence4_or_float {
/** @internal */
RUBY_EXTERN const union bytesequence4_or_float rb_infinity;
# define INFINITY (rb_infinity.float_value)
+# define USE_RB_INFINITY 1
#endif
#ifndef NAN
/** @internal */
RUBY_EXTERN const union bytesequence4_or_float rb_nan;
# define NAN (rb_nan.float_value)
+# define USE_RB_NAN 1
#endif
#ifndef HUGE_VAL
diff --git a/numeric.c b/numeric.c
index a7769ca255..9cc3f4d9d3 100644
--- a/numeric.c
+++ b/numeric.c
@@ -61,14 +61,14 @@
#define DBL_EPSILON 2.2204460492503131e-16
#endif
-#ifdef HAVE_INFINITY
+#ifndef USE_RB_INFINITY
#elif !defined(WORDS_BIGENDIAN) /* BYTE_ORDER == LITTLE_ENDIAN */
const union bytesequence4_or_float rb_infinity = {{0x00, 0x00, 0x80, 0x7f}};
#else
const union bytesequence4_or_float rb_infinity = {{0x7f, 0x80, 0x00, 0x00}};
#endif
-#ifdef HAVE_NAN
+#ifndef USE_RB_NAN
#elif !defined(WORDS_BIGENDIAN) /* BYTE_ORDER == LITTLE_ENDIAN */
const union bytesequence4_or_float rb_nan = {{0x00, 0x00, 0xc0, 0x7f}};
#else