Skip to content

Commit a5b7850

Browse files
authored
Wrap Zend max execution timers check in M4 macro (#14696)
- 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 b1c34a9 commit a5b7850

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
@@ -199,28 +199,7 @@ fi
199199
200200
ZEND_CHECK_ALIGNMENT
201201
ZEND_CHECK_SIGNALS
202-
203-
dnl Don't enable Zend Max Execution Timers by default until PHP 8.3 to not break the ABI
204-
AC_ARG_ENABLE([zend-max-execution-timers],
205-
[AS_HELP_STRING([--enable-zend-max-execution-timers],
206-
[whether to enable zend max execution timers])],
207-
[ZEND_MAX_EXECUTION_TIMERS=$enableval],
208-
[ZEND_MAX_EXECUTION_TIMERS=$ZEND_ZTS])
209-
210-
AS_CASE(["$host_alias"], [*linux*|*freebsd*], [], [ZEND_MAX_EXECUTION_TIMERS='no'])
211-
212-
PHP_CHECK_FUNC(timer_create, rt)
213-
if test "$ac_cv_func_timer_create" != "yes"; then
214-
ZEND_MAX_EXECUTION_TIMERS='no'
215-
fi
216-
217-
if test "$ZEND_MAX_EXECUTION_TIMERS" = "yes"; then
218-
AC_DEFINE(ZEND_MAX_EXECUTION_TIMERS, 1, [Use zend max execution timers])
219-
CFLAGS="$CFLAGS -DZEND_MAX_EXECUTION_TIMERS"
220-
fi
221-
222-
AC_MSG_CHECKING(whether to enable zend max execution timers)
223-
AC_MSG_RESULT($ZEND_MAX_EXECUTION_TIMERS)
202+
ZEND_CHECK_MAX_EXECUTION_TIMERS
224203
])
225204

226205
dnl
@@ -425,3 +404,33 @@ AS_VAR_IF([ZEND_SIGNALS], [yes],
425404
AC_MSG_CHECKING([whether to enable Zend signal handling])
426405
AC_MSG_RESULT([$ZEND_SIGNALS])
427406
])
407+
408+
dnl
409+
dnl ZEND_CHECK_MAX_EXECUTION_TIMERS
410+
dnl
411+
dnl Check whether to enable Zend max execution timers.
412+
dnl
413+
AC_DEFUN([ZEND_CHECK_MAX_EXECUTION_TIMERS], [dnl
414+
AC_ARG_ENABLE([zend-max-execution-timers],
415+
[AS_HELP_STRING([--enable-zend-max-execution-timers],
416+
[Enable Zend max execution timers; when building with thread safety
417+
(--enable-zts), they are automatically enabled by default based on the
418+
system support])],
419+
[ZEND_MAX_EXECUTION_TIMERS=$enableval],
420+
[ZEND_MAX_EXECUTION_TIMERS=$ZEND_ZTS])
421+
422+
AS_CASE([$host_alias], [*linux*|*freebsd*],,
423+
[ZEND_MAX_EXECUTION_TIMERS=no])
424+
425+
AS_VAR_IF([ZEND_MAX_EXECUTION_TIMERS], [yes],
426+
[AC_SEARCH_LIBS([timer_create], [rt],,
427+
[ZEND_MAX_EXECUTION_TIMERS=no])])
428+
429+
AS_VAR_IF([ZEND_MAX_EXECUTION_TIMERS], [yes],
430+
[AC_DEFINE([ZEND_MAX_EXECUTION_TIMERS], [1],
431+
[Define to 1 if Zend max execution timers are supported and enabled.])
432+
AS_VAR_APPEND([CFLAGS], [" -DZEND_MAX_EXECUTION_TIMERS"])])
433+
434+
AC_MSG_CHECKING([whether to enable Zend max execution timers])
435+
AC_MSG_RESULT([$ZEND_MAX_EXECUTION_TIMERS])
436+
])

0 commit comments

Comments
 (0)