@@ -108,8 +108,8 @@ usage()
108
108
echo " $this_script [<options>] or [<installation-path> <number-of-threads>]"
109
109
echo " "
110
110
echo " Options:"
111
- echo " -h, --help Show this help message"
112
- echo " -v, -- version Show version information"
111
+ echo " -h, --help Show this help message"
112
+ echo " -v, -V, -- version Show version information"
113
113
echo " "
114
114
echo " Examples:"
115
115
echo " "
@@ -254,28 +254,38 @@ find_or_install()
254
254
255
255
elif [[ " $package_in_path " == " true" ]]; then
256
256
printf " $this_script : Checking whether $executable in PATH wraps gfortran version 5.1.0 or later... "
257
- $executable -o acceptable_compiler acceptable_compiler.f90
258
- $executable -o print_true print_true.f90
259
- is_true=` ./print_true`
260
- acceptable=` ./acceptable_compiler`
261
- rm acceptable_compiler print_true
262
- if [[ " $acceptable " == " $is_true " ]]; then
263
- printf " yes.\n"
264
- printf " $this_script : Using the $executable found in the PATH.\n"
265
- export MPIFC=mpif90
266
- export MPICC=mpicc
267
- export MPICXX=mpicxx
268
- stack_push acceptable_in_path $package $executable
269
- # Halt the recursion
270
- stack_push dependency_pkg " none"
271
- stack_push dependency_exe " none"
272
- stack_push dependency_path " none"
273
- else
257
+ mpif90__version_header=` mpif90 --version | head -1`
258
+ first_three_characters=` echo $mpif90__version_header | cut -c1-3`
259
+ if [[ " $first_three_characters " != " GNU" ]]; then
274
260
printf " no.\n"
275
261
# Trigger 'find_or_install gcc' and subsequent build of $package
276
262
stack_push dependency_pkg " none" $package " gcc"
277
263
stack_push dependency_exe " none" $executable " gfortran"
278
264
stack_push dependency_path " none" ` ./build $package --default --query-path` ` ./build gcc --default --query-path`
265
+ else
266
+ $executable -o acceptable_compiler acceptable_compiler.f90
267
+ $executable -o print_true print_true.f90
268
+ is_true=` ./print_true`
269
+ acceptable=` ./acceptable_compiler`
270
+ rm acceptable_compiler print_true
271
+ if [[ " $acceptable " == " $is_true " ]]; then
272
+ printf " no.\n"
273
+ # Trigger 'find_or_install gcc' and subsequent build of $package
274
+ stack_push dependency_pkg " none" $package " gcc"
275
+ stack_push dependency_exe " none" $executable " gfortran"
276
+ stack_push dependency_path " none" ` ./build $package --default --query-path` ` ./build gcc --default --query-path`
277
+ else
278
+ printf " yes.\n"
279
+ printf " $this_script : Using the $executable found in the PATH.\n"
280
+ export MPIFC=mpif90
281
+ export MPICC=mpicc
282
+ export MPICXX=mpicxx
283
+ stack_push acceptable_in_path $package $executable
284
+ # Halt the recursion
285
+ stack_push dependency_pkg " none"
286
+ stack_push dependency_exe " none"
287
+ stack_push dependency_path " none"
288
+ fi
279
289
fi
280
290
281
291
else # $package not in PATH and not yet installed by this script
@@ -603,10 +613,43 @@ find_or_install()
603
613
fi # End 'if [[ "$package" != "none" ]]; then'
604
614
}
605
615
616
+ print_header ()
617
+ {
618
+ clear
619
+ echo " "
620
+ echo " *** A default build of OpenCoarrays requires CMake 3.4.0 or later ***"
621
+ echo " *** and MPICH 3.1.4 wrapping GCC Fortran (gfortran) 5.1.0 or later. ***"
622
+ echo " *** Additionally, CMake, MPICH, and GCC have their own prerequisites. ***"
623
+ echo " *** This script will check for most known requirements in your PATH ***"
624
+ echo " *** environment variable and in the default installation directory ***"
625
+ echo " *** to which this script installs each missing prerequisite. The ***"
626
+ echo " *** script will recursively traverse the following dependency tree ***"
627
+ echo " *** and ask permission to download, build, and install any missing ***"
628
+ echo " *** prerequisites: ***"
629
+ echo " "
630
+ tree $opencoarrays_src_dir /doc/dependency_tree | tail -n+2
631
+ echo " "
632
+ echo " *** All prequisites will be downloaded to, built in, and installed in ***"
633
+ echo " $opencoarrays_src_dir /install_prerequisites"
634
+ printf " *** OpenCoarrays will be installed "
635
+ if [[ " $install_path " == " $opencoarrays_src_dir /opencoarrays-installation" ]]; then
636
+ printf " in the above location also. ***\n"
637
+ else
638
+ printf " in ***\n"
639
+ echo " $install_path "
640
+ fi
641
+ printf " Ready to proceed? (y/n)"
642
+ read install_now
643
+
644
+ if [[ " $install_now " != " y" ]]; then
645
+ printf " \n$this_script : Aborting. [exit 85]\n"
646
+ exit 85
647
+ fi
648
+ }
649
+
606
650
build_opencoarrays ()
607
651
{
608
- # A default OpenCoarrays build requires CMake and MPICH. Secondary
609
- # dependencies will be found or installed along the way.
652
+ print_header
610
653
find_or_install mpich &&
611
654
find_or_install cmake &&
612
655
mkdir -p $build_path &&
@@ -665,6 +708,31 @@ report_results()
665
708
echo " export PATH=\" $mpich_install_path /bin\" :\$ PATH " >> $install_path /setup.sh
666
709
echo " fi " >> $install_path /setup.sh
667
710
fi
711
+ cmake_install_path=` ./build cmake --default --query-path`
712
+ if [[ -x " $cmake_install_path /bin/cmake" ]]; then
713
+ echo " if [[ -z \"\$ PATH\" ]]; then " >> $install_path /setup.sh
714
+ echo " export PATH=\" $cmake_install_path /bin\" " >> $install_path /setup.sh
715
+ echo " else " >> $install_path /setup.sh
716
+ echo " export PATH=\" $cmake_install_path /bin\" :\$ PATH " >> $install_path /setup.sh
717
+ echo " fi " >> $install_path /setup.sh
718
+ fi
719
+ flex_install_path=` ./build flex --default --query-path`
720
+ if [[ -x " $flex_install_path /bin/flex" ]]; then
721
+ echo " if [[ -z \"\$ PATH\" ]]; then " >> $install_path /setup.sh
722
+ echo " export PATH=\" $flex_install_path /bin\" " >> $install_path /setup.sh
723
+ echo " else " >> $install_path /setup.sh
724
+ echo " export PATH=\" $flex_install_path /bin\" :\$ PATH " >> $install_path /setup.sh
725
+ echo " fi " >> $install_path /setup.sh
726
+ fi
727
+ bison_install_path=` ./build bison --default --query-path`
728
+ if [[ -x " $bison_install_path /bin/yacc" ]]; then
729
+ echo " if [[ -z \"\$ PATH\" ]]; then " >> $install_path /setup.sh
730
+ echo " export PATH=\" $bison_install_path /bin\" " >> $install_path /setup.sh
731
+ echo " else " >> $install_path /setup.sh
732
+ echo " export PATH=\" $bison_install_path /bin\" :\$ PATH " >> $install_path /setup.sh
733
+ echo " fi " >> $install_path /setup.sh
734
+ fi
735
+ echo " *** Before using caf, cafrun, or build, please execute the following command ***"
668
736
echo " *** Before using caf, cafrun, or build, please execute the following command ***"
669
737
echo " *** or add it to your login script and launch a new shell (or the equivalent ***"
670
738
echo " *** for your shell if you are not using a bash shell): ***"
0 commit comments