|
From: <sv...@va...> - 2012-05-17 15:33:02
|
philippe 2012-05-17 16:32:54 +0100 (Thu, 17 May 2012)
New Revision: 12567
Log:
Fix 274078 improved configure logic for mpicc
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.
Modified files:
trunk/NEWS
trunk/configure.in
trunk/mpi/Makefile.am
Modified: trunk/configure.in (+36 -4)
===================================================================
--- trunk/configure.in 2012-05-17 15:31:13 +01:00 (rev 12566)
+++ trunk/configure.in 2012-05-17 16:32:54 +01:00 (rev 12567)
@@ -1769,12 +1769,18 @@
-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_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 @@
])
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 @@
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 @@
])
CC=$saved_CC
CFLAGS=$saved_CFLAGS
+LDFLAGS="$saved_LDFLAGS"
AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
Modified: trunk/mpi/Makefile.am (+3 -4)
===================================================================
--- trunk/mpi/Makefile.am 2012-05-17 15:31:13 +01:00 (rev 12566)
+++ trunk/mpi/Makefile.am 2012-05-17 16:32:54 +01:00 (rev 12567)
@@ -31,15 +31,14 @@
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
Modified: trunk/NEWS (+1 -0)
===================================================================
--- trunk/NEWS 2012-05-17 15:31:13 +01:00 (rev 12566)
+++ trunk/NEWS 2012-05-17 16:32:54 +01:00 (rev 12567)
@@ -74,6 +74,7 @@
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
|