[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: HP cannot cross-compile
From: |
Akim Demaille |
Subject: |
FYI: HP cannot cross-compile |
Date: |
30 Jan 2002 16:18:02 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) |
I'd like to have opinion on this documentation, especially the section
name etc. Better yet: just FIXME :)
Index: ChangeLog
from Akim Demaille <address@hidden>
* tests/semantics.at (AC_CHECK_SIZEOF): Split into two tests: one
for plain code, the other for cross-compilation code. The latter
is now run with GCC only.
* doc/autoconf.texi (Compilers and Preprocessors): New.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.578
diff -u -u -r1.578 autoconf.texi
--- doc/autoconf.texi 30 Jan 2002 13:08:45 -0000 1.578
+++ doc/autoconf.texi 30 Jan 2002 15:10:33 -0000
@@ -274,6 +274,7 @@
Compilers and Preprocessors
+* Specific Compiler Characteristics:: Some portability issues
* Generic Compiler Characteristics:: Language independent tests
* C Compiler:: Checking its characteristics
* C++ Compiler:: Likewise
@@ -4633,11 +4634,46 @@
compiling.
@menu
+* Specific Compiler Characteristics:: Some portability issues
* Generic Compiler Characteristics:: Language independent tests
* C Compiler:: Checking its characteristics
* C++ Compiler:: Likewise
* Fortran 77 Compiler:: Likewise
@end menu
+
address@hidden Specific Compiler Characteristics
address@hidden Specific Compiler Characteristics
+
+Some compilers exhibit different behaviors.
+
address@hidden @asis
address@hidden Static/Dynamic Expressions
+Autoconf relies on a trick to extract one bit of information from the C
+compiler: using negative array sizes. For instance the following
+excerpt of a C source demonstrates how to test whether @samp{int}s are 4
+bytes long:
+
address@hidden
+int
+main (void)
address@hidden
+ static int test_array [(unsigned long) (sizeof (int)) == 4 ? 1 : -1];
+ test_array [0] = 0
+ return 0;
address@hidden
address@hidden example
+
address@hidden
+To our knowledge, there is a single compiler that does not support this
+trick: the HP C compilers (the real one, not only the ``bundled'') on
+HP-UX 11.00:
+
address@hidden
+$ @kbd{cc -c -Ae +O2 +Onolimit conftest.c}
+cc: "conftest.c": error 1879: Variable-length arrays cannot \
+ have static storage.
address@hidden example
address@hidden table
@node Generic Compiler Characteristics
@subsection Generic Compiler Characteristics
Index: tests/semantics.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/semantics.at,v
retrieving revision 1.34
diff -u -u -r1.34 semantics.at
--- tests/semantics.at 13 Sep 2001 06:53:19 -0000 1.34
+++ tests/semantics.at 30 Jan 2002 15:10:33 -0000
@@ -156,27 +156,48 @@
# AC_CHECK_SIZEOF
# ---------------
+# Not cross-compiling.
AT_CHECK_MACRO([AC_CHECK_SIZEOF],
[[AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(charchar,,
[[#include <stdio.h>
typedef char charchar[2];]])
AC_CHECK_SIZEOF(charcharchar)
+]],
+[AT_CHECK_DEFINES(
+[#define SIZEOF_CHAR 1
+#define SIZEOF_CHARCHAR 2
+#define SIZEOF_CHARCHARCHAR 0
+])])
+
-# Exercize the code used when cross-compiling
+# 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(unsigned char)
-AC_CHECK_SIZEOF(ucharchar,,
+AC_CHECK_SIZEOF(char)
+AC_CHECK_SIZEOF(charchar,,
[[#include <stdio.h>
-typedef unsigned char ucharchar[2];]])
-AC_CHECK_SIZEOF(ucharcharchar)]],
+typedef char charchar[2];]])
+AC_CHECK_SIZEOF(charcharchar)
+]],
[AT_CHECK_DEFINES(
[#define SIZEOF_CHAR 1
#define SIZEOF_CHARCHAR 2
#define SIZEOF_CHARCHARCHAR 0
-#define SIZEOF_UCHARCHAR 2
-#define SIZEOF_UCHARCHARCHAR 0
-#define SIZEOF_UNSIGNED_CHAR 1
])])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: HP cannot cross-compile,
Akim Demaille <=