From: Philippe Waroquiers Date: Thu, 17 May 2012 15:32:54 +0000 (+0000) Subject: Fix 274078 improved configure logic for mpicc X-Git-Tag: svn/VALGRIND_3_8_0~301 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a541560dff47e6a5284c2bede2a2912ac2b2f43e;p=thirdparty%2Fvalgrind.git 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. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12567 --- diff --git a/NEWS b/NEWS index 7f904b0467..7aa3863b39 100644 --- 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 diff --git a/configure.in b/configure.in index df7be3dcbb..69544b4a5e 100644 --- a/configure.in +++ b/configure.in @@ -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 #include ]], [[ + 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 #include ]], [[ + 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) diff --git a/mpi/Makefile.am b/mpi/Makefile.am index c96701f4d4..709c0a4252 100644 --- a/mpi/Makefile.am +++ b/mpi/Makefile.am @@ -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