Skip to content

Commit 88cc00f

Browse files
committed
install.sh: Improve compiler detection
Detect LFortran (not yet supported)
1 parent 2478c5e commit 88cc00f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

install.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,15 @@ exit_if_pkg_config_pc_file_missing "caffeine"
441441
user_compiler_flags="${CPPFLAGS:-} ${FFLAGS:-}"
442442

443443
compiler_version=$($FPM_FC --version)
444-
if [[ $compiler_version == *flang* ]]; then
444+
if [[ $compiler_version =~ 'flang' ]]; then
445445
compiler_flag="-g -O3"
446-
else # assume gfortran
446+
elif [[ $compiler_version =~ 'GNU Fortran' ]]; then
447447
compiler_flag="-g -O3 -ffree-line-length-0 -Wno-unused-dummy-argument"
448+
elif [[ $compiler_version =~ 'LFortran' ]]; then
449+
compiler_flag="-g -O3 --cpp"
450+
else # unknown compiler
451+
compiler_flag="-g -O2"
452+
echo "WARNING: Failed to detect a recognized Fortran compiler"
448453
fi
449454
compiler_flag+=" -DASSERT_MULTI_IMAGE -DASSERT_PARALLEL_CALLBACKS"
450455

0 commit comments

Comments
 (0)