#cmakedefine WITH_SYSTEM_HIREDIS 1
/* Detect endiannes */
- #ifdef HAVE_ENDIAN_H
+
+#ifdef HAVE_ENDIAN_H
#include <endian.h>
- #else
- #ifdef HAVE_SYS_ENDIAN_H
+#elif defined(HAVE_SYS_ENDIAN_H)
#include <sys/endian.h>
- #else
- #ifdef HAVE_MACHINE_ENDIAN_H
+#elif defined(HAVE_MACHINE_ENDIAN_H)
#include <machine/endian.h>
- #else
+#endif
+
+#ifndef BYTE_ORDER
+
+#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
+#endif
+#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
- #if defined(i386) || defined(__i386) || defined(__amd64) || \
- defined(BIT_ZERO_ON_RIGHT) || defined(__x86__)
- #define BYTE_ORDER LITTLE_ENDIAN
- #endif
-
- #if defined(__sparc) || defined(__sparc__) || defined(__powerpc__)
- #define BYTE_ORDER BIG_ENDIAN
- #endif
+#endif
- #endif /* HAVE_MACHINE_ENDIAN_H */
- #endif /* HAVE_SYS_ENDIAN_H */
- #endif /* HAVE_ENDIAN_H */
+#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || \
+ defined(__BIG_ENDIAN__) || \
+ defined(__ARMEB__) || \
+ defined(__THUMBEB__) || \
+ defined(__AARCH64EB__) || \
+ defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
+#define BYTE_ORDER BIG_ENDIAN
+#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \
+ defined(__LITTLE_ENDIAN__) || \
+ defined(__ARMEL__) || \
+ defined(__THUMBEL__) || \
+ defined(__AARCH64EL__) || \
+ defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
+#define BYTE_ORDER LITTLE_ENDIAN
+#else
+#error "I don't know what architecture this is!"
+#endif
- #if !defined(BYTE_ORDER)
- # error "Undefined or unknown BYTE_ORDER"
- #endif
+#endif /* BYTE_ORDER */
/* Configure allocator */
#define uthash_malloc(sz) g_slice_alloc(sz)
#include <string.h>
#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
#include <errno.h>
#include <glib.h>