summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMichael Heimpold <mhei@heimpold.de>2018-02-14 14:46:17 +0100
committerNikita Popov <nikita.ppv@gmail.com>2018-03-23 22:02:17 +0100
commit25ba60b1479eb332a7388732f3ee5467000fbe73 (patch)
tree4165081af39e479de22d2e7e64b75f3174861c9d /configure.ac
parent7f4327bc244263818bb12d4dc87f8a454e0392f2 (diff)
downloadphp-git-25ba60b1479eb332a7388732f3ee5467000fbe73.tar.gz
Fixed bug #75722: Rework valgrind detection
As described in bug report #75722, the configure script (acinclude.m4) currently searches for the valgrind header file and enables valgrind support if found. When cross-compiling the searched paths are invalid for the target platform because they belong to the host system. At the moment, there is no way to tell the build system a dedicated path where to look for the header file. This leads to the issue, that when cross-compiling eg. for ARMv5 platform, that valgrind header file is detected - e.g. because host system is amd64 - and support is enabled - but target platform will never support valgrind (valgrind requires e.g. at least ARMv7). This change reworks the detection so that user could manually opt-in valgrind support and optionally specify a directory where the build system should look for the header file using the --with-valgrind option.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac30
1 files changed, 29 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 05f94f08a9..c5d9be978b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -753,7 +753,35 @@ if test "x$php_crypt_r" = "x1"; then
PHP_CRYPT_R_STYLE
fi
-PHP_CHECK_VALGRIND
+dnl Check valgrind support
+PHP_ARG_WITH(valgrind, [whether to enable valgrind support],
+[ --with-valgrind=DIR Enable valgrind support], yes, no)
+
+if test "$PHP_VALGRIND" != "no"; then
+
+ AC_MSG_CHECKING([for valgrind header])
+
+ if test "$PHP_VALGRIND" = "yes"; then
+ SEARCH_PATH="/usr/local /usr"
+ else
+ SEARCH_PATH="$PHP_VALGRIND"
+ fi
+
+ SEARCH_FOR="/include/valgrind/valgrind.h"
+ for i in $SEARCH_PATH ; do
+ if test -r $i/$SEARCH_FOR; then
+ VALGRIND_DIR=$i
+ fi
+ done
+
+ if test -z "$VALGRIND_DIR"; then
+ AC_MSG_RESULT([not found])
+ else
+ AC_MSG_RESULT(found in $VALGRIND_DIR)
+ AC_DEFINE(HAVE_VALGRIND, 1, [ ])
+ fi
+
+fi
dnl General settings.
dnl -------------------------------------------------------------------------