]> granicus.if.org Git - php/commitdiff
Use PKG_CHECK_MODULES to detect valgrind, and share build config with pcre
authorHugh McMaster <hugh.mcmaster@outlook.com>
Thu, 23 May 2019 13:01:04 +0000 (23:01 +1000)
committerJoe Watkins <krakjoe@php.net>
Sat, 25 May 2019 07:04:22 +0000 (09:04 +0200)
UPGRADING.INTERNALS
configure.ac
ext/pcre/config0.m4

index 5505184092e25e03fd5e04ebf29e4bc3ef7a4921..3104be852415329fa0eb2e612b3722260cc5fa01 100644 (file)
@@ -227,6 +227,8 @@ PHP 7.4 INTERNALS UPGRADE NOTES
       version and excluded versions that aren't supported.
     - PHP_PROG_RE2C is not called in the generated configure.ac for extensions
       anymore and now takes one optional argument - minimum required version.
+    - with-pcre-valgrind and with-valgrind are merged, and valgrind detected by
+      pkgconfig
 
   c. Windows build system changes
 
index f4a01e1e4992677abf80ae1b7aea02905d4fa4b9..c388ebae91ddafe5637cb582a8b3a32af59629cd 100644 (file)
@@ -761,35 +761,22 @@ fi
 dnl Check valgrind support.
 PHP_ARG_WITH([valgrind],
   [whether to enable valgrind support],
-  [AS_HELP_STRING([--with-valgrind=DIR],
+  [AS_HELP_STRING([--with-valgrind],
     [Enable valgrind support])],
   [yes],
   [no])
 
 if test "$PHP_VALGRIND" != "no"; then
+  PKG_CHECK_MODULES([VALGRIND], [valgrind], [have_valgrind="yes"], [have_valgrind="no"])
 
-  AC_MSG_CHECKING([for valgrind header])
-
-  if test "$PHP_VALGRIND" = "yes"; then
-    SEARCH_PATH="/usr/local /usr"
+  if test "$have_valgrind" = "yes"; then
+    PHP_EVAL_INCLINE($VALGRIND_CFLAGS)
+    AC_DEFINE(HAVE_VALGRIND, 1, [ ])
   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
+    if test "$with_valgrind" = "yes"; then
+      AC_MSG_ERROR([Valgrind not found. Please install Valgrind.])
     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.
index a6601fc3f14c158e8d09b89096ab93b48178f730..90bc782a3d5b92de591c4d04ea0aeee548260206 100644 (file)
@@ -81,34 +81,8 @@ else
   else
     AC_MSG_RESULT([no])
   fi
-fi
-
-PHP_ARG_WITH([pcre-valgrind],,
-  [AS_HELP_STRING([--with-pcre-valgrind=DIR],
-    [Enable PCRE valgrind support. Developers only!])],
-  [no],
-  [no])
 
-  if test "$PHP_EXTERNAL_PCRE" != "no"; then
-    AC_MSG_WARN([PHP is going to be linked with an external PCRE, --with-pcre-valgrind has no effect])
-  else
-    if test "$PHP_PCRE_VALGRIND" != "no"; then
-      PHP_PCRE_VALGRIND_INCDIR=
-      AC_MSG_CHECKING([for Valgrind headers location])
-      for i in $PHP_PCRE_VALGRIND $PHP_PCRE_VALGRIND/include $PHP_PCRE_VALGRIND/local/include /usr/include /usr/local/include; do
-        if test -f $i/valgrind/memcheck.h
-        then
-          PHP_PCRE_VALGRIND_INCDIR=$i
-          break
-        fi
-      done
-      if test -z "$PHP_PCRE_VALGRIND_INCDIR"
-      then
-        AC_MSG_ERROR([Could not find valgrind/memcheck.h])
-      else
-        AC_DEFINE(HAVE_PCRE_VALGRIND_SUPPORT, 1, [ ])
-        PHP_ADD_INCLUDE($PHP_PCRE_VALGRIND_INCDIR)
-        AC_MSG_RESULT([$PHP_PCRE_VALGRIND_INCDIR])
-      fi
-    fi
+  if test "$PHP_VALGRIND" != "no" && test "$have_valgrind" = "yes"; then
+      AC_DEFINE(HAVE_PCRE_VALGRIND_SUPPORT, 1, [ ])
   fi
+fi