@@ -53,14 +53,7 @@ if(BUILD_INDEX64)
5353 set (LAPACKELIB "lapacke64" )
5454 set (TMGLIB "tmglib64" )
5555 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWeirdNEC -DLAPACK_ILP64 -DHAVE_LAPACK_CONFIG_H" )
56- set (CPE_ENV $ENV{PE_ENV} )
57- if (CPE_ENV STREQUAL "CRAY" )
58- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -sinteger64" )
59- elseif (CPE_ENV STREQUAL "NVIDIA" )
60- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -i8" )
61- else ()
62- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8" )
63- endif ()
56+ set (FORTRAN_ILP TRUE )
6457else ()
6558 set (BLASLIB "blas" )
6659 set (CBLASLIB "cblas" )
@@ -98,28 +91,44 @@ include(PreventInBuildInstalls)
9891
9992# Check if recursive flag exists
10093include (CheckFortranCompilerFlag)
101- check_fortran_compiler_flag("-recursive" _recursiveFlag)
102- check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
103- check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
94+ if (CMAKE_Fortran_COMPILER_ID STREQUAL Flang)
95+ check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
96+ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
97+ check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
98+ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
99+ check_fortran_compiler_flag("-recursive" _recursiveFlag)
100+ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL XL)
101+ check_fortran_compiler_flag("-qrecur" _qrecurFlag)
102+ else ()
103+ message (WARNING "Fortran local arrays should be allocated on the stack."
104+ " Please use a compiler which guarantees that feature."
105+ " See https://github.com/Reference-LAPACK/lapack/pull/188 and references therein." )
106+ endif ()
104107
105108# Add recursive flag
106- if (_recursiveFlag )
107- string (REGEX MATCH "-recursive " output_test <string > "${CMAKE_Fortran_FLAGS} " )
109+ if (_MrecursiveFlag )
110+ string (REGEX MATCH "-Mrecursive " output_test <string > "${CMAKE_Fortran_FLAGS} " )
108111 if (NOT output_test)
109- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive "
112+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive "
110113 CACHE STRING "Recursive flag must be set" FORCE)
111114 endif ()
112115elseif (_frecursiveFlag)
113116 string (REGEX MATCH "-frecursive" output_test <string > "${CMAKE_Fortran_FLAGS} " )
114117 if (NOT output_test)
115118 set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive"
116- CACHE STRING "Recursive flag must be set" FORCE)
119+ CACHE STRING "Recursive flag must be set" FORCE)
117120 endif ()
118- elseif (_MrecursiveFlag )
119- string (REGEX MATCH "-Mrecursive " output_test <string > "${CMAKE_Fortran_FLAGS} " )
121+ elseif (_recursiveFlag )
122+ string (REGEX MATCH "-recursive " output_test <string > "${CMAKE_Fortran_FLAGS} " )
120123 if (NOT output_test)
121- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
122- CACHE STRING "Recursive flag must be set" FORCE)
124+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
125+ CACHE STRING "Recursive flag must be set" FORCE)
126+ endif ()
127+ elseif (_qrecurFlag)
128+ string (REGEX MATCH "-qrecur" output_test <string > "${CMAKE_Fortran_FLAGS} " )
129+ if (NOT output_test)
130+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qrecur"
131+ CACHE STRING "Recursive flag must be set" FORCE)
123132 endif ()
124133endif ()
125134
@@ -128,7 +137,7 @@ if(UNIX)
128137 set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict" )
129138 endif ()
130139 if (CMAKE_Fortran_COMPILER_ID STREQUAL XL)
131- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none " )
140+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict" )
132141 endif ()
133142# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
134143# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
0 commit comments