@@ -38,8 +38,32 @@ endif()
3838#----------------------------------------------------------------------
3939# Test if MPI implementation provides features needed for failed images
4040#----------------------------------------------------------------------
41- 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)
4241set (MPI_HAS_FAULT_TOL_EXT YES )
42+
43+ CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
44+ if (NOT HAVE_SIGNAL_H)
45+ set (MPI_HAS_FAULT_TOL_EXT NO )
46+ message ( FATAL_ERROR "Currently, OpenCoarrays cannot build without signal.h" )
47+ endif ()
48+
49+ include (CheckSymbolExists)
50+ CHECK_SYMBOL_EXISTS(SIGKILL "signal.h" HAVE_SIGKILL)
51+ if (NOT HAVE_SIGKILL) # try -D_POSIX, needed for mingw-w64, maybe others, see #435
52+ # https://github.com/sourceryinstitute/OpenCoarrays/issues/435#issuecomment-323592433
53+ list ( APPEND CMAKE_REQUIRED_DEFINITIONS -D_POSIX)
54+ CHECK_SYMBOL_EXISTS(SIGKILL "signal.h" HAVE_SIGKILL)
55+ if (HAVE_SIGKILL)
56+ add_definitions (-D_POSIX)
57+ endif ()
58+ endif ()
59+
60+ if (NOT HAVE_SIGKILL)
61+ set (MPI_HAS_FAULT_TOL_EXT NO )
62+ message (FATAL_ERROR "Currently, OpenCoarrays cannot build without SIGKILL from signal.h" )
63+ endif ()
64+
65+ 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)
66+
4367set (old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES} " )
4468if (CMAKE_REQUIRED_INCLUDES)
4569 set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ;${MPI_C_INCLUDE_PATH} )
@@ -65,7 +89,7 @@ if(HAVE_MPI_EXT)
6589 add_definitions (-DHAVE_MPI_EXT_H)
6690 set (MPI_HEADERS ${MPI_HEADERS} ;mpi-ext .h)
6791endif ()
68- include (CheckSymbolExists)
92+
6993foreach (symbol ${NEEDED_SYMBOLS} )
7094 CHECK_SYMBOL_EXISTS(${symbol} ${MPI_HEADERS} HAVE_${symbol} )
7195 if (NOT HAVE_${symbol} )
@@ -89,6 +113,16 @@ if(CAF_ENABLE_FAILED_IMAGES)
89113 add_definitions (-DUSE_FAILED_IMAGES)
90114endif ()
91115
116+ #---------------------------------------------------
117+ # Windows Intel MPI compatibility, see GH issue #435
118+ #---------------------------------------------------
119+ CHECK_SYMBOL_EXISTS(I_MPI_VERSION mpi.h HAVE_Intel_MPI)
120+ if (HAVE_Intel_MPI AND WIN32 )
121+ add_definitions (-DUSE_GCC)
122+ endif ()
123+
124+
125+
92126# Determine whether and how to include OpenCoarrays module based on if the Fortran MPI compiler:
93127# - workds
94128# - is compatible with the fortran compiler used to build the MPI implementation
0 commit comments