diff --git a/toonz/sources/CMakeLists.txt b/toonz/sources/CMakeLists.txt index 00567ca..30b4386 100644 --- a/toonz/sources/CMakeLists.txt +++ b/toonz/sources/CMakeLists.txt @@ -312,6 +312,16 @@ elseif(UNIX) endif() +include(TestBigEndian) +test_big_endian(_SYSTEM_BIG_ENDIAN) +if(_SYSTEM_BIG_ENDIAN) + add_definitions(-DTNZ_LITTLE_ENDIAN=0) +else() + add_definitions(-DTNZ_LITTLE_ENDIAN=1) +endif() +unset(_SYSTEM_BIG_ENDIAN) + + set(C_WARNINGS) set(CXX_WARNINGS) diff --git a/toonz/sources/include/tmachine.h b/toonz/sources/include/tmachine.h index 66c7e70..d7a8944 100644 --- a/toonz/sources/include/tmachine.h +++ b/toonz/sources/include/tmachine.h @@ -4,21 +4,21 @@ #define T_MACHINE_INCLUDED #if defined(_WIN32) || defined(i386) -#define TNZ_LITTLE_ENDIAN 1 #define TNZ_MACHINE_CHANNEL_ORDER_BGRM 1 #elif defined(__sgi) -#define TNZ_LITTLE_ENDIAN 0 #define TNZ_MACHINE_CHANNEL_ORDER_MBGR 1 #elif defined(LINUX) -#define TNZ_LITTLE_ENDIAN 1 #define TNZ_MACHINE_CHANNEL_ORDER_BGRM 1 #elif defined(MACOSX) -#define TNZ_LITTLE_ENDIAN 0 #define TNZ_MACHINE_CHANNEL_ORDER_MRGB 1 #else @UNKNOW PLATFORM @ #endif +#if !defined(TNZ_LITTLE_ENDIAN) +#error "TNZ_LITTLE_ENDIAN not defined!" +#endif + #ifndef WIN32 #ifdef MACOSX #define _finite isfinite diff --git a/toonz/sources/include/toonz4.6/machine.h b/toonz/sources/include/toonz4.6/machine.h index 7f02ef5..e9bf6f6 100644 --- a/toonz/sources/include/toonz4.6/machine.h +++ b/toonz/sources/include/toonz4.6/machine.h @@ -11,31 +11,24 @@ #define SCANNER_DEVNAME "/dev/scanner" #define DDR_DEVNAME "/dev/ddr" #endif - - -#ifdef __sgi -#define TNZ_LITTLE_ENDIAN 0 -#else -#define TNZ_LITTLE_ENDIAN 1 -#endif */ #if defined(_WIN32) || defined(i386) -#define TNZ_LITTLE_ENDIAN 1 #define TNZ_MACHINE_CHANNEL_ORDER_BGRM 1 #elif defined(__sgi) -#define TNZ_LITTLE_ENDIAN 0 #define TNZ_MACHINE_CHANNEL_ORDER_MBGR 1 #elif defined(LINUX) -#define TNZ_LITTLE_ENDIAN 1 #define TNZ_MACHINE_CHANNEL_ORDER_BGRM 1 #elif defined(MACOSX) -#define TNZ_LITTLE_ENDIAN 0 #define TNZ_MACHINE_CHANNEL_ORDER_MRGB 1 #else @UNKNOW PLATFORM @ #endif +#if !defined(TNZ_LITTLE_ENDIAN) +#error "TNZ_LITTLE_ENDIAN not defined!" +#endif + /* #ifdef WIN32 #define TNZ_MACHINE_CHANNEL_ORDER_BGRM 1