Skip to content

Commit ef34e00

Browse files
hughmcmasterkrakjoe
authored andcommitted
Use PKG_CHECK_MODULES to detect valgrind, and share build config with pcre
1 parent e7a1409 commit ef34e00

File tree

3 files changed

+12
-49
lines changed

3 files changed

+12
-49
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ PHP 7.4 INTERNALS UPGRADE NOTES
227227
version and excluded versions that aren't supported.
228228
- PHP_PROG_RE2C is not called in the generated configure.ac for extensions
229229
anymore and now takes one optional argument - minimum required version.
230+
- with-pcre-valgrind and with-valgrind are merged, and valgrind detected by
231+
pkgconfig
230232

231233
c. Windows build system changes
232234

configure.ac

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -761,35 +761,22 @@ fi
761761
dnl Check valgrind support.
762762
PHP_ARG_WITH([valgrind],
763763
[whether to enable valgrind support],
764-
[AS_HELP_STRING([--with-valgrind=DIR],
764+
[AS_HELP_STRING([--with-valgrind],
765765
[Enable valgrind support])],
766766
[yes],
767767
[no])
768768

769769
if test "$PHP_VALGRIND" != "no"; then
770+
PKG_CHECK_MODULES([VALGRIND], [valgrind], [have_valgrind="yes"], [have_valgrind="no"])
770771

771-
AC_MSG_CHECKING([for valgrind header])
772-
773-
if test "$PHP_VALGRIND" = "yes"; then
774-
SEARCH_PATH="/usr/local /usr"
772+
if test "$have_valgrind" = "yes"; then
773+
PHP_EVAL_INCLINE($VALGRIND_CFLAGS)
774+
AC_DEFINE(HAVE_VALGRIND, 1, [ ])
775775
else
776-
SEARCH_PATH="$PHP_VALGRIND"
777-
fi
778-
779-
SEARCH_FOR="/include/valgrind/valgrind.h"
780-
for i in $SEARCH_PATH ; do
781-
if test -r $i/$SEARCH_FOR; then
782-
VALGRIND_DIR=$i
776+
if test "$with_valgrind" = "yes"; then
777+
AC_MSG_ERROR([Valgrind not found. Please install Valgrind.])
783778
fi
784-
done
785-
786-
if test -z "$VALGRIND_DIR"; then
787-
AC_MSG_RESULT([not found])
788-
else
789-
AC_MSG_RESULT(found in $VALGRIND_DIR)
790-
AC_DEFINE(HAVE_VALGRIND, 1, [ ])
791779
fi
792-
793780
fi
794781

795782
dnl General settings.

ext/pcre/config0.m4

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -81,34 +81,8 @@ else
8181
else
8282
AC_MSG_RESULT([no])
8383
fi
84-
fi
85-
86-
PHP_ARG_WITH([pcre-valgrind],,
87-
[AS_HELP_STRING([--with-pcre-valgrind=DIR],
88-
[Enable PCRE valgrind support. Developers only!])],
89-
[no],
90-
[no])
9184

92-
if test "$PHP_EXTERNAL_PCRE" != "no"; then
93-
AC_MSG_WARN([PHP is going to be linked with an external PCRE, --with-pcre-valgrind has no effect])
94-
else
95-
if test "$PHP_PCRE_VALGRIND" != "no"; then
96-
PHP_PCRE_VALGRIND_INCDIR=
97-
AC_MSG_CHECKING([for Valgrind headers location])
98-
for i in $PHP_PCRE_VALGRIND $PHP_PCRE_VALGRIND/include $PHP_PCRE_VALGRIND/local/include /usr/include /usr/local/include; do
99-
if test -f $i/valgrind/memcheck.h
100-
then
101-
PHP_PCRE_VALGRIND_INCDIR=$i
102-
break
103-
fi
104-
done
105-
if test -z "$PHP_PCRE_VALGRIND_INCDIR"
106-
then
107-
AC_MSG_ERROR([Could not find valgrind/memcheck.h])
108-
else
109-
AC_DEFINE(HAVE_PCRE_VALGRIND_SUPPORT, 1, [ ])
110-
PHP_ADD_INCLUDE($PHP_PCRE_VALGRIND_INCDIR)
111-
AC_MSG_RESULT([$PHP_PCRE_VALGRIND_INCDIR])
112-
fi
113-
fi
85+
if test "$PHP_VALGRIND" != "no" && test "$have_valgrind" = "yes"; then
86+
AC_DEFINE(HAVE_PCRE_VALGRIND_SUPPORT, 1, [ ])
11487
fi
88+
fi

0 commit comments

Comments
 (0)