As this script is still needed across the PHP build system its path can
be also set on once place for both phpize usage and regular php-src's
configure.ac.
This creates a single M4 macro PHP_CHECK_BUILTIN and removes other
PHP_CHECK_BUILTIN_* macros. Checks are wrapped in AC_CACHE_CHECK and
PHP_HAVE_BUILTIN_* CPP macro definitions are defined to 1 if builtin
is found and undefined if not.
This also changes all PHP_HAVE_BUILTIN_ symbols to be either undefined
or defined (to value 1) and syncs all #if/ifdef/defined usages of them
in the php-src code. This way it is simpler to use them because they
don't need to be defined to value 0 on Windows, for example. This is
done as previous usages in php-src were mixed and on many places they
were only checked with ifdef.
The Apache HTTP server command-line tool (/usr/sbin/apache2) might be
part of a separate package, such as apache2-bin or similar. If not
installed, the configure script can still find the apxs tool, but
previously didn't check for the HTTP server tool separately. Otherwise,
configure syntax errors (integer expression expected) are thrown when
checking for the Apache version.
The PTHREADS_CHECK is using cache variables so it is run only once early
during the configuration phase, before including SAPI and other M4
files. This removes the TSRM_CHECK_PTHREADS macro and moves the POSIX
Threads check after the PHP_THREAD_SAFETY variable is set in
configure.ac.
The check and error throw in PHP_BUILD_THREAD_SAFE is also joing into
this single check.
This removes the redundant tsrm.m4 file and PHP_CONFIGURE_PART call for
TSRM as it doesn't run any configuration checks anymore.
* Autotools: Refactor AVX-512 checks
- CS synced
- checks wrapped in AC_CACHE_CHECK
- CPP macros PHP_HAVE_AVX512_SUPPORTS and PHP_HAVE_AVX512_VBMI_SUPPORTS
are now either defined to 1 or undefined to avoid manual defining on
Windows (previously they should be either 0 or 1)
* [skip ci] Add basic macros help texts
- All arguments quoted
- PHP_VERSION, PHP_VERSION_ID, PHP_LDFLAGS are used only in templates
with @...@ placeholders
- These are not used in generated Makefile neither in templates:
abs_builddir, abs_srcdir, DEBUG_CFLAGS
- These are used only in generated Makefile: EXTRA_LDFLAGS,
EXTRA_LDFLAGS_PROGRAM, ZEND_EXTRA_LIBS, INCLUDES, EXTRA_INCLUDES,
INSTALL_IT, NATIVE_RPATHS
The sys/sdt.h is required header when using DTrace, HAVE_DTRACE can be
defined together when initializing and PHP_DTRACE_OBJS can be
substituted to simplify the macro usage a bit further.
The m4_normalize is for Autoconf < 2.70 (on 2.70 and later versions a
blank-or-newline separated items can be expanded without using
backslash-newline).
This also syncs the 1st argument quotes.
* Include from build dir first
This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.
Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :
-I$(top_builddir)/main
-I$(top_srcdir)
-I$(top_builddir)/TSRM
-I$(top_builddir)/Zend
-I$(top_srcdir)/main
-I$(top_srcdir)/Zend
-I$(top_srcdir)/TSRM
-I$(top_builddir)/
As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.
After this change, the include path is defined as follows:
-I$(top_builddir)/main
-I$(top_builddir)
-I$(top_srcdir)/main
-I$(top_srcdir)
-I$(top_builddir)/TSRM
-I$(top_builddir)/Zend
-I$(top_srcdir)/Zend
-I$(top_srcdir)/TSRM
* Fix extension include path for out of tree builds
* Include config.h with the brackets form
`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.
Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
This bumps the libpq client-side PostgreSQL library minimum required
version from 9.1 to 10.0.
- Sanity check: PQlibVersion -> PQencryptPasswordConn (available since
libpq 10.0)
- PQsetErrorContextVisibility (available since libpq 9.6)
- lo_truncate64 (available since libpq 9.3), if 32-bit system doesn't
support lo_*64 functions, error is returned and functions are always
available
Additionally, the conditional functions usages in pdo_pgsql and pgsql
extensions that got piled up are cleaned and synced:
- pg_prepare (PQprepare available since libpq 7.4)
- pg_query_params (PQexecParams available since libpq 7.4)
- pg_result_error_field (PQresultErrorField available since libpq 7.4)
- pg_send_prepare (PQsendPrepare available since libpq 7.4)
- pg_send_query_params (PQsendQueryParams available since libpq 7.4)
- pg_set_error_verbosity (PQsetErrorVerbosity available since libpq 7.4)
- pg_transaction_status (PQtransactionStatus available since libpq 7.4)
The Windows libpq version is currently at version 11.4:
https://github.com/winlibs/postgresql
Discussion: https://news-web.php.net/php.internals/123609
Follow-up of GH-14540
The --no-generation-date flag is a common re2c flag used in all re2c
invocations. This adds the 2nd optional argument to PHP_PROG_RE2C M4
macro in BC manner to set the default re2c command-line options and sets
the default RE2C_FLAGS similarly on Windows.
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find client PostgreSQL library
libpq on the system with pkg-config. If not found, check falls back to
pg_config to find the libpq and its headers in common locations as
before.
The PGSQL_CFLAGS and PGSQL_LIBS environment variables can override the
libpq installation paths:
./configure --with-pgsql --with-pdo-pgsql \
PGSQL_CFLAGS=-I/path/to/libpq \
PGSQL_LIBS="-L/path/to/libpq -lpq"
Passing manual, non-standard PostgreSQL installation path can be done
with configure option arguments:
./configure \
--with-pgsql=/any/path/to/postgresql \
--with-pdo-postgresql=/any/path/to/postgresql
If this DIR argument (PostgreSQL installation directory or path to the
pg_config) is passed, it takes precedence over the pkg-config, when
installed on the system.
This also removes the unused HAVE_LIBPQ symbol and passing the
PGSQL_INCLUDE and PGSQL_LIBDIR environment variable to configure in
favor of PGSQL_CFLAGS and PGSQL_LIBS.
Instead of the obsolete backticks the recommended $(...) is used when
invoking the pg_config.
Follow-up of GH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
This enables the zlib library (https://zlib.net/) from a single place to
match the minimum required version across the php-src. This provides a
possible simpler version bump in the future. Macro's 2nd and 3rd
arguments can pass additional actions whether zlib library is found or
not for the possible future adjustments in the ext/standard where also
zlib might be required.
Support for pkg-config was introduced in 1.2.3.1.
The minimum zlib version has been bumped to 1.2.3.1
* Bump minimum zlib version to 1.2.11
This is aligned with CentOS 8, which has 1.2.11 in the default packages.
* [skip ci] Move zlib version change to UPGRADING
This matches the OpenSSL style version change notice already done in
this file.
This is necessary because `zend_get_attribute_object()` will use the persistent
string with the parameter name as the index for a newly created non-persistent
HashTable, which is not legal.
As parameter names are expected to be short-ish, reasonably common terms and
need to sit around in memory anyways, we might as well make them an interned
string, circumstepping the issue without needing to duplicate the parameter
name into a non-persistent string.
If OpenSSL is not found, the PKG_CHECK_MODULES errors out already. To
not introduce too big of a BC break with possible PECL extensions using
this macro, it is perhaps simpler to remove this non-working argument.
Redundant macro arguments are ignored by Autoconf anyway.
Instead of the PHP_SUBST_OLD, which also adds redundant variables to the
generated Makefile, these two can be done with AC_SUBST to be
substituted in the generated main/build-defs.h header and
scripts/php-config script.
- This checks for a type cookie_io_functions_t and defines the
HAVE_FOPENCOOKIE based on type check result and the fopencookie()
function presence.
- Fixed -Wunused... warnings in config.log on stricter compiler
configurations
- The run check for off64_t is wrapped into AC_CACHE_CHECK for having
the php_cv_type_cookie_off64_t cache variable available to customize
possible cross-compilation edge cases
- Comment about glibcs 2.1.2 removed because also some other earlier
versions provided this type already
This was once used on GNU Make from versions 3.59 to 3.63 (released in
1994) to not export all variables, otherwise a system limit may be
exceeded. This was the case for the obsolete UNIX System V (SysV) and is
on current systems not applicable anymore, with such target ignored.
0242577b33 partly fixed the detection of external constant lists referenced on Predefined Constants pages, but changing the file search regex is needed too in order to fully fix the underlying issue in case of cURL constants.
Some constants are extracted from Predefined Constants pages (e.g. https://github.com/php/doc-en/pull/3413), which should alsobe checked when verifying the manual.
This fixes the incompatible pointer type warnings when checking for
reentrant functions declaractions (-Wincompatible-pointer-types) in
config.log. These were not declared on some obsolete systems if
_REENTRANT was not defined. The check is for now left in the code base
but can be transitioned to newer code without checking for missing
declarations or using these otherwise in the future.
Closes GH-14315.
By default compilers may not treat attribute warnings as errors when
encountering an unknown __attribute__, unless some error option is
provided (-Werror=attributes, -Werror=unknown-attributes, -Werror...).
This fixes the check and wraps it into a separate M4 macro to be
extendable in the future if needed. It checks if conftest.err file was
generated by the compilation check when warnings appear. Also, PHP check
is a bit customized by using __alignof__ keyword, so it is left in there
for now to not break existing checks.
* Fix check for newer versions of ICU
The previous test would always trigger, even if the version of ICU
installed didn't require C++17. This was because it incorrectly used
the `test` program, which broke the build on systems without a C++17
compiler.
Tested with macOS 14 and i 7.2.
* Fix broken ICU version check for definition
Same as the previous fix for C++17.
---------
Co-authored-by: Peter Kokot <peterkokot@gmail.com>
This is addon to the GH-13727 bug fix. When configuring the build with:
./configure CFLAGS=-Werror=strict-prototypes
libtool check for parsing nm command would fail:
checking command to parse /usr/bin/nm -B output from cc object... failed
Upstream libtool has this specific check already fixed. Note that this
works only with Autoconf version 2.72 and later and is preparation for
future compilers that might have this error enabled by default.