Skip to content

Commit 25ba60b

Browse files
mheinikic
authored andcommitted
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.
1 parent 7f4327b commit 25ba60b

File tree

3 files changed

+33
-21
lines changed

3 files changed

+33
-21
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2018, PHP 7.2.5
44

5+
- Core:
6+
. Fixed bug #75722 (Convert valgrind detection to configure option).
7+
(Michael Heimpold)
8+
59
- Mbstring:
610
. Fixed bug #75944 (Wrong cp1251 detection). (dmk001)
711
. Fixed bug #76113 (mbstring does not build with Oniguruma 6.8.1).

acinclude.m4

-20
Original file line numberDiff line numberDiff line change
@@ -3249,23 +3249,3 @@ AC_DEFUN([PHP_CHECK_BUILTIN_SSUBLL_OVERFLOW], [
32493249

32503250
dnl Load the AX_CHECK_COMPILE_FLAG macro from the autoconf archive.
32513251
m4_include([build/ax_check_compile_flag.m4])
3252-
3253-
dnl PHP_CHECK_VALGRIND
3254-
AC_DEFUN([PHP_CHECK_VALGRIND], [
3255-
AC_MSG_CHECKING([for valgrind])
3256-
3257-
SEARCH_PATH="/usr/local /usr"
3258-
SEARCH_FOR="/include/valgrind/valgrind.h"
3259-
for i in $SEARCH_PATH ; do
3260-
if test -r $i/$SEARCH_FOR; then
3261-
VALGRIND_DIR=$i
3262-
fi
3263-
done
3264-
3265-
if test -z "$VALGRIND_DIR"; then
3266-
AC_MSG_RESULT([not found])
3267-
else
3268-
AC_MSG_RESULT(found in $VALGRIND_DIR)
3269-
AC_DEFINE(HAVE_VALGRIND, 1, [ ])
3270-
fi
3271-
])

configure.ac

+29-1
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,35 @@ if test "x$php_crypt_r" = "x1"; then
753753
PHP_CRYPT_R_STYLE
754754
fi
755755

756-
PHP_CHECK_VALGRIND
756+
dnl Check valgrind support
757+
PHP_ARG_WITH(valgrind, [whether to enable valgrind support],
758+
[ --with-valgrind=DIR Enable valgrind support], yes, no)
759+
760+
if test "$PHP_VALGRIND" != "no"; then
761+
762+
AC_MSG_CHECKING([for valgrind header])
763+
764+
if test "$PHP_VALGRIND" = "yes"; then
765+
SEARCH_PATH="/usr/local /usr"
766+
else
767+
SEARCH_PATH="$PHP_VALGRIND"
768+
fi
769+
770+
SEARCH_FOR="/include/valgrind/valgrind.h"
771+
for i in $SEARCH_PATH ; do
772+
if test -r $i/$SEARCH_FOR; then
773+
VALGRIND_DIR=$i
774+
fi
775+
done
776+
777+
if test -z "$VALGRIND_DIR"; then
778+
AC_MSG_RESULT([not found])
779+
else
780+
AC_MSG_RESULT(found in $VALGRIND_DIR)
781+
AC_DEFINE(HAVE_VALGRIND, 1, [ ])
782+
fi
783+
784+
fi
757785

758786
dnl General settings.
759787
dnl -------------------------------------------------------------------------

0 commit comments

Comments
 (0)