From 42c5f5de9430e95c9f156a47279d3e577f8da52c Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Fri, 12 Jul 2024 00:40:59 +0200 Subject: [PATCH 1/3] Autotools: Fix config.status script syntax The init-cmds argument is appended to the config.status script with cat command and variables $var are replaced during the cat step to their values, so quoting these values fixes the syntax errors. Fixes report in GH-14872 --- sapi/apache2handler/config.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 index 638dada40defd..ccc536582e2bd 100644 --- a/sapi/apache2handler/config.m4 +++ b/sapi/apache2handler/config.m4 @@ -124,5 +124,5 @@ AC_CONFIG_COMMANDS([apache2handler], [AS_VAR_IF([enable_zts], [yes],, | PHP with --enable-zts | +--------------------------------------------------------------------+ ])])])], - [APACHE_THREADED_MPM=$APACHE_THREADED_MPM; enable_zts=$enable_zts]) + [APACHE_THREADED_MPM="$APACHE_THREADED_MPM"; enable_zts="$enable_zts"]) fi From 041b395b02f631d7796ae4fe3042cc66615a9525 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Fri, 12 Jul 2024 01:18:52 +0200 Subject: [PATCH 2/3] Simplify threaded Apache build detection Instead of checking for entire "grepped" string, this only checks for yes|no values instead. --- sapi/apache2handler/config.m4 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 index ccc536582e2bd..d021489ea784d 100644 --- a/sapi/apache2handler/config.m4 +++ b/sapi/apache2handler/config.m4 @@ -110,11 +110,13 @@ if test "$PHP_APXS2" != "no"; then ;; esac - APACHE_THREADED_MPM=$($APXS_HTTPD -V 2>/dev/null | grep 'threaded:.*yes') - AS_VAR_IF([APACHE_THREADED_MPM],,, [PHP_BUILD_THREAD_SAFE]) + AS_IF([$APXS_HTTPD -V 2>/dev/null | grep -q 'threaded:.*yes'], [ + APACHE_THREADED_MPM=yes + PHP_BUILD_THREAD_SAFE + ], [APACHE_THREADED_MPM=no]) AC_CONFIG_COMMANDS([apache2handler], [AS_VAR_IF([enable_zts], [yes],, - [AS_VAR_IF([APACHE_THREADED_MPM],, + [AS_VAR_IF([APACHE_THREADED_MPM], [no], [AC_MSG_WARN([ +--------------------------------------------------------------------+ | *** WARNING *** | From 7825fe17c2e39975e46a40a75e777319d2152b7b Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Fri, 12 Jul 2024 01:36:38 +0200 Subject: [PATCH 3/3] [skip ci] Redirect the standard output and standard error The "grep -q" is not portable according to docs so this redirects the output and checks the exit status. --- sapi/apache2handler/config.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 index d021489ea784d..def782ea9759e 100644 --- a/sapi/apache2handler/config.m4 +++ b/sapi/apache2handler/config.m4 @@ -110,7 +110,7 @@ if test "$PHP_APXS2" != "no"; then ;; esac - AS_IF([$APXS_HTTPD -V 2>/dev/null | grep -q 'threaded:.*yes'], [ + AS_IF([$APXS_HTTPD -V 2>/dev/null | grep 'threaded:.*yes' >/dev/null 2>&1], [ APACHE_THREADED_MPM=yes PHP_BUILD_THREAD_SAFE ], [APACHE_THREADED_MPM=no])