Merge bitcoin-core/secp256k1#1027: build: Add a check that Valgrind actually supports a host platform

7c7ce872a53f386f7c6a3a8ea04442840902193b build: Add a check that Valgrind actually supports a host platform (Hennadii Stepanov)

Pull request description:

  This PR adds a check that Valgrind actually supports a host platform.

  On master (49f608de474a89e5c742830c8ff5ac8978b5796a):
  ```
  $ ./autogen.sh &> /dev/null && ./configure -q --host=riscv64-linux-gnu 2>&1 | grep valgrind
    valgrind                = yes
  ```

  With this PR:
  ```
  $ ./autogen.sh &> /dev/null && ./configure -q --host=riscv64-linux-gnu 2>&1 | grep valgrind
    valgrind                = no
  ```

  Closes #1023.

ACKs for top commit:
  sipa:
    utACK 7c7ce872a53f386f7c6a3a8ea04442840902193b
  real-or-random:
    utACK 7c7ce872a53f386f7c6a3a8ea04442840902193b

Tree-SHA512: 27f660f7b992ab35dba64b525af1c631f33b8cb25b6a990c81ec4d358c609a2dc03b0932847db9d5aa35eaa880929c7ad2bb4e7719785c2402b1b291cfa91ede
This commit is contained in:
Tim Ruffing 2021-12-05 11:35:05 +01:00
commit 4f01840b82
No known key found for this signature in database
GPG Key ID: 8C461CCD293F6011

View File

@ -13,7 +13,13 @@ AC_DEFUN([SECP_VALGRIND_CHECK],[
if test x"$has_valgrind" != x"yes"; then
CPPFLAGS_TEMP="$CPPFLAGS"
CPPFLAGS="$VALGRIND_CPPFLAGS $CPPFLAGS"
AC_CHECK_HEADER([valgrind/memcheck.h], [has_valgrind=yes; AC_DEFINE(HAVE_VALGRIND,1,[Define this symbol if valgrind is installed])])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <valgrind/memcheck.h>
]], [[
#if defined(NVALGRIND)
# error "Valgrind does not support this platform."
#endif
]])], [has_valgrind=yes; AC_DEFINE(HAVE_VALGRIND,1,[Define this symbol if valgrind is installed, and it supports the host platform])])
fi
])