]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix endianness-detection code on Solaris 11.
authorEvan Nemerson <evan@nemerson.com>
Tue, 15 Mar 2016 03:48:46 +0000 (20:48 -0700)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Thu, 28 Apr 2016 11:37:12 +0000 (13:37 +0200)
Solaris doesn't have sys/endian.h or endian.h, it has sys/byteorder.h,
which doesn't define BYTE_ORDER, it defines either _LITTLE_ENDIAN or
_BIG_ENDIAN.

crc32.c

diff --git a/crc32.c b/crc32.c
index c696aa35e10af6925a930f6898b8c6b49c8855d7..937f48d211eca109a0dfdceac7f9fd06b1f21506 100644 (file)
--- a/crc32.c
+++ b/crc32.c
 # include <machine/endian.h>
 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
 # include <sys/endian.h>
+#elif defined(__sun) || defined(sun)
+# include <sys/byteorder.h>
+# if !defined(LITTLE_ENDIAN)
+#  define LITTLE_ENDIAN 4321
+# endif
+# if !defined(BIG_ENDIAN)
+#  define BIG_ENDIAN 1234
+# endif
+# if !defined(BYTE_ORDER)
+#  if defined(_BIG_ENDIAN)
+#   define BYTE_ORDER BIG_ENDIAN
+#  else
+#   define BYTE_ORDER LITTLE_ENDIAN
+#  endif
+# endif
 #else
 # include <endian.h>
 #endif