2007-04-28 17:35:01 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
# error "A C++ compiler has been selected for C."
|
|
|
|
#endif
|
|
|
|
|
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"
|
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)
|
|
|
|
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
|
|
|
# endif
|
2007-05-22 20:48:16 +04:00
|
|
|
|
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
|
|
|
|
2007-04-28 17:35:01 +04:00
|
|
|
#elif defined(__BORLANDC__)
|
2007-05-23 19:00:54 +04:00
|
|
|
# define COMPILER_ID "Borland"
|
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"
|
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"
|
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"
|
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"
|
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
|
|
|
|
# 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-01-13 20:12:39 +03:00
|
|
|
#elif defined(__PATHSCALE__)
|
|
|
|
# define COMPILER_ID "PathScale"
|
|
|
|
|
2010-11-12 17:12:08 +03:00
|
|
|
#elif defined(_CRAYC)
|
|
|
|
# define COMPILER_ID "Cray"
|
|
|
|
|
2010-12-28 20:15:47 +03:00
|
|
|
#elif defined(__TI_COMPILER_VERSION__)
|
|
|
|
# define COMPILER_ID "TI_DSP"
|
|
|
|
|
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"
|
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
|
|
|
|
# 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-22 20:48:16 +04:00
|
|
|
|
2007-07-12 21:41:00 +04:00
|
|
|
#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
|
2008-02-25 17:23:14 +03:00
|
|
|
/* Analog Devices C++ compiler for Blackfin, TigerSHARC and
|
2007-07-12 21:41:00 +04:00
|
|
|
SHARC (21000) DSPs */
|
|
|
|
# define COMPILER_ID "ADSP"
|
|
|
|
|
2007-05-24 17:35:24 +04:00
|
|
|
/* IAR Systems compiler for embedded systems.
|
|
|
|
http://www.iar.com
|
2007-06-05 18:28:43 +04:00
|
|
|
Not supported yet by CMake
|
2007-05-24 16:33:05 +04:00
|
|
|
#elif defined(__IAR_SYSTEMS_ICC__)
|
2007-06-05 18:28:43 +04:00
|
|
|
# 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"
|
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"
|
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 "]";
|
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];
|
|
|
|
#endif
|
2008-08-07 17:09:45 +04:00
|
|
|
(void)argv;
|
|
|
|
return require;
|
|
|
|
}
|
|
|
|
#endif
|