Skip to content

Commit

Permalink
o Inline consistent MPI configuration with build-tools to compile on …
Browse files Browse the repository at this point in the history
…summit
  • Loading branch information
wtjones1 committed Oct 3, 2022
1 parent 9105f26 commit fe40008
Showing 1 changed file with 43 additions and 14 deletions.
57 changes: 43 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,68 @@ AC_ARG_WITH(mpi,
[[ --with-mpi[=ARG] Path to MPI library installation [ARG=no]]],
[with_mpi="$withval"], [with_mpi="no"] )
AC_ARG_WITH(mpicc,
[[ --with-mpicc[=ARG] MPI C compiler wrapper absolute path [with_mpi/bin/mpicc]]],
[with_mpicc="$withval"], [with_mpicc="with_mpi/bin/mpicc"] )
[[ --with-mpicc[=ARG] MPI C compiler wrapper absolute path [mpicc]]],
[with_mpicc="$withval"], [with_mpicc="mpicc"] )
AC_ARG_WITH(mpibin,
[[ --with-mpibin[=ARG] MPI bin directory [bin]]],
[with_mpibin="$withval"], [with_mpibin="bin"] )
AC_ARG_WITH(mpiinc,
[[ --with-mpiinc[=ARG] MPI include absolute path for mpif.h [with_mpi/include]]],
[with_mpiinc="$withval"], [with_mpiinc="with_mpi/include"] )
[[ --with-mpiinc[=ARG] MPI include directory for mpi.h [include]]],
[with_mpiinc="$withval"], [with_mpiinc="include"] )
AC_DEFINE_UNQUOTED([MPI_PATH],["$with_mpi"],[MPI installation])
if test "$with_mpi" != 'no'
then
AC_MSG_NOTICE([checking MPI installation])
if test "$with_mpiinc" != 'no'
then
if test "$with_mpiinc" = 'with_mpi/include'
if test $(echo $with_mpiinc | grep /)
then
mpi_include="-I${with_mpi}/include"
mpi_include="$with_mpiinc"
else
mpi_include="-I${with_mpiinc}"
mpi_include="$with_mpi/$with_mpiinc"
fi
else
mpi_include=""
mpi_include="."
fi
AC_SUBST([mpi_include])

if test "$with_mpibin" != 'no'
then
if test $(echo $with_mpibin | grep /)
then
MPIBIN="$with_mpibin"
else
MPIBIN="$with_mpi/$with_mpibin"
fi
fi

if test "$with_mpicc" != 'no'
then
if test "$with_mpicc" = 'with_mpi/bin/mpicc'
AC_MSG_NOTICE([checking mpi C compiler wrapper...])
if test $(echo $with_mpicc | grep /)
then
MPICC="${with_mpi}/bin/mpicc"
MPICC="$with_mpicc"
else
MPICC="${with_mpicc}"
MPICC="$MPIBIN/$with_mpicc"
fi
mpi_ldadd="-L${with_mpi}/lib -lmpi"
AC_MSG_RESULT([ $MPICC])
if eval "test -e $MPICC"
then
CC=$MPICC
else
AC_MSG_ERROR([MPI C compiler wrapper does not exist])
fi

mpi_ldadd=''
tokens=($($MPICC -show))
for i in $[{tokens[*]}]
do
mpi_ldadd="$mpi_ldadd $(AS_ECHO([$i]) | grep -- -l 2> /dev/null)"
done

else
MPICC="${CC}"
mpi_ldadd="-L${with_mpi}/lib -lmpi"
# when wrapper is missing (i.e. sgi mpt) link with -lmpi
mpi_ldadd=-lmpi
fi
AC_SUBST([MPICC])
AC_SUBST([mpi_ldadd])
Expand Down

0 comments on commit fe40008

Please sign in to comment.