2 # error "A C++ compiler has been selected for C."
9 #if defined(__INTEL_COMPILER) || defined(__ICC)
10 # define COMPILER_ID "Intel"
12 #elif defined(__BORLANDC__)
13 # define COMPILER_ID "Borland"
15 #elif defined(__WATCOMC__)
16 # define COMPILER_ID "Watcom"
18 #elif defined(__SUNPRO_C)
19 # define COMPILER_ID "SunPro"
21 #elif defined(__HP_cc)
22 # define COMPILER_ID "HP"
25 # define COMPILER_ID "Compaq"
27 #elif defined(__IBMC__)
28 # if defined(__COMPILER_VER__)
29 # define COMPILER_ID "zOS"
30 # elif __IBMC__ >= 800
31 # define COMPILER_ID "XL"
33 # define COMPILER_ID "VisualAge"
37 # define COMPILER_ID "PGI"
39 #elif defined(__GNUC__)
40 # define COMPILER_ID "GNU"
42 #elif defined(_MSC_VER)
43 # define COMPILER_ID "MSVC"
45 #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
46 /* Analog Devices C++ compiler for Blackfin, TigerSHARC and
48 # define COMPILER_ID "ADSP"
50 /* IAR Systems compiler for embedded systems.
52 Not supported yet by CMake
53 #elif defined(__IAR_SYSTEMS_ICC__)
54 # define COMPILER_ID "IAR" */
56 /* sdcc, the small devices C compiler for embedded systems,
57 http://sdcc.sourceforge.net */
59 # define COMPILER_ID "SDCC"
61 #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
62 # define COMPILER_ID "MIPSpro"
64 /* This compiler is either not known or is too old to define an
65 identification macro. Try to identify the platform and guess that
66 it is the native compiler. */
68 # define COMPILER_ID "MIPSpro"
70 #elif defined(__hpux) || defined(__hpua)
71 # define COMPILER_ID "HP"
73 #else /* unknown compiler */
74 # define COMPILER_ID ""
78 /* Construct the string literal in pieces to prevent the source from
79 getting matched. Store it in a pointer rather than an array
80 because some compilers will just produce instructions to fill the
81 array rather than assigning a pointer to a static array. */
82 char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
84 /* Identify known platforms by name. */
85 #if defined(__linux) || defined(__linux__) || defined(linux)
86 # define PLATFORM_ID "Linux"
88 #elif defined(__CYGWIN__)
89 # define PLATFORM_ID "Cygwin"
91 #elif defined(__MINGW32__)
92 # define PLATFORM_ID "MinGW"
94 #elif defined(__APPLE__)
95 # define PLATFORM_ID "Darwin"
97 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
98 # define PLATFORM_ID "Windows"
100 #elif defined(__FreeBSD__) || defined(__FreeBSD)
101 # define PLATFORM_ID "FreeBSD"
103 #elif defined(__NetBSD__) || defined(__NetBSD)
104 # define PLATFORM_ID "NetBSD"
106 #elif defined(__OpenBSD__) || defined(__OPENBSD)
107 # define PLATFORM_ID "OpenBSD"
109 #elif defined(__sun) || defined(sun)
110 # define PLATFORM_ID "SunOS"
112 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
113 # define PLATFORM_ID "AIX"
115 #elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
116 # define PLATFORM_ID "IRIX"
118 #elif defined(__hpux) || defined(__hpux__)
119 # define PLATFORM_ID "HP-UX"
121 #elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
122 # define PLATFORM_ID "Haiku"
123 /* Haiku also defines __BEOS__ so we must
124 put it prior to the check for __BEOS__
127 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
128 # define PLATFORM_ID "BeOS"
130 #elif defined(__QNX__) || defined(__QNXNTO__)
131 # define PLATFORM_ID "QNX"
133 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
134 # define PLATFORM_ID "Tru64"
136 #elif defined(__riscos) || defined(__riscos__)
137 # define PLATFORM_ID "RISCos"
139 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
140 # define PLATFORM_ID "SINIX"
142 #elif defined(__UNIX_SV__)
143 # define PLATFORM_ID "UNIX_SV"
145 #elif defined(__bsdos__)
146 # define PLATFORM_ID "BSDOS"
148 #elif defined(_MPRAS) || defined(MPRAS)
149 # define PLATFORM_ID "MP-RAS"
151 #elif defined(__osf) || defined(__osf__)
152 # define PLATFORM_ID "OSF1"
154 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
155 # define PLATFORM_ID "SCO_SV"
157 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
158 # define PLATFORM_ID "ULTRIX"
160 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
161 # define PLATFORM_ID "Xenix"
163 #else /* unknown platform */
164 # define PLATFORM_ID ""
168 /* Construct the string literal in pieces to prevent the source from
169 getting matched. Store it in a pointer rather than an array
170 because some compilers will just produce instructions to fill the
171 array rather than assigning a pointer to a static array. */
172 char* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
175 /*--------------------------------------------------------------------------*/
180 int main(int argc, char* argv[])
183 require += info_compiler[argc];
184 require += info_platform[argc];