diff options
| author | Tom Lane | 2006-01-12 19:24:27 +0000 |
|---|---|---|
| committer | Tom Lane | 2006-01-12 19:24:27 +0000 |
| commit | 1937d8d9efcc0444525a8eb1f6fbc11fddb9512d (patch) | |
| tree | 4bb8b9972337069d2bf031e7203db1a7251aa0ab /configure.in | |
| parent | 1fc010cc9695c72fedd45b85ed2d8dadcdc7734a (diff) | |
Use a more bulletproof test for whether finite() and isinf() are present.
It seems that recent gcc versions can optimize away calls to these functions
even when the functions do not exist on the platform, resulting in a bogus
positive result. Avoid this by using a non-constant argument and ensuring
that the function result is not simply discarded. Per report from
François Laupretre.
Diffstat (limited to 'configure.in')
| -rw-r--r-- | configure.in | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/configure.in b/configure.in index 94b0a5085d6..8462fffc434 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -dnl $Header: /cvsroot/pgsql/configure.in,v 1.301.2.18 2006/01/05 03:59:47 momjian Exp $ +dnl $Header: /cvsroot/pgsql/configure.in,v 1.301.2.19 2006/01/12 19:24:26 tgl Exp $ dnl dnl Developers, please strive to achieve this order: dnl @@ -912,12 +912,13 @@ AC_CHECK_FUNCS(vsnprintf, [], pgac_need_repl_snprintf=yes) AC_CHECK_DECLS([snprintf, vsnprintf]) -# do this one the hard way in case isinf() is a macro +dnl Cannot use AC_CHECK_FUNC because isinf may be a macro AC_CACHE_CHECK([for isinf], ac_cv_func_isinf, -[AC_TRY_LINK( -[#include <math.h> +[AC_TRY_LINK([ +#include <math.h> +double glob_double; ], -[double x = 0.0; int res = isinf(x);], +[return isinf(glob_double) ? 0 : 1;], [ac_cv_func_isinf=yes], [ac_cv_func_isinf=no])]) @@ -974,8 +975,11 @@ fi dnl Cannot use AC_CHECK_FUNC because finite may be a macro AC_MSG_CHECKING(for finite) -AC_TRY_LINK([#include <math.h>], - [int dummy=finite(1.0);], +AC_TRY_LINK([ +#include <math.h> +double glob_double; +], + [return finite(glob_double) ? 0 : 1;], [AC_DEFINE(HAVE_FINITE, 1, [Define to 1 if you have finite().]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) |
