Skip to content

Wrap Zend max execution timers check in M4 macro #14696

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 29, 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
1 change: 1 addition & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
- Symbol HAVE_PDO_SQLITELIB has been removed.
- Symbol HAVE_WAITPID has been removed.
- Symbol HAVE_LIBPQ has been removed.
- Symbols HAVE_LIBRT and HAVE_TIMER_CREATE removed.
- M4 macro PHP_DEFINE (atomic includes) removed (use AC_DEFINE and config.h).
- M4 macro PHP_WITH_SHARED has been removed (use PHP_ARG_WITH).
- M4 macro PHP_STRUCT_FLOCK has been removed (use AC_CHECK_TYPES).
Expand Down
53 changes: 31 additions & 22 deletions Zend/Zend.m4
Original file line number Diff line number Diff line change
Expand Up @@ -251,28 +251,7 @@ int main(void)
AC_MSG_RESULT(done)

ZEND_CHECK_SIGNALS

dnl Don't enable Zend Max Execution Timers by default until PHP 8.3 to not break the ABI
AC_ARG_ENABLE([zend-max-execution-timers],
[AS_HELP_STRING([--enable-zend-max-execution-timers],
[whether to enable zend max execution timers])],
[ZEND_MAX_EXECUTION_TIMERS=$enableval],
[ZEND_MAX_EXECUTION_TIMERS=$ZEND_ZTS])

AS_CASE(["$host_alias"], [*linux*|*freebsd*], [], [ZEND_MAX_EXECUTION_TIMERS='no'])

PHP_CHECK_FUNC(timer_create, rt)
if test "$ac_cv_func_timer_create" != "yes"; then
ZEND_MAX_EXECUTION_TIMERS='no'
fi

if test "$ZEND_MAX_EXECUTION_TIMERS" = "yes"; then
AC_DEFINE(ZEND_MAX_EXECUTION_TIMERS, 1, [Use zend max execution timers])
CFLAGS="$CFLAGS -DZEND_MAX_EXECUTION_TIMERS"
fi

AC_MSG_CHECKING(whether to enable zend max execution timers)
AC_MSG_RESULT($ZEND_MAX_EXECUTION_TIMERS)
ZEND_CHECK_MAX_EXECUTION_TIMERS
])

dnl
Expand Down Expand Up @@ -413,3 +392,33 @@ AS_VAR_IF([ZEND_SIGNALS], [yes],
AC_MSG_CHECKING([whether to enable Zend signal handling])
AC_MSG_RESULT([$ZEND_SIGNALS])
])

dnl
dnl ZEND_CHECK_MAX_EXECUTION_TIMERS
dnl
dnl Check whether to enable Zend max execution timers.
dnl
AC_DEFUN([ZEND_CHECK_MAX_EXECUTION_TIMERS], [dnl
AC_ARG_ENABLE([zend-max-execution-timers],
[AS_HELP_STRING([--enable-zend-max-execution-timers],
[Enable Zend max execution timers; when building with thread safety
(--enable-zts), they are automatically enabled by default based on the
system support])],
[ZEND_MAX_EXECUTION_TIMERS=$enableval],
[ZEND_MAX_EXECUTION_TIMERS=$ZEND_ZTS])

AS_CASE([$host_alias], [*linux*|*freebsd*],,
[ZEND_MAX_EXECUTION_TIMERS=no])

AS_VAR_IF([ZEND_MAX_EXECUTION_TIMERS], [yes],
[AC_SEARCH_LIBS([timer_create], [rt],,
[ZEND_MAX_EXECUTION_TIMERS=no])])

AS_VAR_IF([ZEND_MAX_EXECUTION_TIMERS], [yes],
[AC_DEFINE([ZEND_MAX_EXECUTION_TIMERS], [1],
[Define to 1 if Zend max execution timers are supported and enabled.])
AS_VAR_APPEND([CFLAGS], [" -DZEND_MAX_EXECUTION_TIMERS"])])

AC_MSG_CHECKING([whether to enable Zend max execution timers])
AC_MSG_RESULT([$ZEND_MAX_EXECUTION_TIMERS])
])
Loading