[build] auto detect big endian (#4551)

This commit is contained in:
Yakun Xu
2020-02-12 07:42:50 -08:00
committed by GitHub
parent 1145d32cb0
commit a70007dbdf
2 changed files with 7 additions and 0 deletions
+2
View File
@@ -202,6 +202,8 @@ AC_PROG_CXX_C_O
AM_PROG_AS
AC_C_BIGENDIAN
# Check for other compiler toolchain tools.
AC_CHECK_TOOL(AR, ar)
+5
View File
@@ -37,8 +37,13 @@
#include "openthread-core-config.h"
#ifndef BYTE_ORDER_BIG_ENDIAN
#if defined(WORDS_BIGENDIAN) || \
defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define BYTE_ORDER_BIG_ENDIAN 1
#else
#define BYTE_ORDER_BIG_ENDIAN 0
#endif
#endif
#include <limits.h>
#include <stdint.h>