From ef756b96e4614d5aa6d75eae72090d4833ae49af Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 25 Jun 2009 08:45:19 -0400 Subject: ENH: Identify Fortran compilers with fixed format This enhances the Fortran compiler id detection by using a source that can compile either as free or fixed format. As long as the compiler knows it should preprocess the source file (.F) the identification can work. Even free-format compilers may try fixed-format parsing if the user specifies certain flags, so we must support both. --- Modules/CMakeDetermineFortranCompiler.cmake | 2 +- Modules/CMakeFortranCompilerId.F.in | 92 +++++++++++++++++++++++++++++ Modules/CMakeFortranCompilerId.F90.in | 84 -------------------------- 3 files changed, 93 insertions(+), 85 deletions(-) create mode 100644 Modules/CMakeFortranCompilerId.F.in delete mode 100644 Modules/CMakeFortranCompilerId.F90.in diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 7afa5ee..b554a8d 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -120,7 +120,7 @@ IF(NOT CMAKE_Fortran_COMPILER_ID_RUN) # Try to identify the compiler. SET(CMAKE_Fortran_COMPILER_ID) INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) - CMAKE_DETERMINE_COMPILER_ID(Fortran FFLAGS CMakeFortranCompilerId.F90) + CMAKE_DETERMINE_COMPILER_ID(Fortran FFLAGS CMakeFortranCompilerId.F) # Fall back to old is-GNU test. IF(NOT CMAKE_Fortran_COMPILER_ID) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in new file mode 100644 index 0000000..74e2cd5 --- /dev/null +++ b/Modules/CMakeFortranCompilerId.F.in @@ -0,0 +1,92 @@ + PROGRAM CMakeFortranCompilerId +#if 0 +! Identify the compiler +#endif +#if defined(__INTEL_COMPILER) || defined(__ICC) + PRINT *, 'INFO:compiler[Intel]' +#elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95) + PRINT *, 'INFO:compiler[SunPro]' +#elif defined(__GNUC__) + PRINT *, 'INFO:compiler[GNU]' +#elif defined(__IBM__) || defined(__IBMC__) + PRINT *, 'INFO:compiler[VisualAge]' +#elif defined(__PGI) + PRINT *, 'INFO:compiler[PGI]' +#elif defined(_COMPILER_VERSION) + PRINT *, 'INFO:compiler[MIPSpro]' +# if 0 +! 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. +# endif +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) + PRINT *, 'INFO:compiler[VisualAge]' +#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) + PRINT *, 'INFO:compiler[MIPSpro]' +#elif defined(__hpux) || defined(__hpux__) + PRINT *, 'INFO:compiler[HP]' +#else + PRINT *, 'INFO:compiler[]' +#endif + +#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(__sgi) || defined(__sgi__) || defined(_SGI) + PRINT *, 'INFO:platform[IRIX]' +#elif defined(__hpux) || defined(__hpux__) + PRINT *, 'INFO:platform[HP-UX]' +#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU) + PRINT *, 'INFO:platform[Haiku]' +# if 0 +! Haiku also defines __BEOS__ so we must +! put it prior to the check for __BEOS__ +# endif +#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]' +#else + PRINT *, 'INFO:platform[]' +#endif + END diff --git a/Modules/CMakeFortranCompilerId.F90.in b/Modules/CMakeFortranCompilerId.F90.in deleted file mode 100644 index c7facb5..0000000 --- a/Modules/CMakeFortranCompilerId.F90.in +++ /dev/null @@ -1,84 +0,0 @@ -PROGRAM CMakeFortranCompilerId -! Identify the compiler -#if defined(__INTEL_COMPILER) || defined(__ICC) - PRINT *, 'INFO:compiler[Intel]' -#elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95) - PRINT *, 'INFO:compiler[SunPro]' -#elif defined(__GNUC__) - PRINT *, 'INFO:compiler[GNU]' -#elif defined(__IBM__) || defined(__IBMC__) - PRINT *, 'INFO:compiler[VisualAge]' -#elif defined(__PGI) - PRINT *, 'INFO:compiler[PGI]' -#elif defined(_COMPILER_VERSION) - PRINT *, 'INFO:compiler[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(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) - PRINT *, 'INFO:compiler[VisualAge]' -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) - PRINT *, 'INFO:compiler[MIPSpro]' -#elif defined(__hpux) || defined(__hpux__) - PRINT *, 'INFO:compiler[HP]' -#else - PRINT *, 'INFO:compiler[]' -#endif - -! Identify the platform -#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(__sgi) || defined(__sgi__) || defined(_SGI) - PRINT *, 'INFO:platform[IRIX]' -#elif defined(__hpux) || defined(__hpux__) - PRINT *, 'INFO:platform[HP-UX]' -#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU) - PRINT *, 'INFO:platform[Haiku]' -! Haiku also defines __BEOS__ so we must -! put it prior to the check for __BEOS__ -#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]' -#else - PRINT *, 'INFO:platform[]' -#endif -END PROGRAM -- cgit v0.12