Commit a207b594 by Hans-Peter Nilsson Committed by Hans-Peter Nilsson

configure.in: Look for <valgrind/memcheck.h> first.

	* configure.in <enable-checking for valgrind>: Look for
	<valgrind/memcheck.h> first.  AC_DEFINE HAVE_VALGRIND_MEMCHECK_H
	if it exists.
	* configure, config.in: Regenerate.
	* ggc-common.c [ENABLE_VALGRIND_CHECKING &&
	HAVE_VALGRIND_MEMCHECK_H]: Include <valgrind/memcheck.h>.  Use
	#elif for other alternatives.
	* ggc-page.c: Ditto.
	* ggc-zone.c: Don't assume <valgrind/memcheck.h>; instead copy
	include structure from ggc-common.c.

From-SVN: r73065
parent cb4d476c
2003-10-29 Hans-Peter Nilsson <hp@axis.com>
* configure.in <enable-checking for valgrind>: Look for
<valgrind/memcheck.h> first. AC_DEFINE HAVE_VALGRIND_MEMCHECK_H
if it exists.
* configure, config.in: Regenerate.
* ggc-common.c [ENABLE_VALGRIND_CHECKING &&
HAVE_VALGRIND_MEMCHECK_H]: Include <valgrind/memcheck.h>. Use
#elif for other alternatives.
* ggc-page.c: Ditto.
* ggc-zone.c: Don't assume <valgrind/memcheck.h>; instead copy
include structure from ggc-common.c.
2003-10-29 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2003-10-29 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa-linux.h (ASM_OUTPUT_ADDR_VEC_ELT): Use label in big switch ELTs. * pa-linux.h (ASM_OUTPUT_ADDR_VEC_ELT): Use label in big switch ELTs.
......
...@@ -241,6 +241,9 @@ ...@@ -241,6 +241,9 @@
through valgrind (a memory checker). This is extremely expensive. */ through valgrind (a memory checker). This is extremely expensive. */
#undef ENABLE_VALGRIND_CHECKING #undef ENABLE_VALGRIND_CHECKING
/* Define if valgrind's valgrind/memcheck.h header is installed. */
#undef HAVE_VALGRIND_MEMCHECK_H
/* Define if valgrind's memcheck.h header is installed. */ /* Define if valgrind's memcheck.h header is installed. */
#undef HAVE_MEMCHECK_H #undef HAVE_MEMCHECK_H
......
...@@ -417,6 +417,15 @@ valgrind_command= ...@@ -417,6 +417,15 @@ valgrind_command=
if test x$ac_checking_valgrind != x ; then if test x$ac_checking_valgrind != x ; then
# It is certainly possible that there's valgrind but no valgrind.h. # It is certainly possible that there's valgrind but no valgrind.h.
# GCC relies on making annotations so we must have both. # GCC relies on making annotations so we must have both.
AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>)
AC_TRY_CPP(
[#include <valgrind/memcheck.h>
#ifndef VALGRIND_DISCARD
#error VALGRIND_DISCARD not defined
#endif],
[gcc_cv_header_valgrind_memcheck_h=yes],
[gcc_cv_header_valgrind_memcheck_h=no])
AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h)
AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>) AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>)
AC_TRY_CPP( AC_TRY_CPP(
[#include <memcheck.h> [#include <memcheck.h>
...@@ -429,14 +438,21 @@ if test x$ac_checking_valgrind != x ; then ...@@ -429,14 +438,21 @@ if test x$ac_checking_valgrind != x ; then
AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind, AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
[$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1]) [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
if test "x$valgrind_path" = "x" || (test $have_valgrind_h = no && test $gcc_cv_header_memcheck_h = no); then if test "x$valgrind_path" = "x" \
AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h/memcheck.h]) || (test $have_valgrind_h = no \
&& test $gcc_cv_header_memcheck_h = no \
&& test $gcc_cv_header_valgrind_memcheck_h = no); then
AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h])
fi fi
valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"' valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
valgrind_command="$valgrind_path -q" valgrind_command="$valgrind_path -q"
AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1, AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
[Define if you want to run subprograms and generated programs [Define if you want to run subprograms and generated programs
through valgrind (a memory checker). This is extremely expensive.]) through valgrind (a memory checker). This is extremely expensive.])
if test $gcc_cv_header_valgrind_memcheck_h = yes; then
AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
[Define if valgrind's valgrind/memcheck.h header is installed.])
fi
if test $gcc_cv_header_memcheck_h = yes; then if test $gcc_cv_header_memcheck_h = yes; then
AC_DEFINE(HAVE_MEMCHECK_H, 1, AC_DEFINE(HAVE_MEMCHECK_H, 1,
[Define if valgrind's memcheck.h header is installed.]) [Define if valgrind's memcheck.h header is installed.])
......
...@@ -48,10 +48,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -48,10 +48,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#endif #endif
#ifdef ENABLE_VALGRIND_CHECKING #ifdef ENABLE_VALGRIND_CHECKING
# ifdef HAVE_MEMCHECK_H # ifdef HAVE_VALGRIND_MEMCHECK_H
# include <memcheck.h> # include <valgrind/memcheck.h>
# elif defined HAVE_MEMCHECK_H
# include <memcheck.h>
# else # else
# include <valgrind.h> # include <valgrind.h>
# endif # endif
#else #else
/* Avoid #ifdef:s when we can help it. */ /* Avoid #ifdef:s when we can help it. */
......
...@@ -31,10 +31,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -31,10 +31,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "timevar.h" #include "timevar.h"
#include "params.h" #include "params.h"
#ifdef ENABLE_VALGRIND_CHECKING #ifdef ENABLE_VALGRIND_CHECKING
# ifdef HAVE_MEMCHECK_H # ifdef HAVE_VALGRIND_MEMCHECK_H
# include <memcheck.h> # include <valgrind/memcheck.h>
# elif defined HAVE_MEMCHECK_H
# include <memcheck.h>
# else # else
# include <valgrind.h> # include <valgrind.h>
# endif # endif
#else #else
/* Avoid #ifdef:s when we can help it. */ /* Avoid #ifdef:s when we can help it. */
......
...@@ -36,7 +36,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -36,7 +36,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "bitmap.h" #include "bitmap.h"
#ifdef ENABLE_VALGRIND_CHECKING #ifdef ENABLE_VALGRIND_CHECKING
#include <valgrind/memcheck.h> # ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
# elif defined HAVE_MEMCHECK_H
# include <memcheck.h>
# else
# include <valgrind.h>
# endif
#else #else
/* Avoid #ifdef:s when we can help it. */ /* Avoid #ifdef:s when we can help it. */
#define VALGRIND_DISCARD(x) #define VALGRIND_DISCARD(x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment