Skip to content

Commit bf7be07

Browse files
authored
Refactor Zend signal handling check (#14678)
This wraps the Zend signal handling check in its own M4 macro for readability and uses AS_VAR_IF, AS_VAR_APPEND for CFLAGS variable, updates help texts and fixes CS.
1 parent 1a5c411 commit bf7be07

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

Zend/Zend.m4

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -260,22 +260,7 @@ int main(void)
260260
261261
AC_MSG_RESULT(done)
262262
263-
AC_ARG_ENABLE([zend-signals],
264-
[AS_HELP_STRING([--disable-zend-signals],
265-
[whether to enable zend signal handling])],
266-
[ZEND_SIGNALS=$enableval],
267-
[ZEND_SIGNALS=yes])
268-
269-
AC_CHECK_FUNCS([sigaction], [], [
270-
ZEND_SIGNALS=no
271-
])
272-
if test "$ZEND_SIGNALS" = "yes"; then
273-
AC_DEFINE(ZEND_SIGNALS, 1, [Use zend signal handling])
274-
CFLAGS="$CFLAGS -DZEND_SIGNALS"
275-
fi
276-
277-
AC_MSG_CHECKING(whether to enable zend signal handling)
278-
AC_MSG_RESULT($ZEND_SIGNALS)
263+
ZEND_CHECK_SIGNALS
279264
280265
dnl Don't enable Zend Max Execution Timers by default until PHP 8.3 to not break the ABI
281266
AC_ARG_ENABLE([zend-max-execution-timers],
@@ -416,3 +401,25 @@ AS_VAR_IF([php_cv_have___cpuid_count], [yes],
416401
[AC_DEFINE([HAVE_CPUID_COUNT], [1],
417402
[Define to 1 if '__cpuid_count' is available.])])
418403
])
404+
405+
dnl
406+
dnl ZEND_CHECK_SIGNALS
407+
dnl
408+
dnl Check whether to enable Zend signal handling if supported by the system.
409+
dnl
410+
AC_DEFUN([ZEND_CHECK_SIGNALS], [dnl
411+
AC_ARG_ENABLE([zend-signals],
412+
[AS_HELP_STRING([--disable-zend-signals],
413+
[Disable Zend signal handling])],
414+
[ZEND_SIGNALS=$enableval],
415+
[ZEND_SIGNALS=yes])
416+
417+
AC_CHECK_FUNCS([sigaction],, [ZEND_SIGNALS=no])
418+
AS_VAR_IF([ZEND_SIGNALS], [yes],
419+
[AC_DEFINE([ZEND_SIGNALS], [1],
420+
[Define to 1 if Zend signal handling is supported and enabled.])
421+
AS_VAR_APPEND([CFLAGS], [" -DZEND_SIGNALS"])])
422+
423+
AC_MSG_CHECKING([whether to enable Zend signal handling])
424+
AC_MSG_RESULT([$ZEND_SIGNALS])
425+
])

0 commit comments

Comments
 (0)