From: Paul Eggert Date: Tue, 5 Feb 2002 22:56:16 +0000 (+0000) Subject: * doc/autoconf.texi (Specific Compiler Characteristics): X-Git-Tag: AUTOCONF-2.52h~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3aff19f8d350b5089aa65d9dcba9b6bd468d37a;p=thirdparty%2Fautoconf.git * 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 --git a/doc/autoconf.texi b/doc/autoconf.texi index 56a27d602..5f3078f1a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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.c} 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 +@code{long} before comparing it. @end table @node Generic Compiler Characteristics diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4 index 8f6af6688..d58a541fd 100644 --- a/lib/autoconf/types.m4 +++ b/lib/autoconf/types.m4 @@ -356,7 +356,7 @@ AC_CACHE_CHECK([size of $1], AS_TR_SH([ac_cv_sizeof_$1]), # 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 --git a/tests/semantics.at b/tests/semantics.at index 51a0f5834..c98ea6899 100644 --- a/tests/semantics.at +++ b/tests/semantics.at @@ -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,,