@@ -40,9 +40,9 @@ case $host_os in
4040 dnl These Homebrew packages may be keg-only, meaning that they won't be found
4141 dnl in expected paths because they may conflict with system files. Ask
4242 dnl Homebrew where each one is located, then adjust paths accordingly.
43-
4443 openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
4544 gmp_prefix=`$BREW --prefix gmp 2>/dev/null`
45+ valgrind_prefix=`$BREW --prefix valgrind 2>/dev/null`
4646 if test x$openssl_prefix != x; then
4747 PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
4848 export PKG_CONFIG_PATH
@@ -52,6 +52,9 @@ case $host_os in
5252 GMP_CPPFLAGS="-I$gmp_prefix/include"
5353 GMP_LIBS="-L$gmp_prefix/lib"
5454 fi
55+ if test x$valgrind_prefix != x; then
56+ VALGRIND_CPPFLAGS="-I$valgrind_prefix/include"
57+ fi
5558 else
5659 AC_PATH_PROG ( [ PORT] ,port ,)
5760 dnl if homebrew isn't installed and macports is, add the macports default paths
@@ -180,12 +183,15 @@ AC_ARG_WITH([valgrind], [AS_HELP_STRING([--with-valgrind=yes|no|auto],
180183if test x"$req_valgrind" = x"no"; then
181184 enable_valgrind=no
182185else
183- AC_CHECK_HEADER ( [ valgrind/memcheck.h] , [ enable_valgrind=yes] , [
186+ SECP_VALGRIND_CHECK
187+ if test x"$has_valgrind" != x"yes"; then
184188 if test x"$req_valgrind" = x"yes"; then
185189 AC_MSG_ERROR ( [ Valgrind support explicitly requested but valgrind/memcheck.h header not available] )
186190 fi
187191 enable_valgrind=no
188- ] , [ ] )
192+ else
193+ enable_valgrind=yes
194+ fi
189195fi
190196AM_CONDITIONAL([ VALGRIND_ENABLED] ,[ test "$enable_valgrind" = "yes"] )
191197
@@ -424,6 +430,10 @@ if test x"$set_bignum" = x"gmp"; then
424430 SECP_INCLUDES="$SECP_INCLUDES $GMP_CPPFLAGS"
425431fi
426432
433+ if test x"$enable_valgrind" = x"yes"; then
434+ SECP_INCLUDES="$SECP_INCLUDES $VALGRIND_CPPFLAGS"
435+ fi
436+
427437if test x"$set_precomp" = x"yes"; then
428438 AC_DEFINE ( USE_ECMULT_STATIC_PRECOMPUTATION , 1 , [ Define this symbol to use a statically generated ecmult table] )
429439fi
0 commit comments