diff --git a/build/php.m4 b/build/php.m4 index 15c1022aea8..22f2b2b8509 100644 --- a/build/php.m4 +++ b/build/php.m4 @@ -160,13 +160,16 @@ EOF ]) dnl -dnl PHP_ADD_MAKEFILE_FRAGMENT([srcfile [, ext_srcdir [, ext_builddir]]]) +dnl PHP_ADD_MAKEFILE_FRAGMENT([makefile [, srcdir [, builddir]]]) dnl dnl Processes a file called Makefile.frag in the source directory of the most dnl recently added extension. $(srcdir) and $(builddir) are substituted with the dnl proper paths. Can be used to supply custom rules and/or additional targets. +dnl For extensions, call this macro after the PHP_NEW_EXTENSION to get these +dnl variables substituted automatically, elsewhere pass the Makefile path +dnl "makefile" and optionally adjust "srcdir" and "builddir". dnl -AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[ +AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT], [dnl ifelse($1,,src=$ext_srcdir/Makefile.frag,src=$1) ifelse($2,,ac_srcdir=$ext_srcdir,ac_srcdir=$2) ifelse($3,,ac_builddir=$ext_builddir,ac_builddir=$3) diff --git a/configure.ac b/configure.ac index 5a8ef0ca8ef..12be2987149 100644 --- a/configure.ac +++ b/configure.ac @@ -814,7 +814,7 @@ if test "$PHP_GCOV" = "yes"; then fi AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov]) - PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/build/Makefile.gcov, $abs_srcdir) + PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/build/Makefile.gcov], [$abs_srcdir]) dnl Remove all optimization flags from CFLAGS. changequote({,}) @@ -1774,8 +1774,12 @@ PHP_ADD_SOURCES([Zend], [m4_normalize([ ])], [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $fiber_asm_cflag]) -PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts) -PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend) +PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/scripts/Makefile.frag], + [$abs_srcdir/scripts], + [scripts]) +PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/Zend/Makefile.frag], + [$abs_srcdir/Zend], + [Zend]) AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ]) diff --git a/ext/json/config.m4 b/ext/json/config.m4 index 4cc381e5a38..0d02dff2345 100644 --- a/ext/json/config.m4 +++ b/ext/json/config.m4 @@ -5,4 +5,4 @@ PHP_NEW_EXTENSION(json, json_scanner.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) PHP_INSTALL_HEADERS([ext/json], [php_json.h php_json_parser.h php_json_scanner.h]) -PHP_ADD_MAKEFILE_FRAGMENT() +PHP_ADD_MAKEFILE_FRAGMENT diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index 9418641e526..d0f07741a9c 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -347,7 +347,7 @@ int main(void) { if test "$PHP_OPCACHE_JIT" = "yes"; then PHP_ADD_BUILD_DIR([$ext_builddir/jit], 1) PHP_ADD_BUILD_DIR([$ext_builddir/jit/ir], 1) - PHP_ADD_MAKEFILE_FRAGMENT($ext_srcdir/jit/Makefile.frag) + PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag]) fi PHP_SUBST([OPCACHE_SHARED_LIBADD]) fi diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4 index 7be3a38430b..bdd567e5c13 100644 --- a/sapi/cgi/config9.m4 +++ b/sapi/cgi/config9.m4 @@ -21,7 +21,7 @@ if test "$PHP_CGI" != "no"; then ;; esac - PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag) + PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/cgi/Makefile.frag]) dnl Set filename. case $host_alias in diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4 index 43cb8c3367f..6bd9c03c20e 100644 --- a/sapi/cli/config.m4 +++ b/sapi/cli/config.m4 @@ -21,7 +21,7 @@ AS_VAR_IF([php_cv_var_PS_STRINGS], [yes], [AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS exists.])]) if test "$PHP_CLI" != "no"; then - PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cli/Makefile.frag) + PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/cli/Makefile.frag]) dnl Set filename. SAPI_CLI_PATH=sapi/cli/php diff --git a/sapi/fuzzer/config.m4 b/sapi/fuzzer/config.m4 index c4d6d662e00..c25d33a327c 100644 --- a/sapi/fuzzer/config.m4 +++ b/sapi/fuzzer/config.m4 @@ -27,7 +27,7 @@ if test "$PHP_FUZZER" != "no"; then dnl Don't use PHP_REQUIRE_CXX() to avoid unnecessarily pulling in -lstdc++ AC_PROG_CXX AC_PROG_CXXCPP - PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/fuzzer/Makefile.frag) + PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fuzzer/Makefile.frag]) SAPI_FUZZER_PATH=sapi/fuzzer PHP_SUBST([SAPI_FUZZER_PATH]) if test -z "$LIB_FUZZING_ENGINE"; then diff --git a/sapi/litespeed/config.m4 b/sapi/litespeed/config.m4 index 07c61f1d612..fb56dd4dad2 100644 --- a/sapi/litespeed/config.m4 +++ b/sapi/litespeed/config.m4 @@ -5,7 +5,9 @@ PHP_ARG_ENABLE([litespeed], [no]) if test "$PHP_LITESPEED" != "no"; then - PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/litespeed/Makefile.frag,$abs_srcdir/sapi/litespeed,sapi/litespeed) + PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/litespeed/Makefile.frag], + [$abs_srcdir/sapi/litespeed], + [sapi/litespeed]) SAPI_LITESPEED_PATH=sapi/litespeed/php PHP_SELECT_SAPI(litespeed, program, lsapi_main.c lsapilib.c, "", '$(SAPI_LITESPEED_PATH)') case $host_alias in diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4 index d68d2d60619..148b05a09cb 100644 --- a/sapi/phpdbg/config.m4 +++ b/sapi/phpdbg/config.m4 @@ -67,7 +67,9 @@ if test "$PHP_PHPDBG" != "no"; then fi ],,[#include ]) - PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/phpdbg/Makefile.frag], [$abs_srcdir/sapi/phpdbg], [$abs_builddir/sapi/phpdbg]) + PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/phpdbg/Makefile.frag], + [$abs_srcdir/sapi/phpdbg], + [$abs_builddir/sapi/phpdbg]) PHP_SELECT_SAPI(phpdbg, program, $PHP_PHPDBG_FILES, $PHP_PHPDBG_CFLAGS, [$(SAPI_PHPDBG_PATH)]) BUILD_BINARY="sapi/phpdbg/phpdbg"