CMakeFortranCompilerId.F.in 8.63 KB
Newer Older
1 2 3 4
      PROGRAM CMakeFortranCompilerId
#if 0
! Identify the compiler
#endif
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#if defined(_MSC_VER)
       PRINT *, 'INFO:simulate[MSVC]'
# if _MSC_VER >= 1900
       PRINT *, 'INFO:simulate_version[019.00]'
# elif _MSC_VER >= 1800
       PRINT *, 'INFO:simulate_version[018.00]'
# elif _MSC_VER >= 1700
       PRINT *, 'INFO:simulate_version[017.00]'
# elif _MSC_VER >= 1600
       PRINT *, 'INFO:simulate_version[016.00]'
# elif _MSC_VER >= 1500
       PRINT *, 'INFO:simulate_version[015.00]'
# elif _MSC_VER >= 1400
       PRINT *, 'INFO:simulate_version[014.00]'
# elif _MSC_VER >= 1310
       PRINT *, 'INFO:simulate_version[013.01]'
# else
       PRINT *, 'INFO:simulate_version[013.00]'
# endif
#endif
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#if defined(__INTEL_LLVM_COMPILER)
        PRINT *, 'INFO:compiler[IntelLLVM]'
! __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
! later.  Look for 6 digit vs. 8 digit version number to decide encoding.
! VVVV is no smaller than the current year when a versio is released.
# if __INTEL_LLVM_COMPILER < 1000000
#  define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
#  define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
#  define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER    % 10)
# else
#  define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
#  define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
#  define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER     % 100)
# endif
#elif defined(__INTEL_COMPILER) || defined(__ICC)
40
        PRINT *, 'INFO:compiler[Intel]'
41 42 43 44 45 46 47 48 49 50
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
# if defined(__INTEL_COMPILER_UPDATE)
#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
# else
#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
# endif
# if defined(__INTEL_COMPILER_BUILD_DATE)
#  define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
51
#elif defined(__SUNPRO_F95)
52
        PRINT *, 'INFO:compiler[SunPro]'
53 54 55 56 57 58 59 60
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F95>>8)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_F95>>4 & 0xF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_F95    & 0xF)
#elif defined(__SUNPRO_F90)
        PRINT *, 'INFO:compiler[SunPro]'
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F90>>8)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_F90>>4 & 0xF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_F90    & 0xF)
61 62
#elif defined(_CRAYFTN)
        PRINT *, 'INFO:compiler[Cray]'
63 64
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
65 66
#elif defined(__G95__)
        PRINT *, 'INFO:compiler[G95]'
67 68
# define COMPILER_VERSION_MAJOR DEC(__G95__)
# define COMPILER_VERSION_MINOR DEC(__G95_MINOR__)
69 70
#elif defined(__PATHSCALE__)
        PRINT *, 'INFO:compiler[PathScale]'
71 72 73 74 75
# 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
76 77
#elif defined(__ABSOFT__)
        PRINT *, 'INFO:compiler[Absoft]'
78 79
#elif defined(__GNUC__)
        PRINT *, 'INFO:compiler[GNU]'
80 81 82 83 84
# 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
85 86 87 88 89
#elif defined(__IBMC__)
# if defined(__COMPILER_VER__)
        PRINT *, 'INFO:compiler[zOS]'
# elif __IBMC__ >= 800
        PRINT *, 'INFO:compiler[XL]'
90 91 92
#  define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
#  define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
#  define COMPILER_VERSION_PATCH DEC(__IBMC__    % 10)
93
# else
94
        PRINT *, 'INFO:compiler[VisualAge]'
95 96 97
#  define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
#  define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
#  define COMPILER_VERSION_PATCH DEC(__IBMC__    % 10)
98
# endif
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
#elif defined(__NVCOMPILER) || defined(__NVCOMPILER_LLVM__)
        PRINT *, 'INFO:compiler[NVHPC]'
# if defined(__NVCOMPILER_MAJOR__)
#  define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
# else
#  define COMPILER_VERSION_MAJOR DEC(__PGIC__)
# endif
# if defined(__NVCOMPILER_MINOR__)
#  define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
# else
#  define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
# endif
# if defined(__NVCOMPILER_PATCHLEVEL__)
#  define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
# elif defined(__PGIC_PATCHLEVEL__)
#  define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
116 117
#elif defined(__PGI)
        PRINT *, 'INFO:compiler[PGI]'
118 119 120 121 122
# 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
123 124 125 126 127 128 129
#elif defined(__FLANG)
        PRINT *, 'INFO:compiler[Flang]'
# define COMPILER_VERSION_MAJOR DEC(__FLANG_MAJOR__)
# define COMPILER_VERSION_MINOR DEC(__FLANG_MINOR__)
# if defined(__FLANG_PATCHLEVEL__)
#  define COMPILER_VERSION_PATCH DEC(__FLANG_PATCHLEVEL__)
# endif
130 131 132 133
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
        PRINT *, 'INFO:compiler[VisualAge]'
#elif defined(__hpux) || defined(__hpux__)
        PRINT *, 'INFO:compiler[HP]'
134 135 136 137 138
#elif defined(NAGFOR)
        PRINT *, 'INFO:compiler[NAG]'
#define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10)
#define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10)
#define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD)
139
#else
140 141
        PRINT *, 'INFO:compiler[]'
#endif
142
#if defined(_CRAYFTN)
143 144
        PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]'
#endif
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170

#if 0
! Identify the platform
#endif
#if defined(__linux) || defined(__linux__) || defined(linux)
        PRINT *, 'INFO:platform[Linux]'
#elif defined(__CYGWIN__)
        PRINT *, 'INFO:platform[Cygwin]'
#elif defined(__MINGW32__)
        PRINT *, 'INFO:platform[MinGW]'
#elif defined(__APPLE__)
        PRINT *, 'INFO:platform[Darwin]'
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
        PRINT *, 'INFO:platform[Windows]'
#elif defined(__FreeBSD__) || defined(__FreeBSD)
        PRINT *, 'INFO:platform[FreeBSD]'
#elif defined(__NetBSD__) || defined(__NetBSD)
        PRINT *, 'INFO:platform[NetBSD]'
#elif defined(__OpenBSD__) || defined(__OPENBSD)
        PRINT *, 'INFO:platform[OpenBSD]'
#elif defined(__sun) || defined(sun)
        PRINT *, 'INFO:platform[SunOS]'
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
        PRINT *, 'INFO:platform[AIX]'
#elif defined(__hpux) || defined(__hpux__)
        PRINT *, 'INFO:platform[HP-UX]'
171
#elif defined(__HAIKU__)
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
        PRINT *, 'INFO:platform[Haiku]'
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
        PRINT *, 'INFO:platform[BeOS]'
#elif defined(__QNX__) || defined(__QNXNTO__)
        PRINT *, 'INFO:platform[QNX]'
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
        PRINT *, 'INFO:platform[Tru64]'
#elif defined(__riscos) || defined(__riscos__)
        PRINT *, 'INFO:platform[RISCos]'
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
        PRINT *, 'INFO:platform[SINIX]'
#elif defined(__UNIX_SV__)
        PRINT *, 'INFO:platform[UNIX_SV]'
#elif defined(__bsdos__)
        PRINT *, 'INFO:platform[BSDOS]'
#elif defined(_MPRAS) || defined(MPRAS)
        PRINT *, 'INFO:platform[MP-RAS]'
#elif defined(__osf) || defined(__osf__)
        PRINT *, 'INFO:platform[OSF1]'
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
        PRINT *, 'INFO:platform[SCO_SV]'
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
        PRINT *, 'INFO:platform[ULTRIX]'
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
        PRINT *, 'INFO:platform[Xenix]'
197
#else
198
        PRINT *, 'INFO:platform[]'
199 200 201 202 203 204 205 206 207
#endif
#if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC))
# if defined(_M_IA64)
        PRINT *, 'INFO:arch[IA64]'
# elif defined(_M_X64) || defined(_M_AMD64)
        PRINT *, 'INFO:arch[x64]'
# elif defined(_M_IX86)
        PRINT *, 'INFO:arch[X86]'
# endif
208
#endif
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230

#if 0
! Encode compiler version digits
#endif
#define DEC_8(n) (((n) / 10000000) % 10)
#define DEC_7(n) (((n) / 1000000)  % 10)
#define DEC_6(n) (((n) / 100000)   % 10)
#define DEC_5(n) (((n) / 10000)    % 10)
#define DEC_4(n) (((n) / 1000)     % 10)
#define DEC_3(n) (((n) / 100)      % 10)
#define DEC_2(n) (((n) / 10)       % 10)
#define DEC_1(n) (((n)    )        % 10)
#define HEX_8(n) ((n)>>28 & 0xF)
#define HEX_7(n) ((n)>>24 & 0xF)
#define HEX_6(n) ((n)>>20 & 0xF)
#define HEX_5(n) ((n)>>16 & 0xF)
#define HEX_4(n) ((n)>>12 & 0xF)
#define HEX_3(n) ((n)>>8  & 0xF)
#define HEX_2(n) ((n)>>4  & 0xF)
#define HEX_1(n) ((n)     & 0xF)
@CMAKE_Fortran_COMPILER_ID_VERSION_INFO@

231
      END