Skip to content

Commit

Permalink
Added MPI compiler macros from buildenv
Browse files Browse the repository at this point in the history
  • Loading branch information
wgropp committed Dec 9, 2015
1 parent 059a0eb commit d2ba260
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions aclocal_mpi.m4
Expand Up @@ -370,3 +370,92 @@ dnl
ifelse([$11],,:,[$11])
fi
])

AC_DEFUN([PAC_PROG_MPICC],[
# Find the compilers, if they aren't set with the environment variables
if test -z "$MPICC" ; then
AC_MSG_CHECKING([for MPI compile wrappers for C])
# First look for the wrappers
if test -n "$MPI_DIR" ; then
for w in mpicc bin/mpicc mpcc bin/mpcc ; do
if test -x $MPI_DIR/$w ; then
MPICC=$MPI_DIR/$w
break
fi
done
fi
# Still not found
if test -z "$MPICC" ; then
# Try looking in the path
saveIFS=$IFS
IFS=":"
for dir in $PATH ; do
for w in mpicc mpcc ; do
if test -x $dir/$w ; then
MPICC=$dir/$w
break 2
fi
done
done
IFS=$saveIFS
fi
if test -n "$MPICC" ; then
AC_MSG_RESULT($MPICC)
else
AC_MSG_RESULT([none found])
fi
fi
AC_SUBST([MPICC])
])

AC_DEFUN([PAC_PROG_MPIFORT],[
if test -z "$MPIFORT" ; then
AC_MSG_CHECKING([for MPI compile wrappers for Fortran])
if test -x $MPI_DIR/mpifort ; then
MPIFORT=$MPI_DIR/mpifort
elif test -x $MPI_DIR/bin/mpif90 ; then
MPIFORT=$MPI_DIR/bin/mpiff90
elif test -x $MPI_DIR/mpxlf ; then
MPIFORT=$MPIDIR/mpxlf
elif test -x $MPI_DIR/bin/mpxlf90 ; then
MPIFORT=$MPIDIR/bin/mpxlf90
else
saveIFS=$IFS
IFS=":"
for dir in $PATH ; do
if test -x $dir/mpifort ; then
MPIFORT=$dir/mpifort
break
elif test -x $dir/mpif90 ; then
MPIFORT=$dir/mpif90
break
elif test -x $dir/mpxlf ; then
MPIFORT=$dir/mpxlf
break
fi
done
IFS=$saveIFS
fi
if test -n "$MPIFORT" ; then
AC_MSG_RESULT($MPIFORT)
else
AC_MSG_RESULT([none found])
fi
fi
AC_SUBST([MPIFORT])
])

## Add a check for whether the C compiler can handle MPI programs
## as on the Cray.
AC_DEFUN([PAC_MPI_CCWORKS],[
AC_SEARCH_LIBS(MPI_Init,$MPILIB mpi mpich)
if test "$ac_cv_search_MPI_Init" = "no" ; then
ifelse($2,,
AC_MSG_ERROR([Could not find MPI library]),[$2])
fi
AC_CHECK_HEADER(mpi.h,pac_have_mpi_h="yes",pac_have_mpi_h="no")
if test $pac_have_mpi_h = "no" ; then
ifelse($2,,
AC_MSG_ERROR([Could not find mpi.h include file]),[$2])
fi
])

0 comments on commit d2ba260

Please sign in to comment.