summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-12-23 13:02:03 -0500
committerMike Frysinger <vapier@gentoo.org>2015-12-23 13:02:03 -0500
commit0b8d28449925711e69d228c24f327c5bf0c2b627 (patch)
tree7dc7e142e1d787c32428c5d235882cb9637f224f
parentb6ba5c29a2ad9dcaac4191e81d2b497d396fa7d1 (diff)
downloadacl-0b8d28449925711e69d228c24f327c5bf0c2b627.tar.gz
use portable AC_C_BIGENDIAN
This allows us to avoid using endian.h.
-rw-r--r--configure.ac1
-rw-r--r--libacl/byteorder.h8
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 <http://www.gnu.org/licenses/>.
*/
-#include <endian.h>
+#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