From 58a3ab92c3bf30afd0b0214919060c63fd1310ea Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Fri, 12 Jul 2024 02:16:49 +0200 Subject: [PATCH] Autotools: Fix config.status script syntax (#14929) 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. * Simplify threaded Apache build detection Instead of checking for entire "grepped" string, this only checks for yes|no values instead. * 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. Fixes report in GH-14872 --- sapi/apache2handler/config.m4 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 index 638dada40de..def782ea975 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 'threaded:.*yes' >/dev/null 2>&1], [ + 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 *** | @@ -124,5 +126,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