autoconf-patches
[Top][All Lists]
Advanced

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

patch for autoconf-2.52g on HP-UX (was: bison 1.32)


From: Paul Eggert
Subject: patch for autoconf-2.52g on HP-UX (was: bison 1.32)
Date: Mon, 4 Feb 2002 03:57:46 -0800 (PST)

Thanks for running those tests.  Their results show that the HP-UX cc
bug has to do with unsigned types in general, not just with size_t.
So the correct workaround is to cast the size to 'long', not to
'unsigned long'.

Here is a proposed patch.

2002-02-04  Paul Eggert  <address@hidden>

        * doc/autoconf.texi (Specific Compiler Characteristics):
        Describe HP-UX cc bug workaround more accurately.
        * lib/autoconf/types.m4 (AC_CHECK_SIZEOF): Cast to long,
        not unsigned long.
        * tests/semantics.at (AC_CHECK_SIZEOF): Check non-GCC
        cross-compilers, too.

diff -pru autoconf/doc/autoconf.texi autoconf-hpux/doc/autoconf.texi
--- autoconf/doc/autoconf.texi  Mon Feb  4 03:33:16 2002
+++ autoconf-hpux/doc/autoconf.texi     Mon Feb  4 03:38:56 2002
@@ -4646,7 +4646,7 @@ bytes long:
 int
 main (void)
 @{
-  static int test_array [(unsigned long) (sizeof (int)) == 4 ? 1 : -1];
+  static int test_array [sizeof (int) == 4 ? 1 : -1];
   test_array [0] = 0
   return 0;
 @}
@@ -4662,6 +4662,9 @@ $ @kbd{cc -c -Ae +O2 +Onolimit conftest.
 cc: "conftest.c": error 1879: Variable-length arrays cannot \
     have static storage.
 @end example
+
+Autoconf works around this problem by casting @code{sizeof (int)} to
address@hidden before comparing it.
 @end table
 
 @node Generic Compiler Characteristics
diff -pru autoconf/lib/autoconf/types.m4 autoconf-hpux/lib/autoconf/types.m4
--- autoconf/lib/autoconf/types.m4      Mon Nov 12 08:08:53 2001
+++ autoconf-hpux/lib/autoconf/types.m4 Mon Feb  4 03:38:55 2002
@@ -356,7 +356,7 @@ AC_CACHE_CHECK([size of $1], AS_TR_SH([a
   # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
   # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
   # This bug is HP SR number 8606223364.
-  _AC_COMPUTE_INT([(unsigned long) (sizeof ($1))],
+  _AC_COMPUTE_INT([(long) (sizeof ($1))],
                   [AS_TR_SH([ac_cv_sizeof_$1])],
                   [AC_INCLUDES_DEFAULT([$3])],
                   [AC_MSG_ERROR([cannot compute sizeof ($1), 77])])
diff -pru autoconf/tests/semantics.at autoconf-hpux/tests/semantics.at
--- autoconf/tests/semantics.at Wed Jan 30 15:26:36 2002
+++ autoconf-hpux/tests/semantics.at    Mon Feb  4 03:38:52 2002
@@ -173,20 +173,8 @@ AC_CHECK_SIZEOF(charcharchar)
 
 # AC_CHECK_SIZEOF
 # ---------------
-# Cross-compiling: only with GCC, as some compilers, such as HP's
-# cannot grok our trick:
-#
-# static int test_array [1 - 2 * !(((unsigned long) (sizeof (unsigned char))) 
>= 0)];
-#
-# configure:3637: cc -c -Ae +O2 +Onolimit  conftest.c >&5
-# cc: "configure", line 3660: error 1879: Variable-length arrays cannot have 
static storage.
-#
 AT_CHECK_MACRO([AC_CHECK_SIZEOF],
 [[# Exercize the code used when cross-compiling
-AC_PROG_CC
-if test "$GCC" != yes; then
-  exit 77
-fi
 cross_compiling=yes
 AC_CHECK_SIZEOF(char)
 AC_CHECK_SIZEOF(charchar,,



reply via email to

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