Skip to content

Commit dc7b67e

Browse files
authored
Autotools: Sync PHP_ADD_MAKEFILE_FRAGMENT (#14766)
- Macro help text updated for extensions and general usage - Arguments quoted - dnl removes redundant newlines in the generated configure script
1 parent 1fa0db0 commit dc7b67e

File tree

9 files changed

+23
-12
lines changed

9 files changed

+23
-12
lines changed

build/php.m4

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,16 @@ EOF
160160
])
161161

162162
dnl
163-
dnl PHP_ADD_MAKEFILE_FRAGMENT([srcfile [, ext_srcdir [, ext_builddir]]])
163+
dnl PHP_ADD_MAKEFILE_FRAGMENT([makefile [, srcdir [, builddir]]])
164164
dnl
165165
dnl Processes a file called Makefile.frag in the source directory of the most
166166
dnl recently added extension. $(srcdir) and $(builddir) are substituted with the
167167
dnl proper paths. Can be used to supply custom rules and/or additional targets.
168+
dnl For extensions, call this macro after the PHP_NEW_EXTENSION to get these
169+
dnl variables substituted automatically, elsewhere pass the Makefile path
170+
dnl "makefile" and optionally adjust "srcdir" and "builddir".
168171
dnl
169-
AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[
172+
AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT], [dnl
170173
ifelse($1,,src=$ext_srcdir/Makefile.frag,src=$1)
171174
ifelse($2,,ac_srcdir=$ext_srcdir,ac_srcdir=$2)
172175
ifelse($3,,ac_builddir=$ext_builddir,ac_builddir=$3)

configure.ac

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ if test "$PHP_GCOV" = "yes"; then
814814
fi
815815

816816
AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
817-
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/build/Makefile.gcov, $abs_srcdir)
817+
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/build/Makefile.gcov], [$abs_srcdir])
818818

819819
dnl Remove all optimization flags from CFLAGS.
820820
changequote({,})
@@ -1774,8 +1774,12 @@ PHP_ADD_SOURCES([Zend], [m4_normalize([
17741774
])],
17751775
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $fiber_asm_cflag])
17761776

1777-
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
1778-
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
1777+
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/scripts/Makefile.frag],
1778+
[$abs_srcdir/scripts],
1779+
[scripts])
1780+
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/Zend/Makefile.frag],
1781+
[$abs_srcdir/Zend],
1782+
[Zend])
17791783

17801784
AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
17811785

ext/json/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ PHP_NEW_EXTENSION(json,
55
json_scanner.c,
66
no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
77
PHP_INSTALL_HEADERS([ext/json], [php_json.h php_json_parser.h php_json_scanner.h])
8-
PHP_ADD_MAKEFILE_FRAGMENT()
8+
PHP_ADD_MAKEFILE_FRAGMENT

ext/opcache/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ int main(void) {
347347
if test "$PHP_OPCACHE_JIT" = "yes"; then
348348
PHP_ADD_BUILD_DIR([$ext_builddir/jit], 1)
349349
PHP_ADD_BUILD_DIR([$ext_builddir/jit/ir], 1)
350-
PHP_ADD_MAKEFILE_FRAGMENT($ext_srcdir/jit/Makefile.frag)
350+
PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag])
351351
fi
352352
PHP_SUBST([OPCACHE_SHARED_LIBADD])
353353
fi

sapi/cgi/config9.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if test "$PHP_CGI" != "no"; then
2121
;;
2222
esac
2323

24-
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag)
24+
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/cgi/Makefile.frag])
2525

2626
dnl Set filename.
2727
case $host_alias in

sapi/cli/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ AS_VAR_IF([php_cv_var_PS_STRINGS], [yes],
2121
[AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS exists.])])
2222

2323
if test "$PHP_CLI" != "no"; then
24-
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cli/Makefile.frag)
24+
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/cli/Makefile.frag])
2525

2626
dnl Set filename.
2727
SAPI_CLI_PATH=sapi/cli/php

sapi/fuzzer/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if test "$PHP_FUZZER" != "no"; then
2727
dnl Don't use PHP_REQUIRE_CXX() to avoid unnecessarily pulling in -lstdc++
2828
AC_PROG_CXX
2929
AC_PROG_CXXCPP
30-
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/fuzzer/Makefile.frag)
30+
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fuzzer/Makefile.frag])
3131
SAPI_FUZZER_PATH=sapi/fuzzer
3232
PHP_SUBST([SAPI_FUZZER_PATH])
3333
if test -z "$LIB_FUZZING_ENGINE"; then

sapi/litespeed/config.m4

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ PHP_ARG_ENABLE([litespeed],
55
[no])
66

77
if test "$PHP_LITESPEED" != "no"; then
8-
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/litespeed/Makefile.frag,$abs_srcdir/sapi/litespeed,sapi/litespeed)
8+
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/litespeed/Makefile.frag],
9+
[$abs_srcdir/sapi/litespeed],
10+
[sapi/litespeed])
911
SAPI_LITESPEED_PATH=sapi/litespeed/php
1012
PHP_SELECT_SAPI(litespeed, program, lsapi_main.c lsapilib.c, "", '$(SAPI_LITESPEED_PATH)')
1113
case $host_alias in

sapi/phpdbg/config.m4

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ if test "$PHP_PHPDBG" != "no"; then
6767
fi
6868
],,[#include <linux/userfaultfd.h>])
6969

70-
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/phpdbg/Makefile.frag], [$abs_srcdir/sapi/phpdbg], [$abs_builddir/sapi/phpdbg])
70+
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/phpdbg/Makefile.frag],
71+
[$abs_srcdir/sapi/phpdbg],
72+
[$abs_builddir/sapi/phpdbg])
7173
PHP_SELECT_SAPI(phpdbg, program, $PHP_PHPDBG_FILES, $PHP_PHPDBG_CFLAGS, [$(SAPI_PHPDBG_PATH)])
7274

7375
BUILD_BINARY="sapi/phpdbg/phpdbg"

0 commit comments

Comments
 (0)