]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Build system hacks to build and install the MPI wrappers library when
authorJulian Seward <jseward@acm.org>
Thu, 2 Mar 2006 13:48:21 +0000 (13:48 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 2 Mar 2006 13:48:21 +0000 (13:48 +0000)
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

auxprogs/Makefile.am
auxprogs/mpiwrap.c
configure.in

index 119cd8036ce050400820327c9ec60262f5d90429..5f637f498a94c93526f549e3262975064f01c3e5 100644 (file)
@@ -23,3 +23,27 @@ valgrind_listener_LDFLAGS   = $(AM_CFLAGS_PRI)
 #----------------------------------------------------------
 
 
+#------------------------- mpi wrappers -----------------------
+# Build libmpiwrap.so for the primary target only.
+# Don't let automake install this, since it puts it in the
+# wrong place.  Instead install it ourselves in the right
+# place using the install-exec-local target below.
+#
+if BUILD_MPIWRAP
+noinst_PROGRAMS       = libmpiwrap.so
+libmpiwrap_so_SOURCES = mpiwrap.c
+libmpiwrap_so_CFLAGS  = $(AM_FLAG_M3264_PRI) \
+                               -g -O -fpic -fno-omit-frame-pointer \
+                               -I../include -I@MPI_PREFIX@/include
+libmpiwrap_so_LDFLAGS = $(AM_FLAG_M3264_PRI) -g -shared
+
+install-exec-local:
+# convert (eg) X86_LINUX to x86-linux
+# really should use sed here, rather than assume tr is available
+       pD=`echo @VG_PLATFORM_PRI@ | tr A-Z_ a-z-` ; \
+       $(mkinstalldirs) $(DESTDIR)$(valdir)/$$pD; \
+       $(INSTALL_PROGRAM) ./libmpiwrap.so $(DESTDIR)$(valdir)/$$pD
+endif
+#
+#----------------------------------------------------------
+
index dbb68e645ac6680d5758f26a7f7bcaeca3c5acfe..0d1d0f21433d9cb503ac66947a2fee5cecfb35ef 100644 (file)
@@ -75,7 +75,6 @@
 #include <pthread.h>    /* pthread_mutex_{lock,unlock} */
 
 /* Include Valgrind magic macros for writing wrappers. */
-#include "../include/valgrind.h"
 #include "../memcheck/memcheck.h"
 
 
@@ -84,7 +83,8 @@
 /*------------------------------------------------------------*/
 
 /* Include headers for whatever MPI implementation the wrappers are to
-   be used with. */
+   be used with.  The configure system will tell us what the path to
+   the chosen MPI implementation is, via -I.. to the compiler. */
 #include "mpi.h"
 
 /* Where are API symbols?
index a9b466d5b6d42ad31acc199d666c8cc4653049a1..c2c6ea66934878a805e4fae3feacc8f83452bb2a 100644 (file)
@@ -596,6 +596,39 @@ AC_TYPE_SIGNAL
 
 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 @@ AC_OUTPUT(
 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