mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-25 10:54:13 +08:00
libcpp: Add missing config for --enable-valgrind-annotations [PR107691]
r7-912 copied (parts of) the valgrind annotation checks from gcc to libcpp. The above copies the missing pieces to libcpp to diagnose when libcpp is configured with --enable-valgrind-annotations but valgrind is not installed. libcpp/ChangeLog: PR preprocessor/107691 * configure.ac: Add valgrind header checks. * configure: Regenerate.
This commit is contained in:
parent
0a62889c7a
commit
5a6c698ea3
57
libcpp/configure
vendored
57
libcpp/configure
vendored
@ -7835,6 +7835,62 @@ case x$enable_languages in
|
||||
esac
|
||||
|
||||
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "valgrind.h" "ac_cv_header_valgrind_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_valgrind_h" = xyes; then :
|
||||
have_valgrind_h=yes
|
||||
else
|
||||
have_valgrind_h=no
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# It is certainly possible that there's valgrind but no valgrind.h.
|
||||
# GCC relies on making annotations so we must have both.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for VALGRIND_DISCARD in <valgrind/memcheck.h>" >&5
|
||||
$as_echo_n "checking for VALGRIND_DISCARD in <valgrind/memcheck.h>... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <valgrind/memcheck.h>
|
||||
#ifndef VALGRIND_DISCARD
|
||||
#error VALGRIND_DISCARD not defined
|
||||
#endif
|
||||
_ACEOF
|
||||
if ac_fn_c_try_cpp "$LINENO"; then :
|
||||
gcc_cv_header_valgrind_memcheck_h=yes
|
||||
else
|
||||
gcc_cv_header_valgrind_memcheck_h=no
|
||||
fi
|
||||
rm -f conftest.err conftest.i conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_header_valgrind_memcheck_h" >&5
|
||||
$as_echo "$gcc_cv_header_valgrind_memcheck_h" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for VALGRIND_DISCARD in <memcheck.h>" >&5
|
||||
$as_echo_n "checking for VALGRIND_DISCARD in <memcheck.h>... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <memcheck.h>
|
||||
#ifndef VALGRIND_DISCARD
|
||||
#error VALGRIND_DISCARD not defined
|
||||
#endif
|
||||
_ACEOF
|
||||
if ac_fn_c_try_cpp "$LINENO"; then :
|
||||
gcc_cv_header_memcheck_h=yes
|
||||
else
|
||||
gcc_cv_header_memcheck_h=no
|
||||
fi
|
||||
rm -f conftest.err conftest.i conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_header_memcheck_h" >&5
|
||||
$as_echo "$gcc_cv_header_memcheck_h" >&6; }
|
||||
if test $gcc_cv_header_valgrind_memcheck_h = yes; then
|
||||
|
||||
$as_echo "#define HAVE_VALGRIND_MEMCHECK_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
if test $gcc_cv_header_memcheck_h = yes; then
|
||||
|
||||
$as_echo "#define HAVE_MEMCHECK_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
# Check whether --enable-valgrind-annotations was given.
|
||||
if test "${enable_valgrind_annotations+set}" = set; then :
|
||||
enableval=$enable_valgrind_annotations;
|
||||
@ -7847,6 +7903,7 @@ if test x$enable_valgrind_annotations != xno \
|
||||
if (test $have_valgrind_h = no \
|
||||
&& test $gcc_cv_header_memcheck_h = no \
|
||||
&& test $gcc_cv_header_valgrind_memcheck_h = no); then
|
||||
as_fn_error $? "*** valgrind annotations requested, but" "$LINENO" 5
|
||||
as_fn_error $? "*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h" "$LINENO" 5
|
||||
fi
|
||||
|
||||
|
@ -226,6 +226,40 @@ case x$enable_languages in
|
||||
esac
|
||||
AC_SUBST(CET_HOST_FLAGS)
|
||||
|
||||
dnl # This check AC_REQUIREs various stuff, so it *must not* be inside
|
||||
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)
|
||||
|
||||
# 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>
|
||||
#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)
|
||||
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
|
||||
|
||||
AC_ARG_ENABLE(valgrind-annotations,
|
||||
[AS_HELP_STRING([--enable-valgrind-annotations],
|
||||
[enable valgrind runtime interaction])], [],
|
||||
@ -235,6 +269,7 @@ if test x$enable_valgrind_annotations != xno \
|
||||
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([*** valgrind annotations requested, but])
|
||||
AC_MSG_ERROR([*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h])
|
||||
fi
|
||||
AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1,
|
||||
|
Loading…
Reference in New Issue
Block a user