]> granicus.if.org Git - php/commitdiff
Move acinclude.m4 to build/php.m4
authorPeter Kokot <peterkokot@gmail.com>
Tue, 12 Mar 2019 23:25:07 +0000 (00:25 +0100)
committerPeter Kokot <peterkokot@gmail.com>
Tue, 23 Apr 2019 18:28:45 +0000 (20:28 +0200)
The acinclude.m4 file is in a usual Autotools build processed with
Automake's aclocal tool. Since PHP currently doesn't use Automake and
aclocal this file can be moved into the build directory. PHP build
system currently generates a combined aclocal.m4 file that Autoconf
can processes automatically.

However, a newer practice is writing all local macros in separate
dedicated files prefixed with package name, in PHP's case PHP_MACRO_NAME
and putting them in a common `m4` directory. PHP uses currently `build`
directory for this purpose.

Name `php.m4` probably most resembles such file for PHP's case.

PHP manually created the aclocal.m4 file from acinclude.m4 and
build/libtool.m4. Which is also not a particularly good practice [1], so
this patch also removes the generated alocal.m4 usage and uses
m4_include() calls manually in the configure.ac and phpize.m4 files
manually.

- sort order is not important but can be alphabetical
- list of *.m4 files prerequisites for configure script generation
  updated
- Moving m4_include() before AC_INIT also removes all comments starting
  with hash character (`#`) in the included files.

[1] https://autotools.io/autoconf/macros.html

.gitignore
build/build.mk
build/php.m4 [moved from acinclude.m4 with 99% similarity]
buildconf
configure.ac
docs/unix-build-system.md
scripts/Makefile.frag
scripts/phpize.in
scripts/phpize.m4

index 52ab256ba3000d3c014524a912bb195dbc98ad0d..d0aa3b394a9d0657389138be1112828e16427975 100644 (file)
@@ -38,9 +38,6 @@
 # Standard object files generated during build process
 *.o
 
-# Generated by `./buildconf` or `phpize`
-aclocal.m4
-
 # Cache directories generated by Autoconf tools - autoconf, autoreconf...
 autom4te.cache/
 
@@ -174,7 +171,6 @@ php
 # ------------------------------------------------------------------------------
 # Extensions files additionally generated by `cd ext/name && phpize && ./configure`
 # ------------------------------------------------------------------------------
-/ext/*/acinclude.m4
 /ext/*/build/
 /ext/*/configure.ac
 /ext/*/run-tests.php
index 46cb0c3360ab88f09ee853b5a472bdd070e8313b..2e261b7824f0b789b76c20da1c6cde338dd1c3d4 100644 (file)
@@ -30,15 +30,11 @@ all: $(stamp) configure $(config_h_in)
 $(stamp): build/buildcheck.sh
        @build/buildcheck.sh $@
 
-configure: aclocal.m4 configure.ac $(PHP_M4_FILES)
+configure: configure.ac $(PHP_M4_FILES)
        @echo rebuilding $@
        @rm -f $@
        @$(PHP_AUTOCONF) $(PHP_AUTOCONF_FLAGS)
 
-aclocal.m4: configure.ac acinclude.m4
-       @echo rebuilding $@
-       @cat acinclude.m4 ./build/libtool.m4 > $@
-
 $(config_h_in): configure
 # Explicitly remove target since autoheader does not seem to work correctly
 # otherwise (timestamps are not updated). Also disable PACKAGE_* symbols in the
similarity index 99%
rename from acinclude.m4
rename to build/php.m4
index 6987056185e05c0f47cbccdc059777fbc0190eb1..dbc8c88006b3551818f505b6805f2be74c7d0eaf 100644 (file)
@@ -2751,13 +2751,3 @@ int main() {
   AC_DEFINE_UNQUOTED(AS_TR_CPP([PHP_HAVE_$1_INSTRUCTIONS]),
    [$have_ext_instructions], [Whether the compiler supports $1 instructions])
 ])
-
-dnl Load the AX_CHECK_COMPILE_FLAG macro from the autoconf archive.
-m4_include([build/ax_check_compile_flag.m4])
-
-m4_include([build/ax_gcc_func_attribute.m4])
-
-m4_include([build/php_cxx_compile_stdcxx.m4])
-
-dnl Load pkg-config macros
-m4_include([build/pkg.m4])
index 6e644df4b80546c72da26fd6b62b3b4bfe17a7c2..4c0fe37a7e41ebd00c89f63a266bbcf3b8f9f658 100755 (executable)
--- a/buildconf
+++ b/buildconf
@@ -27,12 +27,12 @@ while test $# -gt 0; do
 PHP buildconf
 
 A wrapper around the autoconf and autoheader that generate files for building
-PHP on *nix systems (configure, main/php_config.h.in, aclocal.m4...). The
-configure script is used to customize the PHP build based on the provided
-options and system. PHP releases downloaded from PHP.net already include the
-configure script so installing Autoconf and running buildconf is not needed. For
-the PHP sources from the Git repository, buildconf is used for generating a new
-configure script and required files.
+PHP on *nix systems (configure and main/php_config.h.in). The configure script
+is used to customize the PHP build based on the provided options and system. PHP
+releases downloaded from PHP.net already include the configure script so
+installing Autoconf and running buildconf is not needed. For the PHP sources
+from the Git repository, buildconf is used for generating a new configure script
+and required files.
 
 SYNOPSIS:
   buildconf [<options>]
@@ -103,4 +103,4 @@ $MAKE -s -f build/build.mk \
   PHP_AUTOCONF="$PHP_AUTOCONF" \
   PHP_AUTOHEADER="$PHP_AUTOHEADER" \
   PHP_AUTOCONF_FLAGS="$autoconf_flags" \
-  PHP_M4_FILES="$(echo TSRM/*.m4 Zend/Zend.m4 ext/*/config*.m4 sapi/*/config*.m4)"
+  PHP_M4_FILES="$(echo TSRM/*.m4 Zend/Zend.m4 build/*.m4 ext/*/config*.m4 sapi/*/config*.m4)"
index ec3f28c768107ca2d319e7b4714ca15685245c14..43a4fa959345304e4e836b53c7a6577d52afff0c 100644 (file)
@@ -1,5 +1,15 @@
 dnl ## Process this file with autoconf to produce a configure script.
 
+dnl Include external macro definitions before the AC_INIT to also remove
+dnl comments starting with # and empty newlines from the included files.
+dnl -------------------------------------------------------------------------
+m4_include([build/ax_check_compile_flag.m4])
+m4_include([build/ax_gcc_func_attribute.m4])
+m4_include([build/libtool.m4])
+m4_include([build/php_cxx_compile_stdcxx.m4])
+m4_include([build/php.m4])
+m4_include([build/pkg.m4])
+
 dnl Basic autoconf initialization, generation of config.nice.
 dnl -------------------------------------------------------------------------
 
index bdb8d4d146d5f8191bee32efcc91b93d0e3635fc..c576b5e07566c150ba66f6f673430e75a3d2f56a 100644 (file)
@@ -53,7 +53,7 @@ The full syntax:
 PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]])
 ```
 
-Please have a look at `acinclude.m4` for the gory details and meanings of the
+Please have a look at `build/php.m4` for the gory details and meanings of the
 other parameters.
 
 And that's basically it for the extension side.
@@ -118,4 +118,4 @@ contexts. With the help of macros you can define special flags for each
 source-file, where it is located, in which target context it can work, etc.
 
 Have a look at the well documented macros `PHP_ADD_SOURCES(_X)` in
-`acinclude.m4`.
+`build/php.m4`.
index db8ff60c06dba7f407f24c39367ea54366d7d20f..bfbac62ab3dd3013cd7d1fa104c369982a25b852 100644 (file)
@@ -14,7 +14,7 @@ BUILD_FILES = \
        build/php_cxx_compile_stdcxx.m4 \
        build/pkg.m4 \
        build/Makefile.global \
-       acinclude.m4 \
+       build/php.m4 \
        run-tests.php
 
 BUILD_FILES_EXEC = \
index ccb93575744df926648429f57f68208d5c6bc0a0..7a10a369bf8e1e838f6fdcfc21587e7bf69448df 100644 (file)
@@ -9,11 +9,11 @@ includedir="`eval echo @includedir@`/php"
 builddir="`pwd`"
 SED="@SED@"
 
-FILES_BUILD="shtool libtool.m4 ax_check_compile_flag.m4 ax_gcc_func_attribute.m4 php_cxx_compile_stdcxx.m4 pkg.m4 config.guess config.sub ltmain.sh Makefile.global"
-FILES="acinclude.m4 run-tests*.php"
+FILES_BUILD="php.m4 shtool libtool.m4 ax_check_compile_flag.m4 ax_gcc_func_attribute.m4 php_cxx_compile_stdcxx.m4 pkg.m4 config.guess config.sub ltmain.sh Makefile.global"
+FILES="run-tests*.php"
 CLEAN_FILES="$FILES *.o *.lo *.la .libs/ build/ modules/ \
        config.nice configure configure.ac \
-       aclocal.m4 config.h config.h.in conftest* libtool config.cache autom4te.cache/ \
+       config.h config.h.in conftest* libtool config.cache autom4te.cache/ \
        config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h \
        run-tests*.php tests/*.diff tests/*.exp tests/*.log tests/*.out tests/*.php"
 
@@ -146,7 +146,6 @@ phpize_copy_files()
 
   (cd "$phpdir" && cp $FILES_BUILD "$builddir"/build)
   (cd "$phpdir" && cp $FILES "$builddir")
-  (cd "$builddir" && cat acinclude.m4 ./build/libtool.m4 > aclocal.m4)
 }
 
 phpize_replace_prefix()
index d3b471b5cd3abef0d59e0411f9da47e1b1964182..61af6c2b74f90f5840c7c10c59777682e583cfdf 100644 (file)
@@ -1,5 +1,14 @@
 dnl This file becomes configure.ac for self-contained extensions.
 
+dnl Include external macro definitions before the AC_INIT to also remove
+dnl comments starting with # and empty newlines from the included files.
+m4_include([build/ax_check_compile_flag.m4])
+m4_include([build/ax_gcc_func_attribute.m4])
+m4_include([build/libtool.m4])
+m4_include([build/php_cxx_compile_stdcxx.m4])
+m4_include([build/php.m4])
+m4_include([build/pkg.m4])
+
 AC_PREREQ([2.68])
 AC_INIT
 AC_CONFIG_SRCDIR([config.m4])