5
5
# -- This script installs OpenCoarrays and its prerequisites.
6
6
#
7
7
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
8
- # Copyright (c) 2015, Sourcery, Inc.
9
- # Copyright (c) 2015, Sourcery Institute
8
+ # Copyright (c) 2015-2016 , Sourcery, Inc.
9
+ # Copyright (c) 2015-2016 , Sourcery Institute
10
10
# All rights reserved.
11
11
#
12
12
# Redistribution and use in source and binary forms, with or without modification,
@@ -141,6 +141,7 @@ find_or_install()
141
141
" mpich:mpif90"
142
142
" flex:flex"
143
143
" bison:yacc"
144
+ " m4:m4"
144
145
" _unknown:0"
145
146
)
146
147
for element in " ${package_executable_array[@]} " ; do
@@ -206,7 +207,7 @@ find_or_install()
206
207
elif [[ " $package_in_path " == " true" ]]; then
207
208
printf " $this_script : Checking whether $package in PATH is version < $minimum_version ... "
208
209
209
- if [[ " $package_version_in_path " < " $executable version $minimum_version " ]] ; then
210
+ if ! ./check_version.sh $package ` ./build $package --default --query-version ` ; then
210
211
printf " yes.\n"
211
212
# Here we place $package on the dependency stack to trigger the build of the above file:
212
213
stack_push dependency_pkg $package " none"
@@ -264,7 +265,7 @@ find_or_install()
264
265
stack_push dependency_path " none" ` ./build $package --default --query-path` ` ./build gcc --default --query-path`
265
266
else
266
267
printf " yes.\n"
267
- printf " $this_script : Checking whether $executable in PATH wraps gfortran version 5.1 .0 or later... "
268
+ printf " $this_script : Checking whether $executable in PATH wraps gfortran version 5.3 .0 or later... "
268
269
$executable acceptable_compiler.f90 -o acceptable_compiler
269
270
$executable print_true.f90 -o print_true
270
271
acceptable=` ./acceptable_compiler`
@@ -331,7 +332,7 @@ find_or_install()
331
332
stack_push dependency_path " none"
332
333
333
334
elif [[ " $package_in_path " == " true" ]]; then
334
- printf " $this_script : Checking whether $executable in PATH is version 5.1 .0 or later..."
335
+ printf " $this_script : Checking whether $executable in PATH is version 5.3 .0 or later..."
335
336
$executable -o acceptable_compiler acceptable_compiler.f90
336
337
$executable -o print_true print_true.f90
337
338
is_true=` ./print_true`
@@ -399,22 +400,28 @@ find_or_install()
399
400
elif [[ " $package_in_path " == " true" ]]; then
400
401
401
402
printf " $this_script : Checking whether $package in PATH is version < $minimum_version ... "
402
- if [[ " $package_version_in_path " < " $executable $minimum_version " ]] ; then
403
+ if ! ./check_version.sh $package ` ./build $package --default --query-version ` ; then
403
404
printf " yes\n"
404
405
405
406
export FLEX=" $package_install_path /bin/$executable "
406
407
# Trigger 'find_or_install bison' and subsequent build of $package
407
408
stack_push dependency_pkg " bison"
408
409
stack_push dependency_exe " yacc"
409
410
stack_push dependency_path ` ./build bison --default --query-path`
410
-
411
411
else
412
412
printf " no.\n"
413
413
printf " $this_script : Using the $executable found in the PATH.\n"
414
414
export FLEX=$executable
415
415
stack_push acceptable_in_path $package $executable
416
- # Halt the recursion by removing flex from the dependency stack and indicating
417
- # that none of the prerequisites required to build flex are needed.
416
+ # Remove $package from the dependency stack
417
+ stack_pop dependency_pkg package_done
418
+ stack_pop dependency_exe executable_done
419
+ stack_pop dependency_path package_done_path
420
+ # Put $package onto the script_installed log
421
+ stack_push script_installed package_done
422
+ stack_push script_installed executable_done
423
+ stack_push script_installed package_done_path
424
+ # Halt the recursion and signal that none of $package's prerequisites need to be built
418
425
stack_push dependency_pkg " none"
419
426
stack_push dependency_exe " none"
420
427
stack_push dependency_path " none"
@@ -453,19 +460,78 @@ find_or_install()
453
460
454
461
elif [[ " $package_in_path " == " true" ]]; then
455
462
printf " $this_script : Checking whether $package executable $executable in PATH is version < $minimum_version ... "
456
- if [[ " $package_version_in_path " < " $package (GNU Bison) $minimum_version " ]] ; then
463
+ if ! ./check_version.sh $package ` ./build $package --default --query-version ` ; then
457
464
printf " yes.\n"
458
- export YACC=" $package_install_path /bin/yacc"
465
+ export YACC=" $package_install_path /bin/$executable "
466
+ # Trigger 'find_or_install m4' and subsequent build of $package
467
+ stack_push dependency_pkg " m4"
468
+ stack_push dependency_exe " m4"
469
+ stack_push dependency_path ` ./build m4 --default --query-path`
470
+ else
471
+ printf " no.\n"
472
+ printf " $this_script : Using the $package executable $executable found in the PATH.\n"
473
+ YACC=yacc
474
+ stack_push acceptable_in_path $package $executable
475
+ # Remove bison from the dependency stack
476
+ stack_pop dependency_pkg package_done
477
+ stack_pop dependency_exe executable_done
478
+ stack_pop dependency_path package_done_path
479
+ # Put $package onto the script_installed log
480
+ stack_push script_installed package_done
481
+ stack_push script_installed executable_done
482
+ stack_push script_installed package_done_path
483
+ # Halt the recursion and signal that there are no prerequisites to build
484
+ stack_push dependency_pkg " none"
485
+ stack_push dependency_exe " none"
486
+ stack_push dependency_path " none"
487
+ fi
488
+
489
+ else # $package not in PATH and not yet installed by this script
490
+ # Trigger 'find_or_install m4' and subsequent build of $package
491
+ stack_push dependency_pkg " m4"
492
+ stack_push dependency_exe " m4"
493
+ stack_push dependency_path ` ./build m4 --default --query-path`
494
+ fi
495
+
496
+ elif [[ $package == " m4" ]]; then
497
+
498
+ # We arrive when the 'elif [[ $package == "bison" ]]' block pushes "m4" onto the
499
+ # the dependency_pkg stack, resulting in the recursive call 'find_or_install m4'
500
+
501
+ # Every branch that discovers an acceptable pre-existing installation must set the
502
+ # M4 environment variable. Every branch must also manage the dependency stack.
503
+
504
+ if [[ " $script_installed_package " == true ]]; then
505
+ printf " $this_script : Using the $package executable $executable installed by $this_script \n"
506
+ export M4=$package_install_path /bin/m4
507
+ # Remove m4 from the dependency stack
508
+ stack_pop dependency_pkg package_done
509
+ stack_pop dependency_exe executable_done
510
+ stack_pop dependency_path package_done_path
511
+ # Put $package onto the script_installed log
512
+ stack_push script_installed package_done
513
+ stack_push script_installed executable_done
514
+ stack_push script_installed package_done_path
515
+ # Halt the recursion and signal that there are no prerequisites to build
516
+ stack_push dependency_pkg " none"
517
+ stack_push dependency_exe " none"
518
+ stack_push dependency_path " none"
519
+
520
+ elif [[ " $package_in_path " == " true" ]]; then
521
+ printf " $this_script : Checking whether $package executable $executable in PATH is version < $minimum_version ... "
522
+ if ! ./check_version.sh $package ` ./build $package --default --query-version` ; then
523
+ printf " yes.\n"
524
+ export M4=" $package_install_path /bin/m4"
459
525
# Halt the recursion and signal that there are no prerequisites to build
460
526
stack_push dependency_pkg " none"
461
527
stack_push dependency_exe " none"
462
528
stack_push dependency_path " none"
463
529
else
464
530
printf " no.\n"
465
531
printf " $this_script : Using the $package executable $executable found in the PATH.\n"
466
- YACC=yacc
532
+ M4=m4
467
533
stack_push acceptable_in_path $package $executable
468
- # Remove bison from the dependency stack
534
+ # Remove m4 from the dependency stack
469
535
stack_pop dependency_pkg package_done
470
536
stack_pop dependency_exe executable_done
471
537
stack_pop dependency_path package_done_path
@@ -481,7 +547,7 @@ find_or_install()
481
547
482
548
else # $package not in PATH and not yet installed by this script
483
549
# Halt the recursion and signal that there are no prerequisites to build
484
- export YACC =" $package_install_path /bin/yacc "
550
+ export M4 =" $package_install_path /bin/m4 "
485
551
stack_push dependency_pkg " none"
486
552
stack_push dependency_exe " none"
487
553
stack_push dependency_path " none"
@@ -599,6 +665,9 @@ find_or_install()
599
665
elif [[ $package == " flex" ]]; then
600
666
echo " $this_script : export FLEX=$package_install_path /bin/$executable "
601
667
export FLEX=" $package_install_path /bin/$executable "
668
+ elif [[ $package == " m4" ]]; then
669
+ echo " $this_script : export M4=$package_install_path /bin/$executable "
670
+ export M4=" $package_install_path /bin/$executable "
602
671
elif [[ $package == " gcc" ]]; then
603
672
echo " $this_script : export FC=$package_install_path /bin/gfortran"
604
673
export FC=" $package_install_path /bin/gfortran"
@@ -652,7 +721,7 @@ print_header()
652
721
clear
653
722
echo " "
654
723
echo " *** A default build of OpenCoarrays requires CMake 3.4.0 or later ***"
655
- echo " *** and MPICH 3.1.4 wrapping GCC Fortran (gfortran) 5.1 .0 or later. ***"
724
+ echo " *** and MPICH 3.1.4 wrapping GCC Fortran (gfortran) 5.3 .0 or later. ***"
656
725
echo " *** Additionally, CMake, MPICH, and GCC have their own prerequisites. ***"
657
726
echo " *** This script will check for most known requirements in your PATH ***"
658
727
echo " *** environment variable and in the default installation directory ***"
@@ -783,6 +852,14 @@ report_results()
783
852
echo " export PATH=\" $bison_install_path /bin\" :\$ PATH " >> setup.sh
784
853
echo " fi " >> setup.sh
785
854
fi
855
+ m4_install_path=` ./build m4 --default --query-path`
856
+ if [[ -x " $m4_install_path /bin/yacc" ]]; then
857
+ echo " if [[ -z \"\$ PATH\" ]]; then " >> setup.sh
858
+ echo " export PATH=\" $m4_install_path /bin\" " >> setup.sh
859
+ echo " else " >> setup.sh
860
+ echo " export PATH=\" $m4_install_path /bin\" :\$ PATH " >> setup.sh
861
+ echo " fi " >> setup.sh
862
+ fi
786
863
setup_sh_location=$install_path
787
864
$SUDO mv setup.sh $install_path || setup_sh_location=${PWD}
788
865
echo " *** Before using caf, cafrun, or build, please execute the following command ***"
@@ -828,8 +905,8 @@ elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
828
905
echo " opencoarrays $opencoarrays_version "
829
906
echo " "
830
907
echo " OpenCoarrays installer"
831
- echo " Copyright (C) 2015 Sourcery, Inc."
832
- echo " Copyright (C) 2015 Sourcery Institute"
908
+ echo " Copyright (C) 2015-2016 Sourcery, Inc."
909
+ echo " Copyright (C) 2015-2016 Sourcery Institute"
833
910
echo " "
834
911
echo " OpenCoarrays comes with NO WARRANTY, to the extent permitted by law."
835
912
echo " You may redistribute copies of $this_script under the terms of the"
0 commit comments