152 lines
4 KiB
C
152 lines
4 KiB
C
#ifndef id054C8BCA27C84EAA825922EC0A4F3317
|
|
#define id054C8BCA27C84EAA825922EC0A4F3317
|
|
|
|
#if defined(__GNUC__)
|
|
# include <endian.h>
|
|
#else
|
|
# error "Please add endianness detection for your compiler"
|
|
#endif
|
|
|
|
#define DK_ARM_ARCH_6 0
|
|
#define DK_ARM_ARCH_6J 1
|
|
#define DK_ARM_ARCH_6K 2
|
|
#define DK_ARM_ARCH_6Z 3
|
|
#define DK_ARM_ARCH_6ZK 4
|
|
#define DK_ARM_ARCH_6T2 5
|
|
#define DK_ARM_ARCH_7 6
|
|
#define DK_ARM_ARCH_7A 7
|
|
#define DK_ARM_ARCH_7R 8
|
|
#define DK_ARM_ARCH_7M 9
|
|
#define DK_ARM_ARCH_7S 10
|
|
|
|
#if defined(__ANDROID__)
|
|
# define DK_POSIX
|
|
# define DK_ANDROID
|
|
# define DK_MOBILE
|
|
#elif defined(SAILFISHOS)
|
|
# define DK_POSIX
|
|
# define DK_SAILFISHOS
|
|
# define DK_MOBILE
|
|
#elif defined(__gnu_linux__) || defined(__linux__) || defined(linux)
|
|
# define DK_POSIX
|
|
# define DK_LINUX
|
|
# define DK_PC
|
|
#elif defined(_WIN16) || defined(_WIN32) || defined(_WIN64) || \
|
|
defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__)
|
|
# if defined(_WIN32) || defined(__WIN32__)
|
|
# define DK_WIN32
|
|
# endif
|
|
# define DK_WINDOWS
|
|
# define DK_PC
|
|
#else
|
|
# error "Unknown platform"
|
|
#endif
|
|
|
|
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || \
|
|
defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
|
|
# define DK_X86_64
|
|
# define DK_64_BIT
|
|
#elif defined(__arm__)
|
|
# if defined(__ARMEL__) && __ARMEL__ == 1
|
|
# define DK_ARM_EL
|
|
# else
|
|
# define DK_ARM_HF
|
|
# endif
|
|
|
|
# if defined(__ARM_ARCH_6__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_6
|
|
# elif defined(__ARM_ARCH_6J__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_6J
|
|
# elif defined(__ARM_ARCH_6K__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_6K
|
|
# elif defined(__ARM_ARCH_6Z__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_6Z
|
|
# elif defined(__ARM_ARCH_6ZK__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_6ZK
|
|
# elif defined(__ARM_ARCH_6T2__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_6T2
|
|
# elif defined(__ARM_ARCH_7__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_7
|
|
# elif defined(__ARM_ARCH_7A__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_7A
|
|
# elif defined(__ARM_ARCH_7R__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_7R
|
|
# elif defined(__ARM_ARCH_7M__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_7M
|
|
# elif defined(__ARM_ARCH_7S__)
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_7S
|
|
# else
|
|
# error "Unknown ARM version"
|
|
# endif
|
|
# define DK_32_BIT
|
|
# define DK_ARM
|
|
#elif defined(_M_ARM)
|
|
# if _M_ARM != 6 && _M_ARM != 7
|
|
# error "Unknown ARM version"
|
|
# endif
|
|
# if _M_ARM == 6
|
|
# define DK_ARM_ARCH DK_ARM_ARCH_6
|
|
# elif _M_ARM == 7
|
|
# define DK_ARM_ARC DK_ARM_ARCH_7
|
|
# endif
|
|
# define DK_32_BIT
|
|
# define DK_ARM
|
|
#elif defined(__TARGET_ARCH_ARM)
|
|
# if __TARGET_ARCH_ARM != 6 && __TARGET_ARCH_ARM != 7
|
|
# error "Unknown ARM version"
|
|
# endif
|
|
# define DK_ARM_VERSION __TARGET_ARCH_ARM
|
|
# define DK_32_BIT
|
|
# define DK_ARM
|
|
#elif defined(__aarch64__)
|
|
# define DK_ARM
|
|
# define DK_64_BIT
|
|
#elif defined(i386) || defined(__i386) || defined(__i386__) || \
|
|
defined(__i486__) || defined(__i586__) || defined(__i686__) || \
|
|
defined(_M_I86) || defined(_M_IX86) || defined(_X86_) || defined(__INTEL__)
|
|
# define DK_X86
|
|
# define DK_32_BIT
|
|
#elif defined(__ia64__) || defined(_IA64) || defined(__IA64__) || \
|
|
defined(_M_IA64) || defined(__itanium__)
|
|
# define DK_IA64
|
|
# define DK_64_BIT
|
|
#else
|
|
# error "Unknown architecture"
|
|
#endif
|
|
|
|
#if defined(DK_ARM_ARCH)
|
|
# if DK_ARM_ARCH == DK_ARM_ARCH_6 || DK_ARM_ARCH == DK_ARM_ARCH_6J || \
|
|
DK_ARM_ARCH == DK_ARM_ARCH_6K || DK_ARM_ARCH == DK_ARM_ARCH_6Z || \
|
|
DK_ARM_ARCH == DK_ARM_ARCH_6ZK || DK_ARM_ARCH == DK_ARM_ARCH_6T2
|
|
# define DK_ARM_VERSION 6
|
|
# elif DK_ARM_ARCH == DK_ARM_ARCH_7 || DK_ARM_ARCH == DK_ARM_ARCH_7A || \
|
|
DK_ARM_ARCH == DK_ARM_ARCH_7R || DK_ARM_ARCH == DK_ARM_ARCH_7M || \
|
|
DK_ARM_ARCH == DK_ARM_ARCH_7S
|
|
# define DK_ARM_VERSION 7
|
|
# else
|
|
# error "Unknown ARM version"
|
|
# endif
|
|
# if defined(__GNUC__)
|
|
# if defined(__ARM_PCS_VFP)
|
|
# define DK_ARM_HARDFLOAT
|
|
# elif defined(__ARM_PCS)
|
|
# define DK_ARM_SOFTFLOAT
|
|
# else
|
|
# error "Unkown floating point mode"
|
|
# endif
|
|
# else
|
|
# error "Unknown compiler"
|
|
# endif
|
|
#endif
|
|
|
|
#if defined(__ARMEB__) || \
|
|
(defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN)
|
|
# define DK_BIG_ENDIAN
|
|
#elif defined(__ARMEL__) || \
|
|
(defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)
|
|
# define DK_LITTLE_ENDIAN
|
|
#else
|
|
# error "Unknown endianness"
|
|
#endif
|
|
|
|
#endif
|