2007-05-01 02:10:37 +04:00
|
|
|
/* This source file must have a .cpp extension so that all C++ compilers
|
|
|
|
recognize the extension without flags. Borland does not know .cxx for
|
|
|
|
example. */
|
2007-04-28 17:35:01 +04:00
|
|
|
#ifndef __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 */
|
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#if defined(__COMO__)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "Comeau"
|
2012-08-22 18:16:12 +04:00
|
|
|
/* __COMO_VERSION__ = VRR */
|
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
|
2007-05-23 19:00:54 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif 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
|
2007-05-23 19:00:54 +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__)
|
|
|
|
# define COMPILER_ID "Clang"
|
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__)
|
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-23 19:00:54 +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-23 19:00:54 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__SUNPRO_CC)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "SunPro"
|
2011-12-07 18:22:11 +04:00
|
|
|
# if __SUNPRO_CC >= 0x5100
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __SUNPRO_CC = 0xVRRP */
|
2011-12-07 18:22:11 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
|
|
|
|
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
|
|
|
|
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
|
|
|
|
# else
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __SUNPRO_CC = 0xVRP */
|
2011-12-07 18:22:11 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
|
|
|
|
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
|
|
|
|
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
|
|
|
|
# endif
|
2007-05-23 19:00:54 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__HP_aCC)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "HP"
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __HP_aCC = VVRRPP */
|
2012-01-10 22:07:04 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
|
2007-05-23 19:00:54 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__DECCXX)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "Compaq"
|
2012-08-22 18:15:00 +04:00
|
|
|
/* __DECCXX_VER = VVRRTPPPP */
|
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
|
2007-05-23 19:00:54 +04:00
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__IBMCPP__)
|
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 __IBMCPP__ >= 800
|
|
|
|
# define COMPILER_ID "XL"
|
|
|
|
# else
|
|
|
|
# define COMPILER_ID "VisualAge"
|
|
|
|
# endif
|
2012-01-10 22:22:15 +04:00
|
|
|
/* __IBMCPP__ = VRP */
|
2011-12-06 21:07:35 +04:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
|
2009-08-07 18:13:07 +04:00
|
|
|
# endif
|
2007-05-23 19:00:54 +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__)
|
|
|
|
# define COMPILER_ID "TI_DSP"
|
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-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-23 19:00:54 +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-23 19:00:54 +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"
|
|
|
|
|
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-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-23 19:00:54 +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 "]";
|
2007-04-28 17:35:01 +04:00
|
|
|
|
2008-02-25 17:23:14 +03:00
|
|
|
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
|
2008-08-07 17:09:45 +04:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
int require = 0;
|
|
|
|
require += info_compiler[argc];
|
|
|
|
require += info_platform[argc];
|
2011-12-05 18:44:09 +04:00
|
|
|
#ifdef COMPILER_VERSION_MAJOR
|
|
|
|
require += info_version[argc];
|
|
|
|
#endif
|
2008-08-07 17:09:45 +04:00
|
|
|
(void)argv;
|
|
|
|
return require;
|
|
|
|
}
|
2012-11-20 16:37:50 +04:00
|
|
|
|
|
|
|
#ifdef ADD_MAINCRTSTARTUP
|
|
|
|
extern "C" void mainCRTStartup() {}
|
|
|
|
#endif
|