From: Julian Seward Date: Thu, 2 Mar 2006 17:09:16 +0000 (+0000) Subject: Detect/select 'mpicc' (from --with-mpicc=) and use that to build X-Git-Tag: svn/VALGRIND_3_2_0~239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e335ddbef8ac1df623a6db96e3ebfaf8ba9b1686;p=thirdparty%2Fvalgrind.git Detect/select 'mpicc' (from --with-mpicc=) and use that to build libmpiwrap.so. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5708 --- diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 5f637f498a..085daea471 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -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 diff --git a/configure.in b/configure.in index c2c6ea6693..e84ab5787a 100644 --- a/configure.in +++ b/configure.in @@ -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. --------------------