[mpich2-commits] r6730 - in mpich2/trunk/src/mpl: . include
goodell at mcs.anl.gov
goodell at mcs.anl.gov
Mon May 24 15:56:19 CDT 2010
Author: goodell
Date: 2010-05-24 15:56:19 -0500 (Mon, 24 May 2010)
New Revision: 6730
Added:
mpich2/trunk/src/mpl/localdefs.in
Modified:
mpich2/trunk/src/mpl/configure.in
mpich2/trunk/src/mpl/include/mpl_valgrind.h
Log:
add --with(out)-valgrind for specifying valgrind support
This provides users a more intuitive way to enable/disable valgrind
support in MPICH2 and MPL.
Reviewed by buntinas at .
Modified: mpich2/trunk/src/mpl/configure.in
===================================================================
--- mpich2/trunk/src/mpl/configure.in 2010-05-24 20:54:43 UTC (rev 6729)
+++ mpich2/trunk/src/mpl/configure.in 2010-05-24 20:56:19 UTC (rev 6730)
@@ -37,9 +37,81 @@
# A C99 compliant compiler should have inttypes.h for fixed-size int types
AC_CHECK_HEADERS(inttypes.h stdint.h)
-# headers for valgrind client requests
-AC_CHECK_HEADERS([valgrind.h memcheck.h valgrind/valgrind.h valgrind/memcheck.h])
+#######################################################################
+# valgrind support
+AC_ARG_WITH([valgrind],
+ [AS_HELP_STRING([--without-valgrind],[to disable valgrind support (such as because of version issues)])]
+ [AS_HELP_STRING([--with-valgrind=PATH],[use valgrind headers installed in PATH [default is yes]])],
+ [],[with_valgrind=yes])
+if test "$with_valgrind" != "no" ; then
+ savedCPPFLAGS="$CPPFLAGS"
+ if test "$with_valgrind" != "yes" ; then
+ # Clients of MPL will either need to respect the localdefs file (as in
+ # MPICH2) or add this entry to their own CPPFLAGS-equivalent.
+ # (TODO: a pkg-config file would help with this)
+ PAC_APPEND_FLAG([-I${with_valgrind}], [CPPFLAGS])
+ fi
+ # headers for valgrind client requests
+ AC_CHECK_HEADERS([valgrind.h memcheck.h valgrind/valgrind.h valgrind/memcheck.h])
+ # ensure that we have a new enough valgrind with all the client macros
+ # a preproc test would probably be sufficient, but the LINK_IFELSE helps us
+ # double-check that we aren't accidentally grabbing the headers for some
+ # other platform
+ AC_CACHE_CHECK([whether the valgrind headers are broken or too old],
+ [pac_cv_have_broken_valgrind],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([
+#if defined(HAVE_VALGRIND_H) && defined(HAVE_MEMCHECK_H)
+# include <valgrind.h>
+# include <memcheck.h>
+#elif defined(HAVE_VALGRIND_VALGRIND_H) && defined(HAVE_VALGRIND_MEMCHECK_H)
+# include <valgrind/valgrind.h>
+# include <valgrind/memcheck.h>
+#else
+# error unexpected valgrind header error
+#endif
+int foo = 10;
+char mempool_obj;
+],[
+#if defined(VALGRIND_MAKE_MEM_DEFINED)
+ VALGRIND_MAKE_MEM_NOACCESS(&foo,sizeof(foo));
+ VALGRIND_MAKE_MEM_UNDEFINED(&foo,sizeof(foo));
+ VALGRIND_MAKE_MEM_DEFINED(&foo,sizeof(foo));
+ VALGRIND_CHECK_MEM_IS_DEFINED(&foo,sizeof(foo));
+ VALGRIND_CHECK_MEM_IS_ADDRESSABLE(&foo,sizeof(foo));
+#elif defined(VALGRIND_MAKE_READABLE)
+/* older (pre-3.2.0), but still supported style */
+ VALGRIND_MAKE_READABLE(&foo,sizeof(foo));
+ VALGRIND_MAKE_NOACCESS(&foo,sizeof(foo));
+ VALGRIND_MAKE_UNDEFINED(&foo,sizeof(foo));
+ VALGRIND_CHECK_READABLE(&foo,sizeof(foo));
+ VALGRIND_CHECK_WRITEABLE(&foo,sizeof(foo));
+#else
+#error missing essential valgrind client macros
+#endif
+ VALGRIND_CREATE_BLOCK(&foo,sizeof(foo),"description");
+ if (RUNNING_ON_VALGRIND) ++foo;
+ VALGRIND_PRINTF_BACKTRACE("testing: %s","valgrind support");
+ VALGRIND_CREATE_MEMPOOL(&mempool_obj,0,0);
+ VALGRIND_MEMPOOL_ALLOC(&mempool_obj,&foo,sizeof(foo));
+ VALGRIND_MEMPOOL_FREE(&mempool_obj,&foo);
+ VALGRIND_DESTROY_MEMPOOL(&mempool_obj);
+]) dnl end PROGRAM
+ ],
+ [pac_cv_have_broken_valgrind=no], dnl end if-true
+ [pac_cv_have_broken_valgrind=yes] dnl end if-false
+ )] dnl end IFELSE
+ ) dnl end CACHE_CHECK
+
+ if test "$pac_cv_have_broken_valgrind" = "yes" ; then
+ AC_DEFINE([HAVE_BROKEN_VALGRIND],[1],[define if valgrind is old and/or broken compared to what we are expecting])
+ CPPFLAGS="$savedCPPFLAGS"
+ fi
+fi
+#######################################################################
+
+
# Check for strdup
AC_CHECK_FUNCS(strdup)
if test "$ac_cv_func_strdup" = "yes" ; then
@@ -62,4 +134,5 @@
PAC_C_GNU_ATTRIBUTE
dnl Final output
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile localdefs])
+AC_OUTPUT
Modified: mpich2/trunk/src/mpl/include/mpl_valgrind.h
===================================================================
--- mpich2/trunk/src/mpl/include/mpl_valgrind.h 2010-05-24 20:54:43 UTC (rev 6729)
+++ mpich2/trunk/src/mpl/include/mpl_valgrind.h 2010-05-24 20:56:19 UTC (rev 6730)
@@ -32,7 +32,8 @@
#undef MPL_VG_AVAILABLE
-#if defined(MPL_VG_ENABLED)
+#if !defined(HAVE_BROKEN_VALGRIND) && defined(MPL_VG_ENABLED)
+/* FIXME "MPICH_" shouldn't appear anywhere here */
# if defined(MPICH_DEBUG_MEMINIT) && !defined(NVALGRIND)
# if defined(MPL_HAVE_VALGRIND_H) && defined(MPL_HAVE_MEMCHECK_H)
# include <valgrind.h>
Added: mpich2/trunk/src/mpl/localdefs.in
===================================================================
--- mpich2/trunk/src/mpl/localdefs.in (rev 0)
+++ mpich2/trunk/src/mpl/localdefs.in 2010-05-24 20:56:19 UTC (rev 6730)
@@ -0,0 +1,7 @@
+#!/bin/sh
+# When configured within MPICH2 via PAC_CONFIG_SUBDIR, this file will be sourced
+# by the top-level configure. This lets us propagate shell variable changes
+# back upstream.
+
+CPPFLAGS="@CPPFLAGS@"
+
More information about the mpich2-commits
mailing list