2007-04-30 22:10:37 +00: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 13:35:01 +00:00
|
|
|
#ifndef __cplusplus
|
|
|
|
# error "A C compiler has been selected for C++."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__COMO__)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "Comeau"
|
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(__INTEL_COMPILER) || defined(__ICC)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "Intel"
|
2011-12-06 16:54:58 +00: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)
|
|
|
|
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
|
|
|
# endif
|
2007-05-23 15:00:54 +00:00
|
|
|
|
2010-05-17 18:11:20 +00:00
|
|
|
#elif defined(__clang__)
|
|
|
|
# define COMPILER_ID "Clang"
|
2011-12-06 20:14:47 +00: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 18:11:20 +00:00
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(__BORLANDC__)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "Borland"
|
2011-12-06 17:06:06 +00:00
|
|
|
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
|
|
|
|
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
|
2007-05-23 15:00:54 +00:00
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(__WATCOMC__)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "Watcom"
|
2011-12-07 14:18:13 +00:00
|
|
|
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
|
|
|
|
# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
|
2007-05-23 15:00:54 +00:00
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(__SUNPRO_CC)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "SunPro"
|
2011-12-07 14:22:11 +00:00
|
|
|
# if __SUNPRO_CC >= 0x5100
|
|
|
|
# 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
|
|
|
|
# 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 15:00:54 +00:00
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(__HP_aCC)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "HP"
|
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(__DECCXX)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "Compaq"
|
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(__IBMCPP__)
|
2009-08-07 14:13:07 +00:00
|
|
|
# if defined(__COMPILER_VER__)
|
|
|
|
# define COMPILER_ID "zOS"
|
|
|
|
# else
|
2011-12-06 17:07:35 +00:00
|
|
|
# if __IBMCPP__ >= 800
|
|
|
|
# define COMPILER_ID "XL"
|
|
|
|
# else
|
|
|
|
# define COMPILER_ID "VisualAge"
|
|
|
|
# endif
|
|
|
|
# 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 14:13:07 +00:00
|
|
|
# endif
|
2007-05-23 15:00:54 +00:00
|
|
|
|
2007-09-17 19:55:17 +00:00
|
|
|
#elif defined(__PGI)
|
|
|
|
# define COMPILER_ID "PGI"
|
2011-12-06 20:10:29 +00: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 19:55:17 +00:00
|
|
|
|
2010-01-13 17:12:39 +00:00
|
|
|
#elif defined(__PATHSCALE__)
|
|
|
|
# define COMPILER_ID "PathScale"
|
|
|
|
|
2010-11-12 14:12:08 +00:00
|
|
|
#elif defined(_CRAYC)
|
|
|
|
# define COMPILER_ID "Cray"
|
|
|
|
|
2010-12-28 17:15:47 +00:00
|
|
|
#elif defined(__TI_COMPILER_VERSION__)
|
|
|
|
# define COMPILER_ID "TI_DSP"
|
|
|
|
|
2011-01-17 14:52:33 +00:00
|
|
|
#elif defined(__SCO_VERSION__)
|
|
|
|
# define COMPILER_ID "SCO"
|
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(__GNUC__)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "GNU"
|
2011-12-06 16:56:43 +00: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 15:00:54 +00:00
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(_MSC_VER)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "MSVC"
|
2011-12-06 16:56:51 +00: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
|
|
|
|
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
|
|
|
|
# else
|
|
|
|
# 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 15:00:54 +00:00
|
|
|
|
2007-07-12 17:41:00 +00:00
|
|
|
#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
|
2008-02-25 14:23:14 +00:00
|
|
|
/* Analog Devices C++ compiler for Blackfin, TigerSHARC and
|
2007-07-12 17:41:00 +00:00
|
|
|
SHARC (21000) DSPs */
|
|
|
|
# define COMPILER_ID "ADSP"
|
|
|
|
|
2009-07-14 19:17:21 +00:00
|
|
|
#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "MIPSpro"
|
2007-04-28 13:35:01 +00: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 15:00:54 +00:00
|
|
|
# define COMPILER_ID "MIPSpro"
|
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#elif defined(__hpux) || defined(__hpua)
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID "HP"
|
2007-04-28 13:35:01 +00:00
|
|
|
|
|
|
|
#else /* unknown compiler */
|
2007-05-23 15:00:54 +00:00
|
|
|
# define COMPILER_ID ""
|
|
|
|
|
2007-04-28 13:35:01 +00:00
|
|
|
#endif
|
2007-05-23 15:00:54 +00:00
|
|
|
|
2008-03-10 13:32:25 +00: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 20:35:15 +00:00
|
|
|
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
2007-04-28 13:35:01 +00:00
|
|
|
|
2008-02-25 14:23:14 +00:00
|
|
|
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
|
2008-08-07 13:09:45 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
int require = 0;
|
|
|
|
require += info_compiler[argc];
|
|
|
|
require += info_platform[argc];
|
2011-12-05 14:44:09 +00:00
|
|
|
#ifdef COMPILER_VERSION_MAJOR
|
|
|
|
require += info_version[argc];
|
|
|
|
#endif
|
2008-08-07 13:09:45 +00:00
|
|
|
(void)argv;
|
|
|
|
return require;
|
|
|
|
}
|