]> granicus.if.org Git - php/commitdiff
Fixed bug #75722: Rework valgrind detection
authorMichael Heimpold <mhei@heimpold.de>
Wed, 14 Feb 2018 13:46:17 +0000 (14:46 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 23 Mar 2018 21:02:17 +0000 (22:02 +0100)
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.

NEWS
acinclude.m4
configure.ac

diff --git a/NEWS b/NEWS
index 1faf13831ebd1a15e6d7f34227653103d36beb7d..5d65fd0833576ea1f5d18d30ff91eead580a7cfe 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2018, PHP 7.2.5
 
+- Core:
+  . Fixed bug #75722 (Convert valgrind detection to configure option).
+    (Michael Heimpold)
+
 - Mbstring:
   . Fixed bug #75944 (Wrong cp1251 detection). (dmk001)
   . Fixed bug #76113 (mbstring does not build with Oniguruma 6.8.1).
index d42d70853515f104c49da610dcfef1f96235f078..eb06cb7e363f070f8e795dc3e9ee7419a4943630 100644 (file)
@@ -3249,23 +3249,3 @@ AC_DEFUN([PHP_CHECK_BUILTIN_SSUBLL_OVERFLOW], [
 
 dnl Load the AX_CHECK_COMPILE_FLAG macro from the autoconf archive.
 m4_include([build/ax_check_compile_flag.m4])
-
-dnl PHP_CHECK_VALGRIND
-AC_DEFUN([PHP_CHECK_VALGRIND], [
-  AC_MSG_CHECKING([for valgrind])
-
-  SEARCH_PATH="/usr/local /usr"
-  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
-])
index 05f94f08a9c84bef60612c8a474d7e08f926eef2..c5d9be978bda4772952af3ccac9f29279d47f54a 100644 (file)
@@ -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 -------------------------------------------------------------------------