Commit Graph

223 Commits

Author SHA1 Message Date
Christoph M. Becker
3815a773a1
Close GH-16659: Bump ICU requirement to ICU >= 57.1
This requirements bump should rarely affect anybody in practice.  All
major distros already ship more recent ICU versions, and even for
Solaris 11, ICU 57.1 is available via OpenCSW.  Note that ICU 57.1 has
been released on 2016-03-23[1].

[1] <https://icu.unicode.org/download/57>

Closes GH-16688.
2024-11-14 01:30:48 +01: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
Peter Kokot
16e218a596
Autotools: Obsolete PHP_TEST_BUILD, PHP_BUILD_THREAD_SAFE, and PHP_DEF_HAVE (#15802)
The PHP_BUILD_THREAD_SAFE macro is a simple wrapper around setting the
enable_zts variable and can't be used in PHP extensions realistically.

The PHP_TEST_BUILD macro might produce warnings on certain compiler
configurations and default AC_* macros like AC_LINK_IFELSE,
AC_CHECK_LIB, or AC_CHECK_FUNC are better suited for such checks. Also,
a quick browse through the open-source PHP extensions doesn't find
usages of this macro except in imap extension where patch is was already
sent:
https://github.com/php/pecl-mail-imap/pull/11

PHP_DEF_HAVE is a wrapper around AC_DEFINE and using AC_DEFINE_UNQUOTED
and AS_TR_CPP are better suited for this task where also help text can
be passed. Usages in the open source PHP extensions have been checked and
patches sent where found.
2024-09-08 21:09:48 +02:00
Peter Kokot
b97a60c9a3
Autotools: Check Apache version with apxs and HTTPD_VERSION variable (#15476)
The apxs -q HTTPD_VERSION variable is available since Apache 2.4.17.
This change obsoletes the PHP_AP_EXTRACT_VERSION macro and checks the
version in the config.m4 file directly. Version is checked against the
dotted format instead of the version number.
2024-09-08 20:13:48 +02:00
Peter Kokot
6d6bf0530a
Autotools: Enable adding a list of paths in PHP_ADD_INCLUDE (#15777)
This enables adding multiple include paths. For example:

    PHP_ADD_INCLUDE([
      $abs_srcdir
      $abs_builddir
      $abs_srcdir/main
      $abs_builddir/main
    ], [1])

The 2nd argument "prepend" is now validated at Autoconf compile time
instead of the configure time.
2024-09-08 06:57:31 +02:00
Peter Kokot
94ecc1fe7d
Autotools: Sync CS for PHP_PWRITE_TEST and PHP_PREAD_TEST (#15774)
- AS_* macros used
- Arguments quoted
- Cache variable ac_cv_pread renamed to php_cv_func_pread
- Cache variables ac_cv_pwrite renamed to php_cv_func_pwrite
2024-09-07 11:53:35 +02:00
Peter Kokot
e0e6d326e2
Autotools: Sync CS in PHP_PROG_AWK (#15772)
- AS_* macros used
2024-09-06 12:10:50 +02:00
Peter Kokot
418329226a
Autotools: Sync CS in php.m4 (#15771)
- AS_* macros used
2024-09-06 09:31:52 +02:00
Peter Kokot
bcbf7bea92
Autotools: Replace uname with host_alias for finding Solaris (#15770)
This wraps checks in AC_CACHE_CHECK and replaces the "uname -sr" command
with simpler $host_alias as it is already set by the config.guess script
properly.
2024-09-06 08:44:10 +02:00
Peter Kokot
aebe63dd0f
Autotools: Sync CS for PHP_RUNPATH_SWITCH (#15768)
- AS_VAR_IF macros used
- AC_CACHE_VAL and AC_MSG_CHECKING replaced with AC_CACHE_CHECK
- arguments quoted
2024-09-06 08:41:09 +02:00
Peter Kokot
035b0c50bc
Autotools: Sync CS in PHP_EVAL_LIBLINE (#15737)
- AS_* macros used
- arguments quoted
- redundant quotation of variable-variable simplified from [$]$2 to $$2
  (see Autoconf documentation)
2024-09-04 23:27:20 +02:00
Peter Kokot
1a126c540a
Autotools: Normalize flags arguments (#15671)
This is a follow up of 7edb9a07d7 that
provides passing compilation options to PHP_NEW_EXTENSION,
PHP_ADD_SOURCES, PHP_ADD_SOURCES_X, and PHP_SELECT_SAPI as a
blank-or-newline-separated argument.
2024-09-01 01:02:40 +02:00
Peter Kokot
75c797492b
Autotools: Replace backticks with $(...) in php.m4 (#15642)
This is a follow-up of GH-15639
2024-08-30 23:32:42 +02:00
Peter Kokot
0a6019a7d6
Autotools: Use SED variable for sed command (#15641)
This syncs sed usages across the build system as SED variable is set to
a suitable sed program on the system.
2024-08-29 23:46:04 +02:00
Peter Kokot
7e1e450bb9
Autotools: Remove redundant double quotes (#15634) 2024-08-29 15:17:03 +02:00
Peter Kokot
7edb9a07d7
Autotools: Normalize 2nd arg in PHP_ADD_SOURCES_X (#15088)
By using `m4_normalize(m4_expand([...]))`, the arguments can be split
into newlines without using backslashes and it makes working with lists
of files a bit easier.

Tested:
- variables inside the argument
- M4 macro expansions
- dnl comments
- any sequence of newlines, backslash-then-newline, multiple spaces,
  tabs...
- quoted/unquoted arguments

This now works for PHP_NEW_EXTENSION, PHP_ADD_SOURCES, PHP_ADD_SOURCES_X,
and PHP_SELECT_SAPI. The m4_normalize() usage is left in the php-src
config.m4 files following the 0a0d2d0631
for PECL extensions until phpize will be available on all supported
versions (minimum PHP 8.4).
2024-08-29 02:40:18 +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
0a0d2d0631
Autotools: Normalize PHP_INSTALL_HEADERS arguments (#15620)
The m4_normalize(m4_expand([...])) simplifies working with a list of
header files. The m4_normalize() is at this point still used in the
php-src config.m4 files because of copy/paste probability to community
extensions where the arguments still need to be done in the old style to
support phpize in PHP-8.3 and earlier. For example:

    PHP_INSTALL_HEADERS([ext/dom], m4_normalize([
      dom_ce.h
      namespace_compat.h
      xml_common.h
      xpath_callbacks.h
    ]))

When PHP 8.4 will be the minimum supported PHP version, the headers can
be installed without using m4_normalize() in PECL extensions. For
example:

    PHP_INSTALL_HEADERS([ext/dom], [
      dom_ce.h
      namespace_compat.h
      xml_common.h
      xpath_callbacks.h
    ])
2024-08-28 23:08:53 +02:00
Peter Kokot
dc8f18af0b
Fix GH-15534: Bump minimum libxml2 version to 2.9.4 (#15536)
The xmlDictPtr was moved before the includes in libxml2 2.9.4 so the
<libxml/dict.h> can be included directly but for earlier versions the
<libxml/tree.h> needs to be included before. Since PHP requires libxml2
2.9.0 or later and this also fixes builds on Solaris 10.

As earlier 2.9.0-2.9.3 libxml2 versions also include several security
issues, this change bumps the required minimum libxml2 version to 2.9.4

On Windows, a check for minimum libxml2 version is also added.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-08-23 23:14:38 +02:00
Peter Kokot
c79e723725
Autotools: Check re2c version with AS_VERSION_COMPARE (#15465)
This simplifies the version check a bit.
2024-08-22 17:39:03 +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
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
Peter Kokot
8853cf3ae9
Autotools: Add note about PHP_ADD_EXTENSION_DEP usage
Until the AWK regex is implemented better, this macro must be called on
its own line with unquoted arguments.

[skip ci]
2024-08-15 16:40:23 +02: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
6cb6cc6f74
Autotools: Refactor iconv implementation checks (#15357)
This uses AS_* macros and checks for an iconv implementation in a single
cache check block for easier configure log output and possible future
adjustments when iconv is built-in the C library (like on Alpine and
some other systems where it isn't recognized as such yet exactly).
2024-08-12 14:43:24 +02:00
Peter Kokot
36f6a20a6b
Autotools: Quote AC_CHECK_PROG* macro arguments
[skip ci]
2024-08-09 10:27:04 +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
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
079f82a8ec
Sync CPP macros in ext/iconv (#15191)
This syncs and adds help texts for CPP macros defined when iconv
extension is configured.
2024-08-02 00:49:18 +02:00
Peter Kokot
1ca3230966
Autotools: Update php.m4 CPP macros help texts (#15188)
- COMPILE_DL_<extension>
- COOKIE_SEEKER_USES_OFF64_T
- HAVE_BROKEN_GETCWD
- HAVE_LIBEXPAT
- HAVE_PREAD
- HAVE_PWRITE
- MISSING_ASCTIME_R_DECL
- MISSING_CTIME_R_DECL
- MISSING_GMTIME_R_DECL
- MISSING_LOCALTIME_R_DECL
- MISSING_STRTOK_R_DECL
- PHP_PREAD_64
- PHP_PWRITE_64
- SIZEOF_<type>
- HAVE_<type>
2024-08-01 10:08:28 +02:00
Peter Kokot
c96f08aa70
Autotools: Normalize PHP_OUTPUT arguments (#15177)
The m4_normalize([$1]) normalizes items into a single-space-separated
list of files to append them to the global PHP_OUTPUT_FILES variable
that is processed by AC_CONFIG_FILES. Redundant newlines are also
removed in the generated configure script.

PHP extensions using phpize can't use this macro so it's safe to change
this.
2024-08-01 00:14:56 +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
9ea290b72b
Sync HAVE_ICONV preprocessor macro usage (#15148)
HAVE_ICONV marks that PHP extension 'iconv' is available, and not only
that iconv library or its functions/headers are available.
2024-07-29 10:12:57 +02:00
Peter Kokot
2b97c84d4c
Autotools: Quote PHP_CHECK_LIBRARY arguments (#15136)
This syncs the quotes across the PHP_CHECK_LIBRARY macro arguments.
2024-07-28 18:39:14 +02:00
Peter Kokot
ae9b9ead7b
Autotools: Sync PHP_EXT_* M4 macros (#15134)
PHP_EXT_DIR, PHP_EXT_BUILDDIR, and PHP_EXT_SRCDIR macros don't accept
the argument since 82b73fd1e3.
2024-07-28 10:11:01 +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
32210ce967
Autotools: Sync CS in XML related extensions (#15110)
- PHP_SETUP_LIBXML arguments quoted
- Help texts updated for HAVE_LIBXML, HAVE_DOM, HAVE_XMLREADER,
  HAVE_XMLWRITER, HAVE_SOAP, HAVE_SIMPLEXML, and HAVE_XML CPP macros
- Duplicate HAVE_LIBXML symbol definition in PHP_SETUP_LIBXML M4 macro
  removed (the HAVE_LIBXML marks that PHP libxml extension is available and
  not only that libxml2 library is available)
2024-07-27 22:48:51 +02:00
Peter Kokot
003e238436
Autotools: Quote and fix PHP_SELECT_SAPI arguments (#15118)
This macro once had also the 5th argument (the build target), which was
removed via 2a6da0f24c. This quotes all
PHP_SELECT_SAPI arguments and removes the redundant ones. The basic
macro usage help text is moved to the macros section from the obsolete
docs file.
2024-07-27 22:46:36 +02:00
Peter Kokot
0c0da80a2a
Autotools: Replace PHP_DEF_HAVE with AC_DEFINE_UNQUTED (#15119)
The PHP_DEF_HAVE M4 macro is a simple wrapper around the recommended
AC_DEFINE or AC_DEFINE_UNQUOTED (when shell variables are used in
arguments). This also adds some basic help texts to macros.
2024-07-27 11:25:50 +02:00
Peter Kokot
c53b272f67
Autotools: Quote AC_CHECK_LIB arguments (#15116)
This syncs CS for AC_CHECK_LIB where possible, and adds minor help texts
to gettext extension AC_DEFINE symbols, including the HAVE_LIBINTL.
2024-07-27 11:18:52 +02:00
Peter Kokot
6e57550f14
Autotools: Normalize DTrace sources argument (#15111)
Using the m4_normalize, the source files can be added more intuitively
using blank-or-newline delimited list of files. This adds also some
basic help text.
2024-07-26 23:30:20 +02:00
Peter Kokot
ff4b99e260
Autotools: Quote PHP_ADD_LIB* arguments (#15112)
Following previous CS syncs, this quotes arguments in PHP_ADD_LIB* M4
macros:
- PHP_ADD_LIBRARY
- PHP_ADD_LIBRARY_WITH_PATH
- PHP_ADD_LIBPATH
2024-07-26 23:26:55 +02:00
Peter Kokot
68ae477796
Autotools: Quote M4 arguments (#15033)
- PHP_ADD_INCLUDE
- PHP_EVAL_INCLINE
- PHP_EVAL_LIBLINE
2024-07-20 07:21:44 +02:00
Peter Kokot
6857c7c8d6
Autotools: Expand m4_normalize sooner (#15018)
Quoted m4_normalize will expand and change its argument later in the
macro call when M4 is processing the *.m4 sources. Without quotes the
already normalized string is passed to the macro directly. In these
specific cases generated configure script is the same. This is more for
consistency to have this synced and not repeat the pattern too much
in the future when copy/pasting. Note, that many AC_* macros require
similar behavior already (for example, AC_CHECK_FUNCS.)
2024-07-19 15:20:04 +02:00
Peter Kokot
cf1835b8b6
Autotools: Fix Autoconf syntax (erroneous dnl) (#14987)
M4 interprets the dnl in this combination of m4_ifnblank as part of the
preceding text so the [] can be used to avoid this issue.
2024-07-17 15:47:20 +02:00