Skip to content

Commit 0e0e688

Browse files
author
Damian Rouson
committed
Fix installer's compiler-version check
1 parent 2653844 commit 0e0e688

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

prerequisites/acceptable_compiler.f90

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,19 @@
3535
program main
3636
use iso_fortran_env, only : compiler_version
3737
implicit none
38-
print *,(compiler_version() >= "GCC version 6.1.0 ")
38+
integer, parameter :: first_argument=1
39+
integer stat
40+
character(len=9) version_number
41+
call get_command_argument(first_argument,version_number,status=stat)
42+
select case(stat)
43+
case(-1)
44+
error stop "acceptable_compiler.f90: insufficient string length in attempt to read command argument"
45+
case(0)
46+
! successful command argument read
47+
case(1:)
48+
error stop "acceptable_compiler.f90: no version-number supplied"
49+
case default
50+
error stop "invalid status"
51+
end select
52+
print *,(compiler_version() >= "GCC version "//adjustl(trim(version_number))//" ")
3953
end program

prerequisites/install-functions/find_or_install.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,16 +273,18 @@ find_or_install()
273273
stack_push dependency_path "none"
274274

275275
elif [[ "$package_in_path" == "true" ]]; then
276-
info "$this_script: Checking whether $executable in PATH is version $(./build.sh -V gcc) or later..."
276+
export minimum_acceptable_version=$(./build.sh -V gcc)
277+
info "$this_script: Checking whether $executable in PATH is version $minimum_acceptable_version or later..."
277278
$executable -o acceptable_compiler acceptable_compiler.f90 || true;
278279
$executable -o print_true print_true.f90 || true;
279280
if [[ -f ./acceptable_compiler && -f ./print_true ]]; then
280281
is_true=$(./print_true)
281-
acceptable=$(./acceptable_compiler)
282+
acceptable=$(./acceptable_compiler $minimum_acceptable_version)
282283
rm acceptable_compiler print_true
283284
else
284285
acceptable=false
285286
fi
287+
286288
if [[ "$acceptable" == "${is_true:-}" ]]; then
287289
printf "yes.\n"
288290
echo -e "$this_script: Using the $executable found in the PATH.\n"

0 commit comments

Comments
 (0)