@@ -248,9 +248,33 @@ else
248
248
249
249
# Install OpenCoarrays
250
250
251
- source prerequisites/build-functions/set_SUDO_if_needed_to_write_to_directory.sh " $install_prefix "
251
+
252
+ set_SUDO_if_needed_to_write_to_install_dir ()
253
+ {
254
+ info " Checking whether the directory ${install_prefix} exists... "
255
+ if [[ -d " ${install_prefix} " ]]; then
256
+ info " yes"
257
+ info " Checking whether I have write permissions to ${install_prefix} ... "
258
+ if [[ -w " ${install_prefix} " ]]; then
259
+ info " yes"
260
+ else
261
+ info " no"
262
+ SUDO=" sudo"
263
+ fi
264
+ else
265
+ info " no"
266
+ info " Checking whether I can create ${install_prefix} ... "
267
+ if mkdir -p " ${install_prefix} " >& /dev/null; then
268
+ info " yes."
269
+ else
270
+ info " no."
271
+ SUDO=" sudo"
272
+ fi
273
+ fi
274
+ }
275
+ set_SUDO_if_needed_to_write_to_install_dir
252
276
253
- if [[ -d build ]]; then
277
+ if [[ -d " $build_path " ]]; then
254
278
rm -rf " $build_path "
255
279
fi
256
280
mkdir -p " $build_path "
@@ -264,4 +288,17 @@ else
264
288
info " Installing OpenCoarrays with the following command:"
265
289
info " ${SUDO:- } make install"
266
290
${SUDO:- } make install
291
+ if [[ -f " $install_prefix " /lib/libcaf_mpi.a && -f " ${install_prefix} /bin/caf" && -f " ${install_prefix} /bin/cafrun" ]]; then
292
+ info " OpenCoarrays has been installed in"
293
+ info " $install_prefix "
294
+ else
295
+ info " Something went wrong. OpenCoarrays is not in the expected location:"
296
+ emergency " $install_prefix "
297
+ fi
298
+ # See http://stackoverflow.com/questions/31057694/gethostbyname-fail-after-switching-internet-connections/31222970
299
+ loopback_line=` grep $NAME /etc/hosts`
300
+ if [[ -z " ${loopback_line:- } " ]]; then
301
+ info " To ensure the correct functioning of MPI, please add the following line to your /etc/hosts file:"
302
+ info " 127.0.0.1 $NAME "
303
+ fi
267
304
fi
0 commit comments