From 84e4596bd07edd5f81934dddd57857445d114f58 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Mon, 22 Jan 2007 22:55:09 +0000 Subject: [PATCH] (isinf, isnan): Use a volatile global to stop gcc optimizing out the test. In particular this fixes solaris where there isn't an isinf or isnan (though gcc still optimizes as if there is). Reported by Hugh Sasse. (AC_C_VOLATILE): New. --- configure.in | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/configure.in b/configure.in index 73f040855..43ffb4e70 100644 --- a/configure.in +++ b/configure.in @@ -224,6 +224,9 @@ fi AC_C_CONST +# "volatile" is used in a couple of tests below. +AC_C_VOLATILE + AC_C_INLINE if test "$ac_cv_c_inline" != no; then SCM_I_GSC_C_INLINE="\"${ac_cv_c_inline}\"" @@ -958,17 +961,19 @@ AC_CHECK_FUNCS(asinh acosh atanh copysign finite sincos trunc) # use so doesn't detect on macro-only systems like HP-UX. # AC_MSG_CHECKING([for isinf]) -AC_LINK_IFELSE( -[#include -int main () { return (isinf(0.0) != 0); }], +AC_LINK_IFELSE(AC_LANG_SOURCE( +[[#include +volatile double x = 0.0; +int main () { return (isinf(x) != 0); }]]), [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_ISINF, 1, [Define to 1 if you have the `isinf' macro or function.])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for isnan]) -AC_LINK_IFELSE( -[#include -int main () { return (isnan(0.0) != 0); }], +AC_LINK_IFELSE(AC_LANG_SOURCE( +[[#include +volatile double x = 0.0; +int main () { return (isnan(x) != 0); }]]), [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_ISNAN, 1, [Define to 1 if you have the `isnan' macro or function.])],