Commit Graph

768 Commits

Author SHA1 Message Date
Peter Kokot
d59691c02f
Autotools: Move php_shtool variable initialization to PHP_INIT_BUILD_SYSTEM (#14904)
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.
2024-07-10 21:15:02 +02:00
Peter Kokot
9e94d2b040
Autotools: Refactor builtin checks (#14835)
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.
2024-07-08 21:25:16 +02:00
Peter Kokot
1f847a0bdf
Check Apache HTTP Server command-line utility (#14173)
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.
2024-07-08 17:15:09 +02:00
Peter Kokot
e9254494ff
Autotools: Simplify POSIX Threads check (#14855)
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.
2024-07-07 22:44:44 +02:00
Peter Kokot
d7ddf83dde
Autotools: Refactor AVX-512 checks (#14831)
* 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
2024-07-05 15:18:26 +02:00
Peter Kokot
ae420538d2
Autotools: Refactor PHP_BROKEN_GCC_STRLEN_OPT (#14824)
- Synced CS
- Cache variable ac_cv_have_broken_gcc_strlen_opt renamed to
  php_cv_have_broken_gcc_strlen_opt
2024-07-05 10:37:49 +02:00
Peter Kokot
dccc911c04
Autotools: Refactor PHP_TIME_R_TYPE check (#14823)
- Synced CS
- Cache variable ac_cv_time_r_type renamed to php_cv_time_r_type
2024-07-05 10:37:28 +02:00
Peter Kokot
94dc2d2bf3
Autotools: Refactor crypt_r style check (#14820)
- Over-quoted arguments reduced
- AS_VAR_IF and CS synced
- CPP macro help texts updated
2024-07-04 20:18:39 +02:00
Peter Kokot
acac365d95
Autotools: Refactor PHP_TEST_WRITE_STDOUT check (#14819)
- AS_VAR_IF, AS_CASE used, CS synced
- Over-quoted argument reduced
- Cache variable ac_cv_write_stdout renamed to php_cv_have_write_stdout
- CPP macro help text updated
2024-07-04 19:32:31 +02:00
Peter Kokot
dc7b67ebc3
Autotools: Sync PHP_ADD_MAKEFILE_FRAGMENT (#14766)
- Macro help text updated for extensions and general usage
- Arguments quoted
- dnl removes redundant newlines in the generated configure script
2024-07-03 13:15:13 +02:00
Benjamin Eberlei
72c874691b
RFC: Add #[\Deprecated] Attribute (#11293)
see https://wiki.php.net/rfc/deprecated_attribute

Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-07-02 09:44:25 +02:00
Peter Kokot
7711bdcfba
Autotools: Quote PHP_SUBST arguments in php.m4 (#14758) 2024-07-02 05:44:02 +02:00
Peter Kokot
72326362d7
Sync PHP_SUBST_OLD (#14746)
- 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
2024-07-01 19:28:20 +02:00
Peter Kokot
212b2834e9
Autotools: Sync indentation style in build system files (#14725) 2024-06-29 23:25:17 +02:00
Peter Kokot
52ed06dc7d
Autotools: Move HAVE_DTRACE and PHP_DTRACE_OBJS to PHP_INIT_DTRACE (#14722)
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.
2024-06-29 19:12:08 +02:00
Peter Kokot
19a9d85d6b
Rely on Autoconf's automatic removal of conftest* files (#14697)
When test programs are finished or when configure script is interrupted,
Autoconf cleans up all conftest* files.
2024-06-28 22:40:38 +02:00
Peter Kokot
2041c133ac
Normalize AC_CHECK_FUNC* first argument (#14700)
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.
2024-06-28 22:40:24 +02:00
Máté Kocsis
a2cecd2a6f
Remove ZEND_STATIC_ASSERT() calls from legacy arginfo files
After report in 5992a29724 (r143540472)
2024-06-27 21:52:27 +02:00
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* 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.
2024-06-26 00:26:43 +02:00
Peter Kokot
4f450b6264
Bump minimum libpq version to 10.0 (#14628)
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
2024-06-25 20:50:04 +02:00
Peter Kokot
f3feef8b93
Define default RE2C_FLAGS (#14615)
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.
2024-06-24 22:09:04 +02:00
Peter Kokot
f4ce50ddfb
Add optional pkg-config support for PostgreSQL library (libpq) (#14540)
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)
2024-06-21 18:35:37 +02:00
Peter Kokot
b12ccb319f
Add PHP_SETUP_ZLIB M4 macro (#14591)
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.
2024-06-21 15:05:34 +02:00
Tim Düsterhus
a1ea464069
gen_stub: Intern the parameter name string for named arguments in internal attributes (#14595)
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.
2024-06-19 08:06:50 +02:00
Máté Kocsis
bed11e4edc
Generate DocBook 5.2 conformant class synopses pages (#14351)
Related to https://github.com/php/doc-en/pull/3415
2024-06-14 22:12:40 +02:00
Peter Kokot
5a03ff4f6c
Remove PHP_SETUP_OPENSSL inactive 3rd argument (#14323)
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.
2024-06-07 23:48:17 +02:00
Máté Kocsis
28cac9434d
Fix registration of readonly classes
Properties of readonly classes should be implicitly marked as readonly.
2024-06-06 09:58:23 +02:00
Peter Kokot
bf845d563e
Use AC_SUBST for CONFIGURE_COMMAND and CONFIGURE_OPTIONS (#14445)
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.
2024-06-03 08:19:26 +02:00
Peter Kokot
cba3891d53
Join SQLite library setup M4 macros to PHP_SETUP_SQLITE (#14372)
Macro can simplify managing minimum version of SQLite library on less
places.
2024-05-30 18:16:30 +02:00
Peter Kokot
471aa1141f
Refactor fopencookie check (#14346)
- 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
2024-05-30 14:56:47 +02:00
Peter Kokot
d8da8d88e0
Remove obsolete Makefile .NOEXPORT target (#13734)
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.
2024-05-30 12:41:12 +02:00
Máté Kocsis
c08535c804
Fix regex for searching for constant lists
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.
2024-05-30 09:46:56 +02:00
Peter Kokot
de0415e705
Remove PROG_SENDMAIL from Makefile (#14355)
PROG_SENDMAIL is not used in the generated Makefile. For the
main/build-defs.h it is substituted automatically with AC_PATH_PROG.
2024-05-30 00:53:07 +02:00
Máté Kocsis
0242577b33
Also check constants in referenced constant lists
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.
2024-05-29 23:50:46 +02:00
Máté Kocsis
cf004ed47e
Fix implicitly nullable type detection in stubs 2024-05-28 21:06:00 +02:00
Valentin Udaltsov
be19e7954d
Fix gen_stub.php errors (#14335) 2024-05-27 22:11:23 +02:00
Peter Kokot
2ab114ebff
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incompatible pointer type warnings
2024-05-24 21:01:06 +02:00
Peter Kokot
a893e40139
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix incompatible pointer type warnings
2024-05-24 21:00:54 +02:00
Peter Kokot
9e226b2881
Fix incompatible pointer type warnings
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.
2024-05-24 20:57:52 +02:00
Máté Kocsis
78f72cffa4
Add support for generating parameter attributes for the manual (#14270) 2024-05-20 21:03:19 +02:00
Peter Kokot
bc09cd2bc8
Fix the aligned variable attribute check (#14211)
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.
2024-05-19 12:18:59 +02:00
Máté Kocsis
f093015a6c
Fix class constant and property ID generation for the manual (#14249)
Related to https://github.com/php/doc-en/pull/3367
2024-05-17 20:30:16 +02:00
Peter Kokot
173f51365d
Update AX_CHECK_COMPILE_FLAG to serial 7 (#14217)
This syncs the file with upstream:
https://github.com/autoconf-archive/autoconf-archive/blob/master/m4/ax_check_compile_flag.m4
2024-05-13 21:15:20 +02:00
Calvin Buckley
25b224d111 Merge branch 'PHP-8.3' 2024-05-10 15:09:26 -03:00
Calvin Buckley
d479ac4856 Merge remote-tracking branch 'origin/PHP-8.2' into PHP-8.3 2024-05-10 15:08:25 -03:00
Calvin Buckley
4e21a26db2
Fix check for newer versions of ICU (#14186)
* 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>
2024-05-10 14:20:17 -03:00
Peter Kokot
a27cdd65f3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13727: Building with -Werror=strict-prototypes (#14029)
2024-04-22 21:23:15 +02:00
Peter Kokot
71aae5a17e
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13727: Building with -Werror=strict-prototypes (#14029)
2024-04-22 21:22:28 +02:00
Peter Kokot
44775b7617
Fix GH-13727: Building with -Werror=strict-prototypes (#14029)
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.
2024-04-22 21:21:40 +02:00
Peter Kokot
f28ddec540
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix erroneous dnl appended in configure (#14013)
2024-04-21 17:23:58 +02:00