diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-28 14:01:40 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-28 14:01:40 +0000 |
commit | b90976fa555d12d06334a2bc45af8e78b142006e (patch) | |
tree | a5bc6249aa24285c664840fc0a7c18d7aea148b9 /gcc/configure.ac | |
parent | 96902209711de85fd2c86f94b86b5c37295765bb (diff) | |
download | gcc-b90976fa555d12d06334a2bc45af8e78b142006e.tar.gz |
2014-04-28 Richard Biener <rguenther@suse.de>
* configure.ac: Do valgrind header checks unconditionally.
Add --enable-valgrind-annotations.
* system.h: Guard valgrind header inclusion with
ENABLE_VALGRIND_ANNOTATIONS instead of ENABLE_VALGRIND_CHECKING.
* alloc-pool.c (pool_alloc, pool_free): Use
ENABLE_VALGRIND_ANNOTATIONS instead of ENABLE_VALGRIND_CHECKING
to guard possibly dead code.
* config.in: Regenerated.
* configure: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209861 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r-- | gcc/configure.ac | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac index a3154bb32f1..5565524c89a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -514,27 +514,36 @@ dnl # an if statement. This was the source of very frustrating bugs dnl # in converting to autoconf 2.5x! AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) -if test x$ac_valgrind_checking != x ; then - # It is certainly possible that there's valgrind but no valgrind.h. - # GCC relies on making annotations so we must have both. - AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>) - AC_PREPROC_IFELSE([AC_LANG_SOURCE( - [[#include <valgrind/memcheck.h> +# It is certainly possible that there's valgrind but no valgrind.h. +# GCC relies on making annotations so we must have both. +AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>) +AC_PREPROC_IFELSE([AC_LANG_SOURCE( + [[#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_PREPROC_IFELSE([AC_LANG_SOURCE( - [[#include <memcheck.h> +AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h) +AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>) +AC_PREPROC_IFELSE([AC_LANG_SOURCE( + [[#include <memcheck.h> #ifndef VALGRIND_DISCARD #error VALGRIND_DISCARD not defined #endif]])], [gcc_cv_header_memcheck_h=yes], [gcc_cv_header_memcheck_h=no]) - AC_MSG_RESULT($gcc_cv_header_memcheck_h) +AC_MSG_RESULT($gcc_cv_header_memcheck_h) +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 + AC_DEFINE(HAVE_MEMCHECK_H, 1, + [Define if valgrind's memcheck.h header is installed.]) +fi + +if test x$ac_valgrind_checking != x ; then AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind, [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1]) if test "x$valgrind_path" = "x" \ @@ -548,14 +557,6 @@ if test x$ac_valgrind_checking != x ; then AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1, [Define if you want to run subprograms and generated programs 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 - AC_DEFINE(HAVE_MEMCHECK_H, 1, - [Define if valgrind's memcheck.h header is installed.]) - fi fi AC_SUBST(valgrind_path_defines) AC_SUBST(valgrind_command) @@ -594,6 +595,21 @@ gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats, [Define to enable detailed memory allocation stats gathering.]) +AC_ARG_ENABLE(valgrind-annotations, +[AS_HELP_STRING([--enable-valgrind-annotations], + [enable valgrind runtime interaction])], [], +[enable_valgrind_annotations=no]) +if test x$enable_valgrind_annotations != xno \ + || test x$ac_valgrind_checking != x; then + if (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 valgrind/memcheck.h, memcheck.h or valgrind.h]) + fi + AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1, +[Define to get calls to the valgrind runtime enabled.]) +fi + # ------------------------------- # Miscenalleous configure options # ------------------------------- |