From a65901063d7fdb70b26b6dba03a9897ed7c21bc3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 23 Mar 2010 13:35:44 +0000 Subject: [PATCH] Fix Endianess detection on Linux. Some platforms like MIPS can come either in little or in big endian. Therefore a static decision based on the system used is invalid. The header file endian.h should be used for systems on which it is available. At the moment this is at least Linux. Patch by Frank Neufingerl git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@51 a6f86f6d-0131-4f8e-9e7b-e335508773d5 --- ebml/EbmlConfig.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ebml/EbmlConfig.h b/ebml/EbmlConfig.h index d042a6e..a66a41b 100644 --- a/ebml/EbmlConfig.h +++ b/ebml/EbmlConfig.h @@ -36,6 +36,14 @@ #ifndef LIBEBML_CONFIG_H #define LIBEBML_CONFIG_H +#if defined(__linux__) +#include +#if __BYTE_ORDER == __LITTLE_ENDIAN +#undef WORDS_BIGENDIAN +#elif __BYTE_ORDER == __BIG_ENDIAN +#define WORDS_BIGENDIAN 1 +#endif +#else // automatic endianess detection working on GCC #if !defined(WORDS_BIGENDIAN) #if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) || defined (__amd64__) || defined (__x86_64__) @@ -47,6 +55,7 @@ #undef WORDS_BIGENDIAN // for my testing platform (x86) #endif #endif // not autoconf +#endif #define LIBEBML_NAMESPACE libebml #if defined(NO_NAMESPACE) // for older GCC