Commit Graph

670 Commits

Author SHA1 Message Date
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
Sergey Panteleev
84d8fa9f53
PHP-8.2 is now for PHP 8.2.24-dev 2024-08-13 17:18:16 +03:00
Peter Kokot
540b9f5bc7
Autotools: Wrap long texts with m4_text_wrap (#15368)
The m4_text_wrap macro wraps the text into a single space separated
string which is wrapped to not exceed the line lenght of 79 characters
by default.
2024-08-13 10:33:17 +02:00
Peter Kokot
1108710892
Autotools: Sync CS across the configure.ac (#15332)
- AS_* macros used where it makes it easier to read
- Redundant double quotes removed (Autoconf and shell script don't need
  these on these places directly)
- Overquoted arguments reduced in AC_RUN_IFELSE
2024-08-10 22:13:50 +02:00
Peter Kokot
2b30b22d7d
Autotools: Quote PHP_CHECK_SIZEOF macro arguments
[skip ci]
2024-08-10 16:01:22 +02:00
Peter Kokot
a355c3572e
Update and sync PHP build preprocessor macros help texts (#15298)
[skip ci]
2024-08-08 21:31:57 +02:00
Peter Kokot
84e1920c12
Autotools: Add phpized configure log and help separators (#15251)
- This quotes all PHP_CONFIGURE_PART arguments
- When configuring and building extensions with phpize, this makes the
  './configure --help' and './configure' log output a bit more readable
  as it separates the extension configuration, Libtool configuration and
  the rest of the Autoconf and phpize configuration options.
- The ./configure output separators bold tags are moved to the
  PHP_INIT_BUILD_SYSTEM macro to be available also in phpized extensions
- The obsolete ticks `...` converted to the recommended $(...); Autoconf
  configure re-executes itself in shells where the $(...) still wouldn't
  work ok. For example, the default, initial, non-updated shell on
  Solaris 10.
- Empty new lines in help separators synced (Autoconf default separators
  don't include additional empty newline after the separator title);
  so the PHP_HELP_SEPARATOR additional empty line is also removed
  (see './configure --help' output)
2024-08-06 22:15:22 +02:00
Peter Kokot
62f75a7812
Autotools: Refactor thread safety checks (#15214)
- The ZTS is defined on only one place
- Added help text for ZTS preprocessor macro
- The 'enable_zts' variable replaced with PHP_THREAD_SAFETY in
  configure.ac.
- Nits fixed.
2024-08-05 22:30:10 +02:00
Peter Kokot
18a99a4d33
Autotools: Refactor debug checks (#15215)
- Added help text for ZEND_DEBUG preprocessor macro
- CS synced
2024-08-04 21:59:58 +02:00
Peter Kokot
dcdcb3cbfe
Autotools: Replace AC_MSG_ERROR with AC_MSG_FAILURE (#15209)
This replaces the AC_MSG_ERROR with AC_MSG_FAILURE, where appropriate.

The AC_MSG_ERROR outputs given message and exits the configure step. The
AC_MSG_FAILURE does the same but also automatically outputs additional
message "See 'config.log' for more details." which might help directing
the user where to look further.

The AC_MSG_ERROR is used for errors where current test step isn't logged
in the config.log and wouldn't make sense, and AC_MSG_FAILURE is mostly
used in cases of library checks, compilation tests, headers checked with
AC_CHECK_HEADER* and similar tests that are also logged in the
config.log.

AC_MSG_ERROR([Sanity check failed.]) output:

```
configure: error: Sanity check failed.
```

AC_MSG_FAILURE([Sanity check failed.]) output:

```
configure: error: in '/path/to/php-src':
configure: error: Sanity check failed.
See 'config.log' for more details
```
2024-08-04 07:36:37 +02:00
Peter Kokot
4f07cdc584
Replace PHP_OUTPUT with AC_CONFIG_FILES (#15186)
This is a follow-up of GH-15177
(c96f08aa70)
and GH-15185
(9467ffb43c)

The PHP_OUTPUT macro was introduced in the very early phase of the build
system due to AC_OUTPUT handling issues in the old Autoconf versions
before the AC_CONFIG_FILES, AC_CONFIG_COMMANDS etc were introduced with
the AC_OUTPUT signature without arguments. The PHP_OUTPUT was also
helping Makefile.in back then being properly generated based on whether
all files were generated or only some (when using the obsolete
CONFIG_FILES=... ./config.status invocation instead of the new
./config.status --file=...). Another issue is that PHP_OUTPUT can't be
used by extensions when using phpize.

This replaces the PHP_OUTPUT invocations with default AC_CONFIG_FILES.

The obsolete "REDO_ALL" feature at the config.status invocation is also
removed with a simpler unconditional generation.

In phar extension the "ext/phar" is replaced with $ext_dir variable to
be able to use phpize.
2024-08-03 21:52:14 +02:00
Peter Kokot
4993453933
Autotools: Update configure.ac CPP macros help texts (#15189)
- __MUSL__
- DEFAULT_SHORT_OPEN_TAG
- HAVE_BUILD_DEFS_H
- HAVE_GCOV
- HAVE_LIBDL
- PHP_RTLD_NOW
- PHP_SIGCHILD
- ZEND_FIBER_UCONTEXT
2024-08-02 01:14:48 +02:00
Peter Kokot
49a08d5ca3
Autotools: Move HAVE_DTRACE to configure.ac (#15160)
Following 32210ce967 and
9ea290b72b, this moves the HAVE_DTRACE
preprocessor macro definition back to configure.ac so that
PHP_INIT_DTRACE Autoconf macro can be used in extensions without
redefinition interference.
2024-07-30 07:47:11 +02:00
Peter Kokot
575efc0617
Autotools: Quote PHP_ADD_SOURCES* macros arguments (#15146)
- A redundant shell quoted flags argument replaced with Autoconf quotes
  (the PHP_ADD_SOURCES macro already adds the necessary shell quotes
  characters where needed)
- CS synced
2024-07-29 10:08:48 +02:00
Peter Kokot
9cc63e1de9
Autotools: Normalize headers arguments (#15149)
Refactor all "long" arguments into blank-or-newline-separated list of
files with m4_normalize.
2024-07-29 10:08:17 +02:00
Peter Kokot
21e01f3e70
Autotools: Simplify PHP_ALWAYS_SHARED macro (#15129)
Instead of defining an empty M4 macro PHP_ALWAYS_SHARED when configuring
extensions in php-src using the main configure.ac, the m4_ifdef can be
used to conditionally call the macro when it is defined (when using
phpize).
2024-07-28 01:33:05 +02:00
Peter Kokot
0d36701b32
Autotools: Remove dead code (#15128)
This is a left over from 4dee0c4a14.

These definitions are now always done by the config-stubs file. For
phpize builds they are in the phpize.m4 as before.
2024-07-28 01:30:15 +02:00
Peter Kokot
ef8e792962
Autotools: Quote M4 macro arguments
- AC_CHECK_TYPES
- AC_REPLACE_FUNCS
- PHP_HELP_SEPARATOR needs here double quotes as content contains '['
  and ']' characters
2024-07-27 11:22:28 +02:00
Peter Kokot
a7f0fe1f33
Autotools: Quote macro arguments
- PHP_EXPAND_PATH
- PHP_LIBGCC_LIBPATH
- PHP_OUTPUT
- PHP_REMOVE_USR_LIB
2024-07-27 05:26:32 +02:00