Skip to content

Commit cc637cd

Browse files
committed
Autotools: Normalize PHP_ADD_BUILD_DIR 1st argument
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 674ec02 commit cc637cd

File tree

8 files changed

+30
-19
lines changed

8 files changed

+30
-19
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ 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_ADD_BUILD_DIR now also accepts 1st argument as a
187+
blank-or-newline-separated separated list.
186188
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed.
187189
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
188190
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and

build/php.m4

Lines changed: 9 additions & 6 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,9 +750,11 @@ if test "$HAVE_DBA" = "1"; then
750750
]),
751751
[$ext_shared],,
752752
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
753-
PHP_ADD_BUILD_DIR([$ext_builddir/libcdb])
754-
PHP_ADD_BUILD_DIR([$ext_builddir/libflatfile])
755-
PHP_ADD_BUILD_DIR([$ext_builddir/libinifile])
753+
PHP_ADD_BUILD_DIR([
754+
$ext_builddir/libcdb
755+
$ext_builddir/libflatfile
756+
$ext_builddir/libinifile
757+
])
756758
PHP_SUBST([DBA_SHARED_LIBADD])
757759
else
758760
AC_MSG_RESULT([no])

ext/dom/config.m4

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 2 deletions
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

Lines changed: 4 additions & 2 deletions
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)