Build system hacks to build and install the MPI wrappers library when
a suitable mpi.h is found at configure time. This also adds the
configure flag --with-mpi=/path/to/mpi/install so that libmpiwrap.so
can be built against any given MPI installation.
libmpiwrap.so is built and installed for the primary target only. As
usual this all involves various unsavoury build-system hacks.
Fortunately they are all in auxprogs/Makefile.am and configure.in
don't interact with any of our existing build-system hacks :-)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5707 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.in b/configure.in
index a9b466d..c2c6ea6 100644
--- a/configure.in
+++ b/configure.in
@@ -596,6 +596,39 @@
AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
+
+# First consider --with-mpi=..., then check for mpi.h
+MPI_PREFIX="/usr"
+AC_ARG_WITH(mpi,
+ [ --with-mpi=/path/to/mpi/install Specify location of MPI],
+ MPI_PREFIX=$withval
+)
+
+AC_MSG_CHECKING([for $MPI_PREFIX/include/mpi.h])
+
+AC_TRY_COMPILE(, [
+#include "$MPI_PREFIX/include/mpi.h"
+int main ( int argc, char** argv )
+ { int r = MPI_Init(&argc,&argv); return 0 ; }
+],
+[
+ac_have_mpi_h=yes
+AC_MSG_RESULT([yes])
+], [
+ac_have_mpi_h=no
+AC_MSG_RESULT([no])
+])
+
+#if test x$ac_have_mpi_h = xyes ; then
+# AC_DEFINE(HAVE_MPI_H, 1, [Define to 1 if mpi.h is available.])
+#fi
+
+AM_CONDITIONAL(BUILD_MPIWRAP, test x$ac_have_mpi_h = xyes)
+AC_SUBST(MPI_PREFIX)
+
+
+# -------------------- ok. We're done. --------------------
+
AC_OUTPUT(
Makefile
valgrind.spec
@@ -652,7 +685,7 @@
cat<<EOF
Primary build target: ${VG_PLATFORM_PRI}
- Secondary target: ${VG_PLATFORM_SEC}
+ Secondary build target: ${VG_PLATFORM_SEC}
Default supp files: ${DEFAULT_SUPP}
EOF