diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-06 05:13:29 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-06 05:13:29 +0000 |
commit | ea736d55f9596e79184b9b4ade439c71530e86d8 (patch) | |
tree | 5c113bf9e87d01211a8f49011712407ffc8b82aa /configure.in | |
parent | 9d31efc6f0753a88de0a82ab40116ada028189bd (diff) | |
download | ruby-ea736d55f9596e79184b9b4ade439c71530e86d8.tar.gz |
configure.in: check lgamma_r(-0.0)
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/configure.in b/configure.in index b32187bee9..3454d3ae82 100644 --- a/configure.in +++ b/configure.in @@ -2498,6 +2498,38 @@ 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; + + if (lgamma_r(-0.0, &sign) >= 0) 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. |