summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-18 17:46:05 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-18 17:46:05 +0000
commite824b05b3e0c01905d38af7d9c669ddc55cfcfb3 (patch)
treefa7d3e0e89bc9a638258607e3cdb2e6f937a545a /configure.in
parentb7c90baf074156456e2ba5216c492e8b79b8bc3c (diff)
merge revision(s) 54492,54494,54495,54496,54499,54503: [Backport #12249]
* math.c (ruby_tgamma): fix tgamma(-0.0) on mingw. [ruby-core:74817] [Bug #12249] * math.c (ruby_lgamma_r): fix lgamma(-0.0) on mingw and OSX. * math.c (ruby_lgamma_r): mswin's lgamma_r also seems to be wrong. cf. [Bug #12249] * math.c (ruby_lgamma_r): missing/lgamma_r.c is used on Windows, since msvcrt does not provide it. * missing/lgamma_r.c (lgamma_r): fix lgamma(-0.0). [ruby-core:74823] [Bug #12249] * configure.in (rb_cv_lgamma_r_m0): check if lgamma_r(-0.0) returns negative infinity. [Bug #12249] * math.c (ruby_lgamma_r): define by the configured result. * configure.in (rb_cv_lgamma_r_m0): fix the condition for lgamma_r(-0.0). [Bug #12249] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in35
1 files changed, 35 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 1f714db1c9..1d083ea0a3 100644
--- a/configure.in
+++ b/configure.in
@@ -2438,6 +2438,41 @@ main(int argc, char **argv)
])
AS_IF([test "x$rb_cv_atan2_inf_c99" = xyes], [AC_DEFINE(ATAN2_INF_C99)])
+AS_IF([test "x$ac_cv_func_lgamma_r" = xyes], [
+ AC_CACHE_CHECK(whether lgamma_r handles -0.0, rb_cv_lgamma_r_m0, [
+ AC_TRY_RUN([
+@%:@include <math.h>
+@%:@ifdef HAVE_UNISTD_H
+@%:@include <unistd.h>
+@%:@endif
+@%:@ifndef EXIT_SUCCESS
+@%:@define EXIT_SUCCESS 0
+@%:@endif
+@%:@ifndef EXIT_FAILURE
+@%:@define EXIT_FAILURE 1
+@%:@endif
+
+int
+main(int argc, char **argv)
+{
+ int sign;
+ double x = lgamma_r(-0.0, &sign);
+
+ /* should be [+inf, -1] */
+ if (x <= 0) return EXIT_FAILURE;
+ if (!isinf(x)) return EXIT_FAILURE;
+ if (sign != -1) return EXIT_FAILURE;
+ return EXIT_SUCCESS;
+}
+],
+ [rb_cv_lgamma_r_m0=yes],
+ [rb_cv_lgamma_r_m0=no],
+ [rb_cv_lgamma_r_m0=yes]
+ )
+ ])
+ AS_IF([test "x$rb_cv_lgamma_r_m0" = xno], [AC_DEFINE(LGAMMA_R_M0_FIX)])
+])
+
# Some platform need -lrt for clock_gettime, but the other don't.
if test x"$ac_cv_func_clock_gettime" != xyes; then
# glibc 2.17 moves clock_* functions from librt to the main C library.