From: Howard Chu Date: Wed, 9 Nov 2011 03:04:39 +0000 (-0800) Subject: Add Solaris byte-order detection X-Git-Tag: OPENLDAP_REL_ENG_2_4_32~125^2~62 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cc7a89cd677980443a326a3d48fffb71871adb7d;p=openldap Add Solaris byte-order detection --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index f3adb66fb0..e14e141a8b 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -65,8 +65,20 @@ #endif #ifndef BYTE_ORDER -#define BYTE_ORDER __BYTE_ORDER +# if (defined(_LITTLE_ENDIAN) || defined(_BIG_ENDIAN)) && !(defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)) +/* Solaris just defines one or the other */ +# define LITTLE_ENDIAN 1234 +# define BIG_ENDIAN 4321 +# ifdef _LITTLE_ENDIAN +# define BYTE_ORDER LITTLE_ENDIAN +# else +# define BYTE_ORDER BIG_ENDIAN +# endif +# else +# define BYTE_ORDER __BYTE_ORDER +# endif #endif + #ifndef LITTLE_ENDIAN #define LITTLE_ENDIAN __LITTLE_ENDIAN #endif