Normalization include:
- Use dnl for everything that can be ommitted when configure is built in
favor of the shell comment character # which is visible in the output.
- Line length normalized to 80 columns
- Dots for most of the one line sentences
- Macro definitions include similar pattern header comments now
TSRM configuration header file was once created by separate autoconf
build system for TSRM and is with the current code not directly needed
like this anymore.
Add --enable-werror configure option and use it on Travis. It's not
possible to directly use CFLAGS, because it also affects configure
checks which often throw warnings.
We can't enable something similar for Windows builds at this time,
because they throw a lot more warnings.
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
There is now only a single M4 macro in the legacy acinclude.m4 file. A
separate acinclude file was once used with a standalone Zend engine
building but with current build system this can be simplified a bit.
The substitution is already done in the CLI's config.m4 file. Current
SAPIs only provide one PHP_EXECUTABLE variable, i.e. PHP CLI so the one
in the configure.ac can be removed.
The `<loccale.h>` header file, setlocale, and localeconv are part of the
standard C89 [1] and on current systems can be used unconditionally.
Since PHP 7.4 requires at least C89 or greater, the `HAVE_LOCALE_H`,
`HAVE_SETLOCALE`, and `HAVE_LOCALECONV` symbols defined by Autoconf in
configure.ac [2] can be ommitted and simplifed.
The bundled libmagic (file) has also been patched already in version
5.35 and up in upstream location so when it will be patched also in
php-src the check for locale.h header is still left in the configure.ac
and in windows headers definition file.
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.4
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
Omit the bundled libmagic files
Since Autoconf 2.53 the AC_INIT call with only a single argument has
been made obsolete and now includes several other optional arguments to
make installation experience a bit better by providing program version
and links to the project in the `./configure -h` output. This patch also
updates win build version. The phpize.m4 AC_INIT has been updated with
the call without arguments.
This patch joins two very much related pieces of docs together in a
single file dedicated to all sorts of contributing info.
Some more changes:
- Branches info copied from the current master branch
- LXR and bonsai info removed
- Duplicated info reduced a bit
- Security branch updated to 7.1
- Refactor intro for Git commit rules
- Updated README.GIT-RULES file usage in win32/build/confutils.js
- Refactored configure.ac
This patch refactors these macros to also checks for the required given
versions of bison and re2c.
- PHP_PROG_RE2C and PHP_PROG_BISON take optional args - minmimum version
required, and bison also excluded versions.
- Instead of caching values this uses manual checking and messaging
outputs.
- It looks like the minimum version of RE2C 0.13.4 is working ok so far.
The genfiles script improvements:
- Add make override in genfiles
- Move checkings from makedist to genfiles
- Refactored output messages
- Various minor enhancements
RPM specification file was introduced via
7c2f1384d4 for PHP to include official
RPM packages long time agon. With removal of the makerpm script via
3d51d4c90c and Linux repositories to
manage such updated and customized info in their repositories this file
is most likely not needed anymore.
- AC_CHECK_SIZEOF is now called mostly only in PHP_CHECK_STDINT_TYPES()
macro except for some parts checking for the 32 or 64 bit architecture.
- SIZEOF_CHAR removed since it is always 1
- ZEND_BIN_ID is now of a more logical pattern `BIN_48888` on 64bit
architectures and `BIN_44444` on 32bit instead of literal string
`BIN_SIZEOF_CHAR48888` on 64bit and `BIN_SIZEOF_CHAR44444` on 32bit.
The unneeded SIZEOF_CHAR part has been removed.
- XMLRPC_TYPE_CHECKS removed
- The `long long int` is the same as `long long` and redundant checks
removed accordingly.
- Removed PHP_CHECK_64BIT macro. Checking if current platform is 64bit
or not can be also done simply by using a check of the long type on
place. This removes redundant m4 macro PHP_CHECK_64BIT.
Changes:
- AC_TYPE_SIZE_T called on only one place (configure.ac)
- AC_FUNC_ALLOCA called on only one place (configure.ac)
- AC_TYPE_UID_T called on only one place (configure.ac)
- HAVE_STRSTR removed since strstr is part of C89 standard [1]
- Remove checks for strtol and strpbrk
- Checking for the presence of perror function is not needed anymore
since it is part of C89 standard and PHP calls it unconditionally.
- Checking for functions strdup, setenv, strerror, and memmove done only
on one place (configure.ac)
- outdated check for snprintf removed
1: https://port70.net/~nsz/c/c89/c89-draft.html
Function strftime is part of the C89 standard [1] and current systems
don't need to check for its presence anymore.
Additionally, checks for strftime function in tests have been removed
since the PHP strftime function is now always available.
1: https://port70.net/~nsz/c/c89/c89-draft.html
- remove some outdated and not used macro calls
- remove some unused variables
- Remove not needed comment from tokenizer config.m4
- Remove not needed comment
- remove not needed local variables for editors and syntax highlighting
The AC_CHECK_TYPE was refactored in more recent versions of Autoconf
and the call with two arguments is obsolete and not recommended anymore.
This patch also refactors some leftovers of using ulong and uint which
are not standard nor common usages of types in C.
The ulong can be used as zend_ulong and uint usage is actually
`unsigned int`.
The usage of HAVE_ULONG removed since it is not used in current code
base.
Legacy edgecase for some legacy HPUX systems removed:
- sys/stream.h header is not checked and the HAVE_SYS_STREAM_H is
not defined with current build system.
- flags are unsigned int
- max_allowed_packet changed to unsigned int
Changes:
- PHP_TM_GMTOFF removed
- HAVE_TM_GMTOFF replaced with HAVE_STRUCT_TM_TM_GMTOFF
- HAVE_TM_ZONE replaced with HAVE_STRUCT_TM_TM_ZONE
- HAVE_TZNAME removed
The PHP_TM_GMTOFF macro can be replaced with Autoconf's AC_CHECK_MEMBERS
that defines the HAVE_STRUCT_TM_TM_GMTOFF symbol instead of the
HAVE_TM_ZONE.
The HAVE_TZNAME symbol is not used in current code. The obsolete
HAVE_TM_ZONE symbol has been replaced with more proper
HAVE_STRUCT_TM_TM_ZONE. These are defined by the AC_STRUCT_TIMEZONE
macro.
The AC_PROG_CC_C_O macro checks if compiler can use both -c and -o
options together and if not it defines the NO_MINUS_C_MINUS_O symbol.
It is not used in current codebase and therefore removed.
Autoconf 2.59d (released in 2006) [1] started promoting several macros
as not relevant for newer systems anymore, including the `AC_HEADER_STDC`.
This macro checks if given system has C89 compliant header files such
as `<string.h>`, `<stdlib.h>`, `<stdarg.h>`, `<float.h>`,... and defines
the `STDC_HEADERS` symbol [2]. Case is that current systems should be
well supported with at least C89 standard headers [3].
Given headers are still additionally checked with the `AC_PROG_CC`
macro, yet not needed anyway.
Additionally, the HAVE_MEMCPY check has been removed. The memcpy
function is standardized by C89 and later.
Refs:
[1] http://git.savannah.gnu.org/cgit/autoconf.git/tree/NEWS
[2] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/autoconf.html
[3] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
The snprintf function is part of the C99 standard and newer systems in
most cases all support it as defined in the standard. However, some old
Windows and HP-UX systems the function behaves differently. These checks
were also removed and PHP now uses a replacement for the snprintf
function. With gradual transition to C99 usage as a minimum requirement,
it will also be able to be replaced to system's snprintf function
directly.
Additionally in this context the unused HAVE_VSNPRINTF and check for
vsnprintf have been removed. PHP uses its own vsnprintf implementation
for now until more reliable C99 compliant function can be used from the
C libraries.
The sprintf function has been normalized to php_sprintf via
61364b5bb1.
This patch removes the checks to make a custom sprintf function
The ZEND_BROKEN_SPRINTF has been removed and the
hardcoded #define zend_sprintf sprintf is used.
The php_sprintf and zend_sprintf are now symbols to sprintf.
This patch now removes the custom PHP definitions of the php_sprintf and
zend_sprintf functions in favor of the C99 sprintf which is also
standardized in C89 already. Once, on some systems sprintf didn't behave
in same way.
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.
A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.
This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.
With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.
Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files. All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
The Autoconf macro AC_CONFIG_AUX_DIR can set the location of the
auxiliary build tools such as config.guess, config.sub, and bundled
libtool scripts and moves these bundled files from the root directory
to the build subdirectory.
Additionally some changes in this context or as a part of obsoletion:
- The LT_TARGETS variable in build/build2.mk file was once used as a part
of the Automake step. It's not used anymore and has been refactored to
separate makedist script directly.
- ltconfig is not used anymore since libtool 1.4+
cf8d1563c2
- phpize file locations for the config.guess, config.sub, and ltmain.sh
has been refactored accordingly.
The Automake and aclocal were part of the previous PHP build system
where Automake created Makefile from the Makefile.in templates and
aclocal was used to produce the aclocal.m4. They were removed as
dependencies via 9d9d39a0de and
e715fb00f8.
The `pear/scripts`, `pear/php-config`, `pear/phpize`, and
`pear/run-tests` used to be part of the PEAR installation. Now, the
pear installation PHAR file is directly downloaded from pear.php.net
instead.