From 7076f50f1d65b8a603f535e9f52d1c5925e0608e Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 1 Aug 2024 01:40:02 +0200 Subject: [PATCH] Replace PHP_OUTPUT with AC_CONFIG_FILES This is a follow-up of GH-15177 (c96f08aa70d75736fe227975804f998c408acaaf) and GH-15185 The PHP_OUTPUT macro was introduced in the very early phase of the build system due to AC_OUTPUT handling issues in the old Autoconf versions before the AC_CONFIG_FILES, AC_CONFIG_COMMANDS etc were introduced with the AC_OUTPUT signature without arguments. The PHP_OUTPUT was also helping Makefile.in back then being properly generated based on whether all files were generated or only some (when using the obsolete CONFIG_FILES=... ./config.status invocation instead of the new ./config.status --file=...). Another issue is that PHP_OUTPUT can't be used by extensions when using phpize. This replaces the PHP_OUTPUT invocations with default AC_CONFIG_FILES. The obsolete "REDO_ALL" feature at the config.status invocation is also removed with a simpler unconditional generation. In phar extension the "ext/phar" is replaced with $ext_dir variable to be able to use phpize. --- UPGRADING.INTERNALS | 1 + build/php.m4 | 6 ++++-- configure.ac | 30 +++++++++++------------------- ext/phar/config.m4 | 5 ++++- sapi/cgi/config9.m4 | 2 +- sapi/cli/config.m4 | 2 +- sapi/fpm/config.m4 | 2 +- sapi/phpdbg/config.m4 | 2 +- 8 files changed, 24 insertions(+), 26 deletions(-) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 9b4388e808710..621739b01a593 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -174,6 +174,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES - M4 macro PHP_SETUP_LIBXML doesn't define the redundant HAVE_LIBXML symbol anymore. - M4 macro PHP_SETUP_ICONV doesn't define the HAVE_ICONV symbol anymore. + - M4 macro PHP_OUTPUT is obsolete (use AC_CONFIG_FILES). - TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed. - Added pkg-config support to find libpq for the pdo_pgsql and pgsql extensions. The libpq paths can be customized with the PGSQL_CFLAGS and diff --git a/build/php.m4 b/build/php.m4 index fde5ffbaeb1d3..48fd6b2449ecf 100644 --- a/build/php.m4 +++ b/build/php.m4 @@ -94,10 +94,12 @@ dnl dnl PHP_OUTPUT(file) dnl dnl Adds "file" to the list of files generated by AC_OUTPUT. This macro can be -dnl used several times. +dnl used several times. This macro is obsolete as of PHP 8.4 in favor of the +dnl default AC_CONFIG_FILES. dnl AC_DEFUN([PHP_OUTPUT], -[AS_VAR_APPEND([PHP_OUTPUT_FILES], [" m4_normalize([$1])"])]) +[m4_warn([obsolete], [The macro 'PHP_OUTPUT' is obsolete. Use AC_CONFIG_FILES.]) +AC_CONFIG_FILES([$1])]) dnl ---------------------------------------------------------------------------- dnl Build system base macros. diff --git a/configure.ac b/configure.ac index 5422e98f995b3..940ed230f026a 100644 --- a/configure.ac +++ b/configure.ac @@ -1824,13 +1824,13 @@ PHP_ADD_BUILD_DIR(m4_normalize([ Zend/Optimizer ])) -ALL_OUTPUT_FILES="main/build-defs.h \ -scripts/phpize scripts/man1/phpize.1 \ -scripts/php-config scripts/man1/php-config.1 \ -$PHP_OUTPUT_FILES" - -dnl Generate build files. -AC_CONFIG_FILES([$ALL_OUTPUT_FILES]) +AC_CONFIG_FILES([ + main/build-defs.h + scripts/man1/php-config.1 + scripts/man1/phpize.1 + scripts/php-config + scripts/phpize +]) AC_CONFIG_COMMANDS_PRE([PHP_PATCH_CONFIG_HEADERS([main/php_config.h.in])]) @@ -1850,24 +1850,16 @@ Thank you for using PHP. X ],[ - -if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test "\$CONFIG_FILES" = " $ALL_OUTPUT_FILES" || test -z "\$CONFIG_FILES"; then - REDO_ALL=yes -fi - dnl Create configuration headers. dnl ---------------------------------------------------------------------------- cat >Zend/zend_config.h < FEO -dnl Run this only when generating all the files. -if test -n "\$REDO_ALL"; then - echo "creating main/internal_functions.c" - AWK="$AWK" sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in "$EXT_STATIC" > main/internal_functions.c +echo "creating main/internal_functions.c" +AWK="$AWK" sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in "$EXT_STATIC" > main/internal_functions.c - echo "creating main/internal_functions_cli.c" - AWK="$AWK" sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in "$EXT_CLI_STATIC" > main/internal_functions_cli.c -fi +echo "creating main/internal_functions_cli.c" +AWK="$AWK" sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in "$EXT_CLI_STATIC" > main/internal_functions_cli.c ]) AC_OUTPUT diff --git a/ext/phar/config.m4 b/ext/phar/config.m4 index 923b01b15b19c..bd5f59d37e952 100644 --- a/ext/phar/config.m4 +++ b/ext/phar/config.m4 @@ -35,5 +35,8 @@ if test "$PHP_PHAR" != "no"; then PHP_INSTALL_HEADERS([ext/phar], [php_phar.h]) - PHP_OUTPUT([ext/phar/phar.1 ext/phar/phar.phar.1]) + AC_CONFIG_FILES([ + $ext_dir/phar.1 + $ext_dir/phar.phar.1 + ]) fi diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4 index 15fca6e34a3bf..d0ab8b626d803 100644 --- a/sapi/cgi/config9.m4 +++ b/sapi/cgi/config9.m4 @@ -58,5 +58,5 @@ if test "$PHP_CGI" != "no"; then PHP_SUBST([SAPI_CGI_PATH]) PHP_SUBST([BUILD_CGI]) - PHP_OUTPUT([sapi/cgi/php-cgi.1]) + AC_CONFIG_FILES([sapi/cgi/php-cgi.1]) fi diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4 index 3e8b8b10bd32d..8da2c44e3bf34 100644 --- a/sapi/cli/config.m4 +++ b/sapi/cli/config.m4 @@ -55,7 +55,7 @@ if test "$PHP_CLI" != "no"; then PHP_SUBST([SAPI_CLI_PATH]) PHP_SUBST([BUILD_CLI]) - PHP_OUTPUT([sapi/cli/php.1]) + AC_CONFIG_FILES([sapi/cli/php.1]) PHP_INSTALL_HEADERS([sapi/cli], [cli.h]) fi diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index b8610367ccc2f..86db1ffa05b56 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -508,7 +508,7 @@ if test "$PHP_FPM" != "no"; then PHP_ADD_BUILD_DIR([sapi/fpm/fpm]) PHP_ADD_BUILD_DIR([sapi/fpm/fpm/events]) - PHP_OUTPUT([ + AC_CONFIG_FILES([ sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.8 sapi/fpm/php-fpm.conf diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4 index b65fc940ee1f7..d8bfb3a0d9579 100644 --- a/sapi/phpdbg/config.m4 +++ b/sapi/phpdbg/config.m4 @@ -101,5 +101,5 @@ if test "$PHP_PHPDBG" != "no"; then PHP_SUBST([BUILD_PHPDBG]) PHP_SUBST([BUILD_PHPDBG_SHARED]) - PHP_OUTPUT([sapi/phpdbg/phpdbg.1]) + AC_CONFIG_FILES([sapi/phpdbg/phpdbg.1]) fi