Skip to content

Commit fbacc0f

Browse files
authored
Autotools: Normalize PHP_ADD_BUILD_DIR 1st argument (php#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.
1 parent 0a0d2d0 commit fbacc0f

File tree

8 files changed

+30
-19
lines changed

8 files changed

+30
-19
lines changed

UPGRADING.INTERNALS

+2
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES
186186
- M4 macro PHP_INSTALL_HEADERS arguments can now be also
187187
blank-or-newline-separated lists instead of only separated with whitespace
188188
or backslash-then-newline.
189+
- M4 macro PHP_ADD_BUILD_DIR now also accepts 1st argument as a
190+
blank-or-newline-separated separated list.
189191
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed.
190192
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
191193
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and

build/php.m4

+9-6
Original file line numberDiff line numberDiff line change
@@ -911,12 +911,15 @@ AC_DEFUN([PHP_SELECT_SAPI],[
911911
dnl
912912
dnl PHP_ADD_BUILD_DIR(dirs [, create])
913913
dnl
914-
dnl Add build directories and directories required for the out-of-source builds.
915-
dnl When "create" is given, the provided "dirs" are created immediately upon
916-
dnl macro invocation, instead of deferring it to the PHP_GEN_BUILD_DIRS.
917-
dnl
918-
AC_DEFUN([PHP_ADD_BUILD_DIR],[
919-
ifelse($2,,[BUILD_DIR="$BUILD_DIR $1"], [$php_shtool mkdir -p $1])
914+
dnl Add blank-or-newline-separated list of build directories or directories
915+
dnl required for the out-of-source builds. When "create" is given, the provided
916+
dnl "dirs" are created immediately upon macro invocation, instead of deferring
917+
dnl them to the PHP_GEN_BUILD_DIRS.
918+
dnl
919+
AC_DEFUN([PHP_ADD_BUILD_DIR],
920+
[m4_ifblank([$2],
921+
[AS_VAR_APPEND([BUILD_DIR], [" m4_normalize(m4_expand([$1]))"])],
922+
[$php_shtool mkdir -p m4_normalize(m4_expand([$1]))])
920923
])
921924

922925
dnl

configure.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/Zend/Makefile.frag],
17811781
AC_DEFINE([HAVE_BUILD_DEFS_H], [1],
17821782
[Define to 1 if PHP has the <main/build-defs.h> header file.])
17831783

1784-
PHP_ADD_BUILD_DIR(m4_normalize([
1784+
PHP_ADD_BUILD_DIR([
17851785
main
17861786
main/streams
17871787
scripts
@@ -1790,7 +1790,7 @@ PHP_ADD_BUILD_DIR(m4_normalize([
17901790
Zend
17911791
Zend/asm
17921792
Zend/Optimizer
1793-
]))
1793+
])
17941794

17951795
AC_CONFIG_FILES([
17961796
main/build-defs.h

ext/dba/config.m4

+5-3
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,11 @@ AS_VAR_IF([HAVE_DBA], [1], [
765765
]),
766766
[$ext_shared],,
767767
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
768-
PHP_ADD_BUILD_DIR([$ext_builddir/libcdb])
769-
PHP_ADD_BUILD_DIR([$ext_builddir/libflatfile])
770-
PHP_ADD_BUILD_DIR([$ext_builddir/libinifile])
768+
PHP_ADD_BUILD_DIR([
769+
$ext_builddir/libcdb
770+
$ext_builddir/libflatfile
771+
$ext_builddir/libinifile
772+
])
771773
PHP_SUBST([DBA_SHARED_LIBADD])
772774
],
773775
[AC_MSG_RESULT([no])])

ext/dom/config.m4

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ if test "$PHP_DOM" != "no"; then
227227
]),
228228
[$ext_shared],,
229229
[$PHP_LEXBOR_CFLAGS])
230-
PHP_ADD_BUILD_DIR(m4_normalize([
230+
PHP_ADD_BUILD_DIR([
231231
$ext_builddir/parentnode
232232
$ext_builddir/$LEXBOR_DIR/core
233233
$ext_builddir/$LEXBOR_DIR/css/selectors
@@ -242,7 +242,7 @@ if test "$PHP_DOM" != "no"; then
242242
$ext_builddir/$LEXBOR_DIR/ports/posix/lexbor/core
243243
$ext_builddir/$LEXBOR_DIR/selectors-adapted
244244
$ext_builddir/$LEXBOR_DIR/tag
245-
]))
245+
])
246246
PHP_SUBST([DOM_SHARED_LIBADD])
247247
PHP_INSTALL_HEADERS([ext/dom], m4_normalize([
248248
dom_ce.h

ext/intl/config.m4

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ if test "$PHP_INTL" != "no"; then
108108
[shared_objects_intl],
109109
[yes])])
110110

111-
PHP_ADD_BUILD_DIR(m4_normalize([
111+
PHP_ADD_BUILD_DIR([
112112
$ext_builddir/breakiterator
113113
$ext_builddir/calendar
114114
$ext_builddir/collator
@@ -126,7 +126,7 @@ if test "$PHP_INTL" != "no"; then
126126
$ext_builddir/timezone
127127
$ext_builddir/transliterator
128128
$ext_builddir/uchar
129-
]))
129+
])
130130

131131
PHP_ADD_EXTENSION_DEP(intl, date)
132132
fi

ext/opcache/config.m4

+4-2
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,10 @@ int main(void) {
354354
fi
355355

356356
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
357-
PHP_ADD_BUILD_DIR([$ext_builddir/jit])
358-
PHP_ADD_BUILD_DIR([$ext_builddir/jit/ir])
357+
PHP_ADD_BUILD_DIR([
358+
$ext_builddir/jit
359+
$ext_builddir/jit/ir
360+
])
359361
PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag])
360362
])
361363
PHP_SUBST([OPCACHE_SHARED_LIBADD])

sapi/fpm/config.m4

+4-2
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,10 @@ if test "$PHP_FPM" != "no"; then
506506
php_fpm_prefix=$(eval echo $prefix)
507507
AC_SUBST([php_fpm_prefix])
508508

509-
PHP_ADD_BUILD_DIR([sapi/fpm/fpm])
510-
PHP_ADD_BUILD_DIR([sapi/fpm/fpm/events])
509+
PHP_ADD_BUILD_DIR([
510+
sapi/fpm/fpm
511+
sapi/fpm/fpm/events
512+
])
511513
AC_CONFIG_FILES([
512514
sapi/fpm/init.d.php-fpm
513515
sapi/fpm/php-fpm.8

0 commit comments

Comments
 (0)