Skip to content

Commit 1d2b4d4

Browse files
committed
Wrap Zend max execution timers check in M4 macro
- PHP_CHECK_FUNC -> AC_SEARCH_LIBS - Redundant symbols HAVE_LIBRT and HAVE_TIMER_CREATE removed - The rt library for some older systems (Solaris <= 10, older Linux) appended as needed - This uses AC_ and AS_* macros and relies more on Autoconf shell code handling - Help texts updated and synced
1 parent 7f8e8a0 commit 1d2b4d4

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

UPGRADING.INTERNALS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
135135
- Symbol HAVE_PDO_SQLITELIB has been removed.
136136
- Symbol HAVE_WAITPID has been removed.
137137
- Symbol HAVE_LIBPQ has been removed.
138+
- Symbols HAVE_LIBRT and HAVE_TIMER_CREATE removed.
138139
- M4 macro PHP_DEFINE (atomic includes) removed (use AC_DEFINE and config.h).
139140
- M4 macro PHP_WITH_SHARED has been removed (use PHP_ARG_WITH).
140141
- M4 macro PHP_STRUCT_FLOCK has been removed (use AC_CHECK_TYPES).

Zend/Zend.m4

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -251,28 +251,7 @@ int main(void)
251251
AC_MSG_RESULT(done)
252252
253253
ZEND_CHECK_SIGNALS
254-
255-
dnl Don't enable Zend Max Execution Timers by default until PHP 8.3 to not break the ABI
256-
AC_ARG_ENABLE([zend-max-execution-timers],
257-
[AS_HELP_STRING([--enable-zend-max-execution-timers],
258-
[whether to enable zend max execution timers])],
259-
[ZEND_MAX_EXECUTION_TIMERS=$enableval],
260-
[ZEND_MAX_EXECUTION_TIMERS=$ZEND_ZTS])
261-
262-
AS_CASE(["$host_alias"], [*linux*|*freebsd*], [], [ZEND_MAX_EXECUTION_TIMERS='no'])
263-
264-
PHP_CHECK_FUNC(timer_create, rt)
265-
if test "$ac_cv_func_timer_create" != "yes"; then
266-
ZEND_MAX_EXECUTION_TIMERS='no'
267-
fi
268-
269-
if test "$ZEND_MAX_EXECUTION_TIMERS" = "yes"; then
270-
AC_DEFINE(ZEND_MAX_EXECUTION_TIMERS, 1, [Use zend max execution timers])
271-
CFLAGS="$CFLAGS -DZEND_MAX_EXECUTION_TIMERS"
272-
fi
273-
274-
AC_MSG_CHECKING(whether to enable zend max execution timers)
275-
AC_MSG_RESULT($ZEND_MAX_EXECUTION_TIMERS)
254+
ZEND_CHECK_MAX_EXECUTION_TIMERS
276255
])
277256

278257
dnl
@@ -413,3 +392,33 @@ AS_VAR_IF([ZEND_SIGNALS], [yes],
413392
AC_MSG_CHECKING([whether to enable Zend signal handling])
414393
AC_MSG_RESULT([$ZEND_SIGNALS])
415394
])
395+
396+
dnl
397+
dnl ZEND_CHECK_MAX_EXECUTION_TIMERS
398+
dnl
399+
dnl Check whether to enable Zend max execution timers.
400+
dnl
401+
AC_DEFUN([ZEND_CHECK_MAX_EXECUTION_TIMERS], [dnl
402+
AC_ARG_ENABLE([zend-max-execution-timers],
403+
[AS_HELP_STRING([--enable-zend-max-execution-timers],
404+
[Enable Zend max execution timers; when building with thread safety
405+
(--enable-zts), they are automatically enabled by default based on the
406+
system support])],
407+
[ZEND_MAX_EXECUTION_TIMERS=$enableval],
408+
[ZEND_MAX_EXECUTION_TIMERS=$ZEND_ZTS])
409+
410+
AS_CASE([$host_alias], [*linux*|*freebsd*],,
411+
[ZEND_MAX_EXECUTION_TIMERS=no])
412+
413+
AS_VAR_IF([ZEND_MAX_EXECUTION_TIMERS], [yes],
414+
[AC_SEARCH_LIBS([timer_create], [rt],,
415+
[ZEND_MAX_EXECUTION_TIMERS=no])])
416+
417+
AS_VAR_IF([ZEND_MAX_EXECUTION_TIMERS], [yes],
418+
[AC_DEFINE([ZEND_MAX_EXECUTION_TIMERS], [1],
419+
[Define to 1 if Zend max execution timers are supported and enabled.])
420+
AS_VAR_APPEND([CFLAGS], [" -DZEND_MAX_EXECUTION_TIMERS"])])
421+
422+
AC_MSG_CHECKING([whether to enable Zend max execution timers])
423+
AC_MSG_RESULT([$ZEND_MAX_EXECUTION_TIMERS])
424+
])

0 commit comments

Comments
 (0)