Skip to content

Commit 71631bd

Browse files
committed
Refactor Zend signal handling check
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 a2cecd2 commit 71631bd

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
@@ -286,22 +286,7 @@ int main(void)
286286
287287
AC_MSG_RESULT(done)
288288
289-
AC_ARG_ENABLE([zend-signals],
290-
[AS_HELP_STRING([--disable-zend-signals],
291-
[whether to enable zend signal handling])],
292-
[ZEND_SIGNALS=$enableval],
293-
[ZEND_SIGNALS=yes])
294-
295-
AC_CHECK_FUNCS([sigaction], [], [
296-
ZEND_SIGNALS=no
297-
])
298-
if test "$ZEND_SIGNALS" = "yes"; then
299-
AC_DEFINE(ZEND_SIGNALS, 1, [Use zend signal handling])
300-
CFLAGS="$CFLAGS -DZEND_SIGNALS"
301-
fi
302-
303-
AC_MSG_CHECKING(whether to enable zend signal handling)
304-
AC_MSG_RESULT($ZEND_SIGNALS)
289+
ZEND_CHECK_SIGNALS
305290
306291
dnl Don't enable Zend Max Execution Timers by default until PHP 8.3 to not break the ABI
307292
AC_ARG_ENABLE([zend-max-execution-timers],
@@ -410,3 +395,25 @@ AS_VAR_IF([php_cv_have___cpuid_count], [yes],
410395
[AC_DEFINE([HAVE_CPUID_COUNT], [1],
411396
[Define to 1 if '__cpuid_count' is available.])])
412397
])
398+
399+
dnl
400+
dnl ZEND_CHECK_SIGNALS
401+
dnl
402+
dnl Check whether to enable Zend signal handling if supported by the system.
403+
dnl
404+
AC_DEFUN([ZEND_CHECK_SIGNALS], [dnl
405+
AC_ARG_ENABLE([zend-signals],
406+
[AS_HELP_STRING([--disable-zend-signals],
407+
[Disable Zend signal handling])],
408+
[ZEND_SIGNALS=$enableval],
409+
[ZEND_SIGNALS=yes])
410+
411+
AC_CHECK_FUNCS([sigaction],, [ZEND_SIGNALS=no])
412+
AS_VAR_IF([ZEND_SIGNALS], [yes],
413+
[AC_DEFINE([ZEND_SIGNALS], [1],
414+
[Define to 1 if Zend signal handling is supported and enabled.])
415+
AS_VAR_APPEND([CFLAGS], [" -DZEND_SIGNALS"])])
416+
417+
AC_MSG_CHECKING([whether to enable Zend signal handling])
418+
AC_MSG_RESULT([$ZEND_SIGNALS])
419+
])

0 commit comments

Comments
 (0)