This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gccgo] Use AC_C_BIGENDIAN rather than <endian.h>
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Nov 2009 13:33:36 -0800
- Subject: [gccgo] Use AC_C_BIGENDIAN rather than <endian.h>
I committed this patch to the gccgo branch to use the AC_C_BIGENDIAN
configure test rather than assume that the system provides <endian.h>.
Ian
Index: runtime/go-reflect-chan.c
===================================================================
--- runtime/go-reflect-chan.c (revision 154387)
+++ runtime/go-reflect-chan.c (working copy)
@@ -6,8 +6,8 @@
#include <stdlib.h>
#include <stdint.h>
-#include <endian.h>
+#include "config.h"
#include "go-type.h"
#include "channel.h"
@@ -40,7 +40,7 @@ chansend (unsigned char *ch, unsigned ch
} u;
__builtin_memset (u.b, 0, sizeof (uint64_t));
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
__builtin_memcpy (u.b, val, channel->element_size);
#else
__builtin_memcpy (u.b + sizeof (uint64_t) - channel->element_size, val,
@@ -89,7 +89,7 @@ chanrecv (unsigned char *ch, unsigned ch
u.v = s.__val;
}
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
__builtin_memcpy (val, u.b, channel->element_size);
#else
__builtin_memcpy (val, u.b + sizeof (uint64_t) - channel->element_size,
Index: configure.ac
===================================================================
--- configure.ac (revision 154445)
+++ configure.ac (working copy)
@@ -6,7 +6,7 @@
# Process this file with autoreconf to produce configure.
-AC_PREREQ(2.59)
+AC_PREREQ(2.64)
AC_INIT(package-unused, version-unused,, libgo)
AC_CONFIG_SRCDIR(Makefile.am)
AC_CONFIG_HEADER(config.h)
@@ -159,6 +159,8 @@ else
fi
AC_SUBST(SPLIT_STACK)
+AC_C_BIGENDIAN
+
AC_CACHE_SAVE
if test ${multilib} = yes; then