Blame SOURCES/valgrind-3.9.0-mpiwrapper.patch

2601b6
Index: mpi/Makefile.am
2601b6
===================================================================
2601b6
--- valgrind/mpi/Makefile.am	(revision 12965)
2601b6
+++ valgrind/mpi/Makefile.am	(working copy)
2601b6
@@ -1,15 +1,13 @@
2601b6
 include $(top_srcdir)/Makefile.all.am
2601b6
 
2601b6
-# HACK WARNING: automake isn't good at supporting non-$(CC) compilers.
2601b6
-# But we need to use $(MPI_CC) for the MPI stuff.  So we have this mpi stuff
2601b6
-# in its own directory so we can use the following blunt instruments, which
2601b6
-# override the C compiler and all the default flags.
2601b6
-CC = $(MPI_CC)
2601b6
+# HACK WARNING: We like to use the MPI_CC CFLAGS and LDFLAGS but don't
2601b6
+# actually want to link against libmpi.  The wrapper is generic and loaded
2601b6
+# through LD_PRELOAD into the program already using libmpi.
2601b6
 DEFS =
2601b6
 DEFAULT_INCLUDES =
2601b6
 CPPFLAGS =
2601b6
-CFLAGS =
2601b6
-LDFLAGS =
2601b6
+CFLAGS = $(shell $(MPI_CC) -showme:compile)
2601b6
+LDFLAGS = $(shell $(MPI_CC) -showme:link | sed 's/ -lmpi //g')
2601b6
 
2601b6
 EXTRA_DIST = \
2601b6
 	mpiwrap_type_test.c
2601b6
--- valgrind-3.8.0/mpi/Makefile.in.orig	2012-09-12 12:04:46.084508623 +0200
2601b6
+++ valgrind-3.8.0/mpi/Makefile.in	2012-09-12 12:05:56.110800265 +0200
2601b6
@@ -108,17 +108,12 @@
2601b6
 AWK = @AWK@
2601b6
 BOOST_CFLAGS = @BOOST_CFLAGS@
2601b6
 BOOST_LIBS = @BOOST_LIBS@
2601b6
-
2601b6
-# HACK WARNING: automake isn't good at supporting non-$(CC) compilers.
2601b6
-# But we need to use $(MPI_CC) for the MPI stuff.  So we have this mpi stuff
2601b6
-# in its own directory so we can use the following blunt instruments, which
2601b6
-# override the C compiler and all the default flags.
2601b6
-CC = $(MPI_CC)
2601b6
+CC = @CC@
2601b6
 CCAS = @CCAS@
2601b6
 CCASDEPMODE = @CCASDEPMODE@
2601b6
 CCASFLAGS = @CCASFLAGS@
2601b6
 CCDEPMODE = @CCDEPMODE@
2601b6
-CFLAGS = 
2601b6
+CFLAGS = $(shell $(MPI_CC) -showme:compile)
2601b6
 CFLAGS_MPI = @CFLAGS_MPI@
2601b6
 CPP = @CPP@
2601b6
 CPPFLAGS = 
2601b6
@@ -127,6 +122,10 @@
2601b6
 CXXFLAGS = @CXXFLAGS@
2601b6
 CYGPATH_W = @CYGPATH_W@
2601b6
 DEFAULT_SUPP = @DEFAULT_SUPP@
2601b6
+
2601b6
+# HACK WARNING: We like to use the MPI_CC CFLAGS and LDFLAGS but don't
2601b6
+# actually want to link against libmpi.  The wrapper is generic and loaded
2601b6
+# through LD_PRELOAD into the program already using libmpi.
2601b6
 DEFS = 
2601b6
 DEPDIR = @DEPDIR@
2601b6
 DIFF = @DIFF@
2601b6
@@ -156,7 +155,7 @@
2601b6
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
2601b6
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
2601b6
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
2601b6
-LDFLAGS = 
2601b6
+LDFLAGS = $(shell $(MPI_CC) -showme:link | sed 's/ -lmpi //g')
2601b6
 LDFLAGS_MPI = @LDFLAGS_MPI@
2601b6
 LIBOBJS = @LIBOBJS@
2601b6
 LIBS = @LIBS@
2601b6
Index: mpi/libmpiwrap.c
2601b6
===================================================================
2601b6
--- valgrind/mpi/libmpiwrap.c	(revision 12965)
2601b6
+++ valgrind/mpi/libmpiwrap.c	(working copy)
2601b6
@@ -114,6 +114,9 @@
2601b6
    be used with.  The configure system will tell us what the path to
2601b6
    the chosen MPI implementation is, via -I.. to the compiler. */
2601b6
 #include "mpi.h"
2601b6
+#ifdef MPI_LOGICAL
2601b6
+extern __typeof(ompi_mpi_logical) ompi_mpi_logical __attribute__((weak));
2601b6
+#endif
2601b6
 
2601b6
 /* Where are API symbols?
2601b6
    Open MPI      lib/libmpi.so,   soname = libmpi.so.0