2007-04-28 17:35:01 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
# error "A C++ compiler has been selected for C."
|
|
|
|
#endif
|
|
|
|
|
2012-01-10 22:22:15 +04:00
|
|
|
/* Version number components: V=Version, R=Revision, P=Patch
|
|
|
|
Version date components: YYYY=Year, MM=Month, DD=Day */
|
|
|
|
|
2008-02-26 02:47:19 +03:00
|
|
|
#if defined(__18CXX)
|
|
|
|
# define ID_VOID_MAIN
|
|
|
|
#endif
|
2007-04-28 17:35:01 +04:00
|
|
|
|
|
|
|
#if defined(__INTEL_COMPILER) || defined(__ICC)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "Intel"
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __INTEL_COMPILER = VRP */
|
2011-12-06 20:54:58 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
|
|
|
|
# if defined(__INTEL_COMPILER_BUILD_DATE)
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
|
2011-12-06 20:54:58 +04:00
|
|
|
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
|
|
|
# endif
|
2013-10-11 21:54:50 +04:00
|
|
|
# if defined(_MSC_VER)
|
|
|
|
# define SIMULATE_ID "MSVC"
|
|
|
|
/* _MSC_VER = VVRR */
|
|
|
|
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
|
|
|
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
|
|
|
# endif
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2012-11-05 17:33:54 +04:00
|
|
|
#elif defined(__PATHCC__)
|
|
|
|
# define COMPILER_ID "PathScale"
|
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
|
|
|
|
# if defined(__PATHCC_PATCHLEVEL__)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
|
|
|
|
# endif
|
|
|
|
|
2010-05-17 22:11:20 +04:00
|
|
|
#elif defined(__clang__)
|
2013-10-02 21:52:48 +04:00
|
|
|
# if defined(__apple_build_version__)
|
|
|
|
# define COMPILER_ID "AppleClang"
|
|
|
|
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
|
|
|
|
# else
|
|
|
|
# define COMPILER_ID "Clang"
|
|
|
|
# endif
|
2011-12-07 00:14:47 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
2013-10-04 18:13:08 +04:00
|
|
|
# if defined(_MSC_VER)
|
|
|
|
# define SIMULATE_ID "MSVC"
|
|
|
|
/* _MSC_VER = VVRR */
|
|
|
|
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
|
|
|
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
|
|
|
# endif
|
2010-05-17 22:11:20 +04:00
|
|
|
|
2012-02-17 23:17:32 +04:00
|
|
|
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
|
|
|
|
# define COMPILER_ID "Embarcadero"
|
|
|
|
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
|
|
|
|
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
|
|
|
|
# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)
|
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__BORLANDC__)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "Borland"
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __BORLANDC__ = 0xVRR */
|
2011-12-06 21:06:06 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
|
|
|
|
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__WATCOMC__)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "Watcom"
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __WATCOMC__ = VVRR */
|
2011-12-07 18:18:13 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__SUNPRO_C)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "SunPro"
|
2011-12-07 18:22:11 +04:00
|
|
|
# if __SUNPRO_C >= 0x5100
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __SUNPRO_C = 0xVRRP */
|
2011-12-07 18:22:11 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
|
|
|
|
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
|
|
|
|
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
|
|
|
# else
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __SUNPRO_C = 0xVRP */
|
2011-12-07 18:22:11 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
|
|
|
|
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
|
|
|
|
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
|
|
|
# endif
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__HP_cc)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "HP"
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __HP_cc = VVRRPP */
|
2012-01-10 22:07:04 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__DECC)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "Compaq"
|
2012-08-22 18:15:00 +04:00
|
|
|
/* __DECC_VER = VVRRTPPPP */
|
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__IBMC__)
|
2009-08-07 18:13:07 +04:00
|
|
|
# if defined(__COMPILER_VER__)
|
|
|
|
# define COMPILER_ID "zOS"
|
|
|
|
# else
|
2011-12-06 21:07:35 +04:00
|
|
|
# if __IBMC__ >= 800
|
|
|
|
# define COMPILER_ID "XL"
|
|
|
|
# else
|
|
|
|
# define COMPILER_ID "VisualAge"
|
|
|
|
# endif
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __IBMC__ = VRP */
|
2011-12-06 21:07:35 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
2009-08-07 18:13:07 +04:00
|
|
|
# endif
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2007-09-17 23:55:17 +04:00
|
|
|
#elif defined(__PGI)
|
|
|
|
# define COMPILER_ID "PGI"
|
2011-12-07 00:10:29 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
|
|
|
|
# if defined(__PGIC_PATCHLEVEL__)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
|
|
|
|
# endif
|
2007-09-17 23:55:17 +04:00
|
|
|
|
2010-11-12 17:12:08 +03:00
|
|
|
#elif defined(_CRAYC)
|
|
|
|
# define COMPILER_ID "Cray"
|
2012-08-22 19:31:33 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
|
2010-11-12 17:12:08 +03:00
|
|
|
|
2010-12-28 20:15:47 +03:00
|
|
|
#elif defined(__TI_COMPILER_VERSION__)
|
2013-03-14 02:11:29 +04:00
|
|
|
# define COMPILER_ID "TI"
|
2012-08-22 18:15:58 +04:00
|
|
|
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
|
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
|
2010-12-28 20:15:47 +03:00
|
|
|
|
2011-12-02 19:08:15 +04:00
|
|
|
#elif defined(__TINYC__)
|
|
|
|
# define COMPILER_ID "TinyCC"
|
|
|
|
|
2011-01-17 17:52:33 +03:00
|
|
|
#elif defined(__SCO_VERSION__)
|
|
|
|
# define COMPILER_ID "SCO"
|
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__GNUC__)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "GNU"
|
2011-12-06 20:56:43 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
|
|
|
|
# if defined(__GNUC_PATCHLEVEL__)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
|
|
|
# endif
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(_MSC_VER)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "MSVC"
|
2012-01-10 22:22:15 +04:00
|
|
|
/* _MSC_VER = VVRR */
|
2011-12-06 20:56:51 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
|
|
|
|
# if defined(_MSC_FULL_VER)
|
|
|
|
# if _MSC_VER >= 1400
|
2012-01-10 22:22:15 +04:00
|
|
|
/* _MSC_FULL_VER = VVRRPPPPP */
|
2011-12-06 20:56:51 +04:00
|
|
|
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
|
|
|
|
# else
|
2012-01-10 22:22:15 +04:00
|
|
|
/* _MSC_FULL_VER = VVRRPPPP */
|
2011-12-06 20:56:51 +04:00
|
|
|
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# if defined(_MSC_BUILD)
|
|
|
|
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
|
|
|
|
# endif
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2012-08-22 19:48:07 +04:00
|
|
|
/* Analog VisualDSP++ >= 4.5.6 */
|
|
|
|
#elif defined(__VISUALDSPVERSION__)
|
|
|
|
# define COMPILER_ID "ADSP"
|
|
|
|
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
|
|
|
|
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
|
|
|
|
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
|
|
|
|
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
|
|
|
|
|
|
|
|
/* Analog VisualDSP++ < 4.5.6 */
|
2007-07-12 21:41:00 +04:00
|
|
|
#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
|
|
|
|
# define COMPILER_ID "ADSP"
|
|
|
|
|
2007-05-24 17:35:24 +04:00
|
|
|
/* IAR Systems compiler for embedded systems.
|
2012-01-05 00:36:49 +04:00
|
|
|
http://www.iar.com */
|
|
|
|
#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
|
|
|
|
# define COMPILER_ID "IAR"
|
2007-05-24 16:33:05 +04:00
|
|
|
|
2008-02-25 17:23:14 +03:00
|
|
|
/* sdcc, the small devices C compiler for embedded systems,
|
2007-06-26 21:19:46 +04:00
|
|
|
http://sdcc.sourceforge.net */
|
2007-05-24 17:35:24 +04:00
|
|
|
#elif defined(SDCC)
|
2007-06-26 21:19:46 +04:00
|
|
|
# define COMPILER_ID "SDCC"
|
2012-08-22 18:27:09 +04:00
|
|
|
/* SDCC = VRP */
|
|
|
|
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
|
2007-05-24 17:35:24 +04:00
|
|
|
|
2009-07-14 23:17:21 +04:00
|
|
|
#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "MIPSpro"
|
2012-01-10 22:29:39 +04:00
|
|
|
# if defined(_SGI_COMPILER_VERSION)
|
|
|
|
/* _SGI_COMPILER_VERSION = VRP */
|
|
|
|
# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
|
|
|
|
# else
|
|
|
|
/* _COMPILER_VERSION = VRP */
|
|
|
|
# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
|
|
|
|
# endif
|
2007-04-28 17:35:01 +04:00
|
|
|
|
|
|
|
/* This compiler is either not known or is too old to define an
|
|
|
|
identification macro. Try to identify the platform and guess that
|
|
|
|
it is the native compiler. */
|
|
|
|
#elif defined(__sgi)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "MIPSpro"
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__hpux) || defined(__hpua)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "HP"
|
2007-04-28 17:35:01 +04:00
|
|
|
|
|
|
|
#else /* unknown compiler */
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID ""
|
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#endif
|
2007-05-22 20:48:16 +04:00
|
|
|
|
2008-03-10 16:32:25 +03:00
|
|
|
/* Construct the string literal in pieces to prevent the source from
|
|
|
|
getting matched. Store it in a pointer rather than an array
|
|
|
|
because some compilers will just produce instructions to fill the
|
|
|
|
array rather than assigning a pointer to a static array. */
|
2010-12-29 23:35:15 +03:00
|
|
|
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
2013-10-04 18:10:22 +04:00
|
|
|
#ifdef SIMULATE_ID
|
|
|
|
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
|
|
|
#endif
|
2007-04-28 17:35:01 +04:00
|
|
|
|
2008-02-25 17:23:14 +03:00
|
|
|
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
|
2008-08-07 17:09:45 +04:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#ifdef ID_VOID_MAIN
|
|
|
|
void main() {}
|
|
|
|
#else
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
int require = 0;
|
|
|
|
require += info_compiler[argc];
|
|
|
|
require += info_platform[argc];
|
2009-11-20 05:58:42 +03:00
|
|
|
require += info_arch[argc];
|
2011-12-05 18:44:09 +04:00
|
|
|
#ifdef COMPILER_VERSION_MAJOR
|
|
|
|
require += info_version[argc];
|
2013-10-04 18:10:22 +04:00
|
|
|
#endif
|
|
|
|
#ifdef SIMULATE_ID
|
|
|
|
require += info_simulate[argc];
|
|
|
|
#endif
|
|
|
|
#ifdef SIMULATE_VERSION_MAJOR
|
|
|
|
require += info_simulate_version[argc];
|
2011-12-05 18:44:09 +04:00
|
|
|
#endif
|
2008-08-07 17:09:45 +04:00
|
|
|
(void)argv;
|
|
|
|
return require;
|
|
|
|
}
|
|
|
|
#endif
|