summaryrefslogtreecommitdiff
path: root/gcc/aclocal.m4
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-15 00:13:37 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-15 00:13:37 +0000
commit3239b2ba5f5aa18b9bf5573327614856d4bb0bc0 (patch)
treea8a2287780219d70029a474e9e7aabad07e23a65 /gcc/aclocal.m4
parentcefc79bb0e7873e88cd0d8f73609c9c3290bdbef (diff)
downloadgcc-3239b2ba5f5aa18b9bf5573327614856d4bb0bc0.tar.gz
* aclocal.m4 (gcc_AC_C_CHARSET, gcc_AC_C_COMPILE_BIGENDIAN,
gcc_AC_C_FLOAT_FORMAT): New macros. * configure.in: Add AC_PROG_CPP after CC tests; gcc_AC_C_CHARSET and gcc_AC_C_FLOAT_FORMAT after the sizeof tests; and gcc_AC_C_COMPILE_BIGENDIAN after gcc_AC_C_CHAR_BIT. * configure, config.in: Regenerate. * config/a29k/xm-a29k.h, config/arc/xm-arc.h, config/arm/xm-arm.h, config/c4x/xm-c4x.h, config/convex/xm-convex.h, config/d30v/xm-d30v.h, config/i370/xm-linux.h, config/i370/xm-oe.h, config/ia64/xm-ia64.h, config/m32r/xm-m32r.h, config/m68k/xm-m68k.h, config/mips/xm-mips.h, config/pa/xm-linux.h, config/pa/xm-pa.h, config/rs6000/xm-lynx.h, config/rs6000/xm-mach.h, config/rs6000/xm-rs6000.h, config/rs6000/xm-sysv4.h, config/sparc/xm-sparc.h, config/vax/xm-vax.h, config/we32k/xm-we32k.h: Delete. * config/i370/xm-mvs.h, config/m88k/m88k.h, config/romp/xm-romp.h, config/rs6000/xm-beos.h, config/vax/xm-vms.h: Don't define any of: HOST_FLOAT_FORMAT, HOST_EBCDIC, HOST_WORDS_BIG_ENDIAN * config/rs6000/aix.h: Define COLLECT_EXPORT_LIST here. * config.gcc: Remove references to deleted files. (i370-*-opened*): Use i370/xm-mvs.h (which now defines only FATAL_EXIT_CODE, which is the same between oe and mvs). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40478 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/aclocal.m4')
-rw-r--r--gcc/aclocal.m4165
1 files changed, 165 insertions, 0 deletions
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 92e16fb333a..91c6845db39 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -1229,3 +1229,168 @@ AC_CACHE_CHECK(for __int64, ac_cv_c___int64,
[Define if your compiler supports the \`__int64' type.])
fi
])
+
+dnl Host character set probe.
+dnl The EBCDIC values match the table in config/i370/i370.c;
+dnl there are other versions of EBCDIC but GCC won't work with them.
+dnl
+AC_DEFUN([gcc_AC_C_CHARSET],
+[AC_CACHE_CHECK(execution character set, ac_cv_c_charset,
+ [AC_EGREP_CPP(ASCII,
+[#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
+ && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
+ASCII
+#endif], ac_cv_c_charset=ASCII)
+ if test x${ac_cv_c_charset+set} != xset; then
+ AC_EGREP_CPP(EBCDIC,
+[#if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
+ && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
+EBCDIC
+#endif], ac_cv_c_charset=EBCDIC)
+ fi
+ if test x${ac_cv_c_charset+set} != xset; then
+ ac_cv_c_charset=unknown
+ fi])
+if test $ac_cv_c_charset = unknown; then
+ AC_MSG_ERROR([*** Cannot determine host character set.])
+elif test $ac_cv_c_charset = EBCDIC; then
+ AC_DEFINE(HOST_EBCDIC, 1,
+ [Define if the host execution character set is EBCDIC.])
+fi])
+
+dnl Host endianness probe.
+dnl This tests byte-within-word endianness. GCC actually needs
+dnl to know word-within-larger-object endianness. They are the
+dnl same on all presently supported hosts.
+dnl Differs from AC_C_BIGENDIAN in that it does not require
+dnl running a program on the host, and it defines the macro we
+dnl want to see.
+dnl
+AC_DEFUN([gcc_AC_C_COMPILE_BIGENDIAN],
+[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_compile_bigendian,
+[dnl The extra quote protects the [] in the structure definition.
+cat >conftest.$ac_ext <<EOF
+[#include "confdefs.h"
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+/* This structure must have no internal padding. */
+ struct {
+ char prefix[sizeof "endian::" - 1];
+ short word;
+ } tester = {
+ "endian::",
+#if SIZEOF_SHORT == 4
+ ('A' << (CHAR_BIT * 3)) | ('B' << (CHAR_BIT * 2)) |
+#endif
+ ('A' << CHAR_BIT) | 'B'
+};]
+EOF
+ac_cv_c_compile_bigendian=unknown
+if AC_TRY_EVAL(ac_compile); then
+ if grep 'endian::AB' conftest.o >/dev/null 2>&1; then
+ ac_cv_c_compile_bigendian=yes
+ elif grep 'endian::BA' conftest.o >/dev/null 2>&1; then
+ ac_cv_c_compile_bigendian=no
+ fi
+fi
+if test $ac_cv_c_compile_bigendian = unknown; then
+ AC_MSG_ERROR([*** unable to determine endianness])
+fi
+rm -rf conftest*])
+if test $ac_cv_c_compile_bigendian = yes; then
+ AC_DEFINE(HOST_WORDS_BIG_ENDIAN, 1,
+ [Define if the host machine stores words of multi-word integers in
+ big-endian order.])
+fi
+])
+
+dnl Floating point format probe.
+dnl The basic concept is the same as the above: grep the object
+dnl file for an interesting string. We have to watch out for
+dnl rounding changing the values in the object, however; this is
+dnl handled by ignoring the least significant byte of the float.
+dnl
+dnl Does not know about VAX G-float or C4x idiosyncratic format.
+dnl It does know about PDP-10 idiosyncratic format, but this is
+dnl not presently supported by GCC. S/390 "binary floating point"
+dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
+dnl as ASCII?)
+dnl
+AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
+[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
+[# [AC_TRY_COMPILE] will delete the object file before we get a
+# chance to look at it.
+dnl The extra quote protects the [] instances in the code.
+cat >conftest.$ac_ext <<EOF
+[/* This will not work unless sizeof(double) == 8. */
+extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
+
+/* This structure must have no internal padding. */
+struct possibility {
+ char prefix[8];
+ double candidate;
+ char postfix[8];
+};
+
+#define C(cand) { "format::", cand, "::tamrof" }
+struct possibility table [] =
+{
+ C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
+ C( 3.53802595280598432000e+18), /* D__float - VAX */
+ C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
+ C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
+ C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
+};]
+EOF
+if AC_TRY_EVAL(ac_compile); then
+ if grep 'format::.@IEEEF.::tamrof' conftest.o >/dev/null 2>&1; then
+ ac_cv_c_float_format='IEEE (big-endian)'
+ elif grep 'format::.FEEEI@.::tamrof' conftest.o >/dev/null 2>&1; then
+ ac_cv_c_float_format='IEEE (little-endian)'
+ elif grep 'format::.__floa.::tamrof' conftest.o >/dev/null 2>&1; then
+ ac_cv_c_float_format='VAX D-float'
+ elif grep 'format::..PDP-1.::tamrof' conftest.o >/dev/null 2>&1; then
+ ac_cv_c_float_format='PDP-10'
+ elif grep 'format::.BMHEXF.::tamrof' conftest.o >/dev/null 2>&1; then
+ ac_cv_c_float_format='IBM 370 hex'
+ else
+ AC_MSG_ERROR(Unknown floating point format)
+ fi
+else
+ AC_MSG_ERROR(compile failed)
+fi
+rm -rf conftest*])
+format=
+bigend=
+case $ac_cv_c_float_format in
+ 'IEEE (big-endian)' )
+ # IEEE is the default, but define HOST_FLOAT_WORDS_BIG_ENDIAN
+ # in case it's different from HOST_WORDS_BIG_ENDIAN.
+ bigend=yes
+ ;;
+ 'IEEE (little-endian)' )
+ ;;
+ 'VAX D-float' )
+ format=VAX_FLOAT_FORMAT
+ ;;
+ 'PDP-10' )
+ format=PDP10_FLOAT_FORMAT
+ ;;
+ 'IBM 370 hex' )
+ format=IBM_FLOAT_FORMAT
+ ;;
+esac
+if test -n "$format"; then
+ AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
+ [Define to the floating point format of the host machine, if not IEEE.])
+fi
+if test -n "$bigend"; then
+ AC_DEFINE(HOST_FLOAT_WORDS_BIG_ENDIAN, 1,
+ [Define to 1 if the host machine stores floating point numbers in
+ memory with the word containing the sign bit at the lowest address.
+
+ This macro need not be defined if the ordering is the same as for
+ multi-word integers.])
+fi
+])