Skip to content

Autotools: Refactor Valgrind support #14736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -766,26 +766,19 @@ if test "$ac_cv__asm_goto" = yes; then
AC_DEFINE([HAVE_ASM_GOTO], [1], [Define if asm goto support is available.])
fi

dnl Check valgrind support.
dnl Check Valgrind support.
PHP_ARG_WITH([valgrind],
[whether to enable valgrind support],
[whether to enable Valgrind support],
[AS_HELP_STRING([--with-valgrind],
[Enable valgrind support])],
[Enable Valgrind support])],
[no],
[no])

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

if test "$have_valgrind" = "yes"; then
PHP_EVAL_INCLINE($VALGRIND_CFLAGS)
AC_DEFINE(HAVE_VALGRIND, 1, [ ])
else
if test "$with_valgrind" = "yes"; then
AC_MSG_ERROR([Valgrind not found. Please install Valgrind.])
fi
fi
fi
AS_VAR_IF([PHP_VALGRIND], [no],,
[PKG_CHECK_MODULES([VALGRIND], [valgrind],
[PHP_EVAL_INCLINE([$VALGRIND_CFLAGS])
AC_DEFINE([HAVE_VALGRIND], [1],
[Define to 1 if Valgrind is enabled and supported.])])])

dnl Check for openpty. It may require linking against libutil or libbsd.
AC_CHECK_FUNCS([openpty],,
Expand Down
13 changes: 6 additions & 7 deletions ext/pcre/config0.m4
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,13 @@ else
AC_MSG_RESULT([no])
fi

dnl Enable pcre Valgrind support only in DEBUG build (it affects performance).
AS_VAR_IF([PHP_VALGRIND], [no],,
[AS_VAR_IF([ZEND_DEBUG], [yes],
[AC_DEFINE([HAVE_PCRE_VALGRIND_SUPPORT], [1],
[Define to 1 if pcre has Valgrind support enabled.])])])

PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib)
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/])

if test "$PHP_VALGRIND" != "no" && test "$have_valgrind" = "yes"; then
dnl Enable pcre valgrind support only in DEBUG build (it affects performance)
if test "$ZEND_DEBUG" = "yes"; then
AC_DEFINE(HAVE_PCRE_VALGRIND_SUPPORT, 1, [ ])
fi
fi
fi
Loading