[open-coarrays] 72/80: release 1.9.2

Alastair McKinstry mckinstry at moszumanska.debian.org
Wed Oct 25 13:45:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository open-coarrays.

commit b805f16151ead89ef6b6db64e36c854efda139ba
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Sat Sep 23 12:32:49 2017 +0100

    release 1.9.2
---
 .VERSION                                           |  23 +-
 Brewfile                                           |   4 +-
 CMakeLists.txt                                     | 274 ++++++++++-------
 INSTALL.md                                         | 309 +++++++++----------
 doc/man/man1/caf.1                                 |  41 +++
 doc/man/man1/cafrun.1                              |  75 +++++
 install.sh                                         |  17 +-
 prerequisites/install-functions/report_results.sh  |   4 +-
 .../install-functions/windows-install.sh           |  74 +++--
 .../install-functions/windows-install.sh-usage     |   0
 src/extensions/caf-foot                            | 117 -------
 src/extensions/caf-head                            |  32 --
 src/extensions/caf.in                              | 336 +++++++++++++++++++++
 src/extensions/cafrun-foot                         |  47 ---
 src/extensions/cafrun-head                         |  28 --
 src/extensions/cafrun.in                           | 191 ++++++++++++
 src/libcaf-gfortran-descriptor.h                   |   3 +
 src/mpi/CMakeLists.txt                             | 202 ++++++++-----
 src/mpi/mpi_caf.c                                  |  19 +-
 .../integration/coarrayHelloWorld/CMakeLists.txt   |   3 +-
 .../integration/dist_transpose/CMakeLists.txt      |   3 +-
 .../coarray_distributed_transpose.F90              |  46 ++-
 src/tests/integration/events/CMakeLists.txt        |   3 +-
 .../pde_solvers/coarrayBurgers/CMakeLists.txt      |   3 +-
 .../coarrayHeatSimplified/CMakeLists.txt           |  11 +-
 .../pde_solvers/navier-stokes/CMakeLists.txt       |   5 +-
 src/tests/regression/reported/CMakeLists.txt       |  27 +-
 src/tests/unit/collectives/CMakeLists.txt          |  27 +-
 src/tests/unit/events/CMakeLists.txt               |  10 +-
 src/tests/unit/fail_images/CMakeLists.txt          |  39 +--
 src/tests/unit/init_register/CMakeLists.txt        |  63 ++--
 .../unit/init_register/async_comp_alloc_2.f90      |   2 +
 src/tests/unit/init_register/initialize_mpi.F90    |   4 +-
 src/tests/unit/send-get/CMakeLists.txt             |  28 +-
 src/tests/unit/simple/CMakeLists.txt               |   7 +-
 .../{test1Caf.f90 => increment_neighbor.f90}       |   0
 src/tests/unit/sync/CMakeLists.txt                 |  23 +-
 37 files changed, 1268 insertions(+), 832 deletions(-)

diff --git a/.VERSION b/.VERSION
index 6b47b45..33f0de6 100644
--- a/.VERSION
+++ b/.VERSION
@@ -1,18 +1,25 @@
- (HEAD -> master, tag: 1.9.1)
+ (HEAD, tag: 1.9.2)
 
 
 # Fall back version, probably last release:
-1.9.1
+1.9.2
 
 # OpenCoarrays version file. This project uses semantic
 # versioning. For details see http://semver.org
 #
 # Release archive created from commit:
-# 1489c4f11c37d84e9852f82bba97f59166264956  (HEAD -> master, tag: 1.9.1)
-# Created on 2017-08-09 22:00:33 -0400 by Izaak Beekman, and
-# signed by  using E8C38C70328B3A0E.
-# Signature status: E
-gpg: Signature made Wed 09 Aug 2017 07:00:41 PM PDT
+# 499791428d5dd4fd4b3ce43dff7cbb35fd24ff69  (HEAD, tag: 1.9.2)
+# Created on 2017-09-22 17:24:21 -0400 by Izaak Beekman, and
+# signed by Izaak Beekman <zbeekman at gmail.com> using E8C38C70328B3A0E.
+# Signature status: G
+gpg: Signature made Fri Sep 22 17:24:21 2017 EDT
 gpg:                using RSA key E8C38C70328B3A0E
-gpg: Can't check signature: public key not found
+gpg: Good signature from "Izaak Beekman <zbeekman at gmail.com>" [ultimate]
+gpg:                 aka "Izaak B. Beekman (personal website email) <izaak at izaakbeekman.com>" [ultimate]
+gpg:                 aka "Izaak B Beekman (personal website email) <zaak at izaakbeekman.com>" [ultimate]
+gpg:                 aka "Izaak B Beekman (personal website contact email) <contact at izaakbeekman.com>" [ultimate]
+gpg:                 aka "[jpeg image of size 12961]" [ultimate]
+gpg:                 aka "Izaak "Zaak" Beekman (ParaTools Inc. email) <ibeekman at paratools.com>" [ultimate]
+Primary key fingerprint: 1DB1 B5ED E321 22B2 8E56  810D CB21 118C 92A6 4702
+     Subkey fingerprint: DD5B 7472 5C05 6BE1 BE1C  361B E8C3 8C70 328B 3A0E
 
diff --git a/Brewfile b/Brewfile
index 4a0d1c1..ff2b91d 100644
--- a/Brewfile
+++ b/Brewfile
@@ -13,8 +13,8 @@
 
 brew 'cmake'
 brew 'gcc'
-brew 'mpich', args: ['cc=gcc-6', 'cxx=g++-6']
-brew 'opencoarrays'
+brew 'mpich', args: ['cc=gcc-7', 'build-from-source']
+brew 'opencoarrays', args: ['cc=gcc-7', 'build-from-source']
 
 # [Homebrew]: http://brew.sh
 # [Linuxbrew]: http://linuxbrew.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 882409e..cf2aeb7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,7 @@ if((NOT (OpenCoarraysVersion MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) AND (EXISTS "$
     if((git_status STREQUAL "0") AND (git_output MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+"))
       set(OpenCoarraysVersion "${git_output}")
     endif()
-    execute_process(COMMAND "${GIT_EXECUTABLE}" describe --always --dirty
+    execute_process(COMMAND "${GIT_EXECUTABLE}" describe --always
       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
       RESULT_VARIABLE git_status
       OUTPUT_VARIABLE full_git_describe
@@ -65,6 +65,7 @@ endif()
 
 project(opencoarrays VERSION "${OpenCoarraysVersion}" LANGUAGES C Fortran)
 message( STATUS "Building OpenCoarrays version: ${full_git_describe}" )
+set(OpenCoarrays_dist_string "OpenCoarrays-${full_git_describe}")
 
 #Print an error message on an attempt to build inside the source directory tree:
 if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
@@ -89,11 +90,10 @@ endif()
 #Report untested Fortran compiler unless explicitly directed to build all examples.
 if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" )
   set(gfortran_compiler true)
-  # add_definitions(-DPREFIX_NAME=_gfortran_caf_)
   set ( CMAKE_C_FLAGS_CODECOVERAGE "-fprofile-arcs -ftest-coverage -O0"
     CACHE STRING "Code coverage C compiler flags")
   set ( CMAKE_Fortran_FLAGS_CODECOVERAGE "-fprofile-arcs -ftest-coverage -O0"
-    CACHE STRING "Code coverage C compiler flags")
+    CACHE STRING "Code coverage Fortran compiler flags")
 else()
   message(WARNING
     "\n"
@@ -165,6 +165,9 @@ endif()
   if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0 ) )
     add_definitions(-DGCC_GE_7) # Tell library to build against GFortran 7.x bindings b/c we might be using clang for C
   endif()
+  if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0.0 ) )
+    add_definitions(-DGCC_GE_8) # Tell library to build against GFortran 8.x bindings w/ descriptor change
+  endif()
 
 if(gfortran_compiler)
   set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
@@ -222,12 +225,13 @@ if ( (NOT MPI_C_FOUND) OR (NOT MPI_Fortran_FOUND) OR (NOT MPIEXEC))
   set ( MPI_HOME "${MPI_HOME}" "${MY_MPI_EXEC}" "${MY_MPI_EXEC}/.." )
   find_package( MPI REQUIRED )
 endif()
+list(REMOVE_DUPLICATES MPI_Fortran_INCLUDE_PATH)
 
 # Test for consistent MPI environment
 if (NOT MPIEXEC)
   message ( ERROR "CMake failed to find `mpiexec` or similar. If building with `./install.sh` please
 report this bug to the OpenCoarrays developers at
-https://github.com/sourceryinstitute/opencoarrays/issues, otherwise use point CMake
+https://github.com/sourceryinstitute/opencoarrays/issues, otherwise point CMake
 to the desired MPI runtime.")
 endif()
 
@@ -423,6 +427,78 @@ include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH})
 # Use standardized GNU install directory conventions
 #---------------------------------------------------
 include(GNUInstallDirs)
+set(mod_dir_tail "${OpenCoarrays_dist_string}_${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${OpenCoarrays_dist_string}-tests")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
+
+#-----------------
+# Install manpages
+#-----------------
+install(FILES "${CMAKE_SOURCE_DIR}/doc/man/man1/caf.1" "${CMAKE_SOURCE_DIR}/doc/man/man1/cafrun.1"
+  DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
+  PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+  COMPONENT documentation)
+
+#---------------------------------------------------
+# Define macro for compiling with caf wrapper script
+#---------------------------------------------------
+function(caf_compile_executable target main_depend)
+  foreach(includedir IN LISTS MPI_Fortran_INCLUDE_PATH)
+    set(includes ${includes} -I ${includedir})
+  endforeach()
+  string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
+  separate_arguments(config_Fortran_flags UNIX_COMMAND "${CMAKE_Fortran_FLAGS_${build_type}}")
+  get_directory_property( DirDefs DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMPILE_DEFINITIONS )
+  set(localDefs "")
+  foreach(d ${DirDefs})
+    list(APPEND localDefs "-D${d}")
+  endforeach()
+  add_custom_command(OUTPUT "${target}"
+    COMMAND "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf" ${includes} ${localDefs} ${config_Fortran_flags} -o "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target}" "${CMAKE_CURRENT_SOURCE_DIR}/${main_depend}" ${ARGN}
+    DEPENDS "${main_depend}" ${ARGN} caf_mpi_static
+    VERBATIM
+    )
+  add_custom_target("build_${target}" ALL
+    DEPENDS "${target}")
+endfunction(caf_compile_executable)
+
+enable_testing()
+
+#--------------------------------------------------------
+# Setup shellcheck if present for testing/linting scripts
+#--------------------------------------------------------
+find_program(SHELLCHECK_EXE shellcheck
+  DOC "Path to shellcheck executable for linting scripts"
+  )
+if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})
+  if(NOT SHELLCHECK_EXE)
+    message( AUTHOR_WARNING "OpenCoarrays developers should install shellcheck to test/lint all shell scripts.
+    See https://github.com/koalaman/shellcheck#installing for info on obtaining shellcheck.")
+  endif()
+endif()
+
+function(lint_script script_dir script_name)
+  if (SHELLCHECK_EXE)
+    add_test(NAME "shellcheck:${script_name}"
+      COMMAND ${SHELLCHECK_EXE} -x "${script_dir}/${script_name}"
+      WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
+  elseif (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})
+    message( AUTHOR_WARNING "test: shellcheck:${script_name} not run because shellcheck not installed." )
+  endif()
+endfunction()
+
+#-----------------------------------------------
+# Setup script style testing & enforcement macro
+#-----------------------------------------------
+
+find_program(style_pl style.pl "${CMAKE_SOURCE_DIR}/developer-scripts/")
+function(check_script_style script_full_path)
+  if(style_pl)
+    add_test(NAME "style:${script_full_path}"
+      COMMAND "${style_pl}" "${script_full_path}")
+  endif()
+endfunction()
 
 #-------------------------------
 # Recurse into the src directory
@@ -471,12 +547,14 @@ configure_file ( "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in" "${CMAKE_BINARY_
 add_custom_target ( uninstall
   COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/uninstall.cmake" )
 
-enable_testing()
-
 add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
 # See JSON-Fortran's CMakeLists.txt file to find out how to get the check target to depend
 # on the test executables
 
+#---------------------------------------------------------------------------------------
+# Define macro for adding CAF tests, and ensuring proper flags are passed to MPI runtime
+#---------------------------------------------------------------------------------------
+
 # Determine if we're using Open MPI
 execute_process(COMMAND ${MPIEXEC} --version
   OUTPUT_VARIABLE mpi_version_out)
@@ -486,162 +564,144 @@ if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]")
 endif ()
 
 include( ProcessorCount )
-ProcessorCount(N)
-function(add_mpi_test name num_mpi_proc path)
-   if ( ((N LESS num_mpi_proc) OR (N EQUAL 0)) )
-     message(STATUS "Test ${name} is oversubscribed: ${num_mpi_proc} ranks requested with ${N} system processor available.")
+ProcessorCount(N_CPU)
+function(add_caf_test name num_caf_img test_target)
+   # Function to add MPI tests.
+   if ( ((N_CPU LESS num_caf_img) OR (N_CPU EQUAL 0)) )
+     message(STATUS "Test ${name} is oversubscribed: ${num_caf_img} CAF images requested with ${N_CPU} system processor available.")
      if ( openmpi )
-       if ( N LESS 2 )
-	 set( num_mpi_proc 2 )
-	 set (test_parameters --oversubscribe)
-       else()
-	 set ( num_mpi_proc ${N} )
+       if ( N_CPU LESS 2 )
+	 set( num_caf_img 2 )
        endif()
-       message( STATUS "Open-MPI detected, over-riding oversubscribed test, ${name}, with ${num_mpi_proc} ranks." )
+       set (test_parameters --oversubscribe)
+       message( STATUS "Open-MPI back end detected, passing --oversubscribe for oversubscribed test, ${name}, with ${num_caf_img} ranks/images." )
      endif()
    endif()
-   set(test_parameters ${test_parameters} ${MPIEXEC_NUMPROC_FLAG} ${num_mpi_proc} )
-   add_test(NAME ${name} COMMAND ${MPIEXEC} ${test_parameters} "${path}")
+   set(test_parameters -np ${num_caf_img} ${test_parameters})
+   add_test(NAME ${name} COMMAND "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun" ${test_parameters} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test_target}")
    set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
-endfunction(add_mpi_test)
-
-function(add_fault_tolerant_mpi_test name num_mpi_proc path)
-   if ( ((N LESS num_mpi_proc) OR (N EQUAL 0)) )
-     message(STATUS "Test ${name} is oversubscribed: ${num_mpi_proc} ranks requested with ${N} system processor available.")
-     if ( openmpi )
-       if ( N LESS 2 )
-	 set( num_mpi_proc 2 )
-	 set (test_parameters --oversubscribe)
-       else()
-	 set ( num_mpi_proc ${N} )
-       endif()
-       message( STATUS "Open-MPI detected, over-riding oversubscribed test, ${name}, with ${num_mpi_proc} ranks." )
-     endif()
-   endif()
-   set(test_parameters ${test_parameters} ${MPIEXEC_NUMPROC_FLAG} ${num_mpi_proc} -disable-auto-cleanup )
-   add_test(NAME ${name} COMMAND ${MPIEXEC} ${test_parameters} "${path}")
-   set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
-endfunction(add_fault_tolerant_mpi_test)
-
-set(tests_root ${CMAKE_CURRENT_BINARY_DIR}/src/tests)
+endfunction(add_caf_test)
 
+#--------------
+# Add OCA tests
+#--------------
 
 if(opencoarrays_aware_compiler)
   if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})
     message ( STATUS "Running Developer tests is enabled." )
   endif()
   # Unit tests targeting each libcaf_mpi function, argument, and branch of code
-  add_mpi_test(initialize_mpi 2 ${tests_root}/unit/init_register/initialize_mpi)
-  add_mpi_test(register 2 ${tests_root}/unit/init_register/register)
-  add_mpi_test(register_vector 2 ${tests_root}/unit/init_register/register_vector)
-  add_mpi_test(register_alloc_vector 2 ${tests_root}/unit/init_register/register_alloc_vector)
-  add_mpi_test(allocate_as_barrier 2 ${tests_root}/unit/init_register/allocate_as_barrier)
-  add_mpi_test(allocate_as_barrier_proc 8 ${tests_root}/unit/init_register/allocate_as_barrier_proc)
+  add_caf_test(initialize_mpi 2 initialize_mpi)
+  add_caf_test(register 2 register)
+  add_caf_test(register_vector 2 register_vector)
+  add_caf_test(register_alloc_vector 2 register_alloc_vector)
+  add_caf_test(allocate_as_barrier 2 allocate_as_barrier)
+  add_caf_test(allocate_as_barrier_proc 8 allocate_as_barrier_proc)
   if (gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}))
     message( STATUS "Allocatable components of coarray derived types only supported in GFortran >= 7 with OpenCoarrays > 1.8.4" )
     message( STATUS "(but full support not anticipated until OpenCoarrays 2.0 release)" )
     if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0)
-      message( WARNING "Allocatable components of coarray derived type developer tests enabled, despite lack of support in GFortran < 7\n These tests should fail." )
+      message( AUTHOR_WARNING "Allocatable components of coarray derived type developer tests enabled, despite lack of support in GFortran < 7\n These tests should fail." )
     endif()
-    add_mpi_test(register_alloc_comp_1 2 ${tests_root}/unit/init_register/register_alloc_comp_1)
-    add_mpi_test(register_alloc_comp_2 2 ${tests_root}/unit/init_register/register_alloc_comp_2)
-    add_mpi_test(register_alloc_comp_3 2 ${tests_root}/unit/init_register/register_alloc_comp_3)
-    add_mpi_test(async_comp_alloc 6 ${tests_root}/unit/init_register/async_comp_alloc)
-    add_mpi_test(async_comp_alloc_2 2 ${tests_root}/unit/init_register/async_comp_alloc_2)
-    add_mpi_test(comp_allocated_1 2 ${tests_root}/unit/init_register/comp_allocated_1)
-    add_mpi_test(comp_allocated_2 2 ${tests_root}/unit/init_register/comp_allocated_2)
+    add_caf_test(register_alloc_comp_1 2 register_alloc_comp_1)
+    add_caf_test(register_alloc_comp_2 2 register_alloc_comp_2)
+    add_caf_test(register_alloc_comp_3 2 register_alloc_comp_3)
+    add_caf_test(async_comp_alloc 6 async_comp_alloc)
+    add_caf_test(async_comp_alloc_2 2 async_comp_alloc_2)
+    add_caf_test(comp_allocated_1 2 comp_allocated_1)
+    add_caf_test(comp_allocated_2 2 comp_allocated_2)
   endif()
-  add_mpi_test(get_array 2 ${tests_root}/unit/send-get/get_array)
-  add_mpi_test(get_self 2 ${tests_root}/unit/send-get/get_self)
-  add_mpi_test(send_array 2 ${tests_root}/unit/send-get/send_array)
-  add_mpi_test(get_with_offset_1d 2 ${tests_root}/unit/send-get/get_with_offset_1d)
-  add_mpi_test(whole_get_array 2 ${tests_root}/unit/send-get/whole_get_array)
-  add_mpi_test(strided_get 2 ${tests_root}/unit/send-get/strided_get)
-  add_mpi_test(strided_sendget 3 ${tests_root}/unit/send-get/strided_sendget)
-  add_mpi_test(co_sum 4 ${tests_root}/unit/collectives/co_sum_test)
-  add_mpi_test(co_broadcast 4 ${tests_root}/unit/collectives/co_broadcast_test)
-  add_mpi_test(co_min 4 ${tests_root}/unit/collectives/co_min_test)
-  add_mpi_test(co_max 4 ${tests_root}/unit/collectives/co_max_test)
-  add_mpi_test(syncall 8 ${tests_root}/unit/sync/syncall)
-  add_mpi_test(syncimages 8 ${tests_root}/unit/sync/syncimages)
-  add_mpi_test(syncimages2 8 ${tests_root}/unit/sync/syncimages2)
-  add_mpi_test(duplicate_syncimages 8 ${tests_root}/unit/sync/duplicate_syncimages)
-  add_mpi_test(co_reduce 4 ${tests_root}/unit/collectives/co_reduce_test)
-  add_mpi_test(co_reduce_res_im 4 ${tests_root}/unit/collectives/co_reduce_res_im)
-  add_mpi_test(co_reduce_string 4 ${tests_root}/unit/collectives/co_reduce_string)
-  add_mpi_test(syncimages_status 8 ${tests_root}/unit/sync/syncimages_status)
-  add_mpi_test(sync_ring_abort_np3 3 ${tests_root}/unit/sync/sync_image_ring_abort_on_stopped_image)
-  add_mpi_test(sync_ring_abort_np7 7 ${tests_root}/unit/sync/sync_image_ring_abort_on_stopped_image)
-  add_mpi_test(simpleatomics 8 ${tests_root}/unit/simple/atomics)
+  add_caf_test(get_array 2 get_array)
+  add_caf_test(get_self 2 get_self)
+  add_caf_test(send_array 2 send_array)
+  add_caf_test(get_with_offset_1d 2 get_with_offset_1d)
+  add_caf_test(whole_get_array 2 whole_get_array)
+  add_caf_test(strided_get 2 strided_get)
+  add_caf_test(strided_sendget 3 strided_sendget)
+  add_caf_test(co_sum 4 co_sum_test)
+  add_caf_test(co_broadcast 4 co_broadcast_test)
+  add_caf_test(co_min 4 co_min_test)
+  add_caf_test(co_max 4 co_max_test)
+  add_caf_test(syncall 8 syncall)
+  add_caf_test(syncimages 8 syncimages)
+  add_caf_test(syncimages2 8 syncimages2)
+  add_caf_test(duplicate_syncimages 8 duplicate_syncimages)
+  add_caf_test(co_reduce 4 co_reduce_test)
+  add_caf_test(co_reduce_res_im 4 co_reduce_res_im)
+  add_caf_test(co_reduce_string 4 co_reduce_string)
+  add_caf_test(syncimages_status 8 syncimages_status)
+  add_caf_test(sync_ring_abort_np3 3 sync_image_ring_abort_on_stopped_image)
+  add_caf_test(sync_ring_abort_np7 7 sync_image_ring_abort_on_stopped_image)
+  add_caf_test(simpleatomics 8 atomics)
   # possible logic error in the following test
-#  add_mpi_test(increment_my_neighbor 32 ${tests_root}/unit/simple/increment_my_neighbor)
+#  add_caf_test(increment_my_neighbor 32 increment_my_neighbor)
 
   # Integration tests verifying the use of libcaf_mpi in applications
-  add_mpi_test(hello_multiverse 2 ${tests_root}/integration/coarrayHelloWorld/hello_multiverse)
-  add_mpi_test(coarray_burgers_pde 2 ${tests_root}/integration/pde_solvers/coarrayBurgers/coarray_burgers_pde)
-  add_mpi_test(co_heat 2 ${tests_root}/integration/pde_solvers/coarrayHeatSimplified/co_heat)
-  add_mpi_test(asynchronous_hello_world 3 ${tests_root}/integration/events/asynchronous_hello_world)
+  add_caf_test(hello_multiverse 2 hello_multiverse)
+  add_caf_test(coarray_burgers_pde 2 coarray_burgers_pde)
+  add_caf_test(co_heat 2 co_heat)
+  add_caf_test(asynchronous_hello_world 3 asynchronous_hello_world)
 
   # Regression tests based on reported issues
   if((gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0)) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}))
     if( CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0 )
-      message( WARNING "Developer tests requested and GFortran < 7: test source-alloc-no-sync may fail" )
+      message( AUTHOR_WARNING "Developer tests requested and GFortran < 7: test source-alloc-no-sync may fail" )
     endif()
     # GFortran PR 78505 only fixed on trunk/gcc 7, issue #243
-    add_mpi_test(source-alloc-no-sync 8 ${tests_root}/regression/reported/source-alloc-sync)
+    add_caf_test(source-alloc-no-sync 8 source-alloc-sync)
   endif()
 
   # Open GCC 7 regressions
   if ((CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}) OR (gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0)))
-    add_mpi_test(convert-before-put 3 ${tests_root}/regression/reported/convert-before-put)
-    add_mpi_test(put-alloc-comp 2 ${tests_root}/regression/reported/issue-422-send)
-    add_mpi_test(get-put-alloc-comp 3 ${tests_root}/regression/reported/issue-422-send-get)
+    add_caf_test(convert-before-put 3 convert-before-put)
+    add_caf_test(put-alloc-comp 2 issue-422-send)
+    add_caf_test(get-put-alloc-comp 3 issue-422-send-get)
   endif()
 
-  add_mpi_test(allocatable_p2p_event_post 4 ${tests_root}/unit/events/allocatable_p2p_event_post)
+  add_caf_test(allocatable_p2p_event_post 4 allocatable_p2p_event_post)
   # Fixed GCC 7 regressions, should run on GCC 6 and 7
-  add_mpi_test(static_event_post_issue_293 3 ${tests_root}/unit/events/static_event_post_issue_293)
+  add_caf_test(static_event_post_issue_293 3 static_event_post_issue_293)
 
   # These co_reduce (#172, fixed by PR #332, addl discussion in PR
   # #331) tests are for bugs not regressions. Should be fixed in all
   # version of GCC, I beleive
-  add_mpi_test(co_reduce-factorial 4 ${tests_root}/regression/reported/co_reduce-factorial)
-  add_mpi_test(co_reduce-factorial-int8 4 ${tests_root}/regression/reported/co_reduce-factorial-int8)
-  add_mpi_test(co_reduce-factorial-int64 4 ${tests_root}/regression/reported/co_reduce-factorial-int64)
+  add_caf_test(co_reduce-factorial 4 co_reduce-factorial)
+  add_caf_test(co_reduce-factorial-int8 4 co_reduce-factorial-int8)
+  add_caf_test(co_reduce-factorial-int64 4 co_reduce-factorial-int64)
 
   # IMAGE FAIL tests
   if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0)
-    add_mpi_test(image_status_test_1 4 ${tests_root}/unit/fail_images/image_status_test_1)
+    add_caf_test(image_status_test_1 4 image_status_test_1)
     if(CAF_ENABLE_FAILED_IMAGES)
-      # No other way to check that image_fail_test_1 passes.
-      if ((NOT $ENV{TRAVIS}) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}))
-	add_fault_tolerant_mpi_test(image_fail_test_1 4 ${tests_root}/unit/fail_images/image_fail_test_1)
+      if ((NOT DEFINED ENV{TRAVIS}) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}))
+	add_caf_test(image_fail_test_1 4 image_fail_test_1)
 	set_property(TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed.")
-	add_fault_tolerant_mpi_test(image_fail_and_sync_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_1)
-        add_fault_tolerant_mpi_test(image_fail_and_sync_test_2 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_2)
-
-	add_fault_tolerant_mpi_test(image_fail_and_sync_test_3 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_3)
-	add_fault_tolerant_mpi_test(image_fail_and_status_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_status_test_1)
-	add_fault_tolerant_mpi_test(image_fail_and_failed_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_failed_images_test_1)
-	add_fault_tolerant_mpi_test(image_fail_and_stopped_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_stopped_images_test_1)
-	add_fault_tolerant_mpi_test(image_fail_and_get_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_get_test_1)
+	# No other way to check that image_fail_test_1 passes.
+	add_caf_test(image_fail_and_sync_test_1 4 image_fail_and_sync_test_1)
+        add_caf_test(image_fail_and_sync_test_2 4 image_fail_and_sync_test_2)
+
+	add_caf_test(image_fail_and_sync_test_3 4 image_fail_and_sync_test_3)
+	add_caf_test(image_fail_and_status_test_1 4 image_fail_and_status_test_1)
+	add_caf_test(image_fail_and_failed_images_test_1 4 image_fail_and_failed_images_test_1)
+	add_caf_test(image_fail_and_stopped_images_test_1 4 image_fail_and_stopped_images_test_1)
+	add_caf_test(image_fail_and_get_test_1 4 image_fail_and_get_test_1)
       endif()
     endif()
   endif()
 else()
-  add_test(co_sum_extension ${tests_root}/unit/extensions/test-co_sum-extension.sh)
+  add_test(co_sum_extension test-co_sum-extension.sh)
   set_property(TEST co_sum_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
 
-  add_test(co_broadcast_extension ${tests_root}/unit/extensions/test-co_broadcast-extension.sh)
+  add_test(co_broadcast_extension test-co_broadcast-extension.sh)
   set_property(TEST co_broadcast_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
 
-  add_test(co_min_extension ${tests_root}/unit/extensions/test-co_min-extension.sh)
+  add_test(co_min_extension test-co_min-extension.sh)
   set_property(TEST co_min_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
 
-  add_test(co_max_extension ${tests_root}/unit/extensions/test-co_max-extension.sh)
+  add_test(co_max_extension test-co_max-extension.sh)
   set_property(TEST co_max_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
 
-  add_test(co_reduce_extension ${tests_root}/unit/extensions/test-co_reduce-extension.sh)
+  add_test(co_reduce_extension test-co_reduce-extension.sh)
   set_property(TEST co_reduce_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
 endif()
 
diff --git a/INSTALL.md b/INSTALL.md
index 77b7cb0..7a603bb 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -24,16 +24,15 @@ Download this file as a PDF document
   * [Prerequisites]
   * [CMake scripts]
   * [Make]
-* [Obtaining GCC, MPICH, and CMake]
 
 ## End-User Installation ##
 
 Most users will find it easiest and fastest to use package management
 software to install OpenCoarrays.  Package management options for
-macOS (formerly known as OS X), Windows, and Linux are described first
-below. Also described below are options for installing via the
-Sourcery Institute virtual machine or the OpenCoarrays installation
-script.
+macOS, Windows, and Linux are described first below. Also described 
+below are options for installing via the Sourcery Institute virtual 
+machine or via the bash and/or CMake scripts included that are in the 
+OpenCoarrays source.
 
 [top]
 
@@ -41,8 +40,7 @@ script.
 
 [![homebrew](https://img.shields.io/homebrew/v/opencoarrays.svg?style=flat-square)](http://braumeister.org/formula/opencoarrays)
 
-macOS users may use the [Homebrew] or [MacPorts] package management
-systems to install OpenCoarrays.  We recommend [Homebrew].
+* [Homebrew]: This is the recommend OpenCoarrays installation method on macOS.
 
 Basic Homebrew installation steps:
 
@@ -54,7 +52,7 @@ brew install opencoarrays
 OpenCoarrays also ships with a
 [`Brewfile`][Brewfile]
 that will make it easier to install opencoarrays using MPICH built
-with GCC. To install using the
+with the GNU Compiler Collection ([GCC]). To install using the
 [`Brewfile`][Brewfile]
 with MPICH wrapping GCC, follow these steps:
 
@@ -64,56 +62,21 @@ brew update
 brew bundle
 ```
 
-MacPorts installation steps:
-
-```bash
-sudo port selfupdate
-sudo port upgrade outdated
-sudo port install opencoarrays
-```
-
-where the `sudo` command requires administrator privileges.  If you
-install using MacPorts, please also install the `mpstats` port as
-follows:
-
-```bash
-sudo port install mpstats
-```
-
-which supports future OpenCoarrays development by providing download
-data the OpenCoarrays team uses in proposals for research grants and
-development contracts.
+* [MacPorts]: An unmaintained [OpenCoarrays Portfile] exists for the [MacPorts] package
+manager.  Although the current OpenCoarrays contributors have no plans to 
+update the portfile, new contributors are welcome to asssume the port 
+maintainer role and to submit a pull request to update this [INSTALL.md] file.
 
 [top]
 
 ### Windows ###
 
-Windows users may run the windows-install.sh script inside the Windows
-Subsystem for Linux (WSL).
-
-Requirements:
-
-* WSL release 14936 or later,
-* Windows Insider Preview, and
-* "Fast" updates option.
-
-Steps:
-
-```bash
- do-release-upgrade
-./windows-install.sh
-```
-
-where the first command above updates the default Ubuntu 14.04 to
-16.04 and the second command must be executed with the present working
-directory set to the top level of the OpenCoarrays source tree.
-
-The `windows-install.sh` installation script uses Ubuntu's `apt-get`
-package manager to build [GCC] 5.4.0, [CMake], and [MPICH].  Windows
-users who desire a newer version of GCC are welcome to submit a
-request via our [Issues] page and suggest a method for updating.
-Previously attempted upgrade methods are described in the discussion
-thread starting with [commit comment 20539810].
+Windows users may run the [install.sh] script inside the Windows Subsystem 
+for Linux ([WSL]). The script uses Ubuntu's [APT] package manager to build 
+[GCC] 5.4.0, [CMake], and [MPICH].  Windows users who desire a newer version 
+of GCC are welcome to submit a request via our [Issues] page and suggest a 
+method for updating. Previously attempted upgrade methods are described in 
+the discussion thread starting with [commit comment 20539810].
 
 [top]
 
@@ -125,19 +88,17 @@ or pre-installed copies:
 * The [linuxbrew] package manager installs OpenCoarrays on all Linux distributions.
 * Debian-based distributions such as Ubuntu provide an "open-coarrays" [APT package].
 * [Arch Linux] provides an [aur package].
-* [HPCLinux] includes a pre-installed copy of OpenCoarrays.
-* [EasyBuild], a software build and installation framework, can install
-  OpenCoarrays on Linux distributions
+* An [HPCLinux] installation script is in the [developer-scripts] subdirectory (available via git clone only).
+* [EasyBuild] can install OpenCoarrays on Linux distributions
 * [Spack], a multiplatform package manager, can also install OpenCoarrays on Linux distributions
 
-
 [linuxbrew] does not require `sudo` privileges and will generally
 provide the most up-to-date OpenCoarrays release because linxubrew
 pulls directly from macOS homebrew, which updates automatically.
 
 
 <a name="easybuild"></a>
-[EasyBuild] can be used to install OpenCoarrays with the following bash commands:
+With [EasyBuild], the following bash commands install OpenCoarrays:
 ```bash
 # Search available specification files (also known as easyconfigs) for OpenCoarrays
 eb --search OpenCoarrays
@@ -146,15 +107,14 @@ eb --search OpenCoarrays
 # with the desired easyconfig, e.g., OpenCoarrays-1.9.0-gompi-2017a.eb
 eb OpenCoarrays-1.9.0-gompi-2017a.eb --robot
 ```
-Once installed, OpenCoarrays can be used by loading the newly created environment
-module `OpenCoarrays/1.9.0-gompi-2017a`.
+Once installed, use OpenCoarrays by loading the newly created environment
+module `OpenCoarrays/1.9.0-gompi-2017a`:
 ```bash
 module load OpenCoarrays/1.9.0-gompi-2017a
 ```
 
-
 <a name="spack"></a>
-[Spack] can be used to install OpenCoarrays with the following bash commands:
+With [Spack], the following commands install OpenCoarrays in a bash shell:
 ```bash
 # Check build information for OpenCoarrays in the default specification file
 spack spec opencoarrays
@@ -179,7 +139,7 @@ spack module loads --dependencies opencoarrays
 
 ### FreeBSD ###
 
-A FreeBSD Port is available for installing OpenCoarrays.  FreeBSD users can now simply do the following as root:
+Use the OpenCoarrays FreeBSD, Port to install OpenCoarrays by executing the following commands as root:
 ```bash
 pkg install opencoarrays
 ```
@@ -204,7 +164,7 @@ included packages.
 ## Installation Script ##
 
 If the above package management or virtualization options are
-infeasible or unavailable, Linux and macOS users may also install
+infeasible or unavailable, Linux, macOS, and [WSL] users may also install
 OpenCoarrays by downloading and uncompressing our [latest release] and
 running our installation script in the top-level OpenCoarrays source
 directory (see above for the corresponding [Windows] script):
@@ -216,21 +176,6 @@ cd OpenCoarrays-x.y.z
 ```
 
 where `x.y.z` should be replaced with the appropriate version numbers.
-For a scripted or unattended build, use `./install.sh -y` or
-equivalently `./install.sh --yes-to-all`, which will assume
-affirmative answers to all user prompts and will only prompt the user
-if an installation directory is chosen that requires `sudo`
-privelenges (by passing `-i` or equivalently `--install-prefix`).
-
-Before installing OpenCoarrays, the above bash script will attempt to
-detect the presence of the default prerequisite packages: [GCC],
-[MPICH] , and [CMake].  For additional details, see the
-[Prerequisites] section. If any of the installation script cannot find
-the prerequisite packages, the [install.sh] script will attempt to
-download, build, and install any missing packages after asking
-permission to do so.  The script has been tested on Linux and OS X.
-Please submit any related problems or questions to our [Issues] page.
-
 A complete installation should result in the creation of the following
 directories inside the installation path (.e.g, inside `build` in the
 above example):
@@ -242,19 +187,109 @@ above example):
 * `lib`: contains the `libcaf_mpi.a` static library to which codes
   link for CAF support
 
+
+### Example script invocations ###
+Execute `./install.sh --help` or `./install.sh -h` to see a list of flags
+that can be passed to the installer.  Below are examples of useful combinations
+of flags. Each flag also has a single-character version not shown here.
+
+1. Install after building any missing prerequisites -- all source, build,
+and installation files will be inside the OpenCoarrays source tree under
+prerequisites/installations:
+```bash
+$ ./install.sh
+```
+
+2. Install non-interactively by assuming a "yes" answer to all questions
+```bash
+$ ./install.sh --yes-to-all
+```
+
+3. Install with the specified compilers, overriding the default compilers:
+```bash
+$ ./install.sh --with-fortran <path-to-gcc-bin>/gfortran \
+               --with-cxx <path-to-gcc-bin>/g++ \
+               --with-c <path-to-gcc-bin>/gcc 
+```
+Without the latter arguments, [install.sh] will attempt to install the
+default GCC version even if a newer version is available.  This happens
+to protect users from instability in cases when known one or more
+known regressions exist in the newer compiler.
+
+4. Install only a specific prerequisite package (the default version):
+```bash
+$ ./install.sh --package mpich
+```
+
+5. Install a specific version of a prerequisite:
+```bash
+$ ./install.sh --package cmake --install-version 3.7.0
+```
+
+6. Download a prerequisite package (e.g., gcc/gfortran/g++ below) but
+don't build or install it:
+```bash
+$ ./install.sh --only-download gcc
+```
+
+7. Print the default URL, version, or download mechanism that the
+script will use for a given prerequisite package (e.g., mpich below)
+on this system:
+```bash
+$ ./install.sh --print-url mpich
+$ ./install.sh --print-version mpich
+$ ./install.sh --print-downloader mpich
+```
+
+8. Install a prerelease branch (e.g., trunk below) of the GCC repository:
+```bash
+$ ./install.sh --package gcc --install-branch trunk
+```
+
+9. Install to a specific location:
+```bash
+$ ./install.sh --install-prefix /opt/gnu/
+```
+If the path provided in the install prefix requires sudo privileges,
+the user will be prompted for a password after the package download
+and build complete and just before installing to the specified path.
+
+10. Install a prerequisite package from a non-default URL:
+```bash
+$ ./install.sh --package gcc \ 
+  --from-url https://github.com/sourceryinstitute/gcc/archive/teams-20170919.tar.gz \
+  --install-version teams-20170919
+```
+The latter command will install the Sourcery Institute GCC fork that provides 
+experimental support for the Fortran 2015 teams feature.
+
+11. Speed up a GCC build at a higher risk of a faild build:
+```bash
+./install.sh --package gcc --disable-bootstrap
+```
+If the latter command works, it could reduce GCC's build time from hours down to
+minutes.
+
+12. Speed up a GCC build with multithreading at a risk of a failed build:
+```bash
+./install.sh --package gcc --num-threads 4
+```
+The latter command sometimes fails if the GCC build system has not fully
+specified dependencies between source files.
+
+
 [top]
 
 ## Advanced Installation from Source ##
 
 ### Prerequisites ###
 
-The prerequisites below and their dependencies are recommended for the
-broadest coverage of CAF features.  If a prerequisite is missing or
-outdated, the [install.sh] script will prompt the user for permission
-to download, compile, and install it. Before doing so, [install.sh]
-will verify whether that prerequisite's prerequisites are present and
-will recursively traverse the dependency tree until reaching an
-acceptable prerequisite or reaching the end of a branch.
+Package managers and the [install.sh] attempt to handle the installation
+of all OpenCoarrays prerequisites automatically.  Installing with CMake
+or the provided, static Makefile burdens the person installing with the
+need to ensure that all prerequisites have been built and are in the
+expected or specified locations prior to building OpenCoarrays. The 
+prerquisite package/version dependency tree is as follows:
 
 ```text
 opencoarrays
@@ -269,32 +304,18 @@ opencoarrays
         └── mpfr
 ```
 
-If using the advanced [CMake] or [Make] builds detailed below, please
-ensure that these dependencies are met before attempting to build and
-install OpenCoarrays.
-
 [top]
 
 ### CMake scripts ###
 
-#### N.B. ####
-
-__As of OpenCoarrays 1.7.6, passing `FC=mpi_fortran_wrapper` and
-`CC=mpi_c_wrapper` is *DEPRECATED*. Please pass `FC=/path/to/gfortran`
-and `CC=/path/to/gcc`. If you are experimenting with the source to
-source translation capabilities, then please point `FC` and `CC` to
-your Fortran and C compilers of choice. In the case of Cray, or a
-compiler in which MPI is *built-in* to the compiler, you still pass
-the `FC` and `CC` as the Fortran and C compiler, even though MPI is
-built-in.__
-
-[CMake] is the preferred build system.  CMake is a cross-platform
-Makefile generator that includes the testing tool CTest.  To avoid
-cluttering or clobbering the source tree, our CMake setup requires
-that your build directory be any directory other than the top-level
-OpenCoarrays source directory.  In a bash shell, the following steps
-should build OpenCoarrays, install OpenCoarrays, build the tests, run
-the tests, and report the test results:
+On most platforms, the [install.sh] script ultimately invokes [CMake] after performing
+numerous checks, customizations, and installations of any missing prerequisites.  
+Advanced users who prefer to invoke CMake directly may do so as described here.
+CMake is a cross-platform Makefile generator that includes the testing tool CTest.  
+To avoid cluttering or clobbering the source tree, our CMake setup requires that
+your build directory be any directory other than the top-level OpenCoarays
+source directory.  In a bash shell, the following steps should build OpenCoarrays,
+build the tests, run the tests, and report the test results:
 
 ```bash
 tar xvzf opencoarrays.tar.gz
@@ -328,45 +349,38 @@ Advanced options (most users should not use these):
 -DMPI_C_COMPILER=/path/to/c/wrapper
 -DMPI_Fortran_COMPILER=/path/to/fortran/wrapper
 
--DLEGACY_ARCHITECTURE=OFF    # enables the use of FFT libraries that employ AVX instructions
 -DHIGH_RESOLUTION_TIMER=ON   # enables timers that tick once per clock cycle
--DCOMPILER_SUPPORTS_ATOMICS  # enables support for the proposed-Fortran 2015 events
-                             # feature
--DUSE_EXTENSIONS             # builds the opencoarrays module for use-with non-
-                             # OpenCoarrays-aware compilers
 -DCOMPILER_PROVIDES_MPI      # is set automatically when building with-the Cray
                              # Compiler Environment
 ```
 
-The fourth and fifth flags above are not portable and the sixth
-enables code that is incomplete as of release 1.0.0.  The eighth is
-set automatically by the CMake scripts based on the compiler identity
-and version.
-
 [top]
 
 ### Make ###
 
 Unlike the Makefiles that CMake generates automatically for the chosen
-platform, static Makefiles require a great deal more maintenance and
-are less portable.  Also, the static Makefiles provided with
-OpenCoarrays lack several important capabilities.  In particular, they
-will not build the tests; they will not build any of the
-infrastructure for compiling CAF source with non-OpenCoarrays-aware
-compilers (that infrastructure includes the [opencoarrays] module, the
-`caf` compiler wrapper, and the `cafrun` program launcher); nor do the
-static Makefiles provide a `make install` option so you will need to
-manually move the desired library from the corresponding source
-directory to your intended installation location as shown below.
-
-If CMake is unavailable, build and install with Make using steps such as the following:
+platform, static Makefiles require a great deal more maintenance and are
+less portable.  Also, the static Makefiles provided in [src] lack several
+several important capabilities.  In particular, they will not build the tests;
+they will not generate the `caf` compiler wrapper that ensures correct linking
+and `cafrun` program launcher that ensures support for advanced features such
+as Fortran 2015 failed images; they will not build the [opencoarrays] module 
+that can be used to provide some Fortran 2015 features with non-Fortran-2015
+compilers; nor do the static Makefiles provide a `make install` option so you 
+will need to manually move the resultant library from the build location to your chosen
+installation location.
+
+If none of the installation methods mentioned higher in this document are 
+work on your platform and if CMake is unavailable, build and install the 
+OpenCoarrays parallel runtime library as follows:
 
 ```bash
 tar xvzf opencoarrays.tar.gz
 cd opencoarray/src
 make
-mv mpi/libcaf_mpi.a <installation-path>
+mv mpi/libcaf_mpi.a <insert-install-path>
 ```
+replacing the angular-bracketed text with your desired install path.
 
 For the above steps to succeed, you might need to edit the [make.inc]
 file to match your system settings.  For example, you might need to
@@ -377,31 +391,6 @@ file.
 
 [top]
 
-## Obtaining GCC, MPICH, and CMake ##
-
-[GFortran Binaries] binary builds are available at <https://gcc.gnu.org/wiki/GFortranBinaries>.
-
-To build all prerequisites from source, including the current
-development branch of GCC, you might first try the running the
-provided [install.sh] script as described above in the
-[Installation Script] section or try building each prerequisite from
-source inside a bash shell as follows:
-
-```bash
-export gcc_install_path=/desired/installation/destination
-./install.sh --package gcc --install-prefix "${gcc_install_path}"
-./install.sh --package mpich \
-   --with-fortran "${gcc_install_path}"/bin/gfortran \
-   --with-c       "${gcc_install_path}"/bin/gcc      \
-   --with-cxx     "${gcc_install_path}"/bin/g++
-./install.sh --pacakge cmake \
-   --with-fortran "${gcc_install_path}"/bin/gfortran \
-   --with-c       "${gcc_install_path}"/bin/gcc      \
-   --with-cxx     "${gcc_install_path}"/bin/g++
-```
-
-[top]
-
 ---
 
 <div align="center">
@@ -429,8 +418,6 @@ export gcc_install_path=/desired/installation/destination
 [CMake scripts]: #cmake-scripts
 [Make]: #make
 
-[Obtaining GCC, MPICH, and CMake]: #obtaining-gcc-mpich-and-cmake
-
 [Links to source]: #
 
 [install.sh]: ./install.sh
@@ -439,9 +426,11 @@ export gcc_install_path=/desired/installation/destination
 
 [linuxbrew]: http://linuxbrew.sh
 [APT package]: https://qa.debian.org/popcon.php?package=open-coarrays
+[APT]: https://en.wikipedia.org/wiki/APT_(Debian)
 [HPCLinux]: http://www.paratools.com/hpclinux/
 [Brewfile]: https://github.com/sourceryinstitute/OpenCoarrays/blob/master/Brewfile
 [INSTALL.pdf]: https://md2pdf.herokuapp.com/sourceryinstitute/OpenCoarrays/blob/master/INSTALL.pdf
+[INSTALL.md]: https://github.com/sourceryinstitute/OpenCoarrays/blob/master/INSTALL.md
 [CMake]: https://cmake.org
 [Sourcery Institute Store]: http://www.sourceryinstitute.org/store/c1/Featured_Products.html
 [VirtualBox]: https://www.virtualbox.org
@@ -472,3 +461,7 @@ export gcc_install_path=/desired/installation/destination
 [Spack]: https://github.com/LLNL/spack
 [add a new compiler to Spack]: http://spack.readthedocs.io/en/latest/tutorial_modules.html#add-a-new-compiler
 [loading the environment modules with Spack]: http://spack.readthedocs.io/en/latest/module_file_support.html#cmd-spack-module-loads
+[OpenCoarrays Portfile]: https://www.macports.org/ports.php?by=name&substr=opencoarrays
+[WSL]: https://blogs.msdn.microsoft.com/commandline/2017/07/10/ubuntu-now-available-from-the-windows-store/
+[developer-scripts]: https://github.com/sourceryinstitute/OpenCoarrays/tree/master/developer-scripts 
+[src]: https://github.com/sourceryinstitute/OpenCoarrays/tree/master/src
diff --git a/doc/man/man1/caf.1 b/doc/man/man1/caf.1
new file mode 100644
index 0000000..b710677
--- /dev/null
+++ b/doc/man/man1/caf.1
@@ -0,0 +1,41 @@
+.TH CAF 1 2017\-09\-12 OpenCoarrays\-1.9.1 "caf compiler wrapper manual"
+.SH NAME
+.PP
+\fB\fCcaf\fR \- OpenCoarrays compiler wrapper to compile and link coarray Fortran source files and programs
+.SH SYNOPSIS
+.PP
+\fB\fCcaf\fR [compiler\-options] [linker\-options] \fI<fortran\-source\-file>\fP [\fIobject\-files\fP] [libraries]
+.SH DESCRIPTION
+.PP
+\fB\fCcaf\fR is a compiler wrapper script which is generated when the OpenCoarrays library \[la]https://github.com/sourceryinstitute/OpenCoarrays#readme\[ra] that ensures coarray fortran programs are compiled with the same fortran compiler OpenCoarrays was built for,
+.BR gfortran (1)
+by default, and that the linker links against the appropriate parallel runtime, MPI by default. The \fB\fCcaf\fR compiler wrapper serves a similar purpose to the MPI fortran wrapper compiler,
+.BR mpifort (1).
+\fB\fCcaf\fR embeds the full path to the Fortran compiler it was built for, and to the parallel runtime libraries it links against, and a relative path, based on the install location of \fB\fCcaf\fR itself, to the OpenCoarrays library. This ensures that the API and ABI of OpenCoarrays is always consistent with the Fortran compiler it was built for, and the parallel runtime it uses. To upgrade the parallel runtime, e.g., MPI, or the Fortran compiler, you will need to rebuild and install O [...]
+.PP
+\fB\fCcaf\fR tries to be smart about how it calls the underlying compiler and linker. Any user specified libraries will be inserted before the OpenCoarrays library, \fIlibcaf_mpi\fP, and before the parallel runtime libraries. This ensures that the linker will be able to resolve any references to the OpenCoarrays library and the parallel runtime library made by user supplied libraries. In addition any options not recognized by \fB\fCcaf\fR itself, as outlined below in the OPTIONS section. [...]
+.SH OPTIONS
+.TP
+\fB\fC\-\-help\fR, \fB\fC\-h\fR
+Print a brief help/usage message and return without performing any substantive action.
+.TP
+\fB\fC\-\-show\fR, \fB\fC\-s\fR
+Print the default invocation of the underlying compiler, including what flags are passed, etc. This also functions as a dry\-run for executing a specific command, showing the user how the compiler would be called with the additional files and arguments passed by the user.
+.TP
+\fB\fC\-\-version\fR, \fB\fC\-V\fR, \fB\fC\-v\fR
+Print OpenCoarrays version and copyright information and exit.
+.TP
+\fB\fC\-\-wrapping\fR, \fB\fC\-\-wraps\fR, \fB\fC\-w\fR
+Report the name and version of the Fortran compiler \fB\fCcaf\fR is wrapping and exit.
+.SH BUGS
+.PP
+For a list of bugs currently affecting OpenCoarrays, or to report a new one, please report any bugs to the OpenCoarrays project at \[la]https://github.com/sourceryinstitute/OpenCoarrays/issues\[ra]
+.SH AUTHOR
+.PP
+Izaak Beekman \[la]izaak at izaakbeekman.com\[ra]
+.SH SEE ALSO
+.PP
+.BR cafrun (1),
+.BR gfortran (1),
+.BR mpifort (1),
+OpenCoarrays project page \[la]https://github.com/sourceryinstitute/OpenCoarrays#readme\[ra], OpenCoarrays website \[la]http://www.opencoarrays.org\[ra]
diff --git a/doc/man/man1/cafrun.1 b/doc/man/man1/cafrun.1
new file mode 100644
index 0000000..ef069c3
--- /dev/null
+++ b/doc/man/man1/cafrun.1
@@ -0,0 +1,75 @@
+.TH CAFRUN 1 2017\-09\-12 OpenCoarrays\-1.9.1 "cafrun coarray Fortran job launcher manual"
+.SH NAME
+.PP
+\fB\fCcafrun\fR \- Coarray Fortran executable launcher for OpenCoarrays
+.SH SYNOPSIS
+.PP
+\fB\fCcafrun\fR [\fB\fC\-s\fR] \fB\fC\-np\fR <N> \fI</path/to/coarray\-executable>\fP [arg1 [arg2 ...]]
+.SH DESCRIPTION
+.PP
+\fB\fCcafrun\fR is wrapper script which will launch Coarray Fortran
+executables across <N> images using the appropriate parallel
+runtime that OpenCoarrays was compiled against, (e.g.,
+.BR mpiexec (1)).
+\fB\fCcafrun\fR ensures the correct flags are passed to the
+parallel runtime job launcher, as determined by system introspection
+at OpenCoarrays build time. Advanced users may compile their Coarray
+Fortran code however they please, but we recommend using the
+.BR caf (1)
+
+compiler wrapper script for a more user friendly experience.
+.PP
+To see the default command run by \fB\fCcafrun\fR, add the \fB\fC\-s\fR or \fB\fC\-\-show\fR
+flags. To see how a specific command would be executed, simply
+construct the command you plan to use to launch your job, and add
+\fB\fC\-s\fR or \fB\fC\-\-show\fR as the very first flag after \fB\fCcafrun\fR, e.g.,
+\fB\fCcafrun \-s ...\fR to see how \fB\fCcafrun\fR is translating your invocation for
+the parallel runtime job launcher (e.g.,
+.BR mpiexec (1)).
+.SH OPTIONS
+.TP
+\fB\fC\-\-help\fR, \fB\fC\-h\fR
+Print a brief help/usage message and return without
+performing any substantive action.
+.TP
+\fB\fC\-np\fR <N>
+Mandatory flag with argument to specify the number of Coarray
+Fortran images to be spawned. <N> must be a positive integer.
+.TP
+\fB\fC\-\-reenable\-auto\-cleanup\fR
+If OpenCoarrays is built supporting failed images, which requires
+GFortran >= 7.0 and an MPI implementation with user level failure
+mitigation support (ULFM) and NOT disabling it at build time, then
+\fB\fCcafrun\fR turns OFF mpi auto cleanup, and handles cleanup in the
+OpenCoarrays library. This is required to properly support failed
+images. \fB\fC\-\-reenable\-auto\-cleanup\fR re\-enables the parallel runtime's
+auto cleanup features which breaks the failed images functionality
+but provides more robust error detection and application
+aborting. If failed images support was not enabled at OpenCoarrays
+build time, then this flag is a noop.
+.TP
+\fB\fC\-\-show\fR, \fB\fC\-s\fR
+Print the default invocation of the underlying parallel
+runtime's job launcher (e.g., \fB\fCmpiexec\fR), including what flags are
+passed, etc. This also functions as a dry\-run for executing a
+specific \fB\fCcafrun\fR command, showing the user how the compiler would
+be called with the additional files and arguments passed by the
+user.
+.TP
+\fB\fC\-\-version\fR, \fB\fC\-V\fR, \fB\fC\-v\fR
+Print OpenCoarrays version and copyright information and exit.
+.TP
+\fB\fC\-\-wrapping\fR, \fB\fC\-\-wraps\fR, \fB\fC\-w\fR
+Report the version of the parallel runtime \fB\fCcafrun\fR is wrapping and exit.
+.SH BUGS
+.PP
+For a list of bugs currently affecting OpenCoarrays, or to report a new one, please report any bugs to the OpenCoarrays project at \[la]https://github.com/sourceryinstitute/OpenCoarrays/issues\[ra]
+.SH AUTHOR
+.PP
+Izaak Beekman \[la]izaak at izaakbeekman.com\[ra]
+.SH SEE ALSO
+.PP
+.BR caf (1),
+.BR mpiexec (1),
+.BR gfortran (1),
+OpenCoarrays project page \[la]https://github.com/sourceryinstitute/OpenCoarrays#readme\[ra], OpenCoarrays website \[la]http://www.opencoarrays.org\[ra]
diff --git a/install.sh b/install.sh
index d0d12c7..d96be6c 100755
--- a/install.sh
+++ b/install.sh
@@ -310,6 +310,7 @@ elif [[ "${arg_p:-}" == "opencoarrays" ]]; then
     # Install Xcode command line tools (CLT) if on macOS and if needed
     maybe_install_xcodeCLT
     # Install OpenCoarrays
+
     cd prerequisites || exit 1
     installation_record=install-opencoarrays.log
     # shellcheck source=./prerequisites/build-functions/set_SUDO_if_needed_to_write_to_directory.sh
@@ -317,11 +318,17 @@ elif [[ "${arg_p:-}" == "opencoarrays" ]]; then
     version="$("${opencoarrays_src_dir}/install.sh" -V opencoarrays)"
     set_SUDO_if_needed_to_write_to_directory "${install_path}"
 
-    # Using process substitution "> >(...) -" instead of piping to tee via "2>&1 |" ensures that
-    # report_results gets the FC value set in build_opencoarrays
-    # Source: http://stackoverflow.com/questions/8221227/bash-variable-losing-its-value-strange
-    build_opencoarrays > >( tee ../"${installation_record}" ) -
-    report_results 2>&1 | tee -a ../"${installation_record}"
+    if grep -s -q Microsoft /proc/version  ; then
+      info "Windows Subsystem for Linux detected.  Invoking windows-install.sh with the following command:"
+      info "\"${opencoarrays_src_dir}\"/prerequisites/install-functions/windows-install.sh \"$@\""
+      "${opencoarrays_src_dir}"/prerequisites/install-functions/windows-install.sh "$@"
+    else
+      # Using process substitution "> >(...) -" instead of piping to tee via "2>&1 |" ensures that
+      # report_results gets the FC value set in build_opencoarrays
+      # Source: http://stackoverflow.com/questions/8221227/bash-variable-losing-its-value-strange
+      build_opencoarrays > >( tee ../"${installation_record}" ) -
+      report_results 2>&1 | tee -a ../"${installation_record}"
+    fi
   fi
 
 elif [[ "${arg_p:-}" == "ofp" ]]; then
diff --git a/prerequisites/install-functions/report_results.sh b/prerequisites/install-functions/report_results.sh
index 0d1b620..2368ca0 100644
--- a/prerequisites/install-functions/report_results.sh
+++ b/prerequisites/install-functions/report_results.sh
@@ -9,7 +9,7 @@ report_results()
   compiler_install_root="${fully_qualified_FC%bin/gfortran*}"
 
   fully_qualified_MPIFC="$(type -P "${MPIFC}")"
-  mpi_install_root="${fully_qualified_MPIFC%bin/mpif90*}"
+  mpi_install_root="${fully_qualified_MPIFC%bin/mpifort*}"
 
   fully_qualified_CMAKE="$(type -P "${CMAKE}")"
   cmake_install_path="${fully_qualified_CMAKE%/cmake*}"
@@ -71,7 +71,7 @@ report_results()
       echo "set LD_LIBRARY_PATH = (\"${compiler_lib_paths%/}\"/bin \"\$LD_LIBRARY_PATH\") " >> setup.csh
     fi
     echo "                                                                       " >> setup.sh
-    if [[ -x "${mpi_install_root}/bin/mpif90" ]]; then
+    if [[ -x "${mpi_install_root}/bin/mpifort" ]]; then
       echo "# Prepend the MPI path to the PATH environment variable:" | tee -a setup.sh setup.csh
       echo "if [[ -z \"\${PATH}\" ]]; then                                         " >> setup.sh
       echo "  export PATH=\"${mpi_install_root%/}/bin\"                        " >> setup.sh
diff --git a/windows-install.sh b/prerequisites/install-functions/windows-install.sh
similarity index 85%
rename from windows-install.sh
rename to prerequisites/install-functions/windows-install.sh
index 6e9cb47..677580d 100755
--- a/windows-install.sh
+++ b/prerequisites/install-functions/windows-install.sh
@@ -1,4 +1,4 @@
-#/usr/bin/env bash
+#!/usr/bin/env bash
 #
 # windows-install.sh
 #
@@ -109,18 +109,19 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
 ### Validation (decide what's required for running your script and error out)
 #####################################################################
 
-[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "
+[[ -z "${LOG_LEVEL:-}" ]] && emergency "Cannot continue without LOG_LEVEL. "
 
 # shellcheck disable=SC2154
-if [[ "${arg_d}" == "${__flag_present}" ]]; then 
+if [[ "${arg_d}" == "${__flag_present}" ]]; then
    print_debug_only=7
-   if [ "$(( LOG_LEVEL < print_debug_only ))" -ne 0 ]; then
+   if [[ "$(( LOG_LEVEL < print_debug_only ))" -ne 0 ]]; then
      debug "Supressing info and debug messages: one of {-l, -v, -P, -U, -V, -D} present."
      suppress_info_debug_messages
    fi
 fi
 
 # Get linux_distribution name
+# shellcheck disable=SC2154
 {
 info "__file: ${__file}"
 info "__dir: ${__dir}"
@@ -144,7 +145,8 @@ info  "-V (--version-number):   ${arg_V}"
 
 # __________ Process command-line arguments and environment variables _____________
 
-export this_script="$(basename "$0")"
+this_script="$(basename "${0}")"
+export this_script
 debug "this_script=\"${this_script}\""
 
 export install_prefix="${arg_i%/:-${PWD}/prerequisites/installations}"
@@ -153,17 +155,9 @@ info "install_prefix=\"${install_prefix}\""
 export num_threads="${arg_j}"
 info "num_threads=\"${arg_j}\""
 
-set_opencoarrays_version()
-{
-  cmake_project_line="$(grep project "${OPENCOARRAYS_SRC_DIR}/CMakeLists.txt" | grep VERSION)"
-  text_after_version_keyword="${cmake_project_line##*VERSION}"
-  text_before_language_keyword="${text_after_version_keyword%%LANGUAGES*}"
-  opencoarrays_version=$text_before_language_keyword
-  export opencoarrays_version="${opencoarrays_version//[[:space:]]/}"
-}
-set_opencoarrays_version
+opencoarrays_version=$(sed -n '/[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}/{s/^\([^.]*\)\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)\(.*\)/\2/p;q;}' "${OPENCOARRAYS_SRC_DIR%/}/.VERSION")
 
-export build_path="${OPENCOARRAYS_SRC_DIR%/}"/prerequisites/builds/opencoarrays/$opencoarrays_version
+export build_path="${OPENCOARRAYS_SRC_DIR%/}"/prerequisites/builds/opencoarrays/${opencoarrays_version}
 info "build_path=\"${build_path}\""
 
 export CMAKE="${arg_m:-cmake}"
@@ -173,7 +167,7 @@ verify_this_is_ubuntu()
   if [[ ${__os} != "Linux"  ]]; then
     emergency "${__os} not supported: this script is intended for use in Windows Subsystem for Linux "
   fi
-  linux_standard_base_i=`lsb_release -i`
+  linux_standard_base_i=$(lsb_release -i)
   untrimmed_name=${linux_standard_base_i##*Distributor ID:}
   linux_distribution="${untrimmed_name//[[:space:]]/}"
   info "Linux distribution: ${linux_distribution}"
@@ -188,16 +182,16 @@ verify_this_is_ubuntu
 # Ubuntu 16.04 apt-get installs gfortran 5.4.0 or later, which is acceptable for many uses of OpenCoarrays
 verify_acceptable_release_number()
 {
-  linux_standard_base_r=`lsb_release -r`
+  linux_standard_base_r=$(lsb_release -r)
   untrimmed_name=${linux_standard_base_r##*Release:}
   release_number="${untrimmed_name//[[:space:]]/}"
   major_release="${release_number%%.*}"
   minor_release="${release_number##*.}"
   info "Release: ${major_release}.${minor_release}"
-  if [[ $major_release -lt 16  ]]; then
+  if [[ ${major_release} -lt 16  ]]; then
     emergency "Please upgrade to Windows Subsystem for Linux (WSL) Ubuntu 16.04 or later."
-  elif [[ $major_release -eq 16  ]]; then
-    if [[ $minor_release -lt "04"  ]]; then
+  elif [[ ${major_release} -eq 16  ]]; then
+    if [[ ${minor_release} -lt "04"  ]]; then
       emergency "Please upgrade to Windows Subsystem for Linux (WSL) Ubuntu 16.04 or later."
     fi
   fi
@@ -206,7 +200,7 @@ verify_acceptable_release_number
 
 if [[ "${arg_V}" == "${__flag_present}" ]]; then
     # Print just the version number
-    info "$opencoarrays_version"
+    info "${opencoarrays_version}"
 
 elif [[ "${arg_v}" == "${__flag_present}" ]]; then
 
@@ -227,19 +221,19 @@ else
   export FC=${arg_f:-gfortran}
   export CC=${arg_c:-gcc}
   export CXX=${arg_C:-g++}
- 
+
   # Check for and, if necessary, install OpenCoarrays prerequisites
 
-  if ! type "$CMAKE" >& /dev/null; then
+  if ! type "${CMAKE}" >& /dev/null; then
     sudo apt-get install cmake
   fi
-  if ! type "$CXX" >& /dev/null; then
+  if ! type "${CXX}" >& /dev/null; then
     sudo apt-get install g++
   fi
-  if ! type "$FC" >& /dev/null; then
+  if ! type "${FC}" >& /dev/null; then
     sudo apt-get install gfortran
   fi
-  
+
   if ! type mpifort >& /dev/null; then
     sudo apt-get install mpich
   fi
@@ -268,34 +262,34 @@ else
     fi
   }
   set_SUDO_if_needed_to_write_to_install_dir
-  
+
   # Install OpenCoarrays
 
-  if [[ -d "$build_path" ]]; then
-    rm -rf "$build_path"
+  if [[ -d "${build_path}" ]]; then
+    rm -rf "${build_path}"
   fi
-  mkdir -p "$build_path"
-  cd "$build_path"
+  mkdir -p "${build_path}"
+  cd "${build_path}" || exit 25
   info "Configuring OpenCoarrays with the following command:"
-  info "FC=\"$FC\" CC=\"$CC\"  \"$CMAKE\" \"$OPENCOARRAYS_SRC_DIR\" -DCMAKE_INSTALL_PREFIX=\"$install_prefix\""
-  FC="$FC" CC="$CC" "$CMAKE" "$OPENCOARRAYS_SRC_DIR" -DCMAKE_INSTALL_PREFIX="$install_prefix"
+  info "FC=\"${FC}\" CC=\"${CC}\"  \"${CMAKE}\" \"${OPENCOARRAYS_SRC_DIR}\" -DCMAKE_INSTALL_PREFIX=\"${install_prefix}\""
+  FC="${FC}" CC="${CC}" "${CMAKE}" "${OPENCOARRAYS_SRC_DIR}" -DCMAKE_INSTALL_PREFIX="${install_prefix}"
   info "Building OpenCoarrays with the following command:"
-  info "make -j $arg_j"
-  make -j $arg_j
+  info "make -j ${arg_j}"
+  make -j "${arg_j}"
   info "Installing OpenCoarrays with the following command:"
   info "${SUDO:-} make install"
   ${SUDO:-} make install
-  if [[ -f "$install_prefix"/lib/libcaf_mpi.a && -f "${install_prefix}/bin/caf"  && -f "${install_prefix}/bin/cafrun"  ]]; then
+  if [[ -f "${install_prefix}"/lib/libcaf_mpi.a && -f "${install_prefix}/bin/caf"  && -f "${install_prefix}/bin/cafrun"  ]]; then
     info "OpenCoarrays has been installed in"
-    info "$install_prefix"
+    info "${install_prefix}"
   else
     info "Something went wrong. OpenCoarrays is not in the expected location:"
-    emergency "$install_prefix"
+    emergency "${install_prefix}"
   fi
   # See http://stackoverflow.com/questions/31057694/gethostbyname-fail-after-switching-internet-connections/31222970
-  loopback_line=`grep $NAME /etc/hosts`
+  loopback_line=$(grep "${NAME}" /etc/hosts)
   if [[ -z "${loopback_line:-}" ]]; then
     info "To ensure the correct functioning of MPI, please add the following line to your /etc/hosts file:"
-    info "127.0.0.1 $NAME"
+    info "127.0.0.1 ${NAME}"
   fi
 fi
diff --git a/windows-install.sh-usage b/prerequisites/install-functions/windows-install.sh-usage
similarity index 100%
rename from windows-install.sh-usage
rename to prerequisites/install-functions/windows-install.sh-usage
diff --git a/src/extensions/caf-foot b/src/extensions/caf-foot
deleted file mode 100755
index 11375c2..0000000
--- a/src/extensions/caf-foot
+++ /dev/null
@@ -1,117 +0,0 @@
-cmd=$(basename "$0")
-
-usage()
-{
-    echo ""
-    echo " $cmd - Fortran compiler wrapper for OpenCoarrays"
-    echo ""
-    echo " Usage: $cmd <fortran-source-file> [options] ..."
-    echo ""
-    echo " Options:"
-    echo "   --help, -h               Show this help message"
-    echo "   --version, -v, -V        Report version and copyright information"
-    echo "   --wrapping, -w, --wraps  Report the name of the wrapped compiler"
-    echo ""
-    echo " Example usage:"
-    echo ""
-    echo "   $cmd foo.f90 -o foo"
-    echo "   $cmd -v"
-    echo "   $cmd --help"
-    echo ""
-    echo "OpenCoarrays $caf_version $cmd supports three categories of compilers"
-    echo "with the following restrictions for each use case:"
-    echo ""
-    echo " 1. With an OpenCoarrays-Aware (OCA) compiler (GNU 5.1.0 or later),"
-    echo "   a. If any of the options listed above appear, any remaining arguments are ignored."
-    echo "   b. If present, <fortran-source-file> must"
-    echo "      * be a Fortran source file,"
-    echo "      * appear before all other arguments,"
-    echo "      * be the only Fortran source file in the argument list,"
-    echo "      * have a name of the form *.f90, *.F90, *.f, or *.F. "
-    echo "   c. The environment variable 'CAFC' must be empty or point to a Fortran compiler/linker. "
-    echo "   d. If 'CAFC' is empty, a default value of 'mpifort' is used. "
-    echo ""
-    echo " 2. With non-OCA CAF compilers (Intel or Cray),"
-    echo "   a. Observe restrictions 1a-d above."
-    echo "   b. Access OpenCoarrays collective subroutines via use association with an only clause,"
-    echo "      e.g., 'use opencoarrays, only : co_sum,co_broadcast' "
-    echo ""
-    echo " 3. With non-CAF compilers (all compilers not named above),"
-    echo "   a. Observe restrictions 1a-d above."
-    echo "   b. Access OpenCoarrays capabilities via use association ('use opencoarrays')."
-    echo "   c. The only CAF statements or expressions allowed are the following:"
-    echo "      * 'num_images()' "
-    echo "      * 'this_image()' with or without arguments"
-    echo "      * 'sync all' with or without arguments."
-    echo "      * 'sync images' with or without arguments."
-    echo "      * 'error stop' without arguments."
-    echo "      * 'co_sum', 'co_broadcast', 'co_max', 'co_min', or 'co_reduce'"
-    echo ""
-    echo " The caf wrapper will append -L, -l, and other required arguments as necessary"
-    echo " using values that get set during the OpenCoarrays build and installation."
-    echo ""
-
-    exit 1
-}
-
-# Print useage information if caf is invoked without arguments
-if [ $# == 0 ]; then
-  usage | less
-  exit 1
-fi
-
-# Default to "mpifort" Fortran compiler if environment variable CAFC is empty or unset:
-CAFC=${CAFC:-mpifort}
-
-# TODO -- refactor this script to use the bash3boilerplate use case
-max_arguments=100
-link_args="-fcoarray=lib -lcaf_mpi"
-
-if [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
-    echo ""
-    echo "OpenCoarrays Coarray Fortran Compiler Wrapper (caf version $caf_version)"
-    echo "Copyright (C) 2015-2016 Sourcery, Inc."
-    echo ""
-    echo "OpenCoarrays comes with NO WARRANTY, to the extent permitted by law."
-    echo "You may redistribute copies of OpenCoarrays under the terms of the"
-    echo "BSD 3-Clause License.  For more information about these matters, see"
-    echo "the file named LICENSE."
-    echo ""
-elif [[ $1 == '-w' || $1 == '--wraps' || $1 == '--wrapping' ]]; then
-  echo "caf wraps CAFC=$CAFC"
-elif [[ $1 == '-s' || $1 == '--show' ]]; then
-  $CAFC -show
-elif [[ $1 == '-h' || $1 == '--help' ]]; then
-  # Print usage information
-  usage | less
-  exit 1
-elif [ "$caf_compiler" = "true" ]; then
-  # Nothing to do other than invoke the compiler with all the command-line arguments:
-  $CAFC "$@" -L "$caf_lib_dir" $link_args
-else
-  # Verify that a file with the .f90, .F90, .f, or .F extension is the first argument:
-  src_extension=$(echo "$1" | cut -f2 -d'.')
-  if [[ $src_extension == 'f90' || $src_extension == 'F90' || $src_extension == 'f' || $src_extension == 'F' ]]; then
-    # copy the source file into a new file for pre-processing (preprending "caf-" to the new file name):
-    cp "$1" "caf-$1"
-    # Edit the copied source to replace CAF syntax with calls to public procedures in opencoarrays.f90:
-    if [ "$linux" = "true" ]; then
-      sed -i'' 's/sync all/call sync_all/g' "caf-$1"
-      sed -i'' 's/error stop/call error_stop/g' "caf-$1"
-      sed -i'' 's/sync images/call sync_images/g' "caf-$1"
-    else
-      # This works on OS X and other POSIX-compliant operating systems:
-      sed -i '' 's/sync all/call sync_all/g' "caf-$1"
-      sed -i '' 's/error stop/call error_stop/g' "caf-$1"
-      sed -i '' 's/sync images/call sync_images/g' "caf-$1"
-    fi
-    # Replace the file name in command-line argment 1 with the new name beofre invoking the compiler:
-    set -- "caf-$1" "${@:2:$max_arguments}"
-    # Invoke the compiler along with all command-line arguments:
-    $CAFC "$@" -L "$caf_lib_dir" -I "$caf_mod_dir" $link_args
-  else
-    # Print usage information upon encountering an unknowon CAF source file extension
-    usage | less
-    exit 1
-  fi
-fi
diff --git a/src/extensions/caf-head b/src/extensions/caf-head
deleted file mode 100755
index f6274c2..0000000
--- a/src/extensions/caf-head
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-#
-# Coarray Fortran (CAF) Compiler Wrapper
-#
-# Invokes the chosen Fortran compiler with the received command-line
-# arguments.
-#
-# Copyright (c) 2015-2016, Sourcery, Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in the
-#       documentation and/or other materials provided with the distribution.
-#     * Neither the name of the Sourcery, Inc., nor the
-#       names of its contributors may be used to endorse or promote products
-#       derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL SOURCERY, INC., BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
diff --git a/src/extensions/caf.in b/src/extensions/caf.in
new file mode 100755
index 0000000..14d439c
--- /dev/null
+++ b/src/extensions/caf.in
@@ -0,0 +1,336 @@
+#!/usr/bin/env bash
+#
+# OpenCoarrays version @CAF_VERSION@
+#
+# Coarray Fortran (CAF) Compiler Wrapper
+#
+# Invokes the chosen Fortran compiler with the received command-line
+# arguments.
+#
+# Copyright (c) 2015-2016, Sourcery, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in the
+#       documentation and/or other materials provided with the distribution.
+#     * Neither the name of the Sourcery, Inc., nor the
+#       names of its contributors may be used to endorse or promote products
+#       derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL SOURCERY, INC., BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# Exit on error. Append "|| true" if you expect an error.
+set -o errexit
+# Exit on error inside any functions or subshells.
+set -o errtrace
+# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
+set -o nounset
+# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip`
+set -o pipefail
+# Turn on traces, useful while debugging but commented out by default
+# set -o xtrace
+
+#---------------------------
+# Begin configured variables
+#---------------------------
+# List of variables needing configuration:
+#
+# CAF_VERSION, opencoarrays_aware_compiler, Fortran_COMPILER, CAF_MODDIR,
+# MPI_Fortran_LINK_FLAGS, MPI_Fortran_COMPILE_FLAGS,
+# CAF_LIBS, MPI_LIBS
+#
+
+caf_version='@CAF_VERSION@' # fetched from `git describe` and/or
+# `.VERSION` file
+oca_compiler="@opencoarrays_aware_compiler@" # True for GFortran > 5.0.0
+
+# Compiler used to build OpenCoarrays; runtime must match compiler used during build
+cafc="@Fortran_COMPILER@"
+if [[ "${cafc}" == @*@ ]]; then
+  cafc=gfortran
+fi
+caf_mod_dir="@CAF_MODDIR@"    # location of extensions module, needed for non-OCA compilers
+mod_dir_flag="-I"
+
+
+# Ideally these should be absolute paths. Since they are array
+# variables multiple libs (absolute or not) can be specified provided
+# proper quoting is used, when @var@ is expanded. (i.e., expands with
+# double quotes around each library w/path to ensure proper word
+# splittling for paths with spaces) Handling of paths is complex
+# between CMake and pkg-config: pkg-config (new enough versions) will
+# theoretically expand paths with spaces escaped or the path
+# quoted. CMake handles spaces in paths natively, but also sort of
+# punts by making ; a field separator... So long story short,
+# pkg-config output *should* __ALREADY__ handle word splitting, and
+# variables expanded from CMake should be appropriately quoted.
+
+# shellcheck disable=SC2054
+mpi_link_flags=(@MPI_Fortran_LINK_FLAGS@) # e.g. `pkg-config
+# --libs-only-other mpich`
+# __*AND*__ `pkg-config
+# --libs-only-L`
+mpi_compile_flags=(@MPI_Fortran_COMPILE_FLAGS@)
+caf_libs=(@CAF_LIBS@) # e.g. "libcaf_mpi" "libcaf_extensions",
+# preferably full paths, but could be
+# combination of -L... and -lcaf_mpi...
+mpi_libs=(@MPI_LIBS@) # e.g. `pkg-config --libs-only-l` or full paths
+# to MPI libs
+
+#-------------------------
+# End configured variables
+#-------------------------
+
+if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
+  __i_am_main_script="0" # false
+
+  # shellcheck disable=SC2154
+  if [[ "${__usage+x}" ]]; then
+    if [[ "${BASH_SOURCE[1]}" == "${0}" ]]; then
+      __i_am_main_script="1" # true
+    fi
+    __caf_tmp_source_idx=1
+  fi
+else
+  # shellcheck disable=SC2034
+  __i_am_main_script="1" # true
+fi
+
+# Set magic variables for current file, directory, os, etc.
+__dir="$(cd "$(dirname "${BASH_SOURCE[${__caf_tmp_source_idx:-0}]}")" && pwd)"
+__file="${__dir}/$(basename "${BASH_SOURCE[${__caf_tmp_source_idx:-0}]}")"
+# shellcheck disable=SC2034
+__base="$(basename "${__file}")"
+cmd="${__base}"
+
+# Set installation prefix. Compute this dynamically assuming this script is in a bin/ subdir
+# Dereference symbolic links and canonicalize (i.e., abs path) prefix in case stow, homebrew, etc being used
+# mac OS doesn't have readlink -f, so need to crawl symlinks manually.
+# See: https://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
+current_dir="${PWD}"
+cd "${__dir}"
+  target_file="${__file}"
+  max_iter=1000
+  iter=0
+  while [[ -L "${target_file}" ]]; do
+    target_file="$(readlink "${target_file}")"
+    cd "$(dirname "${target_file}")"
+    target_file="$(basename "${target_file}")"
+    if ((++iter >= max_iter)); then
+      echo "Failed to compute OpenCoarrays instalation prefix!" >&2
+      echo "Likely cause: circular symlink cycles." >&2
+      echo "Aborting!" >&2
+      exit 200
+    fi
+  done
+  true_dir="$(pwd -P)"
+  true_dir="${true_dir%/}"
+  # shellcheck disable=SC2034
+  prefix="${true_dir%/bin}"
+  # echo "Install prefix is ${prefix}" # for debugging
+cd "${current_dir}"
+# echo "Current directory is $(pwd)"
+# echo "This script is in ${__dir}"
+
+# Error tracing
+# requires `set -o errtrace`
+__caf_err_report() {
+  local error_code
+  error_code=${?}
+  echo "Error in ${__file} in function ${1} on line ${2}. Please report this error at http://bit.ly/OpenCoarrays-new-issue" >&2
+  exit ${error_code}
+}
+# Always provide an error backtrace
+trap '__caf_err_report "${FUNCNAME:-.}" ${LINENO}' ERR
+
+# See if we are compiling or compiling and/or linking
+__only_compiling () {
+    for arg in "${@}"; do
+      if [[ "${arg}" == "-c" ]]; then
+        return 0
+      fi
+    done
+    return 1
+}
+
+#--------------------------------------------------------------------------
+# End configured variables, now process them and build compile/link command
+#--------------------------------------------------------------------------
+
+# Always make extensions module available, user can choose whether to `use` it or not
+caf_pre_flags=("${mod_dir_flag}${prefix%/}/${caf_mod_dir}")
+
+if [[ "${oca_compiler}" == true ]]; then
+  if [[ -z "${caf_pre_flags[*]:-}" ]]; then
+    caf_pre_flags=('-fcoarray=lib')
+  else
+    caf_pre_flags+=('-fcoarray=lib')
+  fi
+fi
+if [[ -n "${mpi_compile_flags[*]:-}" ]]; then
+  for compileflag in "${mpi_compile_flags[@]:-}"; do
+      caf_pre_flags+=("${compileflag}")
+  done
+fi
+if [[ -n "${mpi_link_flags[*]:-}" ]]; then
+  if ! __only_compiling "${@}"; then
+    for linkflag in "${mpi_link_flags[@]:-}"; do
+      caf_pre_flags+=("${linkflag}")
+    done
+  fi
+fi
+
+# Now do libraries, IN CORRECT ORDER, to append to command
+for lib in "${caf_libs[@]:-}"; do
+  caf_added_libs+=("${prefix%/}/${lib}")
+done
+for lib in "${mpi_libs[@]:-}"; do
+  caf_added_libs+=("${lib}")
+done
+
+usage() {
+  echo ""
+  echo " ${cmd} - Fortran compiler wrapper for OpenCoarrays"
+  echo ""
+  echo " Usage: ${cmd} <fortran-source-file> [compiler-options] [object-files] [linker-options]"
+  echo ""
+  echo " Wrapper options:"
+  echo "   --help, -h               Show this help message and exit"
+  echo "   --version, -v, -V        Report version and copyright information and exit"
+  echo "   --wrapping, -w, --wraps  Report the name of the wrapped compiler and exit"
+  echo "   --show, -s               Show how this wrapper will call the compiler and exit (dry run)"
+  echo ""
+  echo " Example usage:"
+  echo ""
+  echo "   ${cmd} foo.f90 -o foo"
+  echo "   ${cmd} -v"
+  echo "   ${cmd} --help"
+  echo "   ${cmd} -s"
+  echo ""
+  echo "OpenCoarrays ${caf_version} ${cmd} supports three categories of compilers"
+  echo "with the following restrictions for each use case:"
+  echo ""
+  echo " 1. With an OpenCoarrays-Aware (OCA) compiler (GNU 5.1.0 or later),"
+  echo "   a. If any of the options listed above appear, any remaining arguments are ignored."
+  echo "   b. If present, any Fortran <source-file(s)> must have a name of the form:"
+  echo "      *.f90, *.F90, *.f, or *.F. "
+  echo ""
+  echo " 2. With non-OCA CAF compilers (Intel or Cray),"
+  echo "   a. Observe restrictions 1a-d above."
+  echo "   b. Access OpenCoarrays collective subroutines via use association with an only clause,"
+  echo "      e.g., 'use opencoarrays, only : co_sum,co_broadcast' "
+  echo ""
+  echo " 3. With non-CAF compilers (all compilers not named above),"
+  echo "   a. Observe restrictions 1a-d above."
+  echo "   b. Access OpenCoarrays capabilities via use association ('use opencoarrays')."
+  echo "   c. The only CAF statements or expressions allowed are the following:"
+  echo "      * 'num_images()' "
+  echo "      * 'this_image()' with or without arguments"
+  echo "      * 'sync all' with or without arguments."
+  echo "      * 'sync images' with or without arguments."
+  echo "      * 'error stop' without arguments."
+  echo "      * 'co_sum', 'co_broadcast', 'co_max', 'co_min', or 'co_reduce'"
+  echo ""
+  echo " The caf wrapper will append -L..., -l..., and other required flags as necessary"
+  echo " to link against OpenCoarrays, using values that get set during the OpenCoarrays"
+  echo " build and installation."
+  echo ""
+}
+
+# Print useage information if caf is invoked without arguments
+if ((${#} == 0)); then
+  usage | ${PAGER:-less -i -F -X -M -J}
+  exit 1
+fi
+
+if [[ ${1} == -[vV] || ${1} == '--version' ]]; then
+  echo ""
+  echo "OpenCoarrays Coarray Fortran Compiler Wrapper (caf version ${caf_version})"
+  echo "Copyright (C) 2015-2016 Sourcery, Inc."
+  echo ""
+  echo "OpenCoarrays comes with NO WARRANTY, to the extent permitted by law."
+  echo "You may redistribute copies of OpenCoarrays under the terms of the"
+  echo "BSD 3-Clause License.  For more information about these matters, see"
+  echo "the file named LICENSE that is distributed with OpenCoarrays."
+  echo ""
+  exit 0
+elif [[ ${1} == '-w' || ${1} == '--wraps' || ${1} == '--wrapping' ]]; then
+  echo "${cmd} wraps ${cafc}"
+  exit 0
+elif [[ ${1} == '-s' || ${1} == '--show' ]]; then
+  if (($# > 1)); then
+    args="${*:2:$((${#} - 1))}"
+  else
+    args="\${@}"
+  fi
+  if [[ "${caf_pre_flags[*]:-}" ]]; then
+    compiler_args=("${caf_pre_flags[@]}")
+  fi
+  if [[ "${args}" ]]; then
+    compiler_args+=("${args}")
+  fi
+  if [[ "${caf_added_libs[*]:-}" ]]; then
+    if ! __only_compiling "${@}"; then
+      compiler_args+=("${caf_added_libs[@]}")
+    fi
+  fi
+  echo "${cafc}" "${compiler_args[@]}"
+  exit 0
+elif [[ ${1} == '-h' || ${1} == '--help' ]]; then
+  # Print usage information
+  usage | ${PAGER:-less -i -F -X -M -J}
+  exit 0
+elif [[ "${oca_compiler:-}" != "true" ]]; then
+  # Transform file(s) with the .f90, .F90, .f, or .F extension, if present:
+  # Loop over all arguments and perform simple search & replace source transformation on any Fortran sources
+  i=0
+  for arg in "${@}"; do
+    src_extension="${arg##*.}"
+    ((i+=1)) # Increment i to keep track of which arg we're processing
+    if [[ "${src_extension}" == [fF]90 || "${src_extension}" == [fF] ]]; then
+      # Edit & copy the source to replace CAF syntax with calls to public procedures in opencoarrays.f90:
+      sed -e 's/sync all/call sync_all/g' -e 's/error stop/call error_stop/g' \
+        -e 's/sync images/call sync_images/g' "${arg}" >"caf-${arg}"
+      # Replace the file name in command-line argment $i with the new name before invoking the compiler:
+      set -- "${@:1:$((i - 1))}" "caf-${arg}" "${@:$((i + 1)):$((${#} - i))}"
+    fi
+  done
+fi
+
+# Invoke the compiler along with all command-line arguments:
+if [[ "${caf_pre_flags[*]:-}" ]]; then
+  compiler_args=("${caf_pre_flags[@]}")
+fi
+if [[ "${*:-}" ]]; then
+  compiler_args+=("${@}")
+fi
+if [[ "${caf_added_libs[*]:-}" ]]; then
+  if ! __only_compiling "${@}" ; then
+    compiler_args+=("${caf_added_libs[@]}")
+  fi
+fi
+#set -o xtrace # Show what we're doing
+set +o errtrace
+set +o errexit
+if "${cafc}" "${compiler_args[@]}" ; then
+  exit 0
+else
+  echo "Error: comand:" >&2
+  echo "   \`${cafc} ${compiler_args[*]}\`" >&2
+  echo "failed to compile." >&2
+  exit 12
+fi
diff --git a/src/extensions/cafrun-foot b/src/extensions/cafrun-foot
deleted file mode 100644
index d8b0b0c..0000000
--- a/src/extensions/cafrun-foot
+++ /dev/null
@@ -1,47 +0,0 @@
-usage()
-{
-    cmd=$(basename "$0")
-    echo ""
-    echo " $cmd - Coarray Fortran executable launcher for OpenCoarrays"
-    echo ""
-    echo " Usage: $cmd [options] ..."
-    echo ""
-    echo " Options:"
-    echo "   --help, -h           Show this help message"
-    echo "   --version, -v, -V    Report version and copyright information"
-    echo "   --wraps, -w,         Report the name of the wrapped compiler"
-    echo ""
-    echo " Example usage:"
-    echo ""
-    echo "   $cmd -np 2 foo"
-    echo "   $cmd -v"
-    echo "   $cmd --help"
-    echo ""
-    echo " Notes:"
-    echo "   [options] must a CAF executable file, one of the above arguments,"
-    echo "   or an argument to the program name returned by caf --wraps"
-    echo ""
-    exit 1
-}
-
-# Print useage information if caf is invoked without arguments
-if [ $# == 0 ]; then
-  usage
-elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
-  echo ""
-  # shellcheck disable=SC2154
-  echo "OpenCoarrays Coarray Fortran Executable Launcher (caf version $caf_version)"
-  echo "Copyright (C) 2015-2016 Sourcery, Inc."
-  echo ""
-  echo "OpenCoarrays comes with NO WARRANTY, to the extent permitted by law."
-  echo "You may redistribute copies of OpenCoarrays under the terms of the"
-  echo "BSD 3-Clause License.  For more information about these matters, see"
-  echo "the file named LICENSE."
-  echo ""
-elif [[ $1 == '-w' || $1 == '--wraps' ]]; then
-  "${CAFRUN}"-v
-elif [[ $1 == '-h' || $1 == '--help' ]]; then
-  usage
-else
-  "${CAFRUN}" "$@"
-fi
diff --git a/src/extensions/cafrun-head b/src/extensions/cafrun-head
deleted file mode 100755
index 899da32..0000000
--- a/src/extensions/cafrun-head
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-#
-# Coarray Fortran (CAF) Executable Launcher
-#
-# Copyright (c) 2015-2016, Sourcery, Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in the
-#       documentation and/or other materials provided with the distribution.
-#     * Neither the name of the Sourcery, Inc., nor the
-#       names of its contributors may be used to endorse or promote products
-#       derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL SOURCERY, INC., BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/extensions/cafrun.in b/src/extensions/cafrun.in
new file mode 100755
index 0000000..b7613ad
--- /dev/null
+++ b/src/extensions/cafrun.in
@@ -0,0 +1,191 @@
+#!/usr/bin/env bash
+#
+# Coarray Fortran (CAF) Executable Launcher version @CAF_VERSION@
+#
+# Copyright (c) 2015-2016, Sourcery, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in the
+#       documentation and/or other materials provided with the distribution.
+#     * Neither the name of the Sourcery, Inc., nor the
+#       names of its contributors may be used to endorse or promote products
+#       derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL SOURCERY, INC., BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# This script invokes the chosen Fortran compiler with the received command-line
+# arguments.  Current assumptions:
+#    1. The only argument is either an informational flag or a CAF executable
+#       file.
+#    2. The environment variable "FC" is used to determine the identity fo the Fortran compiler/linker.
+#    3. If "FC" is empty, a default value of "mpifort" is used.
+
+
+#---------------------
+# Configured variables
+#---------------------
+#
+# CAF_VERSION, MPIEXEC, MPIEXEC_NUMPROC_FLAG, MPIEXEC_PREFLAGS, MPIEXEC_POSTFLAGS,
+# HAVE_FAILED_IMG
+#
+
+caf_version='@CAF_VERSION@'
+CAFRUN='@MPIEXEC@'
+if [[ ${CAFRUN} == @*@ ]]; then
+  CAFRUN=mpiexec
+fi
+have_failed_img=@HAVE_FAILED_IMG@
+if [[ ${have_failed_img} == @*@ ]]; then
+  have_failed_img=false
+fi
+numproc_flag='@MPIEXEC_NUMPROC_FLAG@'
+if [[ ${numproc_flag} == @*@ ]]; then
+  numproc_flag='-np'
+fi
+preflags='@MPIEXEC_PREFLAGS@'
+if [[ ${preflags} == @*@ ]]; then
+  unset preflags
+fi
+postflags='@MPIEXEC_POSTFLAGS@'
+if [[ ${postflags} == @*@ ]]; then
+  unset postflags
+fi
+
+usage() {
+  cmd="$(basename "${0}")"
+  echo ""
+  echo " ${cmd} - Coarray Fortran executable launcher for OpenCoarrays"
+  echo ""
+  echo " Usage: ${cmd} [options] ..."
+  echo ""
+  echo " Options:"
+  echo "   --help, -h               Show this help message"
+  echo "   --version, -v, -V        Report version and copyright information"
+  echo "   --wraps, -w,             Report the name of the wrapped compiler"
+  echo "   -np <N>,                 Number of images, N, to execute, N must be a positive integer"
+  echo "   --reenable-auto-cleanup  Turn off failed images support (if library support is present)"
+  echo "                            This option re-enables MPI auto cleanup, which is disabled by"
+  echo "                            by default if GFortran/OpenCoarrays/MPI all support failed"
+  echo "                            images through MPI ULFM. When MPI auto cleanup is disabled and"
+  echo "                            failed image support is present, OpenCoarrays triggers cleanup"
+  echo "                            explicitly when a failed/stopped image is encountered in an"
+  echo "                            image control statement without a \`stat=\` clause."
+  echo ""
+  echo " Example usage:"
+  echo ""
+  echo "   ${cmd} -np 2 foo foo_arg1 foo_arg2"
+  echo "   ${cmd} -v"
+  echo "   ${cmd} --help"
+  echo "   ${cmd} --show"
+  echo "   ${cmd} -s -np 4 my_exe"
+  echo "   ${cmd} -np 4 --reenable-auto-cleanup ./my_exe arg1 arg2"
+  echo ""
+  echo " Notes:"
+  echo "   [options] must be a CAF executable file, one of the above arguments,"
+  echo "   or an argument to the program name returned by caf --wraps"
+  echo ""
+}
+
+i=0
+disable_failed_images=false
+for arg in "${@}"; do
+  ((i+=1))
+  if [[ "${arg}" == "--reenable-auto-cleanup" ]]; then
+    # Strip "--reenable-auto-cleanup" from args
+    set -- "${@:1:$((i - 1))}" "${@:$((i+1)):$((${#} - i))}"
+    if ! ${have_failed_img}; then
+      echo "Library was not built with failed image support, so passing \`--reenable-auto-cleanup\` is a noop" >&2
+    fi
+    disable_failed_images=true
+  fi
+done
+
+if ! ${disable_failed_images}; then
+  if ${have_failed_img}; then
+    if [[ -n "${preflags:-}" ]]; then
+      preflags+=(--disable-auto-cleanup)
+    else
+      preflags=(--disable-auto-cleanup)
+    fi
+  fi
+fi
+
+# Print useage information if caf is invoked without arguments
+if ((${#} == 0)); then
+  usage
+  exit 1
+elif [[ "${1}" == -[vV] || "${1}" == '--version' ]]; then
+  echo ""
+  echo "OpenCoarrays Coarray Fortran Executable Launcher (cafrun version ${caf_version})"
+  echo "Copyright (C) 2015-2016 Sourcery, Inc."
+  echo ""
+  echo "OpenCoarrays comes with NO WARRANTY, to the extent permitted by law."
+  echo "You may redistribute copies of OpenCoarrays under the terms of the"
+  echo "BSD 3-Clause License.  For more information about these matters, see"
+  echo "the file named LICENSE."
+  echo ""
+elif [[ "${1}" == -w || "${1}" == --wraps ]]; then
+  "${CAFRUN}" --version
+elif [[ "${1}" == -h || "${1}" == --help ]]; then
+  usage
+elif [[ "${1}" == -s || "${1}" == --show ]]; then
+  if ((${#} > 4)); then
+    mpiexec_args=("${2:-${numproc_flag}}" "${3:-<number_of_images>}")
+    if [[ -n "${preflags[*]:-}" ]]; then
+      mpiexec_args+=("${preflags[@]}")
+    fi
+    mpiexec_args+=("${4:-/path/to/coarray_Fortran_program}")
+    if [[ -n "${postflags[*]:-}" ]]; then
+      mpiexec_args+=("${postflags[@]}")
+    fi
+    if [[ -n "${*:5:$((${#} - 4))}" ]]; then
+      mpiexec_args+=("${@:5:$((${#} - 4))}")
+    fi
+    echo "${CAFRUN} ${mpiexec_args[*]}"
+  else
+    mpiexec_args=("${2:-${numproc_flag}}" "${3:-<number_of_images>}")
+    if [[ -n "${preflags[*]:-}" ]]; then
+      mpiexec_args+=("${preflags[@]}")
+    fi
+    mpiexec_args+=("${4:-/path/to/coarray_Fortran_program}")
+    if [[ -n "${postflags[*]:-}" ]]; then
+      mpiexec_args+=("${postflags[@]}")
+    fi
+    mpiexec_args+=("[arg4 [arg5 [...]]]")
+    echo "${CAFRUN} ${mpiexec_args[*]}"
+  fi
+elif [[ "${1}" == -np || "${1}" == -n ]]; then
+  # shellcheck disable=SC1001
+  if [[ "${2}" =~ ^[\-0-9]+$ ]] && (( ${2} > 0)) && ((${#} > 2)); then
+    mpiexec_args=("${numproc_flag}" "${2}")
+    if [[ -n "${preflags[*]:-}" ]]; then
+      mpiexec_args+=("${preflags[@]}")
+    fi
+    mpiexec_args+=("${3}")
+    if [[ -n "${postflags[*]:-}" ]]; then
+      mpiexec_args+=("${postflags[@]}")
+    fi
+    if [[ -n "${*:4:$((${#} - 3))}" ]]; then
+      mpiexec_args+=("${@:4:$((${#} - 3))}")
+    fi
+
+    "${CAFRUN}" "${mpiexec_args[@]//''/}"
+  else
+    echo "You must pass \"-np\", \"<number_of_images>\", \"/path/to/coarray_Fortran_program\" as the first 3 arguments to ${cmd}."
+    exit 1
+  fi
+fi
diff --git a/src/libcaf-gfortran-descriptor.h b/src/libcaf-gfortran-descriptor.h
index c9b93bc..d69be51 100644
--- a/src/libcaf-gfortran-descriptor.h
+++ b/src/libcaf-gfortran-descriptor.h
@@ -51,6 +51,9 @@ typedef struct gfc_descriptor_t {
   void *base_addr;
   size_t offset;
   ptrdiff_t dtype;
+#ifdef GCC_GE_8
+  ptrdiff_t span;
+#endif
   descriptor_dimension dim[];
 } gfc_descriptor_t;
 
diff --git a/src/mpi/CMakeLists.txt b/src/mpi/CMakeLists.txt
index fa37b4b..a8678c3 100644
--- a/src/mpi/CMakeLists.txt
+++ b/src/mpi/CMakeLists.txt
@@ -1,5 +1,3 @@
-set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/mod)
-
 if (NOT MPI_C_FOUND)
   find_package(MPI REQUIRED)
 
@@ -19,7 +17,7 @@ elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI")
 endif()
 
 if(gfortran_compiler AND (NOT opencoarrays_aware_compiler))
-  # This applied to gfortran 4.9 and some earlier versions (FIX ME: find out which)
+  # This applied to gfortran < 5.2
   add_definitions(-DCOMPILER_SUPPORTS_CAF_INTRINSICS)
 endif()
 
@@ -38,8 +36,32 @@ endif()
 #----------------------------------------------------------------------
 # Test if MPI implementation provides features needed for failed images
 #----------------------------------------------------------------------
-set(NEEDED_SYMBOLS MPIX_ERR_PROC_FAILED;MPIX_ERR_REVOKED;MPIX_Comm_failure_ack;MPIX_Comm_failure_get_acked;MPIX_Comm_shrink;MPIX_Comm_agree)
 set(MPI_HAS_FAULT_TOL_EXT YES)
+
+CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
+if (NOT HAVE_SIGNAL_H)
+  set(MPI_HAS_FAULT_TOL_EXT NO)
+  message( FATAL_ERROR "Currently, OpenCoarrays cannot build without signal.h")
+endif()
+
+include(CheckSymbolExists)
+CHECK_SYMBOL_EXISTS(SIGKILL "signal.h" HAVE_SIGKILL)
+if(NOT HAVE_SIGKILL) # try -D_POSIX, needed for mingw-w64, maybe others, see #435
+                     # https://github.com/sourceryinstitute/OpenCoarrays/issues/435#issuecomment-323592433
+  list( APPEND CMAKE_REQUIRED_DEFINITIONS -D_POSIX)
+  CHECK_SYMBOL_EXISTS(SIGKILL "signal.h" HAVE_SIGKILL)
+  if(HAVE_SIGKILL)
+    add_definitions(-D_POSIX)
+  endif()
+endif()
+
+if (NOT HAVE_SIGKILL)
+  set(MPI_HAS_FAULT_TOL_EXT NO)
+  message (FATAL_ERROR "Currently, OpenCoarrays cannot build without SIGKILL from signal.h")
+endif()
+
+set(NEEDED_SYMBOLS MPIX_ERR_PROC_FAILED;MPIX_ERR_REVOKED;MPIX_Comm_failure_ack;MPIX_Comm_failure_get_acked;MPIX_Comm_shrink;MPIX_Comm_agree)
+
 set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}")
 if(CMAKE_REQUIRED_INCLUDES)
   set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH})
@@ -60,14 +82,15 @@ else()
 endif()
 
 set(MPI_HEADERS mpi.h)
-CHECK_INCLUDE_FILE("mpi-ext.h" HAVE_MPI_EXT)
+include(CheckIncludeFiles)
+CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT)
 if(HAVE_MPI_EXT)
   add_definitions(-DHAVE_MPI_EXT_H)
   set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h)
 endif()
-include(CheckSymbolExists)
+
 foreach(symbol ${NEEDED_SYMBOLS})
-  CHECK_SYMBOL_EXISTS(${symbol} ${MPI_HEADERS} HAVE_${symbol})
+  CHECK_SYMBOL_EXISTS(${symbol} "${MPI_HEADERS}" HAVE_${symbol})
   if(NOT HAVE_${symbol})
     message( STATUS "\${HAVE_${symbol}} = ${HAVE_${symbol}}")
     message( WARNING "Disabling Failed Image support due to lack of support in the current MPI implementation.")
@@ -89,96 +112,119 @@ if(CAF_ENABLE_FAILED_IMAGES)
   add_definitions(-DUSE_FAILED_IMAGES)
 endif()
 
-# Determine whether and how to include OpenCoarrays module based on if the Fortran MPI compiler:
-#   - workds
-#   - is compatible with the fortran compiler used to build the MPI implementation
-if (MPI_Fortran_MODULE_COMPILES)
-  # likely the same compiler compiled MPI
-  set(MPI_CAF_FORTRAN_FILES ../extensions/opencoarrays.F90)
+#---------------------------------------------------
+# Windows Intel MPI compatibility, see GH issue #435
+#---------------------------------------------------
+CHECK_SYMBOL_EXISTS(I_MPI_VERSION mpi.h HAVE_Intel_MPI)
+if(HAVE_Intel_MPI AND WIN32)
+  add_definitions(-DUSE_GCC)
 endif()
 
-add_library(caf_mpi mpi_caf.c ../common/caf_auxiliary.c ${MPI_CAF_FORTRAN_FILES})
+
+add_library(opencoarrays_mod OBJECT ../extensions/opencoarrays.F90)
+set_target_properties(opencoarrays_mod
+  PROPERTIES
+  Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}"
+  POSITION_INDEPENDENT_CODE TRUE)
+
+add_library(caf_mpi SHARED mpi_caf.c ../common/caf_auxiliary.c $<TARGET_OBJECTS:opencoarrays_mod>)
+add_library(caf_mpi_static STATIC  mpi_caf.c ../common/caf_auxiliary.c $<TARGET_OBJECTS:opencoarrays_mod>)
 target_link_libraries(caf_mpi PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES})
+target_link_libraries(caf_mpi_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES})
+
+set(CAF_SO_VERSION 0)
+if(gfortran_compiler)
+  if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0)
+    set(CAF_SO_VERSION 2)
+  elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0)
+    set(CAF_SO_VERSION 1)
+  endif()
+endif()
 
 set_target_properties ( caf_mpi
   PROPERTIES
-  SOVERSION ${PROJECT_VERSION.MAJOR}.${PROJECT_VERSION.MINOR}
-  VERSION ${PROJECT_VERSION}
-  )
+  SOVERSION ${CAF_SO_VERSION}
+#  VERSION ${PROJECT_VERSION}
+)
+
+# Create a symlink in the include dir
+add_custom_command(TARGET caf_mpi
+  POST_BUILD
+  COMMAND ${CMAKE_COMMAND} -E create_symlink "./${mod_dir_tail}/opencoarrays.mod" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/opencaorrays.mod"
+  COMMENT "Creating symlink ${CMAKE_INSTALL_INCLUDEDIR}/opencaorrays.mod --> ${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}/opencoarrays.mod")
 
+install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+  FILES_MATCHING PATTERN "*.mod")
+
+set_target_properties( caf_mpi_static
+  PROPERTIES
+  SOVERSION ${CAF_SO_VERSION}
+#  VERSION ${PROJECT_VERSION}
+)
 
 if (gfortran_compiler)
   target_compile_options(caf_mpi INTERFACE -fcoarray=lib)
+  target_compile_options(caf_mpi_static INTERFACE -fcoarray=lib)
 endif()
 
-include_directories(${CMAKE_BINARY_DIR}/mod)
-
 install(TARGETS caf_mpi EXPORT OpenCoarraysTargets
-  ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+  DESTINATION "${CMAKE_INSTALL_LIBDIR}"
   LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
 )
-
-# Install modules to standard include dir, but namespace them with compiler/version
-set (mod_install "OpenCoarrays/${CMAKE_Fortran_COMPILER_ID}/${CMAKE_Fortran_COMPILER_VERSION}")
-install(DIRECTORY  "${CMAKE_BINARY_DIR}/mod/"
-  DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/${mod_install}"
-  FILES_MATCHING PATTERN "*.mod"
-)
-
-# Now add a link in standard include dir so that compilers will find by default... this may or may not actually be a good idea...
-if ( "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" )
-  INSTALL(CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ${mod_install}/opencoarrays.mod \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_INCLUDEDIR}/opencoarrays.mod )"
+install(TARGETS caf_mpi_static EXPORT OpenCoarraysTargets
+  ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
   )
-endif ()
-
-# Now we write the script that passes CAF source to the compiler with the necessary arguments
-# and, if necessary, performs some code transformations prior to invoking the compiler.
-set(exe_dir ${CMAKE_BINARY_DIR}/bin_staging)
-set(compiler_wrapper ${exe_dir}/caf)
-install(
-    FILES "${compiler_wrapper}"
-    PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
-    DESTINATION "${CMAKE_INSTALL_BINDIR}"
-)
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/caf-head CAF_HEADER)
-file(WRITE  "${compiler_wrapper}" "${CAF_HEADER}\n")
-file(APPEND "${compiler_wrapper}"  "caf_mod_dir=\"${CMAKE_INSTALL_FULL_INCLUDEDIR}/mod\"\n")
-file(APPEND "${compiler_wrapper}"  "caf_lib_dir=\"${CMAKE_INSTALL_FULL_LIBDIR}\"\n")
-file(APPEND "${compiler_wrapper}"  "caf_version=${full_git_describe}\n")
-if(gfortran_compiler)
-  file(APPEND "${compiler_wrapper}"  "link_args='-fcoarray=lib -lcaf_mpi'\n")
-elseif(portland_group_compiler)
-  file(APPEND "${compiler_wrapper}"  "link_args=-lcaf_mpi\n")
-endif()
-if(opencoarrays_aware_compiler)
-  file(APPEND "${compiler_wrapper}"  "caf_compiler=true\n")
-else()
-  file(APPEND "${compiler_wrapper}"  "caf_compiler=false\n")
-endif()
 
-if ( DEFINED ENV{FC} )
-  file(APPEND "${compiler_wrapper}"  "CAFC=${MPI_Fortran_COMPILER}\n")
-endif ()
 
-if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
-  file(APPEND "${compiler_wrapper}"  "linux=true\n")
+##############################################
+# Configure `caf` and `cafrun` wrapper scripts
+##############################################
+# List of caf.in variables needing configuration:
+#
+# @CAF_VERSION@ @opencoarrays_aware_compiler@ @Fortran_COMPILER@ @CAF_MODDIR@
+# @MPI_Fortran_LINK_FLAGS@ @MPI_Fortran_COMPILE_FLAGS@
+# @CAF_LIBS@ @MPI_LIBS@
+#
+
+set(CAF_VERSION "${full_git_describe}")
+set(Fortran_COMPILER "${CMAKE_Fortran_COMPILER}")
+set(CAF_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}")
+set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}")
+set(MPI_LIBS "")
+foreach( lib IN LISTS MPI_Fortran_LIBRARIES)
+  set(MPI_LIBS "${MPI_LIBS} \"${lib}\"")
+endforeach()
+string(STRIP "${MPI_LIBS}" MPI_LIBS)
+set_target_properties(caf_mpi_static
+  PROPERTIES OUTPUT_NAME caf_mpi)
+get_target_property(libcaf_static caf_mpi_static OUTPUT_NAME)
+set(CAF_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libcaf_static}${CMAKE_STATIC_LIBRARY_SUFFIX}")
+
+configure_file("${CMAKE_SOURCE_DIR}/src/extensions/caf.in" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf"
+  @ONLY)
+
+
+# List of carrun.in variables needing configuration:
+#
+# @CAF_VERSION@ @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ @MPIEXEC_PREFLAGS@ @MPIEXEC_POSTFLAGS@
+# @HAVE_FAILED_IMG@
+#
+
+if(CAF_ENABLE_FAILED_IMAGES)
+  set(HAVE_FAILED_IMG "true")
+else()
+  set(HAVE_FAILED_IMG "false")
 endif()
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/caf-foot FOOTER)
-file(APPEND "${compiler_wrapper}" "${FOOTER}")
 
-# Now we write the script that launches executable files produced from CAF codes
-set(caf_launcher ${exe_dir}/cafrun)
-install(
-    FILES "${caf_launcher}"
-    PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
-    DESTINATION "${CMAKE_INSTALL_BINDIR}"
-)
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/cafrun-head CAFRUN_HEADER)
-file(WRITE  "${caf_launcher}" "${CAFRUN_HEADER}\n")
-file(APPEND "${caf_launcher}"  "caf_version=${full_git_describe}\n")
-file(APPEND "${caf_launcher}"  "CAFRUN=${MPIEXEC}\n")
+configure_file("${CMAKE_SOURCE_DIR}/src/extensions/cafrun.in" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun"
+  @ONLY)
 
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/cafrun-foot FOOTER)
-file(APPEND "${caf_launcher}" "${FOOTER}")
+install(PROGRAMS "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun"
+  "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf"
+  DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
 
-#set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${exe_dir}/cafrun;${exe_dir}/caf;${exe_dir}/test-caf-tally.sh")
+lint_script("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" caf)
+check_script_style("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf")
+lint_script("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" cafrun)
+check_script_style("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun")
diff --git a/src/mpi/mpi_caf.c b/src/mpi/mpi_caf.c
index 01c5825..d981420 100644
--- a/src/mpi/mpi_caf.c
+++ b/src/mpi/mpi_caf.c
@@ -2703,9 +2703,7 @@ copy_data (void *ds, mpi_caf_token_t *token, MPI_Aint offset, int dst_type,
     This typedef is made to allow storing a copy of a remote descriptor on the
     stack without having to care about the rank.  */
 typedef struct gfc_max_dim_descriptor_t {
-  void *base_addr;
-  size_t offset;
-  ptrdiff_t dtype;
+  gfc_descriptor_t base;
   descriptor_dimension dim[GFC_MAX_DIMENSIONS];
 } gfc_max_dim_descriptor_t;
 
@@ -3838,11 +3836,14 @@ PREFIX(is_present) (caf_token_t token, int image_index, caf_reference_t *refs)
                        MPI_BYTE, global_dynamic_win);
             }
 #ifdef EXTRA_DEBUG_OUTPUT
-          fprintf (stderr, "%d/%d: %s() remote desc rank: %d (ref_rank: %d)\n", caf_this_image, caf_num_images,
-                   __FUNCTION__, GFC_DESCRIPTOR_RANK (&src_desc), ref_rank);
-          for (i = 0; i < GFC_DESCRIPTOR_RANK (&src_desc); ++i)
-            fprintf (stderr, "%d/%d: %s() remote desc dim[%d] = (lb = %d, ub = %d, stride = %d)\n", caf_this_image, caf_num_images,
-                     __FUNCTION__, i, src_desc.dim[i].lower_bound, src_desc.dim[i]._ubound, src_desc.dim[i]._stride);
+          {
+            gfc_descriptor_t * src = (gfc_descriptor_t *)(&src_desc);
+            fprintf (stderr, "%d/%d: %s() remote desc rank: %d (ref_rank: %d)\n", caf_this_image, caf_num_images,
+                     __FUNCTION__, GFC_DESCRIPTOR_RANK (src), ref_rank);
+            for (i = 0; i < GFC_DESCRIPTOR_RANK (src); ++i)
+              fprintf (stderr, "%d/%d: %s() remote desc dim[%d] = (lb = %d, ub = %d, stride = %d)\n", caf_this_image, caf_num_images,
+                       __FUNCTION__, i, src_desc.dim[i].lower_bound, src_desc.dim[i]._ubound, src_desc.dim[i]._stride);
+          }
 #endif
 
           for (i = 0; riter->u.a.mode[i] != CAF_ARR_REF_NONE; ++i)
@@ -4136,7 +4137,7 @@ static void \
 redux_char_by_reference_adapter (void *invec, void *inoutvec, int *len,
       MPI_Datatype *datatype)
 {
-  long int string_len;
+  MPI_Aint string_len;
   MPI_Type_extent(*datatype, &string_len);
   for(int i = 0; i < *len; i++)
     {
diff --git a/src/tests/integration/coarrayHelloWorld/CMakeLists.txt b/src/tests/integration/coarrayHelloWorld/CMakeLists.txt
index 9bcf8bb..30dfce7 100644
--- a/src/tests/integration/coarrayHelloWorld/CMakeLists.txt
+++ b/src/tests/integration/coarrayHelloWorld/CMakeLists.txt
@@ -1,2 +1 @@
-add_executable(hello_multiverse hello_multiverse.F90)
-target_link_libraries(hello_multiverse OpenCoarrays)
+caf_compile_executable(hello_multiverse hello_multiverse.F90)
diff --git a/src/tests/integration/dist_transpose/CMakeLists.txt b/src/tests/integration/dist_transpose/CMakeLists.txt
index 807ba4d..e3752e1 100644
--- a/src/tests/integration/dist_transpose/CMakeLists.txt
+++ b/src/tests/integration/dist_transpose/CMakeLists.txt
@@ -2,8 +2,7 @@ if (HIGH_RESOLUTION_TIMER)
   add_definitions(-DHAVE_WALLTIME)
   set(walltime_o walltime.o)
 endif()
-add_executable(coarray_distributed_transpose
+caf_compile_executable(coarray_distributed_transpose
   coarray_distributed_transpose.F90
   ${walltime_o}
   )
-target_link_libraries(coarray_distributed_transpose OpenCoarrays)
diff --git a/src/tests/integration/dist_transpose/coarray_distributed_transpose.F90 b/src/tests/integration/dist_transpose/coarray_distributed_transpose.F90
index a06692a..586bc57 100644
--- a/src/tests/integration/dist_transpose/coarray_distributed_transpose.F90
+++ b/src/tests/integration/dist_transpose/coarray_distributed_transpose.F90
@@ -34,31 +34,13 @@
 !==================  test transposes with integer x,y,z values  ===============================
 module run_size
     use iso_fortran_env
-#ifndef HAVE_WALLTIME
-#  ifdef MPI_WORKING_MODULE
-     use MPI, only : WALLTIME=>MPI_WTIME
-     implicit none
-#  else
-     implicit none
-     include 'mpif.h'
-#    define WALLTIME MPI_WTIME
-#  endif
-#else
-  implicit none
-#endif
-        integer(int64), codimension[*] :: nx, ny, nz
-        integer(int64), codimension[*] :: my, mx, first_y, last_y, first_x, last_x
-        integer(int64) :: my_node, num_nodes
-        real(real64), codimension[*] :: tran_time
-
-#ifdef HAVE_WALLTIME
-interface
-   function WALLTIME() bind(C, name = "WALLTIME")
-   use iso_fortran_env
-       real(real64) :: WALLTIME
-   end function WALLTIME
-end interface
-#endif
+    implicit none
+
+    integer(int64), codimension[*] :: nx, ny, nz
+    integer(int64), codimension[*] :: my, mx, first_y, last_y, first_x, last_x
+    integer(int64) :: my_node, num_nodes
+    real(real64), codimension[*] :: tran_time
+
 
 contains
 
@@ -226,9 +208,11 @@ contains
     implicit none
 
     integer(int64) :: i,stage
+    real(real64) :: tmp
 
     sync all   !--  wait for other nodes to finish compute
-    tran_time = tran_time - WALLTIME()
+    call cpu_time(tmp)
+    tran_time = tran_time - tmp
 
     call copy3 (    u(1,1,first_x,1+(my_node-1)*my) &                   !-- intra-node transpose
                 ,  ur(1,1,first_y,1+(my_node-1)*mx) &                   !-- no inter-node transpose needed
@@ -262,7 +246,8 @@ contains
 #endif
 
     sync all     !--  wait for other nodes to finish transpose
-    tran_time = tran_time + WALLTIME()
+    call cpu_time(tmp)
+    tran_time = tran_time + tmp
 
  end  subroutine transpose_X_Y
 
@@ -273,9 +258,11 @@ subroutine transpose_Y_X
     implicit none
 
     integer(int64) :: i, stage
+    real(real64) :: tmp
 
     sync all   !--  wait for other nodes to finish compute
-    tran_time = tran_time - WALLTIME()
+    call cpu_time(tmp)
+    tran_time = tran_time - tmp
 
     call copy3 (   ur(1,1,first_y,1+(my_node-1)*mx) &                   !-- intra-node transpose
                 ,   u(1,1,first_x,1+(my_node-1)*my) &                   !-- no inter-node transpose needed
@@ -309,7 +296,8 @@ subroutine transpose_Y_X
 #endif
 
     sync all     !--  wait for other nodes to finish transpose
-    tran_time = tran_time + WALLTIME()
+    call cpu_time(tmp)
+    tran_time = tran_time + tmp
 
  end  subroutine transpose_Y_X
 
diff --git a/src/tests/integration/events/CMakeLists.txt b/src/tests/integration/events/CMakeLists.txt
index db38a98..fafb1cb 100644
--- a/src/tests/integration/events/CMakeLists.txt
+++ b/src/tests/integration/events/CMakeLists.txt
@@ -1,2 +1 @@
-add_executable(asynchronous_hello_world async-hello.F90)
-target_link_libraries(asynchronous_hello_world OpenCoarrays)
+caf_compile_executable(asynchronous_hello_world async-hello.F90)
diff --git a/src/tests/integration/pde_solvers/coarrayBurgers/CMakeLists.txt b/src/tests/integration/pde_solvers/coarrayBurgers/CMakeLists.txt
index a5d09dd..bd83ed6 100644
--- a/src/tests/integration/pde_solvers/coarrayBurgers/CMakeLists.txt
+++ b/src/tests/integration/pde_solvers/coarrayBurgers/CMakeLists.txt
@@ -18,6 +18,7 @@ else()
   message ("Unknown Fortran compiler: ${CMAKE_Fortran_COMPILER_ID}")
 endif()
 
+set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf")
 add_executable(coarray_burgers_pde
   main.F90
   global_field.F90
@@ -26,5 +27,5 @@ add_executable(coarray_burgers_pde
   ${library_directory}/object_interface.F90
   ${library_directory}/co_object_interface.F90
 )
-target_link_libraries(coarray_burgers_pde OpenCoarrays)
+add_dependencies(coarray_burgers_pde caf_mpi_static)
 target_include_directories(coarray_burgers_pde PRIVATE ${config_directory})
diff --git a/src/tests/integration/pde_solvers/coarrayHeatSimplified/CMakeLists.txt b/src/tests/integration/pde_solvers/coarrayHeatSimplified/CMakeLists.txt
index 84c8ffc..84ec5e2 100644
--- a/src/tests/integration/pde_solvers/coarrayHeatSimplified/CMakeLists.txt
+++ b/src/tests/integration/pde_solvers/coarrayHeatSimplified/CMakeLists.txt
@@ -1,6 +1,11 @@
+set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf")
+add_library(local_field OBJECT local_field.f90)
+add_library(global_field OBJECT global_field.f90)
+add_dependencies(local_field caf_mpi_static)
+add_dependencies(global_field local_field caf_mpi_static)
 add_executable(co_heat
   main.f90
-  global_field.f90
-  local_field.f90
+  $<TARGET_OBJECTS:local_field>
+  $<TARGET_OBJECTS:global_field>
 )
-target_link_libraries(co_heat OpenCoarrays)
+add_dependencies(co_heat caf_mpi_static)
diff --git a/src/tests/integration/pde_solvers/navier-stokes/CMakeLists.txt b/src/tests/integration/pde_solvers/navier-stokes/CMakeLists.txt
index bb02a91..2e48c95 100644
--- a/src/tests/integration/pde_solvers/navier-stokes/CMakeLists.txt
+++ b/src/tests/integration/pde_solvers/navier-stokes/CMakeLists.txt
@@ -8,12 +8,11 @@ if ( ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64") AND ("${CMAKE_SYSTEM_NAME}"
       message(WARNING "Attempting to use libfft_avx.a, which only works on recent x86 architectures.")
       set(fft_library ${CMAKE_CURRENT_SOURCE_DIR}/libfft_avx.a )
     endif()
-    add_executable( coarray_navier_stokes
-      EXCLUDE_FROM_ALL
+    caf_compile_executable( coarray_navier_stokes
       coarray-shear_coll.F90
       ${walltime_o}
+      ${fft_library}
     )
-    target_link_libraries(coarray_navier_stokes OpenCoarrays ${fft_library})
   endif()
 else()
   # Skip Navier-Stokes build until an appropriate FFT has been found.
diff --git a/src/tests/regression/reported/CMakeLists.txt b/src/tests/regression/reported/CMakeLists.txt
index 336df9f..930a82c 100644
--- a/src/tests/regression/reported/CMakeLists.txt
+++ b/src/tests/regression/reported/CMakeLists.txt
@@ -1,20 +1,7 @@
-add_executable(co_reduce-factorial issue-172-wrong-co_reduce.f90)
-target_link_libraries(co_reduce-factorial OpenCoarrays)
-
-add_executable(co_reduce-factorial-int8 issue-172-wrong-co_reduce-int8.f90)
-target_link_libraries(co_reduce-factorial-int8 OpenCoarrays)
-
-add_executable(co_reduce-factorial-int64 issue-172-wrong-co_reduce-int64.f90)
-target_link_libraries(co_reduce-factorial-int64 OpenCoarrays)
-
-add_executable(source-alloc-sync issue-243-source-allocation-no-sync.f90)
-target_link_libraries(source-alloc-sync OpenCoarrays)
-
-add_executable(convert-before-put issue-292-convert-type-before-put.f90)
-target_link_libraries(convert-before-put OpenCoarrays)
-
-add_executable(issue-422-send issue-422-send.F90)
-target_link_libraries(issue-422-send OpenCoarrays)
-
-add_executable(issue-422-send-get issue-422-send-get.F90)
-target_link_libraries(issue-422-send-get OpenCoarrays)
+caf_compile_executable(co_reduce-factorial issue-172-wrong-co_reduce.f90)
+caf_compile_executable(co_reduce-factorial-int8 issue-172-wrong-co_reduce-int8.f90)
+caf_compile_executable(co_reduce-factorial-int64 issue-172-wrong-co_reduce-int64.f90)
+caf_compile_executable(source-alloc-sync issue-243-source-allocation-no-sync.f90)
+caf_compile_executable(convert-before-put issue-292-convert-type-before-put.f90)
+caf_compile_executable(issue-422-send issue-422-send.F90)
+caf_compile_executable(issue-422-send-get issue-422-send-get.F90)
diff --git a/src/tests/unit/collectives/CMakeLists.txt b/src/tests/unit/collectives/CMakeLists.txt
index d565cf6..47244bc 100644
--- a/src/tests/unit/collectives/CMakeLists.txt
+++ b/src/tests/unit/collectives/CMakeLists.txt
@@ -1,20 +1,7 @@
-add_executable(co_sum_test co_sum.F90)
-target_link_libraries(co_sum_test OpenCoarrays)
-
-add_executable(co_broadcast_test co_broadcast.F90)
-target_link_libraries(co_broadcast_test OpenCoarrays)
-
-add_executable(co_min_test co_min.F90)
-target_link_libraries(co_min_test OpenCoarrays)
-
-add_executable(co_max_test co_max.F90)
-target_link_libraries(co_max_test OpenCoarrays)
-
-add_executable(co_reduce_test co_reduce.F90)
-target_link_libraries(co_reduce_test OpenCoarrays)
-
-add_executable(co_reduce_res_im co_reduce_res_im.f90)
-target_link_libraries(co_reduce_res_im OpenCoarrays)
-
-add_executable(co_reduce_string co_reduce_string.f90)
-target_link_libraries(co_reduce_string OpenCoarrays)
+caf_compile_executable(co_sum_test co_sum.F90)
+caf_compile_executable(co_broadcast_test co_broadcast.F90)
+caf_compile_executable(co_min_test co_min.F90)
+caf_compile_executable(co_max_test co_max.F90)
+caf_compile_executable(co_reduce_test co_reduce.F90)
+caf_compile_executable(co_reduce_res_im co_reduce_res_im.f90)
+caf_compile_executable(co_reduce_string co_reduce_string.f90)
diff --git a/src/tests/unit/events/CMakeLists.txt b/src/tests/unit/events/CMakeLists.txt
index 601a47d..063a6cc 100644
--- a/src/tests/unit/events/CMakeLists.txt
+++ b/src/tests/unit/events/CMakeLists.txt
@@ -1,8 +1,2 @@
-# Fortran tests
-
-add_executable(allocatable_p2p_event_post allocatable_p2p_event_post.f90)
-target_link_libraries(allocatable_p2p_event_post OpenCoarrays)
-
-add_executable(static_event_post_issue_293 static_event_post_issue_293.f90)
-target_link_libraries(static_event_post_issue_293 OpenCoarrays)
-
+caf_compile_executable(allocatable_p2p_event_post allocatable_p2p_event_post.f90)
+caf_compile_executable(static_event_post_issue_293 static_event_post_issue_293.f90)
diff --git a/src/tests/unit/fail_images/CMakeLists.txt b/src/tests/unit/fail_images/CMakeLists.txt
index 0bc5d01..dc70fc2 100644
--- a/src/tests/unit/fail_images/CMakeLists.txt
+++ b/src/tests/unit/fail_images/CMakeLists.txt
@@ -1,27 +1,12 @@
-add_executable(image_fail_test_1 image_fail_test_1.f90)
-target_link_libraries(image_fail_test_1 OpenCoarrays)
-
-add_executable(image_status_test_1 image_status_test_1.f90)
-target_link_libraries(image_status_test_1 OpenCoarrays)
-
-add_executable(image_fail_and_sync_test_1 image_fail_and_sync_test_1.f90)
-target_link_libraries(image_fail_and_sync_test_1 OpenCoarrays)
-
-add_executable(image_fail_and_sync_test_2 image_fail_and_sync_test_2.f90)
-target_link_libraries(image_fail_and_sync_test_2 OpenCoarrays)
-
-add_executable(image_fail_and_sync_test_3 image_fail_and_sync_test_3.f90)
-target_link_libraries(image_fail_and_sync_test_3 OpenCoarrays)
-
-add_executable(image_fail_and_status_test_1 image_fail_and_status_test_1.f90)
-target_link_libraries(image_fail_and_status_test_1 OpenCoarrays)
-
-add_executable(image_fail_and_get_test_1 image_fail_and_get_test_1.f90)
-target_link_libraries(image_fail_and_get_test_1 OpenCoarrays)
-
-add_executable(image_fail_and_failed_images_test_1 image_fail_and_failed_images_test_1.f90)
-target_link_libraries(image_fail_and_failed_images_test_1 OpenCoarrays)
-
-add_executable(image_fail_and_stopped_images_test_1 image_fail_and_stopped_images_test_1.f90)
-target_link_libraries(image_fail_and_stopped_images_test_1 OpenCoarrays)
-
+caf_compile_executable(image_status_test_1 image_status_test_1.f90)
+
+# The following tests require special flag passed to MPI runtime:
+# `-disable-auto-cleanup`
+caf_compile_executable(image_fail_test_1 image_fail_test_1.f90)
+caf_compile_executable(image_fail_and_sync_test_1 image_fail_and_sync_test_1.f90)
+caf_compile_executable(image_fail_and_sync_test_2 image_fail_and_sync_test_2.f90)
+caf_compile_executable(image_fail_and_sync_test_3 image_fail_and_sync_test_3.f90)
+caf_compile_executable(image_fail_and_status_test_1 image_fail_and_status_test_1.f90)
+caf_compile_executable(image_fail_and_get_test_1 image_fail_and_get_test_1.f90)
+caf_compile_executable(image_fail_and_failed_images_test_1 image_fail_and_failed_images_test_1.f90)
+caf_compile_executable(image_fail_and_stopped_images_test_1 image_fail_and_stopped_images_test_1.f90)
diff --git a/src/tests/unit/init_register/CMakeLists.txt b/src/tests/unit/init_register/CMakeLists.txt
index 13e8ddb..c1ab7f8 100644
--- a/src/tests/unit/init_register/CMakeLists.txt
+++ b/src/tests/unit/init_register/CMakeLists.txt
@@ -1,40 +1,25 @@
-add_executable(initialize_mpi initialize_mpi.F90)
-target_link_libraries(initialize_mpi OpenCoarrays)
-
-add_executable(register register.f90)
-target_link_libraries(register OpenCoarrays)
-
-add_executable(register_vector register_vector.f90)
-target_link_libraries(register_vector OpenCoarrays)
-
-add_executable(register_alloc_vector register_alloc_vector.f90)
-target_link_libraries(register_alloc_vector OpenCoarrays)
-
-add_executable(allocate_as_barrier allocate_as_barrier.f90)
-target_link_libraries(allocate_as_barrier OpenCoarrays)
-
-add_executable(allocate_as_barrier_proc allocate_as_barrier_proc.f90)
-target_link_libraries(allocate_as_barrier_proc OpenCoarrays)
-
-if (gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7))
-  add_executable(async_comp_alloc async_comp_alloc.f90)
-  target_link_libraries(async_comp_alloc OpenCoarrays)
-
-  add_executable(async_comp_alloc_2 async_comp_alloc_2.f90)
-  target_link_libraries(async_comp_alloc_2 OpenCoarrays)
-
-  add_executable(register_alloc_comp_1 register_alloc_comp_1.f90)
-  target_link_libraries(register_alloc_comp_1 OpenCoarrays)
-
-  add_executable(register_alloc_comp_2 register_alloc_comp_2.f90)
-  target_link_libraries(register_alloc_comp_2 OpenCoarrays)
-
-  add_executable(register_alloc_comp_3 register_alloc_comp_3.f90)
-  target_link_libraries(register_alloc_comp_3 OpenCoarrays)
-
-  add_executable(comp_allocated_1 comp_allocated_1.f90)
-  target_link_libraries(comp_allocated_1 OpenCoarrays)
-
-  add_executable(comp_allocated_2 comp_allocated_2.f90)
-  target_link_libraries(comp_allocated_2 OpenCoarrays)
+caf_compile_executable(initialize_mpi initialize_mpi.F90)
+caf_compile_executable(register register.f90)
+caf_compile_executable(register_vector register_vector.f90)
+caf_compile_executable(register_alloc_vector register_alloc_vector.f90)
+caf_compile_executable(allocate_as_barrier allocate_as_barrier.f90)
+caf_compile_executable(allocate_as_barrier_proc allocate_as_barrier_proc.f90)
+
+if (gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0))
+  caf_compile_executable(async_comp_alloc async_comp_alloc.f90)
+  caf_compile_executable(async_comp_alloc_2 async_comp_alloc_2.f90)
+  caf_compile_executable(register_alloc_comp_1 register_alloc_comp_1.f90)
+  caf_compile_executable(register_alloc_comp_2 register_alloc_comp_2.f90)
+  caf_compile_executable(register_alloc_comp_3 register_alloc_comp_3.f90)
+  caf_compile_executable(comp_allocated_1 comp_allocated_1.f90)
+  caf_compile_executable(comp_allocated_2 comp_allocated_2.f90)
+elseif((CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}))
+  message( AUTHOR_WARNING "Skipping building the following tests due to GFortran < 7.x lack of compatibility:
+    async_comp_alloc.f90
+    async_comp_alloc_2.f90
+    register_alloc_comp_1.f90
+    register_alloc_comp_2.f90
+    register_alloc_comp_3.f90
+    comp_allocated_1.f90
+    comp_allocated_2.f90" )
 endif()
diff --git a/src/tests/unit/init_register/async_comp_alloc_2.f90 b/src/tests/unit/init_register/async_comp_alloc_2.f90
index d4243c8..501069c 100644
--- a/src/tests/unit/init_register/async_comp_alloc_2.f90
+++ b/src/tests/unit/init_register/async_comp_alloc_2.f90
@@ -11,6 +11,8 @@ program async_comp_alloc_2
 
   sync all
 
+  if ( num_images() < 2 ) error stop "Test async_comp_alloc_2 requires at least 2 images to run"
+
   associate(me => this_image())
     if (me == 2) then
       allocate(parent_obj%arr(3))
diff --git a/src/tests/unit/init_register/initialize_mpi.F90 b/src/tests/unit/init_register/initialize_mpi.F90
index 074b754..732e9bc 100644
--- a/src/tests/unit/init_register/initialize_mpi.F90
+++ b/src/tests/unit/init_register/initialize_mpi.F90
@@ -50,7 +50,9 @@ program initialize_mpi
   call MPI_COMM_SIZE(MPI_COMM_WORLD,np,ierr)
 
   ! Everybody verifies that they have a valid image number and rank
-  if(me < 1 .or. np < 1) error stop "Test failed."
+  if(me < 1 .or. np < 1 .or. me > np) error stop "Test failed."
+
+  sync all
 
   ! Image 1 reports test success
   if(me==1) print *,"Test passed."
diff --git a/src/tests/unit/send-get/CMakeLists.txt b/src/tests/unit/send-get/CMakeLists.txt
index 9717bff..43611ab 100644
--- a/src/tests/unit/send-get/CMakeLists.txt
+++ b/src/tests/unit/send-get/CMakeLists.txt
@@ -1,23 +1,11 @@
-add_executable(get_array get_array_test.f90)
-target_link_libraries(get_array OpenCoarrays)
+caf_compile_executable(get_array get_array_test.f90)
 
-#add_executable(get old_get_array_test.f90)
+#caf_compile_executable(get old_get_array_test.f90)
 #target_link_libraries(is_this_still_needed OpenCoarrays)
 
-add_executable(get_self sameloc.f90)
-target_link_libraries(get_self OpenCoarrays)
-
-add_executable(send_array send_array_test.f90)
-target_link_libraries(send_array OpenCoarrays)
-
-add_executable(get_with_offset_1d get_with_offset_1d.f90)
-target_link_libraries(get_with_offset_1d OpenCoarrays)
-
-add_executable(whole_get_array whole_get_array.f90)
-target_link_libraries(whole_get_array OpenCoarrays)
-
-add_executable(strided_get strided_get.f90)
-target_link_libraries(strided_get OpenCoarrays)
-
-add_executable(strided_sendget strided_sendget.f90)
-target_link_libraries(strided_sendget OpenCoarrays)
+caf_compile_executable(get_self sameloc.f90)
+caf_compile_executable(send_array send_array_test.f90)
+caf_compile_executable(get_with_offset_1d get_with_offset_1d.f90)
+caf_compile_executable(whole_get_array whole_get_array.f90)
+caf_compile_executable(strided_get strided_get.f90)
+caf_compile_executable(strided_sendget strided_sendget.f90)
diff --git a/src/tests/unit/simple/CMakeLists.txt b/src/tests/unit/simple/CMakeLists.txt
index 85159af..4f67eec 100644
--- a/src/tests/unit/simple/CMakeLists.txt
+++ b/src/tests/unit/simple/CMakeLists.txt
@@ -1,10 +1,7 @@
 # Fortran tests
 
-add_executable(increment_my_neighbor test1Caf.f90)
-target_link_libraries(increment_my_neighbor OpenCoarrays)
-
-add_executable(atomics testAtomics.f90)
-target_link_libraries(atomics OpenCoarrays)
+caf_compile_executable(increment_my_neighbor increment_neighbor.f90)
+caf_compile_executable(atomics testAtomics.f90)
 
 # C tests
 #include(CMakeForceCompiler)
diff --git a/src/tests/unit/simple/test1Caf.f90 b/src/tests/unit/simple/increment_neighbor.f90
similarity index 100%
rename from src/tests/unit/simple/test1Caf.f90
rename to src/tests/unit/simple/increment_neighbor.f90
diff --git a/src/tests/unit/sync/CMakeLists.txt b/src/tests/unit/sync/CMakeLists.txt
index c6b4bb4..17bb098 100644
--- a/src/tests/unit/sync/CMakeLists.txt
+++ b/src/tests/unit/sync/CMakeLists.txt
@@ -1,17 +1,6 @@
-add_executable(syncall syncall.f90)
-target_link_libraries(syncall OpenCoarrays)
-
-add_executable(syncimages syncimages.f90)
-target_link_libraries(syncimages OpenCoarrays)
-
-add_executable(syncimages2 syncimages2.f90)
-target_link_libraries(syncimages2 OpenCoarrays)
-
-add_executable(duplicate_syncimages duplicate_syncimages.f90)
-target_link_libraries(duplicate_syncimages OpenCoarrays)
-
-add_executable(syncimages_status syncimages_status.f90)
-target_link_libraries(syncimages_status OpenCoarrays)
-
-add_executable(sync_image_ring_abort_on_stopped_image sync_image_ring_abort_on_stopped_image.f90)
-target_link_libraries(sync_image_ring_abort_on_stopped_image OpenCoarrays)
+caf_compile_executable(syncall syncall.f90)
+caf_compile_executable(syncimages syncimages.f90)
+caf_compile_executable(syncimages2 syncimages2.f90)
+caf_compile_executable(duplicate_syncimages duplicate_syncimages.f90)
+caf_compile_executable(syncimages_status syncimages_status.f90)
+caf_compile_executable(sync_image_ring_abort_on_stopped_image sync_image_ring_abort_on_stopped_image.f90)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/open-coarrays.git



More information about the debian-science-commits mailing list