1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
|
/*
Package: dyncall
Library: test
File: test/gen-masm/dyncall_macros.h
Description: Platform detection macros
License:
Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
dyncall macros
Platform detection, specific defines and configuration.
The purpose of this file is to provide coherent platform and compiler
specific defines. So instead of defines like WIN32, _OpenBSD_ or
__GNUC__, one should use DC__OS_Win32, DC__OS_OpenBSD or DC__C_GNU,
respectively.
REVISION
2007/12/11 initial
*/
#ifndef DYNCALL_MACROS_H
#define DYNCALL_MACROS_H
/* Platform specific defines. */
/* MS Windows XP x64/Vista64 or later. */
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
#define DC__OS_Win64
/* MS Windows NT/95/98/ME/2000/XP/Vista32. */
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__WINDOWS__) || defined(_WINDOWS)
#define DC__OS_Win32
/* All the OS' based on Darwin OS (MacOS X, OpenDarwin). Note that '__APPLE__' may be defined for classic MacOS, too. */
/* __MACOSX__ is not defined in gcc assembler mode (switch: -S) */
/* @@@ TODO: Check for Classic OS */
#elif defined(__APPLE__) || defined(__Darwin__)
# define DC__OS_Darwin
# if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
# define DC__OS_IPhone
# else /* defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) */
# define DC__OS_MacOSX
# endif
/* The most popular open source Unix-like OS - Linux. */
#elif defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
#define DC__OS_Linux
/* The most powerful open source Unix-like OS - FreeBSD. */
#elif defined(__FreeBSD__)
#define DC__OS_FreeBSD
/* The most secure open source Unix-like OS - OpenBSD. */
#elif defined(__OpenBSD__)
#define DC__OS_OpenBSD
/* The most portable open source Unix-like OS - NetBSD. */
#elif defined(__NetBSD__)
#define DC__OS_NetBSD
/* The FreeBSD fork having heavy clusterization in mind - DragonFlyBSD. */
#elif defined(__DragonFly__)
#define DC__OS_DragonFlyBSD
/* Sun's Unix-like OS - SunOS / Solaris. */
#elif defined(__sun__) || defined(__sun) || defined(sun)
#define DC__OS_SunOS
/* The "Linux-like environment for Windows" - Cygwin. */
#elif defined(__CYGWIN__)
#define DC__OS_Cygwin
/* The "Minimalist GNU for Windows" - MinGW. */
#elif defined(__MINGW__)/*@@@*/
#define DC__OS_MinGW
/* The Nintendo DS (homebrew) using devkitpro. */
#elif defined(__nds__)
#define DC__OS_NDS
/* The PlayStation Portable (homebrew) SDK. */
#elif defined(__psp__) || defined(PSP)
#define DC__OS_PSP
/* Haiku (BeOS alike). */
#elif defined(__HAIKU__)
#define DC__OS_BeOS
/* The Unix successor - Plan9 from Bell Labs */
#elif defined(Plan9) || defined(__Plan9__)
#define DC__OS_Plan9
/* Digital's Unix-like OS - VMS */
#elif defined(__vms)
#define DC__OS_VMS
#else
#error Unsupported OS.
#endif
/* Compiler specific defines. Do not change the order, because */
/* some of the compilers define flags for compatible ones, too. */
/* Intel's C/C++ compiler. */
#if defined(__INTEL_COMPILER)
#define DC__C_Intel
/* MS C/C++ compiler. */
#elif defined(_MSC_VER)
#define DC__C_MSVC
/* The GNU Compiler Collection - GCC. */
#elif defined(__GNUC__)
#define DC__C_GNU
/* Watcom compiler. */
#elif defined(__WATCOMC__)
#define DC__C_WATCOM
/* Portable C Compiler. */
#elif defined(__PCC__)
#define DC__C_PCC
/* Undetected C Compiler. */
#else
#define DC__C_UNKNOWN
#endif
/* Architecture. */
/* Check architecture. */
#if defined(_M_IX86) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__386__)
# define DC__Arch_Intel_x86
#elif defined(_M_X64_) || defined(_M_AMD64) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
# define DC__Arch_AMD64
#elif defined(_M_IA64) || defined(__ia64__)
# define DC__Arch_Itanium
#elif defined(_M_PPC) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(__ppc__) || defined(__power__)
# define DC__Arch_PowerPC
#elif defined(__ppc64__) || defined(_ARCH_PPC64) || defined(__power64__)
# define DC__Arch_PPC64
#elif defined(__mips64__)
# define DC__Arch_MIPS64
#elif defined(_M_MRX000) || defined(__mips__)
# define DC__Arch_MIPS
#elif defined(__arm__) && !defined(__thumb__)
# define DC__Arch_ARM_ARM
#elif defined(__arm__) && defined(__thumb__)
# define DC__Arch_ARM_THUMB
#elif defined(__sh__)
# define DC__Arch_SuperH
#endif
/* Rough OS classification. */
#if defined(DC__OS_Win32) || defined(DC__OS_Win64)
# define DC_WINDOWS
#elif defined(DC__OS_NDS) || defined(DC__OS_PSP)
# define DC_OTHER
#else
# define DC_UNIX
#endif
/* Misc machine-dependent quirks. */
#if defined(DC__Arch_ARM_ARM) || defined(DC__Arch_ARM_THUMB)
# if defined(__ARM_EABI__) || defined(DC__OS_NDS)
# define DC__ABI_ARM_EABI
# elif defined(__APCS_32__)
# define DC__ABI_ARM_APCS32
# endif
#endif /* ARM */
#if defined(DC__Arch_MIPS) || defined(DC__Arch_MIPS64)
# if defined(_ABIO32)
# define DC__ABI_MIPS_O32
# elif defined(_ABIN32)
# define DC__ABI_MIPS_N32
# elif defined(_ABI64)
# define DC__ABI_MIPS_N64
# else
# define DC__ABI_MIPS_EABI
# endif
#endif /* MIPS */
#endif /* DYNCALL_MACROS_H */
|