@@ -28,9 +28,9 @@ find_or_install()
28
28
done
29
29
30
30
if [[ " $package " == " $executable " ]]; then
31
- echo -e " $this_script : Checking whether $executable is in the PATH..."
31
+ printf " $this_script : Checking whether $executable is in the PATH..."
32
32
else
33
- echo -e " $this_script : Checking whether $package executable $executable is in the PATH..."
33
+ printf " $this_script : Checking whether $package executable $executable is in the PATH..."
34
34
fi
35
35
if type " $executable " > /dev/null; then
36
36
printf " yes.\n"
@@ -43,8 +43,7 @@ find_or_install()
43
43
44
44
package_install_path=$( ./build.sh -P " $package " )
45
45
46
- echo -e " $this_script : Checking whether $executable is in the directory in which $this_script \n"
47
- printf " installs it by default and whether the user has executable permission for it..."
46
+ printf " Checking whether $executable is in the prerequisites/instalations directory.."
48
47
if [[ -x " $package_install_path /bin/$executable " ]]; then
49
48
printf " yes.\n"
50
49
script_installed_package=true
@@ -111,8 +110,30 @@ find_or_install()
111
110
# Every branch that discovers an acceptable pre-existing installation must set the
112
111
# MPIFC, MPICC, and MPICXX environment variables. Every branch must also manage the
113
112
# dependency stack.
113
+
114
+ if [[ ! -z " ${arg_f} " ]]; then
115
+
116
+ # -f or --with-fortran argument specifies a compiler, which we use if mpif90
117
+ # invokes the specified compiler. Otherwise, we halt and print an error message.
118
+
119
+ mpif90_wraps=$( mpif90 --version)
120
+ compiler=$( ${arg_f} --version)
121
+ if [[ " ${mpif90_wraps} " != " ${compiler} " ]]; then
122
+ emergency " The specified compiler ${arg_f} differs from the compiler that mpif90 invokes."
123
+ else
124
+ info " mpif90 invokes the specified compiler ${arg_f} "
125
+ fi
126
+ export MPIFC=mpif90
127
+ export MPICC=mpicc
128
+ export MPICXX=mpicxx
129
+
130
+ # Halt the recursion
131
+ stack_push dependency_pkg " none"
132
+ stack_push dependency_exe " none"
133
+ stack_push dependency_path " none"
134
+
135
+ elif [[ " $script_installed_package " == true ]]; then
114
136
115
- if [[ " $script_installed_package " == true ]]; then
116
137
echo -e " $this_script : Using the $package installed by $this_script \n"
117
138
export MPIFC=$package_install_path /bin/mpif90
118
139
export MPICC=$package_install_path /bin/mpicc
@@ -123,9 +144,10 @@ find_or_install()
123
144
stack_push dependency_path " none"
124
145
125
146
elif [[ " $package_in_path " == " true" ]]; then
147
+
126
148
echo -e " $this_script : Checking whether $executable in PATH wraps gfortran... "
127
- mpif90__version_header =$( mpif90 --version | head -1)
128
- first_three_characters=$( echo " $mpif90__version_header " | cut -c1-3)
149
+ mpif90_version_header =$( mpif90 --version | head -1)
150
+ first_three_characters=$( echo " $mpif90_version_header " | cut -c1-3)
129
151
if [[ " $first_three_characters " != " GNU" ]]; then
130
152
printf " no.\n"
131
153
# Trigger 'find_or_install gcc' and subsequent build of $package
@@ -142,11 +164,8 @@ find_or_install()
142
164
is_true=$( ./print_true)
143
165
rm acceptable_compiler print_true
144
166
145
- [ " $acceptable " == " $is_true " ] && printf " yes.\n"
146
- [ ! -z " ${arg_f} " ] && printf " no.\n Default compiler installation overridden by --with-fortran/-f=${arg_f} \n"
147
-
148
- if [[ " $acceptable " == " $is_true " || ! -z " ${arg_f} " ]]; then
149
- echo -e " $this_script : Using the $executable found in the PATH.\n"
167
+ if [[ " $acceptable " == " $is_true " ]]; then
168
+ printf " yes.\n $this_script : Using the $executable found in the PATH.\n"
150
169
export MPIFC=mpif90
151
170
export MPICC=mpicc
152
171
export MPICXX=mpicxx
@@ -173,7 +192,7 @@ find_or_install()
173
192
174
193
elif [[ $package == " gcc" ]]; then
175
194
176
- # We arrive when the 'elif [[ $package == "gcc " ]]' block pushes "gcc" onto the
195
+ # We arrive here when the 'elif [[ $package == "mpich " ]]' block pushes "gcc" onto the
177
196
# the dependency_pkg stack, resulting in the recursive call 'find_or_install gcc'
178
197
179
198
# Every branch that discovers an acceptable pre-existing installation must set the
0 commit comments