1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

688 Commits

Author SHA1 Message Date
Calvin Buckley
13b83a46cf Bump libtool to serial 63 from 2.5.4 (#21067)
The libtool 1.5.26 is bundled with PHP since the very early days of the
Autotools build system to ease the building process and avoid additional
dependency on the system Libtool. This updates the bundled libtool to
2.5.4 version.

Fixes and implementations:

- Fixed race conditions when building PHP in parallel ("cannot create
  .libs" warnings).
- Implements request https://bugs.php.net/70374 (Update libtool.m4)
- Fixes libtool eating -flto flags.
- Fixes GH-17310 (configure producing errors on macOS)
- Fixes GH-15946 (./configure error when building with NixOS)

Changes:
- Add a script to update autotools files.
- libtool is spread across multiple files; phpize is updated to handle
  this.
- Remove outdated hacks, i.e. for `ar`.
- Remove documentation references to external libtool, as we vendor it.
- `--with-pic` is now `--enable-pic`. Error out on the old flag.
- On macOS linker now uses -undefined dynamic_lookup flag for shared
  extensions and shared embed SAPI (libphp) instead of older
  '-undefined suppress -flat_namespace' combination.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2026-03-11 12:37:56 -03:00
Peter Kokot
4fbe41116b Enable all warnings for re2c (#19051)
This helps noticing issues like GH-17204 and GH-17523 sooner.
2026-02-13 17:43:35 +01:00
Peter Kokot
8032d6fa16 Autotools: Check struct stat.st_blocks with AC_CHECK_MEMBERS (#13562)
The AC_STRUCT_ST_BLOCKS expects fileblocks object to be compiled with
AC_LIBOBJ if stat.st_blocks is missing on the system. This can be
simplified with the usual AC_CHECK_MEMBERS since PHP is using the
stat.st_blocks (and stat.st_blksize) conditionally.

These members are mostly present on all POSIX-based systems except on
Windows these days.

This also removes the obsolete HAVE_ST_BLOCKS symbol:
https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/types.m4?h=v2.72#n1055

Additionally, the st_blksize and st_blocks members are checked
conditionally with HAVE_ preprocessor macros. Instead of filtering
Windows specifically here, the preprocessor macros
HAVE_STRUCT_STAT_ST_BLKSIZE and HAVE_STRUCT_STAT_ST_BLOCKS can be used.
2026-02-10 19:59:10 +01:00
Peter Kokot
4b723900c3 Update minimum required PHP version in Autotools build system (#20933)
At the time of writing, PHP found on host system must be at least 8.0
for build/gen_stub.php and Zend/zend_vm_gen.php scripts to work.

Minimum required version is updated to 8.1 to still support building PHP
from source on any possible old systems, and enabling new features in
build/gen_stub.php, such as readonly properties.
2026-02-10 16:12:30 +01:00
Gina Peter Banyard
668606816f Zend: move class autoloading from SPL to Zend (#21001)
The primary motivation for this change is that this sort of functionality should reside in core and not in an extension.
The reason being is that this causes issues in regard to extension dependencies and resolution,
something that prevents GH-14544.
2026-01-28 01:57:30 +00:00
Peter Kokot
3b67680609 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix cross-compilation for musl C library
2025-10-03 00:59:22 +02:00
DubbleClick
2b8d8ba7c4 Fix cross-compilation for musl C library
This adds a PHP_C_STANDARD_LIBRARY Autoconf macro to detect glibc/musl
more accurately and fixes "cross-compilation" with musl-libc on glibc
systems.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>

Closes GH-19352
2025-10-03 00:58:44 +02:00
Daniel Scherzer
a4c712c379 master is now for PHP 8.6.0-dev 2025-09-23 14:59:55 -04:00
David Carlier
2a96af743e fix build warnings for Haiku.
especially linker warning about php binary having an executable stack.

cloe GH-19575
2025-09-06 14:06:10 +01:00
Danack
17d4002977 Check if the macro AC_PROG_CC_C99 actually made the compiler accept C99 code. (#6317) 2025-08-31 08:42:55 +02:00
Peter Kokot
a4d39f9713 Fix missing strnlen symbol on Solaris 10 (#19109)
- On Solaris, strnlen was implemented on Solaris 11.
- In Autotools, strnlen can be also checked in Zend scope as
  HAVE_STRNLEN is used only there.
2025-07-14 23:07:04 +02:00
Peter Kokot
d154c7253e Autoconf: Move getlogin check for HAVE_GETLOGIN to ext/posix (#19058)
This check is related only to ext/posix so it's more clear to have it
defined when ext/posix is enabled.
2025-07-07 17:43:36 +02:00
Peter Kokot
8a75b3c50c Remove conditional checks for ssize_t type (#18996)
The ssize_t type is already used unconditionally in php-src code
everywhere except the main/s{n,p}printf.c files. On Windows ssize_t is
available as an alias to the SSIZE_T defined in BaseTsd.h (available in
affected files through the included windows.h in zend_config.w32.h).

This also makes the Autoconf macro PHP_CHECK_SIZEOF obsolete in favor of
the AC_CHECK_SIZEOF, which is more convenient to check for types without
the need to run the test program - omitting the cross-compilation
issues. AC_CHECK_SIZEOF once didn't provide including additional headers
(resolved in Autoconf versions after 2.13).
2025-07-02 01:45:40 +02:00
Peter Kokot
93e3aca5fa Remove HAVE_INTMAX_T and SIZEOF_INTMAX_T (#18971)
The intmax_t is a C99 standard type defined in `<stdint.h>` and widely
available on current platforms. On Windows they are available as of
Visual Studio 2013. Using it conditionally as in these occurrences is
not needed anymore.
2025-06-29 19:50:27 +02:00
Niels Dossche
8d116a4ba1 Implement GH-15483: Use C23 memset_explicit() for ZEND_SECURE_ZERO() if available (#18713) 2025-06-29 14:29:28 +02:00
Peter Kokot
fffe642d67 Remove HAVE_PTRDIFF_T and SIZEOF_PTRDIFF_T (#18968)
The ptrdiff_t is a C89 standard type defined in `<stddef.h>` and widely
available on current platforms. Using it conditionally as in these
occurrences is not needed anymore.
2025-06-28 20:16:12 +02:00
Remi Collet
6820a4de23 Fix GH-18579: --libdir option default value
Using PHP_LIBDIR for lib64 case
2025-06-04 11:56:12 +02:00
Calvin Buckley
76791e90b9 Use win32 glob implementation on all platforms (#18164)
* Move glob to main/ from win32/

In preparation to make the Win32 reimplementation the standard
cross-platform one. Currently, it doesn't do that and just passes
through the original glob implementation. We could consider also having
an option to use the standard glob for systems that have a sufficient
one.

* Enable building with win32 glob on non-windows

Kind of broken. We're namespacing the function and struct, but not yet
the GLOB_* defines. There are a lot of places callers check if i.e.
NOMATCH is defined that would likely become redundant.

Currently it also has php_glob and #defines glob php_glob (etc.) - I
suspect doing the opposite and changing the callers would make more
sense, just doing MVP to geet it to build (even if it fails tests).

* Massive first pass at conversion to internal glob

Have not tested yet. the big things are:

- Should be invisible to userland PHP code.
- A lot of :%s/GLOB_/PHP_GLOB_/g; the diff can be noisy as a result,
  especially in comments.
- Prefixes everything with PHP_ to avoid conflicts with system glob in
  case it gets included transitively.
- A lot of weird shared definitions that were sprawled out to other
  headers are now included in php_glob.h.
- A lot of (but not yet all cases) of HAVE_GLOB are removed, since we
  can always fall back to php_glob.
- Using the system glob is not wired up yet; it'll need more shim
  ifdefs for each flag type than just glob_t/glob/globfree defs.

* Fix inclusion of GLOB_ONLYDIR

This is a GNU extension, but we don't need to implement it, as the GNU
implementation is flawed enough that callers have to manually filter it
anyways; just provide a stub definition for the constant.

We could consideer implementing this properly later. For now, fixes the
basic glob constant tests.

* Remove HAVE_GLOBs

We now always have a glob implementation that works. HAVE_GLOB should
only be used to check if we have a system implementation, for if we
decide to wrap the system implementation instead.

* We don't need to care about being POSIXly correct for internal glob

* Check for reallocarray

Ideally temporary until GH-17433.

* Forgot to move this file from win32/ to main/

* Check for issetugid (BSD function)

* Allow using the system glob with --enable-system-glob

* Style fix after removing ifdef

* Remove empty case for system glob
2025-05-20 16:20:59 -03:00
Christoph M. Becker
836a162089 Don't fiddle with NDEBUG in C code (GH-16511)
* Don't fiddle with NDEBUG in C code

It is way to late to do this in php.h, since assert.h has already been
included.  Even pushing that down to zend_portability.h may not have
the desired effect.  Instead we define or undefine NDEBUG as CFLAG, so
that it works in all circumstances.

As a last resort we fail at build time, if `NDEBUG` is defined when
`ZEND_DEBUG` is enabled.

We also remove the useless workaround in zend_test to include assert.h
again, since that usually won't have any effect anyway.

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2024-10-27 18:20:59 +01:00
Saki Takamachi
7bd0bcadaa Prepare for PHP 8.4 2024-09-25 00:03:39 +09:00
Peter Kokot
796eba65e7 Autotools: Fix CS in undefined sanitizer check (#15892)
To prevent possible unused warnings turning into false errors.
2024-09-15 15:52:37 +02:00
Peter Kokot
ea4e8d513c Autotools: Check copy_file_range with AC_COMPILE_IFELSE (#15858)
Running the test program is not required as compilation step already
errors out if needed.
2024-09-12 20:56:56 +02:00
Arnaud Le Blanc
c21899a9f0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Do not remove -O0 in the middle of a flag
  Fix removal of optimization cflags in debug builds (#9647)
2024-09-12 13:12:51 +02:00
Arnaud Le Blanc
be1bf3f35e Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Do not remove -O0 in the middle of a flag
  Fix removal of optimization cflags in debug builds (#9647)
2024-09-12 13:11:49 +02:00
Arnaud Le Blanc
c639614346 Do not remove -O0 in the middle of a flag
Fixes GH-15826
Closes GH-15828

Co-authored-by: Peter Kokot <petk@php.net>
2024-09-12 13:08:54 +02:00
Arnaud Le Blanc
60c2687712 Fix removal of optimization cflags in debug builds (#9647)
Discard known '-O' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
2024-09-12 13:08:44 +02:00
Pierrick Charron
7e722e3ba4 PHP-8.2 is now for PHP 8.2.25-dev 2024-09-10 15:26:28 -04:00
Eric Mann
bb2b7df9dc PHP-8.3 is now for PHP 8.3.13-dev 2024-09-10 06:38:48 -07:00
Peter Kokot
6cd0e50845 Autotools: Document the EXTENSION_DIR environment variable (#15743) 2024-09-04 23:25:50 +02:00
Peter Kokot
db9a7aaf05 Autotools: Sync CS in configure.ac (#15706)
This further replaces more raw shell usages with AS_* macros.
2024-09-02 19:00:58 +02:00
Peter Kokot
8699da6f33 Autotools: Document PHP environment build configuration vars (#15684)
This marks the following environment variables as precious:

- PHP_BUILD_ARCH
- PHP_BUILD_COMPILER
- PHP_BUILD_PROVIDER
- PHP_BUILD_SYSTEM
- PHP_UNAME

Meaning, they are now also shown in the `./configure --help` output, and
they can be used like this when configuring the PHP build:

    ./configure PHP_BUILD_ARCH="..." PHP_BUILD_COMPILER="..."  ...
2024-09-01 23:57:33 +02:00
Arnaud Le Blanc
58aa6fc830 Lazy objects
RFC: https://wiki.php.net/rfc/lazy-objects

Closes GH-15019
2024-08-30 17:30:03 +02:00
Peter Kokot
1b757c8d3c Autotools: Replace backticks command substitutions with $(...) (#15639)
This is a follow-up of previous backticks replacement commits. This
replaces backticks command substitutions in remaining ext config M4
files, phpize, and configure.ac with the recommended $(...).

Note that $(...) still does not work on some obsolete shells that ship
with Solaris 10, for example. Elsewhere they should work. However, for
these obsolete shells Autoconf also re-executes the shell script under
the supported shell so it can make them work regardless.

Additionally, few comments CS are also adjusted to not cause confusion
when searching for backticks usages and one indentation sync done.

As of Autoconf 2.72 the backticks in macro help texts are also replaced
with single quotes.
2024-08-30 00:40:49 +02:00
Peter Kokot
fbacc0f936 Autotools: Normalize PHP_ADD_BUILD_DIR 1st argument (#15612)
The m4_normalize(m4_expand([$1])) expands the given argument if it
contains M4 macros, and then trims the items together into a space
separated string in an intuitive way.
2024-08-29 00:44:29 +02:00
Peter Kokot
3f4028d3d9 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15587: Autotools: fix configure check for aarch64 CRC32 API
2024-08-25 18:02:25 +02:00
Peter Kokot
5c44610093 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15587: Autotools: fix configure check for aarch64 CRC32 API
2024-08-25 18:01:33 +02:00
Bernd Kuhls
5947db6bb8 Fix GH-15587: Autotools: fix configure check for aarch64 CRC32 API
On arm32 bit the check succeeds leading to a build error later on:

/home/autobuild/autobuild/instance-3/output-1/build/php-8.3.10/ext/standard/crc32.c:70:12:
 error: 'armv8-a' does not support feature 'nothing'
   70 | #   pragma GCC target ("+nothing+crc")

Co-authored-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[http://lists.busybox.net/pipermail/buildroot/2024-August/761151.html]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
2024-08-25 18:00:29 +02:00
Peter Kokot
babf18c52e Autotools: Remove obsolete compiler reset (#15549)
This was once added via 827ad656cb to
store the compiler variable when being modified due to using libtool
passing pthread_cflags to linker.
2024-08-23 16:54:21 +02:00
Peter Kokot
1b3c204033 Autotools: Add min-version argument to PHP_PROG_PHP macro (#15477)
This makes a bit simpler to use this macro by optionally passing the
required minimum PHP version. If version is not passed it falls back
to 7.4 as before. Minimum version also added to configure.ac.
2024-08-22 17:30:08 +02:00
Peter Kokot
4e193b4113 Autotools: Move abs_srcdir and abs_builddir to init macro (#15537)
This syncs the abs_srcdir and abs_builddir variables assignments between
the php-src build and phpize. The `&&` was picked over `;` as it is more
rigorous - the pwd command would fail if cd fails for some reason.
2024-08-22 16:26:48 +02:00
Peter Kokot
e7874f2089 Autotools: Move Zend/zend_config.h to AC_CONFIG_COMMANDS (#15538)
Instead of creating Zend/zend_config.h header file in an initialization
argument of "default" commands, this creates it in its own wrapper
when config.status is called.
2024-08-22 16:26:28 +02:00
Peter Kokot
602a4ac735 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug GH-15514 (Configure error: genif.sh: syntax error)

Autotools: Refactor main/internal_functions commands

This wraps generation of main/internal_functions* files into a separate
AC_CONFIG_COMMANDS and uses a SHELL variable instead of sh command.
Autoconf sets the SHELL variable to a suitable current shell the
configure is running in.

Instead of putting the commands into the 2nd argument the 3rd
initialization argument is used like before because it is easier to read
and work with variables (AWK, EXT_STATIC and EXT_CLI_STATIC), which
would need to be assigned again for the 2nd argument.

This simplifies the configure usage on Solaris 10 C shell and KornShell
without issuing errors when executing genif.sh script.
2024-08-21 18:20:42 +02:00
Peter Kokot
d5b5e61d80 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug GH-15514 (Configure error: genif.sh: syntax error)
2024-08-21 18:17:58 +02:00
Peter Kokot
48a18e5be7 Fix bug GH-15514 (Configure error: genif.sh: syntax error)
Autoconf assigns the current suitable shell to SHELL variable. This
notably fixes cases on Solaris 10 when using C shell or KornShell where
genif.sh: syntax error at line 35 occurs due to using the `sh` command.
2024-08-21 18:16:07 +02:00
Peter Kokot
c69d29ebc3 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15515: Configure error grep illegal option q (#15516)
2024-08-21 15:57:33 +02:00
Peter Kokot
9e63e20a2c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15515: Configure error grep illegal option q (#15516)
2024-08-21 15:54:56 +02:00
Peter Kokot
63841ba7cf Fix GH-15515: Configure error grep illegal option q (#15516)
On Solaris default grep doesn't support the -q option. In such cases
the grep output can be redirected to /dev/null and the exit status is
checked.
2024-08-21 15:51:27 +02:00
Peter Kokot
40217b2ea4 Autotools: Move auto_cflags marker to PHP_INIT_BUILD_SYSTEM (#15487)
The "hacky" auto_cflags variable is otherwise set only for the Oracle
Developer Studio compiler (which is at this point also non-usable) and
perhaps might be removed in the future but this is for now moved to the
PHP_INIT_BUILD_SYSTEM for consistent settings between the php-src build
and phpize.

The PHP_INIT_BUILD_SYSTEM is now also called sooner in phpize to match
the php-src build.
2024-08-19 22:29:20 +02:00
Peter Kokot
dffe25bd19 Autotools: Move AWK finder to PHP_INIT_BUILD_SYSTEM (#15478)
This calls the PHP_PROG_AWK from a single place for php-src build and
phpize.
2024-08-18 13:30:03 +02:00
Jakub Zelenka
0b61b8dc99 PHP-8.3 is now for PHP-8.3.12-dev 2024-08-13 20:16:40 +01:00