autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_LANG_BOOL_COMPILE_TRY(C) fails with OS vendor compilers


From: Paul Eggert
Subject: Re: AC_LANG_BOOL_COMPILE_TRY(C) fails with OS vendor compilers
Date: Fri, 20 Aug 2004 00:04:52 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

I installed the following simple patch to work around the Autoconf
problem you reported last month.  I'm not sure the fancier solutions
we discussed are worth the aggravation of developing and maintaining
them.  Thanks again for reporting the problem.

2004-08-19  Paul Eggert  <address@hidden>

        * lib/autoconf/c.m4 (AC_LANG_BOOL_COMPILE_TRY(C),
        AC_C_LONG_DOUBLE): Undo 2004-06-04 change, as it didn't work with
        HP-UX 11.23 cc/aCC or Tru64 4.0 cc.  Problem reported by Noah Misch in
        <http://lists.gnu.org/archive/html/autoconf/2004-07/msg00004.html>.

Index: c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.189
retrieving revision 1.190
diff -p -u -r1.189 -r1.190
--- c.m4        4 Jun 2004 19:39:54 -0000       1.189
+++ c.m4        20 Aug 2004 07:01:02 -0000      1.190
@@ -228,14 +228,13 @@ char (*f) () = $1;
 
 # AC_LANG_BOOL_COMPILE_TRY(C)(PROLOGUE, EXPRESSION)
 # -------------------------------------------------
-# The C standard does not require a diagnostic when we compute 1 / 0
-# at compile-time, but we don't know of any compiler that fails to
-# diagnose this.  Diagnostics are required for some other expressions
-# (e.g., ((EXPRESSION) ? 0 : (0, 0)), INT_MAX + !!(EXPRESSION)),
-# but they don't work as well in practice.
+# Return a program that is valid if EXPRESSION is nonzero.
+# EXPRESSION must be an integer constant expression.
+# 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], [static int v = 1 / !!($2);
-v = 0;
+[AC_LANG_PROGRAM([$1], [static int test_array @<:@1 - 2 * !($2)@:>@;
+test_array @<:@0@:>@ = 0
 ])])
 
 
@@ -968,8 +967,6 @@ AC_DEFUN([AC_C_LONG_DOUBLE],
                  + (DBL_MANT_DIG < LDBL_MANT_DIG)
                  - (LDBL_MAX_EXP < DBL_MAX_EXP)
                  - (LDBL_MANT_DIG < DBL_MANT_DIG)))
-          && (0 < ((DBL_MAX < LDBL_MAX) + (LDBL_EPSILON < DBL_EPSILON)
-                   - (LDBL_MAX < DBL_MAX) - (DBL_EPSILON < LDBL_EPSILON)))
           && (int) LDBL_EPSILON == 0
          ]])],
       ac_cv_c_long_double=yes,




reply via email to

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