Skip to content

Commit 530e0d6

Browse files
authored
Create modules directory in a centralized location (#13411)
Shared objects of extensions during the *nix build are copied to the `modules` directory. It is a practice established since the early days of the PHP build system. Other build systems may have similar concept of "library destination directory". On Windows, they are put into the root build directory. Such directory simplifies collection of the shared extensions during testing, or when running the cli executable at the end of the build process. 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 community extensions. The AC_CONFIG_COMMANDS_PRE is executed at the end of the configuration phase, before creating the config.status script, where also build directories and global Makefile are created. The pwd is executed using the recommended $(...) instead of the obsolete backticks. Autoconf automatically locates the proper shell and re-executes the configure script if such case is found that $(...) is not supported (the initial /bin/sh on Solaris 10, for example).
1 parent 79e4ca1 commit 530e0d6

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

build/php.m4

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ 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(
133+
[dnl Directory for storing shared objects of extensions.
134+
PHP_ADD_BUILD_DIR([modules])
135+
phplibdir="$(pwd)/modules"
136+
PHP_SUBST([phplibdir])
137+
PHP_GEN_BUILD_DIRS
138+
PHP_GEN_GLOBAL_MAKEFILE
139+
])dnl
131140
])
132141

133142
dnl
@@ -136,6 +145,7 @@ dnl
136145
dnl Generates the global makefile.
137146
dnl
138147
AC_DEFUN([PHP_GEN_GLOBAL_MAKEFILE],[
148+
AC_MSG_NOTICE([creating Makefile])
139149
cat >Makefile <<EOF
140150
srcdir = $abs_srcdir
141151
builddir = $abs_builddir
@@ -881,6 +891,7 @@ dnl
881891
dnl PHP_GEN_BUILD_DIRS
882892
dnl
883893
AC_DEFUN([PHP_GEN_BUILD_DIRS],[
894+
AC_MSG_NOTICE([creating build directories])
884895
$php_shtool mkdir -p $BUILD_DIR
885896
])
886897

configure.ac

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,8 +1380,6 @@ case `eval echo $datadir` in
13801380
;;
13811381
esac
13821382

1383-
phplibdir=`pwd`/modules
1384-
$php_shtool mkdir -p $phplibdir
13851383
phptempdir=`pwd`/libs
13861384

13871385
old_exec_prefix=$exec_prefix
@@ -1508,7 +1506,6 @@ PHP_SUBST_OLD(program_suffix)
15081506
PHP_SUBST(includedir)
15091507
PHP_SUBST(libdir)
15101508
PHP_SUBST(mandir)
1511-
PHP_SUBST(phplibdir)
15121509
PHP_SUBST(phptempdir)
15131510
PHP_SUBST(prefix)
15141511
PHP_SUBST(localstatedir)
@@ -1750,9 +1747,6 @@ PHP_ADD_BUILD_DIR(Zend Zend/asm Zend/Optimizer)
17501747
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
17511748
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
17521749

1753-
PHP_GEN_BUILD_DIRS
1754-
PHP_GEN_GLOBAL_MAKEFILE
1755-
17561750
AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
17571751

17581752
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)