|
From: <sv...@va...> - 2006-03-02 13:48:24
|
Author: sewardj
Date: 2006-03-02 13:48:21 +0000 (Thu, 02 Mar 2006)
New Revision: 5707
Log:
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=3D/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 :-)
Modified:
trunk/auxprogs/Makefile.am
trunk/auxprogs/mpiwrap.c
trunk/configure.in
Modified: trunk/auxprogs/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/auxprogs/Makefile.am 2006-03-02 13:44:05 UTC (rev 5706)
+++ trunk/auxprogs/Makefile.am 2006-03-02 13:48:21 UTC (rev 5707)
@@ -23,3 +23,27 @@
#----------------------------------------------------------
=20
=20
+#------------------------- 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 =3D libmpiwrap.so
+libmpiwrap_so_SOURCES =3D mpiwrap.c
+libmpiwrap_so_CFLAGS =3D $(AM_FLAG_M3264_PRI) \
+ -g -O -fpic -fno-omit-frame-pointer \
+ -I../include -I@MPI_PREFIX@/include
+libmpiwrap_so_LDFLAGS =3D $(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=3D`echo @VG_PLATFORM_PRI@ | tr A-Z_ a-z-` ; \
+ $(mkinstalldirs) $(DESTDIR)$(valdir)/$$pD; \
+ $(INSTALL_PROGRAM) ./libmpiwrap.so $(DESTDIR)$(valdir)/$$pD
+endif
+#
+#----------------------------------------------------------
+
Modified: trunk/auxprogs/mpiwrap.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/auxprogs/mpiwrap.c 2006-03-02 13:44:05 UTC (rev 5706)
+++ trunk/auxprogs/mpiwrap.c 2006-03-02 13:48:21 UTC (rev 5707)
@@ -75,7 +75,6 @@
#include <pthread.h> /* pthread_mutex_{lock,unlock} */
=20
/* Include Valgrind magic macros for writing wrappers. */
-#include "../include/valgrind.h"
#include "../memcheck/memcheck.h"
=20
=20
@@ -84,7 +83,8 @@
/*------------------------------------------------------------*/
=20
/* 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"
=20
/* Where are API symbols?
Modified: trunk/configure.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/configure.in 2006-03-02 13:44:05 UTC (rev 5706)
+++ trunk/configure.in 2006-03-02 13:48:21 UTC (rev 5707)
@@ -596,6 +596,39 @@
=20
AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr =
strstr semtimedop])
=20
+
+# First consider --with-mpi=3D..., then check for mpi.h
+MPI_PREFIX=3D"/usr"
+AC_ARG_WITH(mpi,
+ [ --with-mpi=3D/path/to/mpi/install Specify location of MPI],
+ MPI_PREFIX=3D$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 )=20
+ { int r =3D MPI_Init(&argc,&argv); return 0 ; }
+],
+[
+ac_have_mpi_h=3Dyes
+AC_MSG_RESULT([yes])
+], [
+ac_have_mpi_h=3Dno
+AC_MSG_RESULT([no])
+])
+
+#if test x$ac_have_mpi_h =3D 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 =3D xyes)
+AC_SUBST(MPI_PREFIX)
+
+
+# -------------------- ok. We're done. --------------------
+
AC_OUTPUT(
Makefile=20
valgrind.spec
@@ -652,7 +685,7 @@
cat<<EOF
=20
Primary build target: ${VG_PLATFORM_PRI}
- Secondary target: ${VG_PLATFORM_SEC}
+ Secondary build target: ${VG_PLATFORM_SEC}
Default supp files: ${DEFAULT_SUPP}
=20
EOF
|