This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Hopeful patch for configure breakage


I'd appreciate it if the people whose grep doesn't like the
floating-point format or endianness tests would try this patch.  It
does two things: switches to egrep, and puts \n at the end of the
strings we're grepping for.  This probably won't be good enough, but
perhaps we will be lucky.

It should also make the float format detector understand the ARM
better, and the message printed by the endian detector a tad less
stilted.

zw

	* aclocal.m4 (gcc_AC_C_COMPILE_BIGENDIAN): Rename
	gcc_AC_C_COMPILE_ENDIAN, make 'checking ...' message less
	stilted.  Put an 'X' and a '\n' at the end of the test
	structure.  Use egrep to examine object file.
	(gcc_AC_C_FLOAT_FORMAT): Put an \n at the end of each entry in
	the test array.  Use egrep to examine object file..  Detect
	ARM style floats (EI@@PFEE) and the hypothetical opposite
	case.  Only define HOST_FLOAT_WORDS_BIG_ENDIAN if it's
	different from HOST_WORDS_BIG_ENDIAN.

	* configure.in: Move float format check after integer
	endianness check.  Adjust for renamed macro.

	* configure, config.in: Regenerate.

===================================================================
Index: aclocal.m4
--- aclocal.m4	2001/03/15 00:13:34	1.44
+++ aclocal.m4	2001/03/15 09:29:47
@@ -1266,8 +1266,8 @@ dnl Differs from AC_C_BIGENDIAN in that 
 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,
+AC_DEFUN([gcc_AC_C_COMPILE_ENDIAN],
+[AC_CACHE_CHECK(byte ordering, ac_cv_c_compile_endian,
 [dnl The extra quote protects the [] in the structure definition.
 cat >conftest.$ac_ext <<EOF
 [#include "confdefs.h"
@@ -1278,27 +1278,29 @@ cat >conftest.$ac_ext <<EOF
   struct {
     char prefix[sizeof "endian::" - 1];
     short word;
+    char postfix[2];
  } tester = {
     "endian::",
 #if SIZEOF_SHORT == 4
     ('A' << (CHAR_BIT * 3)) | ('B' << (CHAR_BIT * 2)) |
 #endif
-    ('A' << CHAR_BIT) | 'B'
+    ('A' << CHAR_BIT) | 'B',
+    'X', '\n'
 };]
 EOF
-ac_cv_c_compile_bigendian=unknown
+ac_cv_c_compile_endian=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
+  if   egrep 'endian::AB' conftest.o >/dev/null 2>&1; then
+    ac_cv_c_compile_endian=big-endian
+  elif egrep 'endian::BA' conftest.o >/dev/null 2>&1; then
+    ac_cv_c_compile_endian=little-endian
   fi
 fi
-if test $ac_cv_c_compile_bigendian = unknown; then
+if test $ac_cv_c_compile_endian = unknown; then
   AC_MSG_ERROR([*** unable to determine endianness])
 fi
 rm -rf conftest*])
-if test $ac_cv_c_compile_bigendian = yes; then
+if test $ac_cv_c_compile_endian = big-endian; then
   AC_DEFINE(HOST_WORDS_BIG_ENDIAN, 1,
   [Define if the host machine stores words of multi-word integers in
    big-endian order.])
@@ -1333,7 +1335,7 @@ struct possibility {
   char postfix[8];
 };
 
-#define C(cand) { "format::", cand, "::tamrof" }
+#define C(cand) { "format::", cand, "::tamro\n" }
 struct possibility table [] =
 {
   C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
@@ -1344,15 +1346,19 @@ struct possibility table [] =
 };]
 EOF
 if AC_TRY_EVAL(ac_compile); then
-  if   grep 'format::.@IEEEF.::tamrof' conftest.o >/dev/null 2>&1; then
+  if   egrep 'format::.@IEEEF.::tamro' 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
+  elif egrep 'format::.I@@PFE.::tamro' conftest.o >/dev/null 2>&1; then
+    ac_cv_c_float_format='IEEE (big-endian)'
+  elif egrep 'format::.FEEEI@.::tamro' conftest.o >/dev/null 2>&1; then
+    ac_cv_c_float_format='IEEE (little-endian)'
+  elif egrep 'format::.EFP@@I.::tamro' 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
+  elif egrep 'format::.__floa.::tamro' 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
+  elif egrep 'format::..PDP-1.::tamro' 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
+  elif egrep 'format::.BMHEXF.::tamro' conftest.o >/dev/null 2>&1; then
     ac_cv_c_float_format='IBM 370 hex'
   else
     AC_MSG_ERROR(Unknown floating point format)
@@ -1361,15 +1367,23 @@ else
   AC_MSG_ERROR(compile failed)
 fi
 rm -rf conftest*])
+# IEEE is the default format.  If the float endianness isn't the same
+# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
+# (which is a tristate: yes, no, default).  This is only an issue with
+# IEEE; the other formats are only supported by a few machines each,
+# all with the same endianness.
 format=
-bigend=
+fbigend=
 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
+	if test $ac_cv_c_compile_endian = little-endian; then
+	    fbigend=1
+	fi
 	;;
     'IEEE (little-endian)' )
+	if test $ac_cv_c_compile_endian = big-endian; then
+	    fbigend=0
+	fi
 	;;
     'VAX D-float' )
 	format=VAX_FLOAT_FORMAT
@@ -1385,12 +1399,13 @@ 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,
+if test -n "$fbigend"; then
+	AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
   [Define to 1 if the host machine stores floating point numbers in
-   memory with the word containing the sign bit at the lowest address.
+   memory with the word containing the sign bit at the lowest address,
+   or to 0 if it does it the other way around.
 
-   This macro need not be defined if the ordering is the same as for
+   This macro should not be defined if the ordering is the same as for
    multi-word integers.])
 fi
 ])
===================================================================
Index: configure.in
--- configure.in	2001/03/15 00:13:35	1.499
+++ configure.in	2001/03/15 09:29:47
@@ -379,7 +379,6 @@ if test $ac_cv_c___int64 = yes; then
 fi
 
 gcc_AC_C_CHARSET
-gcc_AC_C_FLOAT_FORMAT
 
 # If the native compiler is GCC, we can enable warnings even in stage1.  
 # That's useful for people building cross-compilers, or just running a
@@ -464,7 +463,8 @@ AC_CHECK_HEADER(pthread.h, [have_pthread
 
 # These tests can't be done till we know if we have limits.h.
 gcc_AC_C_CHAR_BIT
-gcc_AC_C_COMPILE_BIGENDIAN
+gcc_AC_C_COMPILE_ENDIAN
+gcc_AC_C_FLOAT_FORMAT
 
 # See if GNAT has been installed
 AC_CHECK_PROG(have_gnat, gnatbind, yes, no)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]