Skip to content

Commit 8e14412

Browse files
author
Damian Rouson
authored
Merge pull request #230 from sourceryinstitute/fix-install-with-ancient-gcc-in-path
Fixes #229
2 parents 32c081d + 6cea240 commit 8e14412

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

prerequisites/install-functions/find_or_install.sh

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,17 @@ find_or_install()
163163

164164
else
165165

166-
echo -e "$this_script: Checking whether $executable in PATH wraps gfortran version >= $(./build.sh -V gcc) and < 7.0.0 ... "
167-
$executable acceptable_compiler.f90 -o acceptable_compiler
168-
$executable print_true.f90 -o print_true
169-
acceptable=$(./acceptable_compiler)
170-
is_true=$(./print_true)
171-
rm acceptable_compiler print_true
172-
173-
if [[ "$acceptable" == "$is_true" ]]; then
166+
info "$this_script: Checking whether $executable in PATH wraps gfortran version >= $(./build.sh -V gcc) and < 7.0.0 ... "
167+
$executable acceptable_compiler.f90 -o acceptable_compiler || true;
168+
$executable print_true.f90 -o print_true || true;
169+
if [[ -f ./acceptable_compiler && -f ./print_true ]]; then
170+
acceptable=$(./acceptable_compiler)
171+
is_true=$(./print_true)
172+
rm acceptable_compiler print_true
173+
else
174+
acceptable=false
175+
fi
176+
if [[ "$acceptable" == "${is_true:-}" ]]; then
174177
printf "yes.\n %s: Using the $executable found in the PATH.\n" "$this_script"
175178
export MPIFC=mpif90
176179
export MPICC=mpicc
@@ -260,13 +263,17 @@ find_or_install()
260263
stack_push dependency_path "none"
261264

262265
elif [[ "$package_in_path" == "true" ]]; then
263-
echo -e "$this_script: Checking whether $executable in PATH is version $(./build.sh -V gcc) or later..."
264-
$executable -o acceptable_compiler acceptable_compiler.f90
265-
$executable -o print_true print_true.f90
266-
is_true=$(./print_true)
267-
acceptable=$(./acceptable_compiler)
268-
rm acceptable_compiler print_true
269-
if [[ "$acceptable" == "$is_true" ]]; then
266+
info "$this_script: Checking whether $executable in PATH is version $(./build.sh -V gcc) or later..."
267+
$executable -o acceptable_compiler acceptable_compiler.f90 || true;
268+
$executable -o print_true print_true.f90 || true;
269+
if [[ -f ./accepatable_compiler && -f ./print_true ]]; then
270+
is_true=$(./print_true)
271+
acceptable=$(./acceptable_compiler)
272+
rm acceptable_compiler print_true
273+
else
274+
acceptable=false
275+
fi
276+
if [[ "$acceptable" == "${is_true:-}" ]]; then
270277
printf "yes.\n"
271278
echo -e "$this_script: Using the $executable found in the PATH.\n"
272279
export FC=gfortran

0 commit comments

Comments
 (0)