Skip to content

Autotools: Simplify few PHP_ADD_BUILD_DIR calls #15783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ PHP 8.4 INTERNALS UPGRADE NOTES
- ac_cv_write_stdout -> php_cv_have_write_stdout
and all other checks wrapped with their belonging cache variables (see *.m4
source files for details).
- The ext_builddir, ext_srcdir, and ext_dir variables are now set before
calling the PHP_NEW_EXTENSION macro, enabling their usage anywhere in the
current config.m4 file.

c. Windows build system changes
- The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19,
Expand Down
9 changes: 6 additions & 3 deletions build/config-stubs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
dir=$1; shift
for stubfile in $dir/*/config0.m4 $dir/*/config.m4 $dir/*/config9.m4; do
echo "dnl Define where extension directories are located in the configure context
AC_DEFUN([PHP_EXT_BUILDDIR], [$(dirname $stubfile)])
AC_DEFUN([PHP_EXT_DIR], [$(dirname $stubfile)])
AC_DEFUN([PHP_EXT_SRCDIR], [\$abs_srcdir/$(dirname $stubfile)])
ext_builddir=$(dirname $stubfile)
ext_dir=$(dirname $stubfile)
ext_srcdir=\$abs_srcdir/$(dirname $stubfile)
AC_DEFUN([PHP_EXT_BUILDDIR], [\$ext_builddir])
AC_DEFUN([PHP_EXT_DIR], [\$ext_dir])
AC_DEFUN([PHP_EXT_SRCDIR], [\$ext_srcdir])
sinclude($stubfile)"
done
4 changes: 0 additions & 4 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -936,10 +936,6 @@ dnl substituted.
dnl "cxx" can be used to indicate that a C++ shared module is desired.
dnl "zend_ext" indicates a zend extension.
AC_DEFUN([PHP_NEW_EXTENSION],[
ext_builddir=[]PHP_EXT_BUILDDIR()
ext_srcdir=[]PHP_EXT_SRCDIR()
ext_dir=[]PHP_EXT_DIR()

ifelse($5,,ac_extra=,[ac_extra=$(echo "m4_normalize(m4_expand([$5]))"|$SED s#@ext_srcdir@#$ext_srcdir#g|$SED s#@ext_builddir@#$ext_builddir#g)])

if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
Expand Down
3 changes: 1 addition & 2 deletions ext/hash/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ AS_VAR_IF([ac_cv_c_bigendian_php], [yes], [
AC_DEFINE([HAVE_SLOW_HASH3], [1],
[Define to 1 if the PHP hash extension uses the slow SHA3 algorithm.])
AC_MSG_WARN([Using SHA3 slow implementation on bigendian])
SHA3_DIR=
], [
AC_CHECK_SIZEOF([long])
AC_MSG_CHECKING([if we're at 64-bit platform])
Expand All @@ -32,6 +31,7 @@ AS_VAR_IF([ac_cv_c_bigendian_php], [yes], [
])
EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c"
PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
PHP_ADD_BUILD_DIR([$ext_builddir/$SHA3_DIR])
])

PHP_NEW_EXTENSION([hash], m4_normalize([
Expand Down Expand Up @@ -60,7 +60,6 @@ PHP_NEW_EXTENSION([hash], m4_normalize([
[no],,
[$PHP_HASH_CFLAGS])
PHP_ADD_BUILD_DIR([$ext_builddir/murmur])
AS_VAR_IF([SHA3_DIR],,, [PHP_ADD_BUILD_DIR([$ext_builddir/$SHA3_DIR])])
PHP_INSTALL_HEADERS([ext/hash], m4_normalize([
php_hash_adler32.h
php_hash_crc32.h
Expand Down
26 changes: 11 additions & 15 deletions ext/mbstring/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ AC_DEFUN([PHP_MBSTRING_ADD_BASE_SOURCES], [
PHP_MBSTRING_BASE_SOURCES="$PHP_MBSTRING_BASE_SOURCES $1"
])

AC_DEFUN([PHP_MBSTRING_ADD_BUILD_DIR], [
PHP_MBSTRING_EXTRA_BUILD_DIRS="$PHP_MBSTRING_EXTRA_BUILD_DIRS $1"
])

AC_DEFUN([PHP_MBSTRING_ADD_INCLUDE], [
PHP_MBSTRING_EXTRA_INCLUDES="$PHP_MBSTRING_EXTRA_INCLUDES $1"
])
Expand All @@ -25,10 +21,6 @@ AC_DEFUN([PHP_MBSTRING_EXTENSION], [
[$PHP_MBSTRING_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
PHP_SUBST([MBSTRING_SHARED_LIBADD])

for dir in $PHP_MBSTRING_EXTRA_BUILD_DIRS; do
PHP_ADD_BUILD_DIR([$ext_builddir/$dir], [1])
done

for dir in $PHP_MBSTRING_EXTRA_INCLUDES; do
PHP_ADD_INCLUDE([$ext_srcdir/$dir])
PHP_ADD_INCLUDE([$ext_builddir/$dir])
Expand Down Expand Up @@ -83,14 +75,18 @@ AC_DEFUN([PHP_MBSTRING_SETUP_MBREGEX], [
fi
])

dnl
dnl PHP_MBSTRING_SETUP_LIBMBFL
dnl
dnl Setup the required bundled libmbfl.
dnl
AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [
dnl
dnl Bundled libmbfl is required and can not be disabled
dnl
PHP_MBSTRING_ADD_BUILD_DIR([libmbfl])
PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/mbfl])
PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/filters])
PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/nls])
PHP_ADD_BUILD_DIR([$ext_builddir/libmbfl], [1])
PHP_ADD_BUILD_DIR([
$ext_builddir/libmbfl/filters
$ext_builddir/libmbfl/mbfl
$ext_builddir/libmbfl/nls
])
PHP_MBSTRING_ADD_INCLUDE([libmbfl])
PHP_MBSTRING_ADD_INCLUDE([libmbfl/mbfl])

Expand Down
14 changes: 7 additions & 7 deletions ext/opcache/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ if test "$PHP_OPCACHE" != "no"; then

JIT_CFLAGS="-I@ext_builddir@/jit/ir -D$IR_TARGET -DIR_PHP"
AS_VAR_IF([ZEND_DEBUG], [yes], [JIT_CFLAGS="$JIT_CFLAGS -DIR_DEBUG"])

PHP_ADD_BUILD_DIR([
$ext_builddir/jit
$ext_builddir/jit/ir
])
])

AC_CHECK_FUNCS([mprotect shm_create_largepage])
Expand Down Expand Up @@ -353,12 +358,7 @@ int main(void) {
]))
fi

AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
PHP_ADD_BUILD_DIR([
$ext_builddir/jit
$ext_builddir/jit/ir
])
PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag])
])
AS_VAR_IF([PHP_OPCACHE_JIT], [yes],
[PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag])])
PHP_SUBST([OPCACHE_SHARED_LIBADD])
fi
14 changes: 8 additions & 6 deletions scripts/phpize.m4
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ AC_CONFIG_AUX_DIR([build])
AC_PRESERVE_HELP_ORDER

PHP_CONFIG_NICE([config.nice])
PHP_INIT_BUILD_SYSTEM

AC_DEFUN([PHP_EXT_BUILDDIR],[.])dnl
AC_DEFUN([PHP_EXT_DIR],[""])dnl
AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir])dnl
AC_DEFUN([PHP_ALWAYS_SHARED],[
ext_builddir=.
ext_dir=""
ext_srcdir=$abs_srcdir
AC_DEFUN([PHP_EXT_BUILDDIR], [$ext_builddir])dnl
AC_DEFUN([PHP_EXT_DIR], [$ext_dir])dnl
AC_DEFUN([PHP_EXT_SRCDIR], [$ext_srcdir])dnl
AC_DEFUN([PHP_ALWAYS_SHARED], [
ext_output="yes, shared"
ext_shared=yes
test "[$]$1" = "no" && $1=yes
])dnl

PHP_INIT_BUILD_SYSTEM

PKG_PROG_PKG_CONFIG
AC_PROG_CC([cc gcc])
PHP_DETECT_ICC
Expand Down
Loading