summaryrefslogtreecommitdiff
path: root/utils/porting.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/porting.h')
-rw-r--r--utils/porting.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/utils/porting.h b/utils/porting.h
index 9a47851d4..becd7acaa 100644
--- a/utils/porting.h
+++ b/utils/porting.h
@@ -44,13 +44,23 @@
# define UCLIBC_RUNTIME_PREFIX "/"
#endif
+#undef UCLIBC_ENDIAN_HOST
#define UCLIBC_ENDIAN_LITTLE 1234
#define UCLIBC_ENDIAN_BIG 4321
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_LITTLE
-#elif __BYTE_ORDER == __BIG_ENDIAN
-# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_BIG
-#else
+#if defined(BYTE_ORDER)
+# if BYTE_ORDER == LITTLE_ENDIAN
+# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_LITTLE
+# elif BYTE_ORDER == BIG_ENDIAN
+# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_BIG
+# endif
+#elif defined(__BYTE_ORDER)
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_LITTLE
+# elif __BYTE_ORDER == __BIG_ENDIAN
+# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_BIG
+# endif
+#endif
+#if !defined(UCLIBC_ENDIAN_HOST)
# error "Unknown host byte order!"
#endif