CMakeFortranCompilerId.F.in 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. PROGRAM CMakeFortranCompilerId
  2. #if 0
  3. ! Identify the compiler
  4. #endif
  5. #if defined(_MSC_VER)
  6. PRINT *, 'INFO:simulate[MSVC]'
  7. # if _MSC_VER >= 1900
  8. PRINT *, 'INFO:simulate_version[019.00]'
  9. # elif _MSC_VER >= 1800
  10. PRINT *, 'INFO:simulate_version[018.00]'
  11. # elif _MSC_VER >= 1700
  12. PRINT *, 'INFO:simulate_version[017.00]'
  13. # elif _MSC_VER >= 1600
  14. PRINT *, 'INFO:simulate_version[016.00]'
  15. # elif _MSC_VER >= 1500
  16. PRINT *, 'INFO:simulate_version[015.00]'
  17. # elif _MSC_VER >= 1400
  18. PRINT *, 'INFO:simulate_version[014.00]'
  19. # elif _MSC_VER >= 1310
  20. PRINT *, 'INFO:simulate_version[013.01]'
  21. # else
  22. PRINT *, 'INFO:simulate_version[013.00]'
  23. # endif
  24. #endif
  25. #if defined(__INTEL_COMPILER) || defined(__ICC)
  26. PRINT *, 'INFO:compiler[Intel]'
  27. # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
  28. # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
  29. # if defined(__INTEL_COMPILER_UPDATE)
  30. # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
  31. # else
  32. # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
  33. # endif
  34. # if defined(__INTEL_COMPILER_BUILD_DATE)
  35. # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
  36. # endif
  37. #elif defined(__SUNPRO_F95)
  38. PRINT *, 'INFO:compiler[SunPro]'
  39. # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F95>>8)
  40. # define COMPILER_VERSION_MINOR HEX(__SUNPRO_F95>>4 & 0xF)
  41. # define COMPILER_VERSION_PATCH HEX(__SUNPRO_F95 & 0xF)
  42. #elif defined(__SUNPRO_F90)
  43. PRINT *, 'INFO:compiler[SunPro]'
  44. # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F90>>8)
  45. # define COMPILER_VERSION_MINOR HEX(__SUNPRO_F90>>4 & 0xF)
  46. # define COMPILER_VERSION_PATCH HEX(__SUNPRO_F90 & 0xF)
  47. #elif defined(_CRAYFTN)
  48. PRINT *, 'INFO:compiler[Cray]'
  49. # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
  50. # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
  51. #elif defined(__G95__)
  52. PRINT *, 'INFO:compiler[G95]'
  53. # define COMPILER_VERSION_MAJOR DEC(__G95__)
  54. # define COMPILER_VERSION_MINOR DEC(__G95_MINOR__)
  55. #elif defined(__PATHSCALE__)
  56. PRINT *, 'INFO:compiler[PathScale]'
  57. # define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
  58. # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
  59. # if defined(__PATHCC_PATCHLEVEL__)
  60. # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
  61. # endif
  62. #elif defined(__ABSOFT__)
  63. PRINT *, 'INFO:compiler[Absoft]'
  64. #elif defined(__GNUC__)
  65. PRINT *, 'INFO:compiler[GNU]'
  66. # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
  67. # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
  68. # if defined(__GNUC_PATCHLEVEL__)
  69. # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
  70. # endif
  71. #elif defined(__IBMC__)
  72. # if defined(__COMPILER_VER__)
  73. PRINT *, 'INFO:compiler[zOS]'
  74. # elif __IBMC__ >= 800
  75. PRINT *, 'INFO:compiler[XL]'
  76. # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
  77. # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
  78. # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
  79. # else
  80. PRINT *, 'INFO:compiler[VisualAge]'
  81. # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
  82. # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
  83. # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
  84. # endif
  85. #elif defined(__PGI)
  86. PRINT *, 'INFO:compiler[PGI]'
  87. # define COMPILER_VERSION_MAJOR DEC(__PGIC__)
  88. # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
  89. # if defined(__PGIC_PATCHLEVEL__)
  90. # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
  91. # endif
  92. #elif defined(__FLANG)
  93. PRINT *, 'INFO:compiler[Flang]'
  94. # define COMPILER_VERSION_MAJOR DEC(__FLANG_MAJOR__)
  95. # define COMPILER_VERSION_MINOR DEC(__FLANG_MINOR__)
  96. # if defined(__FLANG_PATCHLEVEL__)
  97. # define COMPILER_VERSION_PATCH DEC(__FLANG_PATCHLEVEL__)
  98. # endif
  99. #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
  100. PRINT *, 'INFO:compiler[MIPSpro]'
  101. # if 0
  102. ! This compiler is either not known or is too old to define an
  103. ! identification macro. Try to identify the platform and guess that
  104. ! it is the native compiler.
  105. # endif
  106. #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
  107. PRINT *, 'INFO:compiler[VisualAge]'
  108. #elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
  109. PRINT *, 'INFO:compiler[MIPSpro]'
  110. #elif defined(__hpux) || defined(__hpux__)
  111. PRINT *, 'INFO:compiler[HP]'
  112. #elif defined(NAGFOR)
  113. PRINT *, 'INFO:compiler[NAG]'
  114. #define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10)
  115. #define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10)
  116. #define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD)
  117. #elif 1
  118. # if 0
  119. ! The above 'elif 1' instead of 'else' is to work around a bug in the
  120. ! SGI preprocessor which produces both the __sgi and else blocks.
  121. # endif
  122. PRINT *, 'INFO:compiler[]'
  123. #endif
  124. #if defined(__CRAYXE) || defined(__CRAYXC)
  125. PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]'
  126. #endif
  127. #if 0
  128. ! Identify the platform
  129. #endif
  130. #if defined(__linux) || defined(__linux__) || defined(linux)
  131. PRINT *, 'INFO:platform[Linux]'
  132. #elif defined(__CYGWIN__)
  133. PRINT *, 'INFO:platform[Cygwin]'
  134. #elif defined(__MINGW32__)
  135. PRINT *, 'INFO:platform[MinGW]'
  136. #elif defined(__APPLE__)
  137. PRINT *, 'INFO:platform[Darwin]'
  138. #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
  139. PRINT *, 'INFO:platform[Windows]'
  140. #elif defined(__FreeBSD__) || defined(__FreeBSD)
  141. PRINT *, 'INFO:platform[FreeBSD]'
  142. #elif defined(__NetBSD__) || defined(__NetBSD)
  143. PRINT *, 'INFO:platform[NetBSD]'
  144. #elif defined(__OpenBSD__) || defined(__OPENBSD)
  145. PRINT *, 'INFO:platform[OpenBSD]'
  146. #elif defined(__sun) || defined(sun)
  147. PRINT *, 'INFO:platform[SunOS]'
  148. #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
  149. PRINT *, 'INFO:platform[AIX]'
  150. #elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
  151. PRINT *, 'INFO:platform[IRIX]'
  152. #elif defined(__hpux) || defined(__hpux__)
  153. PRINT *, 'INFO:platform[HP-UX]'
  154. #elif defined(__HAIKU__)
  155. PRINT *, 'INFO:platform[Haiku]'
  156. #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
  157. PRINT *, 'INFO:platform[BeOS]'
  158. #elif defined(__QNX__) || defined(__QNXNTO__)
  159. PRINT *, 'INFO:platform[QNX]'
  160. #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
  161. PRINT *, 'INFO:platform[Tru64]'
  162. #elif defined(__riscos) || defined(__riscos__)
  163. PRINT *, 'INFO:platform[RISCos]'
  164. #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
  165. PRINT *, 'INFO:platform[SINIX]'
  166. #elif defined(__UNIX_SV__)
  167. PRINT *, 'INFO:platform[UNIX_SV]'
  168. #elif defined(__bsdos__)
  169. PRINT *, 'INFO:platform[BSDOS]'
  170. #elif defined(_MPRAS) || defined(MPRAS)
  171. PRINT *, 'INFO:platform[MP-RAS]'
  172. #elif defined(__osf) || defined(__osf__)
  173. PRINT *, 'INFO:platform[OSF1]'
  174. #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
  175. PRINT *, 'INFO:platform[SCO_SV]'
  176. #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
  177. PRINT *, 'INFO:platform[ULTRIX]'
  178. #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
  179. PRINT *, 'INFO:platform[Xenix]'
  180. #elif 1
  181. # if 0
  182. ! The above 'elif 1' instead of 'else' is to work around a bug in the
  183. ! SGI preprocessor which produces both the __sgi and else blocks.
  184. # endif
  185. PRINT *, 'INFO:platform[]'
  186. #endif
  187. #if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC))
  188. # if defined(_M_IA64)
  189. PRINT *, 'INFO:arch[IA64]'
  190. # elif defined(_M_X64) || defined(_M_AMD64)
  191. PRINT *, 'INFO:arch[x64]'
  192. # elif defined(_M_IX86)
  193. PRINT *, 'INFO:arch[X86]'
  194. # endif
  195. #endif
  196. #if 0
  197. ! Encode compiler version digits
  198. #endif
  199. #define DEC_8(n) (((n) / 10000000) % 10)
  200. #define DEC_7(n) (((n) / 1000000) % 10)
  201. #define DEC_6(n) (((n) / 100000) % 10)
  202. #define DEC_5(n) (((n) / 10000) % 10)
  203. #define DEC_4(n) (((n) / 1000) % 10)
  204. #define DEC_3(n) (((n) / 100) % 10)
  205. #define DEC_2(n) (((n) / 10) % 10)
  206. #define DEC_1(n) (((n) ) % 10)
  207. #define HEX_8(n) ((n)>>28 & 0xF)
  208. #define HEX_7(n) ((n)>>24 & 0xF)
  209. #define HEX_6(n) ((n)>>20 & 0xF)
  210. #define HEX_5(n) ((n)>>16 & 0xF)
  211. #define HEX_4(n) ((n)>>12 & 0xF)
  212. #define HEX_3(n) ((n)>>8 & 0xF)
  213. #define HEX_2(n) ((n)>>4 & 0xF)
  214. #define HEX_1(n) ((n) & 0xF)
  215. @CMAKE_Fortran_COMPILER_ID_VERSION_INFO@
  216. END