diff --git a/libselinux/src/regex.c b/libselinux/src/regex.c index a3b427b4..0c5ad274 100644 --- a/libselinux/src/regex.c +++ b/libselinux/src/regex.c @@ -13,7 +13,18 @@ #endif #ifndef __BYTE_ORDER__ -#error __BYTE_ORDER__ not defined. Unable to determine endianness. + +/* If the compiler doesn't define __BYTE_ORDER__, try to use the C + * library header definitions. */ +#include +#ifndef __BYTE_ORDER +#error Neither __BYTE_ORDER__ nor __BYTE_ORDER defined. Unable to determine endianness. +#endif + +#define __ORDER_LITTLE_ENDIAN __LITTLE_ENDIAN +#define __ORDER_BIG_ENDIAN __BIG_ENDIAN +#define __BYTE_ORDER__ __BYTE_ORDER + #endif #ifdef USE_PCRE2