CMakeFortranCompilerId.F.in 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
  100. PRINT *, 'INFO:compiler[VisualAge]'
  101. #elif defined(__hpux) || defined(__hpux__)
  102. PRINT *, 'INFO:compiler[HP]'
  103. #elif defined(NAGFOR)
  104. PRINT *, 'INFO:compiler[NAG]'
  105. #define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10)
  106. #define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10)
  107. #define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD)
  108. #else
  109. PRINT *, 'INFO:compiler[]'
  110. #endif
  111. #if defined(__CRAYXE) || defined(__CRAYXC)
  112. PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]'
  113. #endif
  114. #if 0
  115. ! Identify the platform
  116. #endif
  117. #if defined(__linux) || defined(__linux__) || defined(linux)
  118. PRINT *, 'INFO:platform[Linux]'
  119. #elif defined(__CYGWIN__)
  120. PRINT *, 'INFO:platform[Cygwin]'
  121. #elif defined(__MINGW32__)
  122. PRINT *, 'INFO:platform[MinGW]'
  123. #elif defined(__APPLE__)
  124. PRINT *, 'INFO:platform[Darwin]'
  125. #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
  126. PRINT *, 'INFO:platform[Windows]'
  127. #elif defined(__FreeBSD__) || defined(__FreeBSD)
  128. PRINT *, 'INFO:platform[FreeBSD]'
  129. #elif defined(__NetBSD__) || defined(__NetBSD)
  130. PRINT *, 'INFO:platform[NetBSD]'
  131. #elif defined(__OpenBSD__) || defined(__OPENBSD)
  132. PRINT *, 'INFO:platform[OpenBSD]'
  133. #elif defined(__sun) || defined(sun)
  134. PRINT *, 'INFO:platform[SunOS]'
  135. #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
  136. PRINT *, 'INFO:platform[AIX]'
  137. #elif defined(__hpux) || defined(__hpux__)
  138. PRINT *, 'INFO:platform[HP-UX]'
  139. #elif defined(__HAIKU__)
  140. PRINT *, 'INFO:platform[Haiku]'
  141. #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
  142. PRINT *, 'INFO:platform[BeOS]'
  143. #elif defined(__QNX__) || defined(__QNXNTO__)
  144. PRINT *, 'INFO:platform[QNX]'
  145. #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
  146. PRINT *, 'INFO:platform[Tru64]'
  147. #elif defined(__riscos) || defined(__riscos__)
  148. PRINT *, 'INFO:platform[RISCos]'
  149. #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
  150. PRINT *, 'INFO:platform[SINIX]'
  151. #elif defined(__UNIX_SV__)
  152. PRINT *, 'INFO:platform[UNIX_SV]'
  153. #elif defined(__bsdos__)
  154. PRINT *, 'INFO:platform[BSDOS]'
  155. #elif defined(_MPRAS) || defined(MPRAS)
  156. PRINT *, 'INFO:platform[MP-RAS]'
  157. #elif defined(__osf) || defined(__osf__)
  158. PRINT *, 'INFO:platform[OSF1]'
  159. #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
  160. PRINT *, 'INFO:platform[SCO_SV]'
  161. #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
  162. PRINT *, 'INFO:platform[ULTRIX]'
  163. #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
  164. PRINT *, 'INFO:platform[Xenix]'
  165. #else
  166. PRINT *, 'INFO:platform[]'
  167. #endif
  168. #if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC))
  169. # if defined(_M_IA64)
  170. PRINT *, 'INFO:arch[IA64]'
  171. # elif defined(_M_X64) || defined(_M_AMD64)
  172. PRINT *, 'INFO:arch[x64]'
  173. # elif defined(_M_IX86)
  174. PRINT *, 'INFO:arch[X86]'
  175. # endif
  176. #endif
  177. #if 0
  178. ! Encode compiler version digits
  179. #endif
  180. #define DEC_8(n) (((n) / 10000000) % 10)
  181. #define DEC_7(n) (((n) / 1000000) % 10)
  182. #define DEC_6(n) (((n) / 100000) % 10)
  183. #define DEC_5(n) (((n) / 10000) % 10)
  184. #define DEC_4(n) (((n) / 1000) % 10)
  185. #define DEC_3(n) (((n) / 100) % 10)
  186. #define DEC_2(n) (((n) / 10) % 10)
  187. #define DEC_1(n) (((n) ) % 10)
  188. #define HEX_8(n) ((n)>>28 & 0xF)
  189. #define HEX_7(n) ((n)>>24 & 0xF)
  190. #define HEX_6(n) ((n)>>20 & 0xF)
  191. #define HEX_5(n) ((n)>>16 & 0xF)
  192. #define HEX_4(n) ((n)>>12 & 0xF)
  193. #define HEX_3(n) ((n)>>8 & 0xF)
  194. #define HEX_2(n) ((n)>>4 & 0xF)
  195. #define HEX_1(n) ((n) & 0xF)
  196. @CMAKE_Fortran_COMPILER_ID_VERSION_INFO@
  197. END