From 0b8d28449925711e69d228c24f327c5bf0c2b627 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 23 Dec 2015 13:02:03 -0500 Subject: use portable AC_C_BIGENDIAN This allows us to avoid using endian.h. --- configure.ac | 1 + libacl/byteorder.h | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index cd3c680..0525c62 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,7 @@ AC_PROG_CC AM_PROG_CC_C_O AC_USE_SYSTEM_EXTENSIONS AC_FUNC_GCC_VISIBILITY +AC_C_BIGENDIAN AM_PROG_AR LT_INIT diff --git a/libacl/byteorder.h b/libacl/byteorder.h index 05f5d87..772fbc0 100644 --- a/libacl/byteorder.h +++ b/libacl/byteorder.h @@ -15,9 +15,9 @@ along with this program. If not, see . */ -#include +#include "config.h" -#if __BYTE_ORDER == __BIG_ENDIAN +#ifdef WORDS_BIGENDIAN # define cpu_to_le16(w16) le16_to_cpu(w16) # define le16_to_cpu(w16) ((u_int16_t)((u_int16_t)(w16) >> 8) | \ (u_int16_t)((u_int16_t)(w16) << 8)) @@ -26,12 +26,10 @@ (u_int32_t)(((u_int32_t)(w32) >> 8) & 0xFF00) | \ (u_int32_t)(((u_int32_t)(w32) << 8) & 0xFF0000) | \ (u_int32_t)( (u_int32_t)(w32) <<24)) -#elif __BYTE_ORDER == __LITTLE_ENDIAN +#else # define cpu_to_le16(w16) ((u_int16_t)(w16)) # define le16_to_cpu(w16) ((u_int16_t)(w16)) # define cpu_to_le32(w32) ((u_int32_t)(w32)) # define le32_to_cpu(w32) ((u_int32_t)(w32)) -#else -# error unknown endianess? #endif -- cgit v1.2.1