Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Open MPI programs with autoconf/automake?
From: Nuno Sucena Almeida (slug_at_[hidden])
Date: 2008-11-07 14:11:40


Hi,
        see if this macro solves your problem:
        http://autoconf-archive.cryp.to/acx_mpi.html

        it requires some improvement, but might be a start. Since I only have OpenMPI
I use it in the following way(it's not pretty):

configure.ac:
(...)
dnl Check for MPI
dnl This check will set the MPICC and MPICXX variables to the MPI compiler
ones
dnl if the library is found, or to the regular compilers if not.
AC_ARG_WITH(mpi, [AC_HELP_STRING([--with-mpi],
                 [enable MPI support [default=yes]])],
                 [case "${withval}" in
                       yes|no) with_mpi=$withval;;
                       *)
                       AC_MSG_ERROR(bad value ${withval} for --with-mpi);;
                  esac],
                 [with_mpi=yes])
if test "x$with_mpi" = "xyes"; then
        ACX_MPI([], [AC_MSG_ERROR(could not find mpi library for --with-mpi)])
        AC_DEFINE(HAVE_MPI)
        MPI_CXXLIBS=`mpicxx --showme:link`
        MPI_CXXFLAGS=`mpicxx --showme:compile`
        AC_SUBST(MPI_CXXLIBS)
        AC_SUBST(MPI_CXXFLAGS)
else
  MPICC="$CC"
  MPICXX="$CXX"
  AC_SUBST(MPICC)
  AC_SUBST(MPICXX)
fi
AM_CONDITIONAL([WE_HAVE_MPI],[test "x$with_mpi" = "xyes"])
(...)

Makefile.am:
(...)
# MPI headers/libraries:
INCLUDES+=$(MPI_CXXFLAGS)
OTHERLIBS+=$(MPI_CXXLIBS)

etc
I would start by improving the mentioned macro with specific support for each
MPI implementation...

                        Nuno

On Thursday 06 November 2008 06:35:33 am Raymond Wan wrote:
> I'm not sure if this is relevant to this mailing list, but I'm trying to
> get autoconf/automake working with an Open MPI program I am writing (in

-- 
http://aeminium.org/slug/