bug-autoconf
[Top][All Lists]
Advanced

[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: Jim Meyering
Subject: Re: autoconf-2.59 and AC_C_LONG_DOUBLE: comments and a proposal
Date: Wed, 02 Jun 2004 21:12:27 +0200

"Nelson H. F. Beebe" <address@hidden> wrote:
> In autoconf-2.59, and likely earlier version, the test macro
> AC_C_LONG_DOUBLE expands to the following code to test the Standard C
> limits (for readability, I've run the code through the "indent"
> prettyprinter):
>
> #include <float.h>
> long double foo = 0.0;
> int
> main()
> {
>     static int test_array[1 - 2 * !(  /* 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))];
>     test_array[0] = 0;
>     return 0;
> }
>
> On many systems, compilation of this test fails.  For example, on Sun
> Solaris, with native compilers, the code expands to
...
> and compilation reports
>
>       configure:3109: CC -c   conftest.c >&5
>       "conftest.c", line 32: Error: An integer constant expression is 
> required within the array subscript operator.
...
> Examination of the 1989 ANSI C Standard, section 3.8.1. `Conditional
> Inclusion'' provides the requirement from its first line:
>
>>> The expresssion that controls conditional inclusion shall be an
>>> integral constant expresion ...
>    ^^^^^^^^ NB

Hi Nelson,

Doesn't the above quote refer to expressions in cpp directives?
I believe that expressions elsewhere (like the one in the autoconf
test program, above) aren't subject to that restriction.

Note that the AC_C_LONG_DOUBLE autoconf test is a compile-time-only test.
It doesn't require running a just-created executable or even creating an
executable.  That's important in that the test is useful also in
a cross-compiling environment.

Jim




reply via email to

[Prev in Thread] Current Thread [Next in Thread]