From 535e45a8b137507173fa6c2c9275246147bd6a26 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Wed, 20 Feb 2008 17:13:02 +0000 Subject: [PATCH] Endianness setup in Solaris compatibility header. Add its include to CFLAGS, not just CPPFLAGS. git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@739 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- Makefile.defs | 4 ++-- core/compat/solaris.h | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile.defs b/Makefile.defs index 069d3672..c25c4e29 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -40,8 +40,8 @@ OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]") # Additions for Solaris support. ifeq ($(OS),solaris) GETARCH=uname -p - CPPFLAGS += -DHAVE_SYS_SOCKIO_H -DBSD_COMP -include compat/solaris.h -fPIC - CFLAGS += -DHAVE_SYS_SOCKIO_H -DBSD_COMP -fPIC + CPPFLAGS += -DHAVE_SYS_SOCKIO_H -DBSD_COMP -fPIC -include compat/solaris.h + CFLAGS += -DHAVE_SYS_SOCKIO_H -DBSD_COMP -fPIC -include compat/solaris.h # For nanosleep. LDFLAGS += -lrt # For inet_aton. diff --git a/core/compat/solaris.h b/core/compat/solaris.h index 4e3ddb32..2c4ebba5 100644 --- a/core/compat/solaris.h +++ b/core/compat/solaris.h @@ -1,9 +1,10 @@ #ifndef __SOLARIS_H__ #define __SOLARIS_H__ -#ifdef SOLARIS /* * New compatibility code for Solaris. + * This is conditionally included *in the Makefile.defs*, so it doesn't + * need to be conditionalized here. */ #ifndef timeradd @@ -65,16 +66,15 @@ typedef unsigned long long int u_int64_t; #endif -#if defined(sun) #include -#if defined(_BIG_ENDIAN) + +/* Which of these applies depends on which compiler suite is used! */ +#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN) #define BYTE_ORDER BIG_ENDIAN -#else +#elif (defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN) #define BYTE_ORDER LITTLE_ENDIAN -#endif #else -#include +#error "No endianness found for Solaris build." #endif -#endif /* SOLARIS */ #endif