Commit 88a762b8 authored by vijaysm's avatar vijaysm
Browse files

Decipher whether the compiler supports MPI by trying to compile a program with no additional flags

parent 7c5ae59c
......@@ -31,6 +31,17 @@ AC_DEFUN([FATHOM_CHECK_CXX_WORKS], [
])
AC_DEFUN([FATHOM_CHECK_MPI_ENABLED], [
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([if $CXX works with MPI])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM( [#include <mpi.h>]
[int i=MPI_SUCCESS;] )],
[AC_MSG_RESULT([yes]); enablempi=yes],
[AC_MSG_RESULT([no]); enablempi=no])
AC_LANG_POP([C++])
])
########## Helper function for FATHOM_CHECK_COMPILERS #############
# args: compiler variable, compiler list, path
AC_DEFUN([FATHOM_SET_MPI_COMPILER], [
......@@ -123,23 +134,25 @@ if test "xno" != "x$enablempi"; then
COMPILERPATHS="${WITH_MPI}/bin"
fi
# C support
FATHOM_SET_MPI_COMPILER([CC], [$CC_LIST], [$COMPILERPATHS])
AC_PROG_CC
AC_PROG_CPP
FATHOM_CHECK_MPI_ENABLED
# C++ support
FATHOM_SET_MPI_COMPILER([CXX],[$CXX_LIST],[$COMPILERPATHS])
AC_PROG_CXX
AC_PROG_CXXCPP
# C support
FATHOM_SET_MPI_COMPILER([CC], [$CC_LIST], [$COMPILERPATHS])
AC_PROG_CC
AC_PROG_CPP
# Fortran support
if (test "x$CHECK_FC" != "xno"); then
FATHOM_SET_MPI_COMPILER([FC], [$FC_LIST],[$COMPILERPATHS])
FATHOM_SET_MPI_COMPILER([F77],[$F77_LIST],[$COMPILERPATHS])
AC_PROG_FC
AC_PROG_F77
fi
# C++ support
FATHOM_SET_MPI_COMPILER([CXX],[$CXX_LIST],[$COMPILERPATHS])
AC_PROG_CXX
AC_PROG_CXXCPP
# Fortran support
if (test "x$CHECK_FC" != "xno"); then
FATHOM_SET_MPI_COMPILER([FC], [$FC_LIST],[$COMPILERPATHS])
FATHOM_SET_MPI_COMPILER([F77],[$F77_LIST],[$COMPILERPATHS])
AC_PROG_FC
AC_PROG_F77
fi
]) # FATHOM_CHECK_COMPILERS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment