Skip to content

Commit d278115

Browse files
author
Quellyn Snead
committed
Address issues with IBM XL builds (#606).
Be more explicit about selecting recursive fortran flags, as not every compiler will correctly reject an incorrect option (e.g., XL).
1 parent 79aa0f2 commit d278115

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

CBLAS/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/cblas_mangling.h
1111
MACRO_NAMESPACE "F77_"
1212
SYMBOL_NAMESPACE "F77_")
1313
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
14-
message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
15-
configure_file(include/lapacke_mangling_with_flags.h.in
16-
${LAPACK_BINARY_DIR}/include/lapacke_mangling.h)
14+
message(WARNING "Reverting to pre-defined include/cblas_mangling.h")
1715
configure_file(include/cblas_mangling_with_flags.h.in
1816
${LAPACK_BINARY_DIR}/include/cblas_mangling.h)
1917
endif()

CMakeLists.txt

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,28 +91,40 @@ include(PreventInBuildInstalls)
9191

9292
# Check if recursive flag exists
9393
include(CheckFortranCompilerFlag)
94-
check_fortran_compiler_flag("-recursive" _recursiveFlag)
95-
check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
96-
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+
endif()
97103

98104
# Add recursive flag
99-
if(_recursiveFlag)
100-
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
105+
if(_MrecursiveFlag)
106+
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
101107
if(NOT output_test)
102-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
108+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
103109
CACHE STRING "Recursive flag must be set" FORCE)
104110
endif()
105111
elseif(_frecursiveFlag)
106112
string(REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
107113
if(NOT output_test)
108114
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive"
109-
CACHE STRING "Recursive flag must be set" FORCE)
115+
CACHE STRING "Recursive flag must be set" FORCE)
110116
endif()
111-
elseif(_MrecursiveFlag)
112-
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
117+
elseif(_recursiveFlag)
118+
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
113119
if(NOT output_test)
114-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
115-
CACHE STRING "Recursive flag must be set" FORCE)
120+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
121+
CACHE STRING "Recursive flag must be set" FORCE)
122+
endif()
123+
elseif(_qrecurFlag)
124+
string(REGEX MATCH "-qrecur" output_test <string> "${CMAKE_Fortran_FLAGS}")
125+
if(NOT output_test)
126+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qrecur"
127+
CACHE STRING "Recursive flag must be set" FORCE)
116128
endif()
117129
endif()
118130

@@ -121,7 +133,7 @@ if(UNIX)
121133
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict")
122134
endif()
123135
if(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
124-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none")
136+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict")
125137
endif()
126138
# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
127139
# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin

INSTALL/make.inc.XLF

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ CFLAGS = -O3 -qnosave
1414
# the compiler options desired when NO OPTIMIZATION is selected.
1515
#
1616
FC = xlf
17-
FFLAGS = -O3 -qfixed -qnosave
17+
FFLAGS = -O3 -qfixed -qnosave -qrecur
1818
# For -O2, add -qstrict=none
1919
FFLAGS_DRV = $(FFLAGS)
20-
FFLAGS_NOOPT = -O0 -qfixed -qnosave
20+
FFLAGS_NOOPT = -O0 -qfixed -qnosave -qrecur
2121

2222
# Define LDFLAGS to the desired linker options for your machine.
2323
#

0 commit comments

Comments
 (0)