From: Paul Eggert Date: Fri, 16 Nov 2001 20:09:58 +0000 (+0000) Subject: (AC_LANG_BOOL_COMPILE_TRY(C)): Make the array X-Git-Tag: AUTOCONF-2.52g~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71a641098a8fc7ee671cabe23621bfcb4af5f007;p=thirdparty%2Fautoconf.git (AC_LANG_BOOL_COMPILE_TRY(C)): Make the array static, to catch errors if the value isn't known at compile-time and the compiler supports dynamic arrays. Change its name from `_array_' to `test_array' to avoid potential name clashes. (AC_C_LONG_DOUBLE): Make it a compile-time test, not a run-time test. Do not define HAVE_LONG_DOUBLE if `long double' is no better than double. Catch a bug in GCC 2.95.2 x86. --- diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 0ba0d6733..3656e350a 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -197,8 +197,8 @@ f = $1; # Be sure to use this array to avoid `unused' warnings, which are even # errors with `-W error'. m4_define([AC_LANG_BOOL_COMPILE_TRY(C)], -[AC_LANG_PROGRAM([$1], [int _array_ @<:@1 - 2 * !($2)@:>@; -_array_ @<:@0@:>@ = 0 +[AC_LANG_PROGRAM([$1], [static int test_array @<:@1 - 2 * !($2)@:>@; +test_array @<:@0@:>@ = 0 ])]) @@ -828,25 +828,21 @@ fi # AC_C_LONG_DOUBLE # ---------------- AC_DEFUN([AC_C_LONG_DOUBLE], -[AC_CACHE_CHECK(for long double, ac_cv_c_long_double, -[if test "$GCC" = yes; then - ac_cv_c_long_double=yes -else -AC_TRY_RUN( -[int -main () -{ - /* The Stardent Vistra knows sizeof(long double), but does not - support it. */ - long double foo = 0.0; - /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ - exit (sizeof (long double) < sizeof (double)); -}], -ac_cv_c_long_double=yes, ac_cv_c_long_double=no) -fi]) +[AC_CACHE_CHECK( + [for working long double with more range or precision than double], + [ac_cv_c_long_double], + [AC_COMPILE_IFELSE( + [AC_LANG_BOOL_COMPILE_TRY( + [#include + long double foo = 0.0;], + [/* Using '|' rather than '||' catches a GCC 2.95.2 x86 bug. */ + (DBL_MAX < LDBL_MAX) | (LDBL_EPSILON < DBL_EPSILON) + | (DBL_MAX_EXP < LDBL_MAX_EXP) | (DBL_MANT_DIG < LDBL_MANT_DIG)])], + ac_cv_c_long_double=yes, + ac_cv_c_long_double=no)]) if test $ac_cv_c_long_double = yes; then AC_DEFINE(HAVE_LONG_DOUBLE, 1, - [Define to 1 if the `long double' type works.]) + [Define to 1 if long double works and has more range or precision than double.]) fi ])# AC_C_LONG_DOUBLE