Skip to content

Commit 3ac9e5d

Browse files
committed
Create modules directory in a centralized location
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 2e7c6e1 commit 3ac9e5d

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

build/php.m4

+12
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
@@ -136,6 +146,7 @@ dnl
136146
dnl Generates the global makefile.
137147
dnl
138148
AC_DEFUN([PHP_GEN_GLOBAL_MAKEFILE],[
149+
AC_MSG_NOTICE([creating Makefile])
139150
cat >Makefile <<EOF
140151
srcdir = $abs_srcdir
141152
builddir = $abs_builddir
@@ -881,6 +892,7 @@ dnl
881892
dnl PHP_GEN_BUILD_DIRS
882893
dnl
883894
AC_DEFUN([PHP_GEN_BUILD_DIRS],[
895+
AC_MSG_NOTICE([creating build directories])
884896
$php_shtool mkdir -p $BUILD_DIR
885897
])
886898

configure.ac

-6
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

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