|
|
|
|
|
|
|
|
|
|
|
|
| |
It caused build failures on half of Debian's release architectures WHILE
BEING TOTALLY UNUSED!!! And it was buggy, too -- for example, ARM is big
endian while it was recognized as little endian (le versions of ARM are
usually called ARMEL).
A non-enumerated CPU (like hppa or s390) or OS (kfreebsd) also caused build
failures for no good reason.
If we'll need to known endianness in the future, please, check for it
directly rather than maintaining a big and incomplete list of architectures.
|
|
platform.h is a tool I made to allow for effortless detection of the
compiler, OS, and architecture that the app is being compiled for.
- To check the operating system, you can check whether these macros are
defined:
TARGET_OS_WINDOWS
TARGET_OS_MACOSX
TARGET_OS_LINUX
TARGET_OS_SOLARIS // OpenSolaris, Solaris, etc
TARGET_OS_FREEBSD
TARGET_OS_OPENBSD
TARGET_OS_NETBSD
TARGET_OS_DOS
TARGET_OS_NDSFIRMWARE // NDS == Nintendo DS
- To check whether the platform is 32 or 64-bit:
TARGET_CPU_BITS == 32
TARGET_CPU_BITS == 64
- To check your platform's endianness (byte ordering), check whether
these are defined:
TARGET_LITTLE_ENDIAN // x86, x86_64, Alpha, IA64, ARM
TARGET_BIG_ENDIAN // PowerPC, SPARC
- To check for a compiler, you can check whether these macros are
defined:
TARGET_COMPILER_MSVC // Visual C++
TARGET_COMPILER_ICC // Intel C/C++ compiler
TARGET_COMPILER_GCC // GCC
Note that there are some subsets of GCC that you may want
to check for (these macros will be defined *in addition*
to the TARGET_COMPILER_GCC macro:
TARGET_COMPILER_CYGWIN
TARGET_COMPILER_MINGW
TARGET_COMPILER_DJGPP // DOS port
TARGET_COMPILER_BORLAND
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
|