Autotools: Normalize PHP_ADD_BUILD_DIR 1st argument (#15612)

The m4_normalize(m4_expand([$1])) expands the given argument if it
contains M4 macros, and then trims the items together into a space
separated string in an intuitive way.
This commit is contained in:
Peter Kokot 2024-08-29 00:44:29 +02:00 committed by GitHub
parent 0a0d2d0631
commit fbacc0f936
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 29 additions and 18 deletions

View file

@ -186,6 +186,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES
- M4 macro PHP_INSTALL_HEADERS arguments can now be also - M4 macro PHP_INSTALL_HEADERS arguments can now be also
blank-or-newline-separated lists instead of only separated with whitespace blank-or-newline-separated lists instead of only separated with whitespace
or backslash-then-newline. or backslash-then-newline.
- M4 macro PHP_ADD_BUILD_DIR now also accepts 1st argument as a
blank-or-newline-separated separated list.
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed. - 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 - 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 extensions. The libpq paths can be customized with the PGSQL_CFLAGS and

View file

@ -911,12 +911,15 @@ AC_DEFUN([PHP_SELECT_SAPI],[
dnl dnl
dnl PHP_ADD_BUILD_DIR(dirs [, create]) dnl PHP_ADD_BUILD_DIR(dirs [, create])
dnl dnl
dnl Add build directories and directories required for the out-of-source builds. dnl Add blank-or-newline-separated list of build directories or directories
dnl When "create" is given, the provided "dirs" are created immediately upon dnl required for the out-of-source builds. When "create" is given, the provided
dnl macro invocation, instead of deferring it to the PHP_GEN_BUILD_DIRS. dnl "dirs" are created immediately upon macro invocation, instead of deferring
dnl them to the PHP_GEN_BUILD_DIRS.
dnl dnl
AC_DEFUN([PHP_ADD_BUILD_DIR],[ AC_DEFUN([PHP_ADD_BUILD_DIR],
ifelse($2,,[BUILD_DIR="$BUILD_DIR $1"], [$php_shtool mkdir -p $1]) [m4_ifblank([$2],
[AS_VAR_APPEND([BUILD_DIR], [" m4_normalize(m4_expand([$1]))"])],
[$php_shtool mkdir -p m4_normalize(m4_expand([$1]))])
]) ])
dnl dnl

View file

@ -1781,7 +1781,7 @@ PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/Zend/Makefile.frag],
AC_DEFINE([HAVE_BUILD_DEFS_H], [1], AC_DEFINE([HAVE_BUILD_DEFS_H], [1],
[Define to 1 if PHP has the <main/build-defs.h> header file.]) [Define to 1 if PHP has the <main/build-defs.h> header file.])
PHP_ADD_BUILD_DIR(m4_normalize([ PHP_ADD_BUILD_DIR([
main main
main/streams main/streams
scripts scripts
@ -1790,7 +1790,7 @@ PHP_ADD_BUILD_DIR(m4_normalize([
Zend Zend
Zend/asm Zend/asm
Zend/Optimizer Zend/Optimizer
])) ])
AC_CONFIG_FILES([ AC_CONFIG_FILES([
main/build-defs.h main/build-defs.h

View file

@ -765,9 +765,11 @@ AS_VAR_IF([HAVE_DBA], [1], [
]), ]),
[$ext_shared],, [$ext_shared],,
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1]) [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
PHP_ADD_BUILD_DIR([$ext_builddir/libcdb]) PHP_ADD_BUILD_DIR([
PHP_ADD_BUILD_DIR([$ext_builddir/libflatfile]) $ext_builddir/libcdb
PHP_ADD_BUILD_DIR([$ext_builddir/libinifile]) $ext_builddir/libflatfile
$ext_builddir/libinifile
])
PHP_SUBST([DBA_SHARED_LIBADD]) PHP_SUBST([DBA_SHARED_LIBADD])
], ],
[AC_MSG_RESULT([no])]) [AC_MSG_RESULT([no])])

View file

@ -227,7 +227,7 @@ if test "$PHP_DOM" != "no"; then
]), ]),
[$ext_shared],, [$ext_shared],,
[$PHP_LEXBOR_CFLAGS]) [$PHP_LEXBOR_CFLAGS])
PHP_ADD_BUILD_DIR(m4_normalize([ PHP_ADD_BUILD_DIR([
$ext_builddir/parentnode $ext_builddir/parentnode
$ext_builddir/$LEXBOR_DIR/core $ext_builddir/$LEXBOR_DIR/core
$ext_builddir/$LEXBOR_DIR/css/selectors $ext_builddir/$LEXBOR_DIR/css/selectors
@ -242,7 +242,7 @@ if test "$PHP_DOM" != "no"; then
$ext_builddir/$LEXBOR_DIR/ports/posix/lexbor/core $ext_builddir/$LEXBOR_DIR/ports/posix/lexbor/core
$ext_builddir/$LEXBOR_DIR/selectors-adapted $ext_builddir/$LEXBOR_DIR/selectors-adapted
$ext_builddir/$LEXBOR_DIR/tag $ext_builddir/$LEXBOR_DIR/tag
])) ])
PHP_SUBST([DOM_SHARED_LIBADD]) PHP_SUBST([DOM_SHARED_LIBADD])
PHP_INSTALL_HEADERS([ext/dom], m4_normalize([ PHP_INSTALL_HEADERS([ext/dom], m4_normalize([
dom_ce.h dom_ce.h

View file

@ -108,7 +108,7 @@ if test "$PHP_INTL" != "no"; then
[shared_objects_intl], [shared_objects_intl],
[yes])]) [yes])])
PHP_ADD_BUILD_DIR(m4_normalize([ PHP_ADD_BUILD_DIR([
$ext_builddir/breakiterator $ext_builddir/breakiterator
$ext_builddir/calendar $ext_builddir/calendar
$ext_builddir/collator $ext_builddir/collator
@ -126,7 +126,7 @@ if test "$PHP_INTL" != "no"; then
$ext_builddir/timezone $ext_builddir/timezone
$ext_builddir/transliterator $ext_builddir/transliterator
$ext_builddir/uchar $ext_builddir/uchar
])) ])
PHP_ADD_EXTENSION_DEP(intl, date) PHP_ADD_EXTENSION_DEP(intl, date)
fi fi

View file

@ -354,8 +354,10 @@ int main(void) {
fi fi
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [ AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
PHP_ADD_BUILD_DIR([$ext_builddir/jit]) PHP_ADD_BUILD_DIR([
PHP_ADD_BUILD_DIR([$ext_builddir/jit/ir]) $ext_builddir/jit
$ext_builddir/jit/ir
])
PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag]) PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag])
]) ])
PHP_SUBST([OPCACHE_SHARED_LIBADD]) PHP_SUBST([OPCACHE_SHARED_LIBADD])

View file

@ -506,8 +506,10 @@ if test "$PHP_FPM" != "no"; then
php_fpm_prefix=$(eval echo $prefix) php_fpm_prefix=$(eval echo $prefix)
AC_SUBST([php_fpm_prefix]) AC_SUBST([php_fpm_prefix])
PHP_ADD_BUILD_DIR([sapi/fpm/fpm]) PHP_ADD_BUILD_DIR([
PHP_ADD_BUILD_DIR([sapi/fpm/fpm/events]) sapi/fpm/fpm
sapi/fpm/fpm/events
])
AC_CONFIG_FILES([ AC_CONFIG_FILES([
sapi/fpm/init.d.php-fpm sapi/fpm/init.d.php-fpm
sapi/fpm/php-fpm.8 sapi/fpm/php-fpm.8