[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: autoconf-2.59 and AC_C_LONG_DOUBLE: comments and a proposal
From: |
Paul Eggert |
Subject: |
Re: autoconf-2.59 and AC_C_LONG_DOUBLE: comments and a proposal |
Date: |
Wed, 02 Jun 2004 16:45:22 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
"Nelson H. F. Beebe" <address@hidden> writes:
> This then results in run-time failures if [s]printf floating-point
> format items with the L type modifier, or long double library
> routines, like powl(), are used.
I'd like to distinguish between failures of the compiler and failures
of the run-time library. How about if we have AC_C_LONG_DOUBLE stand
only for the compiler issues, and add new macros for the
runtime-library issues? After all, the C compiler need not be a
hosted implementation.
I installed the following patch to autoconf that I hope resolves all
the issues that you mentioned for the compiler proper, plus a few
other issues that I thought of while I was at it. The library issues
remain.
2004-06-02 Paul Eggert <address@hidden>
* lib/autoconf/c.m4 (AC_LONG_DOUBLE): Don't check LDBL_MAX
and LDBL_EPSILON, as the resulting expression isn't an
integer constant expression and violates the C standard.
Problem reported by Nelson H. F. Beebe. Also, check
for "L" suffix, and check that long double doesn't have
worse range or precision than double, that mixed-mode
arithmetic doesn't generate a diagnostic, that double
constants fit in long double.
--- c.m4.~1.187.~ 2004-05-03 13:15:44 -0700
+++ c.m4 2004-06-02 16:38:23 -0700
@@ -948,11 +948,25 @@ AC_DEFUN([AC_C_LONG_DOUBLE],
[ac_cv_c_long_double],
[AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY(
- [#include <float.h>
- 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)])],
+ [[#include <float.h>
+ long double const a[] =
+ {
+ 0.0L, DBL_MIN, DBL_MAX, DBL_EPSILON,
+ LDBL_MIN, LDBL_MAX, LDBL_EPSILON
+ };
+ long double
+ f (long double x)
+ {
+ return ((x + (unsigned long int) 10) * (-1 / x) + a[0]
+ + (x ? f (x) : 'c'));
+ }
+ ]],
+ [[(0 < ((DBL_MAX_EXP < LDBL_MAX_EXP)
+ + (DBL_MANT_DIG < LDBL_MANT_DIG)
+ - (LDBL_MAX_EXP < DBL_MAX_EXP)
+ - (LDBL_MANT_DIG < DBL_MANT_DIG)))
+ && (int) LDBL_EPSILON == 0
+ ]])],
ac_cv_c_long_double=yes,
ac_cv_c_long_double=no)])
if test $ac_cv_c_long_double = yes; then
- Re: autoconf-2.59 and AC_C_LONG_DOUBLE: comments and a proposal,
Paul Eggert <=