Detect/select 'mpicc' (from --with-mpicc=) and use that to build

libmpiwrap.so.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5708
This commit is contained in:
Julian Seward 2006-03-02 17:09:16 +00:00
parent f1d729480c
commit e335ddbef8
2 changed files with 44 additions and 5 deletions

View 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

View 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. --------------------