ENH: Merging CompilerId implementation from branch CMake-Modules-CompilerId to the main tree. Changes between CMake-Modules-CompilerId-bp and CMake-Modules-CompilerId-mp1 are included.

This commit is contained in:
Brad King 2007-04-28 09:35:01 -04:00
parent bceb1532c6
commit eac71647dd
8 changed files with 329 additions and 66 deletions

View File

@ -1,5 +1,7 @@
SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
SET(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
SET(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
SET(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
SET(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
@ -16,7 +18,7 @@ SET(CMAKE_C_COMPILER_ENV_VAR "CC")
IF(CMAKE_COMPILER_IS_MINGW)
SET(MINGW 1)
ENDIF(CMAKE_COMPILER_IS_MINGW)
SET(CMAKE_COMPILER_IS_GNUCC_RUN 1)
SET(CMAKE_C_COMPILER_ID_RUN 1)
SET(CMAKE_C_SOURCE_FILE_EXTENSIONS c)
SET(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_C_LINKER_PREFERENCE None)

View File

@ -0,0 +1,51 @@
#ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif
#ifdef __CLASSIC_C__
# define const
#endif
static char const info_compiler[] = "INFO:compiler["
#if defined(__INTEL_COMPILER) || defined(__ICC)
"Intel"
#elif defined(__BORLANDC__)
"Borland"
#elif defined(__WATCOMC__)
"Watcom"
#elif defined(__SUNPRO_C)
"SunPro"
#elif defined(__HP_cc)
"HP"
#elif defined(__DECC)
"Compaq"
#elif defined(__IBMC__)
"VisualAge"
#elif defined(__GNUC__)
"GNUC"
#elif defined(_MSC_VER)
"MSVC"
#elif defined(_COMPILER_VERSION)
"MIPSpro"
/* 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)
"MIPSpro"
#elif defined(__hpux) || defined(__hpua)
"HP"
#else /* unknown compiler */
""
#endif
"]";
/* Include the platform identification source. */
#include "CMakePlatformId.h"
/* Make sure the information strings are referenced. */
int main()
{
return ((int)&info_compiler) + ((int)&info_platform);
}

View File

@ -1,5 +1,7 @@
SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
SET(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
SET(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
SET(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
SET(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
@ -16,7 +18,7 @@ SET(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
IF(CMAKE_COMPILER_IS_MINGW)
SET(MINGW 1)
ENDIF(CMAKE_COMPILER_IS_MINGW)
SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
SET(CMAKE_CXX_COMPILER_ID_RUN 1)
SET(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm)
SET(CMAKE_CXX_LINKER_PREFERENCE Prefered)

View File

@ -0,0 +1,49 @@
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#endif
static char const info_compiler[] = "INFO:compiler["
#if defined(__COMO__)
"Comeau"
#elif defined(__INTEL_COMPILER) || defined(__ICC)
"Intel"
#elif defined(__BORLANDC__)
"Borland"
#elif defined(__WATCOMC__)
"Watcom"
#elif defined(__SUNPRO_CC)
"SunPro"
#elif defined(__HP_aCC)
"HP"
#elif defined(__DECCXX)
"Compaq"
#elif defined(__IBMCPP__)
"VisualAge"
#elif defined(__GNUC__)
"GNUC"
#elif defined(_MSC_VER)
"MSVC"
#elif defined(_COMPILER_VERSION)
"MIPSpro"
/* 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)
"MIPSpro"
#elif defined(__hpux) || defined(__hpua)
"HP"
#else /* unknown compiler */
""
#endif
"]";
/* Include the platform identification source. */
#include "CMakePlatformId.h"
/* Make sure the information strings are referenced. */
int main()
{
return ((int)&info_compiler) + ((int)&info_platform);
}

View File

@ -53,42 +53,33 @@ IF(NOT CMAKE_RANLIB)
ENDIF(NOT CMAKE_RANLIB)
MARK_AS_ADVANCED(CMAKE_RANLIB)
# do not test for GNU if the generator is visual studio
# Build a small source file to identify the compiler.
IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
SET(CMAKE_COMPILER_IS_GNUCC_RUN 1)
ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
SET(CMAKE_C_COMPILER_ID_RUN 1)
SET(CMAKE_C_PLATFORM_ID "Windows")
# TODO: Set the compiler id. It is probably MSVC but
# the user may be using an integrated Intel compiler.
# SET(CMAKE_C_COMPILER_ID "MSVC")
ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
IF(NOT CMAKE_C_COMPILER_ID_RUN)
SET(CMAKE_C_COMPILER_ID_RUN 1)
IF(NOT CMAKE_COMPILER_IS_GNUCC_RUN)
# test to see if the c compiler is gnu
IF(CMAKE_C_FLAGS)
SET(CMAKE_BOOT_C_FLAGS ${CMAKE_C_FLAGS})
ELSE(CMAKE_C_FLAGS)
SET(CMAKE_BOOT_C_FLAGS $ENV{CFLAGS})
ENDIF(CMAKE_C_FLAGS)
EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS ${CMAKE_BOOT_C_FLAGS} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
SET(CMAKE_COMPILER_IS_GNUCC_RUN 1)
IF(NOT CMAKE_COMPILER_RETURN)
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
SET(CMAKE_COMPILER_IS_GNUCC 1)
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the C compiler is GNU succeeded with "
"the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
ELSE("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the C compiler is GNU failed with "
"the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
SET(CMAKE_COMPILER_IS_MINGW 1)
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
SET(CMAKE_COMPILER_IS_CYGWIN 1)
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)
ENDIF(NOT CMAKE_COMPILER_IS_GNUCC_RUN)
# Try to identify the compiler.
SET(CMAKE_C_COMPILER_ID)
INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(C ${CMAKE_ROOT}/Modules/CMakeCCompilerId.c)
# Set old compiler and platform id variables.
IF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
SET(CMAKE_COMPILER_IS_GNUCC 1)
ENDIF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
IF("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
SET(CMAKE_COMPILER_IS_MINGW 1)
ELSEIF("${CMAKE_C_PLATFORM_ID}" MATCHES "Cygwin")
SET(CMAKE_COMPILER_IS_CYGWIN 1)
ENDIF("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
ENDIF(NOT CMAKE_C_COMPILER_ID_RUN)
# configure variables set in this file for fast reload later on
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in

View File

@ -61,42 +61,45 @@ IF(NOT CMAKE_RANLIB)
ENDIF(NOT CMAKE_RANLIB)
MARK_AS_ADVANCED(CMAKE_RANLIB)
# do not test for GNU if the generator is visual studio
IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
# This block was used before the compiler was identified by building a
# source file. Unless g++ crashes when building a small C++
# executable this should no longer be needed.
#
# The g++ that comes with BeOS 5 segfaults if you run "g++ -E"
# ("gcc -E" is fine), which throws up a system dialog box that hangs cmake
# until the user clicks "OK"...so for now, we just assume it's g++.
IF(BEOS)
SET(CMAKE_COMPILER_IS_GNUCXX 1)
SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
ENDIF(BEOS)
# IF(BEOS)
# SET(CMAKE_COMPILER_IS_GNUCXX 1)
# SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
# ENDIF(BEOS)
IF(NOT CMAKE_COMPILER_IS_GNUCXX_RUN)
# test to see if the cxx compiler is gnu
SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
IF(NOT CMAKE_COMPILER_RETURN)
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
SET(CMAKE_COMPILER_IS_GNUCXX 1)
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the C++ compiler is GNU succeeded with "
"the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
ELSE("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the C++ compiler is GNU failed with "
"the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
SET(CMAKE_COMPILER_IS_MINGW 1)
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
SET(CMAKE_COMPILER_IS_CYGWIN 1)
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX_RUN)
# Build a small source file to identify the compiler.
IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
SET(CMAKE_CXX_COMPILER_ID_RUN 1)
SET(CMAKE_CXX_PLATFORM_ID "Windows")
# TODO: Set the compiler id. It is probably MSVC but
# the user may be using an integrated Intel compiler.
# SET(CMAKE_CXX_COMPILER_ID "MSVC")
ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
IF(NOT CMAKE_CXX_COMPILER_ID_RUN)
SET(CMAKE_CXX_COMPILER_ID_RUN 1)
# Try to identify the compiler.
SET(CMAKE_CXX_COMPILER_ID)
INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerId.cpp)
# Set old compiler and platform id variables.
IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
SET(CMAKE_COMPILER_IS_GNUCXX 1)
ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
IF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
SET(CMAKE_COMPILER_IS_MINGW 1)
ELSEIF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "Cygwin")
SET(CMAKE_COMPILER_IS_CYGWIN 1)
ENDIF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
ENDIF(NOT CMAKE_CXX_COMPILER_ID_RUN)
# configure all variables set in this file
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in

View File

@ -0,0 +1,111 @@
# Macro to compile a source file to identify the compiler. This is
# used internally by CMake and should not be included by user code.
MACRO(CMAKE_DETERMINE_COMPILER_ID lang src)
# Store the compiler identification source file.
SET(CMAKE_${lang}_COMPILER_ID_SRC "${src}")
IF(WIN32 AND NOT CYGWIN)
# This seems to escape spaces:
#FILE(TO_NATIVE_PATH "${CMAKE_${lang}_COMPILER_ID_SRC}"
# CMAKE_${lang}_COMPILER_ID_SRC)
STRING(REGEX REPLACE "/" "\\\\" CMAKE_${lang}_COMPILER_ID_SRC
"${CMAKE_${lang}_COMPILER_ID_SRC}")
ENDIF(WIN32 AND NOT CYGWIN)
# Make sure user-specified compiler flags are used.
IF(CMAKE_${lang}_FLAGS)
SET(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS})
ELSE(CMAKE_${lang}_FLAGS)
SET(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${lang}FLAGS})
ENDIF(CMAKE_${lang}_FLAGS)
# Create an empty directory in which to run the test.
SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang})
FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
# Compile the compiler identification source.
STRING(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
IF(COMMAND EXECUTE_PROCESS)
EXECUTE_PROCESS(
COMMAND ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} ${CMAKE_${lang}_COMPILER_ID_SRC}
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
)
ELSE(COMMAND EXECUTE_PROCESS)
EXEC_PROGRAM(
${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR}
ARGS ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} \"${CMAKE_${lang}_COMPILER_ID_SRC}\"
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT
)
ENDIF(COMMAND EXECUTE_PROCESS)
# Check the result of compilation.
IF(CMAKE_${lang}_COMPILER_ID_RESULT)
# Compilation failed.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Compiling the ${lang} compiler identification source file \""
"${CMAKE_${lang}_COMPILER_ID_SRC}\" failed with the following output:\n"
"${CMAKE_${lang}_COMPILER_ID_RESULT}\n"
"${CMAKE_${lang}_COMPILER_ID_OUTPUT}\n\n")
ELSE(CMAKE_${lang}_COMPILER_ID_RESULT)
# Compilation succeeded.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Compiling the ${lang} compiler identification source file \""
"${CMAKE_${lang}_COMPILER_ID_SRC}\" succeeded with the following output:\n"
"${CMAKE_${lang}_COMPILER_ID_OUTPUT}\n\n")
# Find the executable produced by the compiler.
SET(CMAKE_${lang}_COMPILER_ID_EXE)
GET_FILENAME_COMPONENT(CMAKE_${lang}_COMPILER_ID_SRC_BASE ${CMAKE_${lang}_COMPILER_ID_SRC} NAME_WE)
FOREACH(name a.out a.exe ${CMAKE_${lang}_COMPILER_ID_SRC_BASE}.exe)
IF(EXISTS ${CMAKE_${lang}_COMPILER_ID_DIR}/${name})
SET(CMAKE_${lang}_COMPILER_ID_EXE ${CMAKE_${lang}_COMPILER_ID_DIR}/${name})
ENDIF(EXISTS ${CMAKE_${lang}_COMPILER_ID_DIR}/${name})
ENDFOREACH(name)
# Check if the executable was found.
IF(CMAKE_${lang}_COMPILER_ID_EXE)
# The executable was found.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Compilation of the ${lang} compiler identification source \""
"${CMAKE_${lang}_COMPILER_ID_SRC}\" produced \""
"${CMAKE_${lang}_COMPILER_ID_EXE}\"\n\n")
# Read the compiler identification string from the executable file.
FILE(STRINGS ${CMAKE_${lang}_COMPILER_ID_EXE}
CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 2 REGEX "INFO:")
FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
IF("${info}" MATCHES ".*INFO:compiler\\[(.*)\\].*")
STRING(REGEX REPLACE ".*INFO:compiler\\[(.*)\\].*" "\\1"
CMAKE_${lang}_COMPILER_ID "${info}")
ELSEIF("${info}" MATCHES ".*INFO:platform\\[(.*)\\].*")
STRING(REGEX REPLACE ".*INFO:platform\\[(.*)\\].*" "\\1"
CMAKE_${lang}_PLATFORM_ID "${info}")
ENDIF("${info}" MATCHES ".*INFO:compiler\\[(.*)\\].*")
ENDFOREACH(info)
# Check the compiler identification string.
IF(CMAKE_${lang}_COMPILER_ID)
# The compiler identification was found.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"The ${lang} compiler identification is ${CMAKE_${lang}_COMPILER_ID}\n\n")
ELSE(CMAKE_${lang}_COMPILER_ID)
# The compiler identification could not be found.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"The ${lang} compiler identification could not be found in \""
"${CMAKE_${lang}_COMPILER_ID_EXE}\"\n\n")
ENDIF(CMAKE_${lang}_COMPILER_ID)
ELSE(CMAKE_${lang}_COMPILER_ID_EXE)
# The executable was not found.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Compilation of the ${lang} compiler identification source \""
"${CMAKE_${lang}_COMPILER_ID_SRC}\" did not produce an executable in "
"${CMAKE_${lang}_COMPILER_ID_DIR} "
"with a name known to CMake.\n\n")
ENDIF(CMAKE_${lang}_COMPILER_ID_EXE)
ENDIF(CMAKE_${lang}_COMPILER_ID_RESULT)
ENDMACRO(CMAKE_DETERMINE_COMPILER_ID)

54
Modules/CMakePlatformId.h Normal file
View File

@ -0,0 +1,54 @@
/* Identify known platforms by name. */
static char const info_platform[] = "INFO:platform["
#if defined(__linux) || defined(__linux__) || defined(linux)
"Linux"
#elif defined(__CYGWIN__)
"Cygwin"
#elif defined(__MINGW32__)
"MinGW"
#elif defined(__APPLE__)
"Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
"Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
"FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
"NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
"OpenBSD"
#elif defined(__sun) || defined(sun)
"SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
"AIX"
#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
"IRIX"
#elif defined(__hpux) || defined(__hpux__)
"HP-UX"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
"BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
"QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
"Tru64"
#elif defined(__riscos) || defined(__riscos__)
"RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
"SINIX"
#elif defined(__UNIX_SV__)
"UNIX_SV"
#elif defined(__bsdos__)
"BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
"MP-RAS"
#elif defined(__osf) || defined(__osf__)
"OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
"SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
"ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
"Xenix"
#else /* unknown platform */
""
#endif
"]";