5 # error "A C compiler has been selected for C++."
13 # define COMPILER_ID "Comeau"
15 # define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
16 # define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
18 #elif defined(__INTEL_COMPILER) || defined(__ICC)
19 # define COMPILER_ID "Intel"
20 # if defined(_MSC_VER)
21 # define SIMULATE_ID "MSVC"
24 # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
25 # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
26 # if defined(__INTEL_COMPILER_UPDATE)
27 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
29 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
31 # if defined(__INTEL_COMPILER_BUILD_DATE)
33 # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
35 # if defined(_MSC_VER)
37 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
38 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
41 #elif defined(__PATHCC__)
42 # define COMPILER_ID "PathScale"
43 # define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
44 # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
45 # if defined(__PATHCC_PATCHLEVEL__)
46 # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
49 #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
50 # define COMPILER_ID "Embarcadero"
51 # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
52 # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
53 # define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)
55 #elif defined(__BORLANDC__)
56 # define COMPILER_ID "Borland"
58 # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
59 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
61 #elif defined(__WATCOMC__) && __WATCOMC__ < 1200
62 # define COMPILER_ID "Watcom"
64 # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
65 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
66 # if (__WATCOMC__ % 10) > 0
67 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
70 #elif defined(__WATCOMC__)
71 # define COMPILER_ID "OpenWatcom"
73 # define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
74 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
75 # if (__WATCOMC__ % 10) > 0
76 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
79 #elif defined(__SUNPRO_CC)
80 # define COMPILER_ID "SunPro"
81 # if __SUNPRO_CC >= 0x5100
83 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
84 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
85 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
88 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
89 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
90 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
93 #elif defined(__HP_aCC)
94 # define COMPILER_ID "HP"
96 # define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
97 # define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
98 # define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
100 #elif defined(__DECCXX)
101 # define COMPILER_ID "Compaq"
103 # define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
104 # define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
105 # define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
107 #elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
108 # define COMPILER_ID "zOS"
110 # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
111 # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
112 # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
114 #elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
115 # define COMPILER_ID "XL"
117 # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
118 # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
119 # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
121 #elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
122 # define COMPILER_ID "VisualAge"
124 # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
125 # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
126 # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
129 # define COMPILER_ID "PGI"
130 # define COMPILER_VERSION_MAJOR DEC(__PGIC__)
131 # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
132 # if defined(__PGIC_PATCHLEVEL__)
133 # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
136 #elif defined(_CRAYC)
137 # define COMPILER_ID "Cray"
138 # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
139 # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
141 #elif defined(__TI_COMPILER_VERSION__)
142 # define COMPILER_ID "TI"
144 # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
145 # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
146 # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
148 #elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
149 # define COMPILER_ID "Fujitsu"
151 #elif defined(__SCO_VERSION__)
152 # define COMPILER_ID "SCO"
154 #elif defined(__clang__) && defined(__apple_build_version__)
155 # define COMPILER_ID "AppleClang"
156 # if defined(_MSC_VER)
157 # define SIMULATE_ID "MSVC"
159 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
160 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
161 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
162 # if defined(_MSC_VER)
164 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
165 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
167 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
169 #elif defined(__clang__)
170 # define COMPILER_ID "Clang"
171 # if defined(_MSC_VER)
172 # define SIMULATE_ID "MSVC"
174 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
175 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
176 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
177 # if defined(_MSC_VER)
179 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
180 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
183 #elif defined(__GNUC__)
184 # define COMPILER_ID "GNU"
185 # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
186 # if defined(__GNUC_MINOR__)
187 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
189 # if defined(__GNUC_PATCHLEVEL__)
190 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
193 #elif defined(_MSC_VER)
194 # define COMPILER_ID "MSVC"
196 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
197 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
198 # if defined(_MSC_FULL_VER)
199 # if _MSC_VER >= 1400
201 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
204 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
207 # if defined(_MSC_BUILD)
208 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
211 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
212 # define COMPILER_ID "ADSP"
213 #if defined(__VISUALDSPVERSION__)
215 # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
216 # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
217 # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
220 #elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
221 # define COMPILER_ID "IAR"
223 #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
224 # define COMPILER_ID "MIPSpro"
225 # if defined(_SGI_COMPILER_VERSION)
227 # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
228 # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
229 # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
232 # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
233 # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
234 # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
242 # define COMPILER_ID "MIPSpro"
244 #elif defined(__hpux) || defined(__hpua)
245 # define COMPILER_ID "HP"
248 # define COMPILER_ID ""
255 char const* info_compiler =
"INFO" ":" "compiler[" COMPILER_ID
"]";
257 char const* info_simulate =
"INFO" ":" "simulate[" SIMULATE_ID
"]";
261 char const* qnxnto =
"INFO" ":" "qnxnto[]";
264 #define STRINGIFY_HELPER(X) #X
265 #define STRINGIFY(X) STRINGIFY_HELPER(X)
268 #if defined(__linux) || defined(__linux__) || defined(linux)
269 # define PLATFORM_ID "Linux"
271 #elif defined(__CYGWIN__)
272 # define PLATFORM_ID "Cygwin"
274 #elif defined(__MINGW32__)
275 # define PLATFORM_ID "MinGW"
277 #elif defined(__APPLE__)
278 # define PLATFORM_ID "Darwin"
280 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
281 # define PLATFORM_ID "Windows"
283 #elif defined(__FreeBSD__) || defined(__FreeBSD)
284 # define PLATFORM_ID "FreeBSD"
286 #elif defined(__NetBSD__) || defined(__NetBSD)
287 # define PLATFORM_ID "NetBSD"
289 #elif defined(__OpenBSD__) || defined(__OPENBSD)
290 # define PLATFORM_ID "OpenBSD"
292 #elif defined(__sun) || defined(sun)
293 # define PLATFORM_ID "SunOS"
295 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
296 # define PLATFORM_ID "AIX"
298 #elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
299 # define PLATFORM_ID "IRIX"
301 #elif defined(__hpux) || defined(__hpux__)
302 # define PLATFORM_ID "HP-UX"
304 #elif defined(__HAIKU__)
305 # define PLATFORM_ID "Haiku"
307 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
308 # define PLATFORM_ID "BeOS"
310 #elif defined(__QNX__) || defined(__QNXNTO__)
311 # define PLATFORM_ID "QNX"
313 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
314 # define PLATFORM_ID "Tru64"
316 #elif defined(__riscos) || defined(__riscos__)
317 # define PLATFORM_ID "RISCos"
319 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
320 # define PLATFORM_ID "SINIX"
322 #elif defined(__UNIX_SV__)
323 # define PLATFORM_ID "UNIX_SV"
325 #elif defined(__bsdos__)
326 # define PLATFORM_ID "BSDOS"
328 #elif defined(_MPRAS) || defined(MPRAS)
329 # define PLATFORM_ID "MP-RAS"
331 #elif defined(__osf) || defined(__osf__)
332 # define PLATFORM_ID "OSF1"
334 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
335 # define PLATFORM_ID "SCO_SV"
337 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
338 # define PLATFORM_ID "ULTRIX"
340 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
341 # define PLATFORM_ID "Xenix"
343 #elif defined(__WATCOMC__)
344 # if defined(__LINUX__)
345 # define PLATFORM_ID "Linux"
347 # elif defined(__DOS__)
348 # define PLATFORM_ID "DOS"
350 # elif defined(__OS2__)
351 # define PLATFORM_ID "OS2"
353 # elif defined(__WINDOWS__)
354 # define PLATFORM_ID "Windows3x"
357 # define PLATFORM_ID ""
361 # define PLATFORM_ID ""
370 #if defined(_WIN32) && defined(_MSC_VER)
371 # if defined(_M_IA64)
372 # define ARCHITECTURE_ID "IA64"
374 # elif defined(_M_X64) || defined(_M_AMD64)
375 # define ARCHITECTURE_ID "x64"
377 # elif defined(_M_IX86)
378 # define ARCHITECTURE_ID "X86"
380 # elif defined(_M_ARM)
382 # define ARCHITECTURE_ID "ARMV4I"
384 # define ARCHITECTURE_ID "ARMV5I"
386 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
389 # elif defined(_M_MIPS)
390 # define ARCHITECTURE_ID "MIPS"
392 # elif defined(_M_SH)
393 # define ARCHITECTURE_ID "SHx"
396 # define ARCHITECTURE_ID ""
399 #elif defined(__WATCOMC__)
401 # define ARCHITECTURE_ID "I86"
403 # elif defined(_M_IX86)
404 # define ARCHITECTURE_ID "X86"
407 # define ARCHITECTURE_ID ""
411 # define ARCHITECTURE_ID ""
416 ('0' + (((n) / 10000000)%10)), \
417 ('0' + (((n) / 1000000)%10)), \
418 ('0' + (((n) / 100000)%10)), \
419 ('0' + (((n) / 10000)%10)), \
420 ('0' + (((n) / 1000)%10)), \
421 ('0' + (((n) / 100)%10)), \
422 ('0' + (((n) / 10)%10)), \
427 ('0' + ((n)>>28 & 0xF)), \
428 ('0' + ((n)>>24 & 0xF)), \
429 ('0' + ((n)>>20 & 0xF)), \
430 ('0' + ((n)>>16 & 0xF)), \
431 ('0' + ((n)>>12 & 0xF)), \
432 ('0' + ((n)>>8 & 0xF)), \
433 ('0' + ((n)>>4 & 0xF)), \
437 #ifdef COMPILER_VERSION_MAJOR
438 char const info_version[] = {
439 'I',
'N',
'F',
'O',
':',
440 'c',
'o',
'm',
'p',
'i',
'l',
'e',
'r',
'_',
'v',
'e',
'r',
's',
'i',
'o',
'n',
'[',
441 COMPILER_VERSION_MAJOR,
442 # ifdef COMPILER_VERSION_MINOR
443 '.', COMPILER_VERSION_MINOR,
444 # ifdef COMPILER_VERSION_PATCH
445 '.', COMPILER_VERSION_PATCH,
446 # ifdef COMPILER_VERSION_TWEAK
447 '.', COMPILER_VERSION_TWEAK,
455 #ifdef SIMULATE_VERSION_MAJOR
456 char const info_simulate_version[] = {
457 'I',
'N',
'F',
'O',
':',
458 's',
'i',
'm',
'u',
'l',
'a',
't',
'e',
'_',
'v',
'e',
'r',
's',
'i',
'o',
'n',
'[',
459 SIMULATE_VERSION_MAJOR,
460 # ifdef SIMULATE_VERSION_MINOR
461 '.', SIMULATE_VERSION_MINOR,
462 # ifdef SIMULATE_VERSION_PATCH
463 '.', SIMULATE_VERSION_PATCH,
464 # ifdef SIMULATE_VERSION_TWEAK
465 '.', SIMULATE_VERSION_TWEAK,
476 char const* info_platform =
"INFO" ":" "platform[" PLATFORM_ID
"]";
477 char const* info_arch =
"INFO" ":" "arch[" ARCHITECTURE_ID
"]";
482 const char* info_language_dialect_default =
"INFO" ":" "dialect_default["
483 #if __cplusplus >= 201402L
485 #elif __cplusplus >= 201103L
494 int main(
int argc,
char* argv[])
497 require += info_compiler[argc];
498 require += info_platform[argc];
499 #ifdef COMPILER_VERSION_MAJOR
500 require += info_version[argc];
503 require += info_simulate[argc];
505 #ifdef SIMULATE_VERSION_MAJOR
506 require += info_simulate_version[argc];
508 require += info_language_dialect_default[argc];