]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix 274078 improved configure logic for mpicc
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 17 May 2012 15:32:54 +0000 (15:32 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 17 May 2012 15:32:54 +0000 (15:32 +0000)
Patch from Dave Goodell.
See bug 274078 for detailed patch description.

Tested on deb6/amd64 with a static MPI (now it will be ignored
rather than make the Valgrind build failing), with a shared MPI,
and with no MPI.

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

NEWS
configure.in
mpi/Makefile.am

diff --git a/NEWS b/NEWS
index 7f904b0467e638a021051b0035279bbdcc04f1a1..7aa3863b39c36c71fb81d5a50ab058c7ef2276aa 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -74,6 +74,7 @@ where XXXXXX is the bug number as listed below.
 270796  s390x: Removed broken support for the TS insn
 271438  Fix configure for proper SSE4.2 detection
 273114  s390x: Support TR, TRE, TROO, TROT, TRTO, and TRTT instructions
+274078  improved configure logic for mpicc
 276993  fix mremap 'no thrash checks' 
 281482  valgrind's memcheck incorrect byte allocation count in realloc() for silly argument
 282230  group allocator for small fixed size, use it for MC_Chunk/SEc vbit
index df7be3dcbb4cb9b227b94bd6e1c385c8cbaf5fbc..69544b4a5ec5c06be0a7709f2ef4563e77f3d832 100644 (file)
@@ -1769,12 +1769,18 @@ elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
        -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
        -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
   mflag_primary=$FLAG_M64
+elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
+  mflag_primary="$FLAG_M32 -arch i386"
+elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
+  mflag_primary="$FLAG_M64 -arch x86_64"
 fi
 
 mflag_secondary=
 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
      -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
   mflag_secondary=$FLAG_M32
+elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
+  mflag_secondary="$FLAG_M32 -arch i386"
 fi
 
 
@@ -1784,19 +1790,39 @@ AC_ARG_WITH(mpicc,
 )
 AC_SUBST(MPI_CC)
 
+## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
+## use these values in the check for a functioning mpicc.
+##
+## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
+## mflag_primary/mflag_secondary are sufficient approximations of that behavior
+AM_COND_IF([VGCONF_OS_IS_LINUX],
+           [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
+            LDFLAGS_MPI="-fpic -shared"])
+AM_COND_IF([VGCONF_OS_IS_DARWIN],
+           [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
+            LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
+
+AC_SUBST([CFLAGS_MPI])
+AC_SUBST([LDFLAGS_MPI])
+
+
 ## See if MPI_CC works for the primary target
 ##
 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
 saved_CC=$CC
 saved_CFLAGS=$CFLAGS
 CC=$MPI_CC
-CFLAGS=$mflag_primary
+CFLAGS="$CFLAGS_MPI $mflag_primary"
+saved_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS_MPI $mflag_primary"
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <mpi.h>
 #include <stdio.h>
 ]], [[
+  int ni, na, nd, comb;
   int r = MPI_Init(NULL,NULL);
-  r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
+  r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
+  r |= MPI_Finalize();
   return r; 
 ]])], [
 ac_have_mpi2_pri=yes
@@ -1807,6 +1833,7 @@ AC_MSG_RESULT([no])
 ])
 CC=$saved_CC
 CFLAGS=$saved_CFLAGS
+LDFLAGS="$saved_LDFLAGS"
 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
 
 ## See if MPI_CC works for the secondary target.  Complication: what if
@@ -1817,18 +1844,22 @@ AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
 saved_CC=$CC
 saved_CFLAGS=$CFLAGS
+saved_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
   CC="$MPI_CC this will surely fail"
 else
   CC=$MPI_CC
 fi
-CFLAGS=$mflag_secondary
+CFLAGS="$CFLAGS_MPI $mflag_secondary"
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <mpi.h>
 #include <stdio.h>
 ]], [[
+  int ni, na, nd, comb;
   int r = MPI_Init(NULL,NULL);
-  r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
+  r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
+  r |= MPI_Finalize();
   return r; 
 ]])], [
 ac_have_mpi2_sec=yes
@@ -1839,6 +1870,7 @@ AC_MSG_RESULT([no])
 ])
 CC=$saved_CC
 CFLAGS=$saved_CFLAGS
+LDFLAGS="$saved_LDFLAGS"
 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
 
 
index c96701f4d49a17dc76fdc6fe19a2c66aad85d3e4..709c0a4252e69542bc219b22b06ce920f6f86bb2 100644 (file)
@@ -31,15 +31,14 @@ noinst_DSYMS = $(noinst_PROGRAMS)
 endif
 
 
+## NOTE: this logic, the AM_FLAG_M3264_ logic in ../Makefile.all.am, and the
+## mflag_primary/mflag_secondary logic in ../configure.in unfortunately all need
+## to be kept in sync with each other
 if VGCONF_OS_IS_LINUX
- CFLAGS_MPI  = -g -O -fno-omit-frame-pointer -Wall -fpic
- LDFLAGS_MPI = -fpic -shared
  MPI_FLAG_M3264_PRI = $(AM_FLAG_M3264_PRI)
  MPI_FLAG_M3264_SEC = $(AM_FLAG_M3264_SEC)
 endif
 if VGCONF_OS_IS_DARWIN
- CFLAGS_MPI  = -g -O -fno-omit-frame-pointer -Wall -dynamic
- LDFLAGS_MPI = -dynamic -dynamiclib -all_load
  MPI_FLAG_M3264_PRI = $(AM_FLAG_M3264_PRI)
  MPI_FLAG_M3264_SEC = $(AM_FLAG_M3264_SEC)
 endif