Skip to content

Commit 0a0d2d0

Browse files
authored
Autotools: Normalize PHP_INSTALL_HEADERS arguments (php#15620)
The m4_normalize(m4_expand([...])) simplifies working with a list of header files. The m4_normalize() is at this point still used in the php-src config.m4 files because of copy/paste probability to community extensions where the arguments still need to be done in the old style to support phpize in PHP-8.3 and earlier. For example: PHP_INSTALL_HEADERS([ext/dom], m4_normalize([ dom_ce.h namespace_compat.h xml_common.h xpath_callbacks.h ])) When PHP 8.4 will be the minimum supported PHP version, the headers can be installed without using m4_normalize() in PECL extensions. For example: PHP_INSTALL_HEADERS([ext/dom], [ dom_ce.h namespace_compat.h xml_common.h xpath_callbacks.h ])
1 parent 09c4982 commit 0a0d2d0

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

UPGRADING.INTERNALS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ PHP 8.4 INTERNALS UPGRADE NOTES
183183
- M4 macro PHP_OUTPUT is obsolete (use AC_CONFIG_FILES).
184184
- M4 macro PHP_PROG_SETUP now accepts an argument to set the minimum required
185185
PHP version during the build.
186+
- M4 macro PHP_INSTALL_HEADERS arguments can now be also
187+
blank-or-newline-separated lists instead of only separated with whitespace
188+
or backslash-then-newline.
186189
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed.
187190
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
188191
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and

build/php.m4

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,24 +2030,25 @@ dnl Misc. macros
20302030
dnl ----------------------------------------------------------------------------
20312031

20322032
dnl
2033-
dnl PHP_INSTALL_HEADERS(path [, file ...])
2034-
dnl
2035-
dnl PHP header files to be installed.
2036-
dnl
2037-
AC_DEFUN([PHP_INSTALL_HEADERS],[
2038-
ifelse([$2],[],[
2039-
for header_file in $1; do
2040-
PHP_RUN_ONCE(INSTALLHEADERS, $header_file, [
2041-
INSTALL_HEADERS="$INSTALL_HEADERS $header_file"
2042-
])
2033+
dnl PHP_INSTALL_HEADERS(path [, files ...])
2034+
dnl
2035+
dnl Add PHP header files to the list to be installed on the system. The "files"
2036+
dnl argument is a blank-or-newline-separated list of header files or directories
2037+
dnl located in the "path". If 2nd argument is not given, it installs header
2038+
dnl files in all paths from the blank-or-newline-separated "path" argument.
2039+
dnl
2040+
AC_DEFUN([PHP_INSTALL_HEADERS],
2041+
[m4_ifblank([$2], [
2042+
for header_file in m4_normalize(m4_expand([$1])); do
2043+
PHP_RUN_ONCE([INSTALLHEADERS], [$header_file],
2044+
[INSTALL_HEADERS="$INSTALL_HEADERS $header_file"])
20432045
done
20442046
], [
20452047
header_path=$1
2046-
for header_file in $2; do
2048+
for header_file in m4_normalize(m4_expand([$2])); do
20472049
hp_hf="$header_path/$header_file"
2048-
PHP_RUN_ONCE(INSTALLHEADERS, $hp_hf, [
2049-
INSTALL_HEADERS="$INSTALL_HEADERS $hp_hf"
2050-
])
2050+
PHP_RUN_ONCE([INSTALLHEADERS], [$hp_hf],
2051+
[INSTALL_HEADERS="$INSTALL_HEADERS $hp_hf"])
20512052
done
20522053
])
20532054
])

0 commit comments

Comments
 (0)