Skip to content

Commit 2c65dea

Browse files
committed
Create modules directory in a centralized location
Shared objects of extensions during the build are copied to the `modules` directory. It is a practice established since the early days of the PHP build system. This change ensures that the directory is consistently created in a single location, for both the primary PHP build process and when utilizing `phpize` within extensions. The AC_CONFIG_COMMANDS_PRE is executed before creating the config.status script, where also build directories and global Makefile can be created.
1 parent ec9b68c commit 2c65dea

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

build/php.m4

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[
128128
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
129129
> Makefile.objects
130130
> Makefile.fragments
131+
dnl Run at the end of the configuration, before creating the config.status.
132+
AC_CONFIG_COMMANDS_PRE([dnl
133+
dnl Directory for storing shared objects of extensions.
134+
PHP_ADD_BUILD_DIR([modules])dnl
135+
phplibdir=`pwd`/modules
136+
PHP_SUBST(phplibdir)dnl
137+
dnl Create build directories and generate global Makefile.
138+
PHP_GEN_BUILD_DIRS[]dnl
139+
PHP_GEN_GLOBAL_MAKEFILE[]dnl
140+
])dnl
131141
])
132142

133143
dnl

configure.ac

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,8 +1401,6 @@ case `eval echo $datadir` in
14011401
;;
14021402
esac
14031403

1404-
phplibdir=`pwd`/modules
1405-
$php_shtool mkdir -p $phplibdir
14061404
phptempdir=`pwd`/libs
14071405

14081406
old_exec_prefix=$exec_prefix
@@ -1529,7 +1527,6 @@ PHP_SUBST_OLD(program_suffix)
15291527
PHP_SUBST(includedir)
15301528
PHP_SUBST(libdir)
15311529
PHP_SUBST(mandir)
1532-
PHP_SUBST(phplibdir)
15331530
PHP_SUBST(phptempdir)
15341531
PHP_SUBST(prefix)
15351532
PHP_SUBST(localstatedir)
@@ -1771,9 +1768,6 @@ PHP_ADD_BUILD_DIR(Zend Zend/asm Zend/Optimizer)
17711768
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
17721769
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
17731770

1774-
PHP_GEN_BUILD_DIRS
1775-
PHP_GEN_GLOBAL_MAKEFILE
1776-
17771771
AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
17781772

17791773
dnl Make directories when building in a separate build directory.

scripts/phpize.m4

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ AC_PROG_LIBTOOL
162162

163163
all_targets='$(PHP_MODULES) $(PHP_ZEND_EX)'
164164
install_targets="install-modules install-headers"
165-
phplibdir="`pwd`/modules"
166165
CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
167166
CFLAGS_CLEAN='$(CFLAGS) -D_GNU_SOURCE'
168167
CXXFLAGS_CLEAN='$(CXXFLAGS)'
@@ -188,7 +187,6 @@ PHP_SUBST(prefix)
188187
PHP_SUBST(exec_prefix)
189188
PHP_SUBST(libdir)
190189
PHP_SUBST(prefix)
191-
PHP_SUBST(phplibdir)
192190
PHP_SUBST(phpincludedir)
193191

194192
PHP_SUBST(CC)
@@ -210,11 +208,6 @@ PHP_SUBST(SHELL)
210208
PHP_SUBST(INSTALL_HEADERS)
211209
PHP_SUBST(BUILD_CC)
212210

213-
PHP_GEN_BUILD_DIRS
214-
PHP_GEN_GLOBAL_MAKEFILE
215-
216-
test -d modules || $php_shtool mkdir modules
217-
218211
AC_CONFIG_HEADERS([config.h])
219212

220213
AC_CONFIG_COMMANDS_PRE([PHP_PATCH_CONFIG_HEADERS([config.h.in])])

0 commit comments

Comments
 (0)