]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Detect/select 'mpicc' (from --with-mpicc=) and use that to build
authorJulian Seward <jseward@acm.org>
Thu, 2 Mar 2006 17:09:16 +0000 (17:09 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 2 Mar 2006 17:09:16 +0000 (17:09 +0000)
libmpiwrap.so.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5708

auxprogs/Makefile.am
configure.in

index 5f637f498a94c93526f549e3262975064f01c3e5..085daea4711b005de67a8a78acf6c5789c4d7c36 100644 (file)
@@ -25,17 +25,30 @@ valgrind_listener_LDFLAGS   = $(AM_CFLAGS_PRI)
 
 #------------------------- mpi wrappers -----------------------
 # Build libmpiwrap.so for the primary target only.
+#
+# This is really horrible.
+#
 # 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.
 #
+# Also, automake isn't good at supporting non-$(CC) compilers.
+# But we need to use $(MPI_CC) here.  Hence the nasty hack of
+# directly saying how to build libmpiwrap.so, instead of
+# using automake's standard gunk.
+#
 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
+#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
+libmpiwrap.so: mpiwrap.c
+       $(MPI_CC) -g -O -fno-omit-frame-pointer -fpic -shared \
+               -I../include -I@MPI_PREFIX@/include \
+               $(AM_FLAG_M3264_PRI) \
+               -o libmpiwrap.so mpiwrap.c
 
 install-exec-local:
 # convert (eg) X86_LINUX to x86-linux
index c2c6ea66934878a805e4fae3feacc8f83452bb2a..e84ab5787a81f1090ca7b40ce164a805036721dd 100644 (file)
@@ -597,7 +597,31 @@ AC_TYPE_SIGNAL
 AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
 
 
+# Do we have a useable mpicc (MPI-ised C compiler) ?
+MPI_CC="mpicc"
+AC_ARG_WITH(mpicc,
+   [  --with-mpicc=            Specify name of MPI-ised C compiler],
+   MPI_CC=$withval
+)
+AC_MSG_CHECKING([for usable mpicc])
+saved_CC=$CC
+CC=$MPI_CC
+AC_TRY_COMPILE(, [
+int main ( ) { return 0; }
+],
+[
+ac_have_mpicc=yes
+AC_MSG_RESULT([$MPI_CC])
+], [
+ac_have_mpicc=no
+AC_MSG_RESULT([no])
+])
+CC=$saved_CC
+
+
 # First consider --with-mpi=..., then check for mpi.h
+saved_CC=$CC
+CC=$MPI_CC
 MPI_PREFIX="/usr"
 AC_ARG_WITH(mpi,
    [  --with-mpi=/path/to/mpi/install    Specify location of MPI],
@@ -618,6 +642,7 @@ AC_MSG_RESULT([yes])
 ac_have_mpi_h=no
 AC_MSG_RESULT([no])
 ])
+CC=$saved_CC
 
 #if test x$ac_have_mpi_h = xyes ; then
 #  AC_DEFINE(HAVE_MPI_H, 1, [Define to 1 if mpi.h is available.])
@@ -625,6 +650,7 @@ AC_MSG_RESULT([no])
 
 AM_CONDITIONAL(BUILD_MPIWRAP, test x$ac_have_mpi_h = xyes)
 AC_SUBST(MPI_PREFIX)
+AC_SUBST(MPI_CC)
 
 
 # -------------------- ok.  We're done. --------------------