From 65a8a7c3b8b04c89a441e731f5fc1594f7b1c0e6 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Mon, 17 Jun 2024 14:04:58 +0200 Subject: [PATCH 1/4] Add PHP_SETUP_ZLIB M4 macro 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. --- build/php.m4 | 14 ++++++++++++++ ext/gd/config.m4 | 9 +-------- ext/mysqlnd/config.w32 | 2 +- ext/mysqlnd/config9.m4 | 11 ++++------- ext/zlib/config.w32 | 2 +- ext/zlib/config0.m4 | 16 +++++++--------- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/build/php.m4 b/build/php.m4 index 0b1ba242547a1..9e1dd3de7ef5f 100644 --- a/build/php.m4 +++ b/build/php.m4 @@ -1929,6 +1929,20 @@ PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.7.7], [ ]) ]) +dnl +dnl PHP_SETUP_ZLIB(shared-add [, action-found, [action-not-found]]) +dnl +dnl Common setup macro for zlib library. If zlib is not found on the system, the +dnl default error by PKG_CHECK_MODULES is emitted, unless the action-not-found +dnl is given. +dnl +AC_DEFUN([PHP_SETUP_ZLIB], [dnl +PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0.4], [dnl + PHP_EVAL_INCLINE([$ZLIB_CFLAGS]) + PHP_EVAL_LIBLINE([$ZLIB_LIBS], [$1]) + $2], [$3])dnl +]) + dnl ---------------------------------------------------------------------------- dnl Misc. macros dnl ---------------------------------------------------------------------------- diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index 5c1c7a867c2f8..2830bfaf125ec 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -65,13 +65,6 @@ dnl dnl Checks for the configure options dnl -dnl zlib is always required -AC_DEFUN([PHP_GD_ZLIB],[ - PKG_CHECK_MODULES([ZLIB], [zlib]) - PHP_EVAL_LIBLINE($ZLIB_LIBS, GD_SHARED_LIBADD) - PHP_EVAL_INCLINE($ZLIB_CFLAGS) -]) - dnl libpng is always required AC_DEFUN([PHP_GD_PNG],[ PKG_CHECK_MODULES([PNG], [libpng]) @@ -224,7 +217,7 @@ dnl These are always available with bundled library AC_DEFINE(HAVE_GD_TGA, 1, [ ]) dnl Various checks for GD features - PHP_GD_ZLIB + PHP_SETUP_ZLIB([GD_SHARED_LIBADD]) PHP_GD_PNG PHP_GD_AVIF PHP_GD_WEBP diff --git a/ext/mysqlnd/config.w32 b/ext/mysqlnd/config.w32 index 5f191297d1196..f5efa999df150 100644 --- a/ext/mysqlnd/config.w32 +++ b/ext/mysqlnd/config.w32 @@ -34,7 +34,7 @@ if (PHP_MYSQLND != "no") { CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects) ) { - AC_DEFINE("MYSQLND_COMPRESSION_ENABLED", 1, "Compression support"); + AC_DEFINE("MYSQLND_COMPRESSION_ENABLED", 1, "Define to 1 if mysqlnd has compressed protocol support."); AC_DEFINE("MYSQLND_SSL_SUPPORTED", 1, "SSL support"); if (CHECK_LIB("crypt32.lib", "mysqlnd")) { AC_DEFINE("MYSQLND_HAVE_SSL", 1, "Extended SSL support"); diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4 index 93f5b8f992b38..8b0d64cffb2f4 100644 --- a/ext/mysqlnd/config9.m4 +++ b/ext/mysqlnd/config9.m4 @@ -31,13 +31,10 @@ if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes"; then mysqlnd_result.c mysqlnd_result_meta.c mysqlnd_debug.c mysqlnd_commands.c \ mysqlnd_block_alloc.c mysqlnd_read_buffer.c mysqlnd_plugin.c php_mysqlnd.c" - - if test "$PHP_MYSQLND_COMPRESSION_SUPPORT" != "no"; then - PKG_CHECK_MODULES([ZLIB], [zlib]) - PHP_EVAL_LIBLINE($ZLIB_LIBS, MYSQLND_SHARED_LIBADD) - PHP_EVAL_INCLINE($ZLIB_CFLAGS) - AC_DEFINE([MYSQLND_COMPRESSION_ENABLED], 1, [Enable compressed protocol support]) - fi + AS_VAR_IF([PHP_MYSQLND_COMPRESSION_SUPPORT], [no],, + [PHP_SETUP_ZLIB([MYSQLND_SHARED_LIBADD], + [AC_DEFINE([MYSQLND_COMPRESSION_ENABLED], [1], + [Define to 1 if mysqlnd has compressed protocol support.])])]) AC_DEFINE([MYSQLND_SSL_SUPPORTED], 1, [Enable core mysqlnd SSL code]) diff --git a/ext/zlib/config.w32 b/ext/zlib/config.w32 index 70bd1a74fab4f..80b7bb1766810 100644 --- a/ext/zlib/config.w32 +++ b/ext/zlib/config.w32 @@ -7,7 +7,7 @@ if (PHP_ZLIB == "yes") { CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects)) { EXTENSION("zlib", "zlib.c zlib_fopen_wrapper.c zlib_filter.c", PHP_ZLIB_SHARED, "/D ZLIB_EXPORTS /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); - AC_DEFINE("HAVE_ZLIB", 1, "ZLIB support"); + AC_DEFINE("HAVE_ZLIB", 1, "Define to 1 if zlib extension is available."); if (!PHP_ZLIB_SHARED) { ADD_DEF_FILE("ext\\zlib\\php_zlib.def"); diff --git a/ext/zlib/config0.m4 b/ext/zlib/config0.m4 index 0d60700565601..6138cb9debbb0 100644 --- a/ext/zlib/config0.m4 +++ b/ext/zlib/config0.m4 @@ -4,13 +4,11 @@ PHP_ARG_WITH([zlib], [Include ZLIB support (requires zlib >= 1.2.0.4)])]) if test "$PHP_ZLIB" != "no"; then - PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0.4]) - - PHP_EVAL_LIBLINE($ZLIB_LIBS, ZLIB_SHARED_LIBADD) - PHP_EVAL_INCLINE($ZLIB_CFLAGS) - - AC_DEFINE(HAVE_ZLIB,1,[ ]) - - PHP_NEW_EXTENSION(zlib, zlib.c zlib_fopen_wrapper.c zlib_filter.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) - PHP_SUBST(ZLIB_SHARED_LIBADD) + PHP_SETUP_ZLIB([ZLIB_SHARED_LIBADD], [dnl + AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if zlib extension is available.]) + PHP_NEW_EXTENSION([zlib], + [zlib.c zlib_fopen_wrapper.c zlib_filter.c], + [$ext_shared],, + [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1]) + PHP_SUBST([ZLIB_SHARED_LIBADD])]) fi From e5c9c43ef5ef0ee0bb20b8956e9bea3f4fbf2557 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Mon, 17 Jun 2024 14:35:08 +0200 Subject: [PATCH 2/4] Bump minimum zlib version to 1.2.3.1 Support for pkg-config was introduced in 1.2.3.1. --- UPGRADING.INTERNALS | 1 + build/php.m4 | 2 +- ext/zlib/config0.m4 | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 10e4ac250b281..27b1ef87c561f 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -142,6 +142,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES - PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path directory anymore. - M4 macro PHP_SETUP_OPENSSL doesn't accept the 3rd argument anymore. + - Minimum required zlib library version is 1.2.3.1. c. Windows build system changes - The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19 have diff --git a/build/php.m4 b/build/php.m4 index 9e1dd3de7ef5f..a888f7116014b 100644 --- a/build/php.m4 +++ b/build/php.m4 @@ -1937,7 +1937,7 @@ dnl default error by PKG_CHECK_MODULES is emitted, unless the action-not-found dnl is given. dnl AC_DEFUN([PHP_SETUP_ZLIB], [dnl -PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0.4], [dnl +PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3.1], [dnl PHP_EVAL_INCLINE([$ZLIB_CFLAGS]) PHP_EVAL_LIBLINE([$ZLIB_LIBS], [$1]) $2], [$3])dnl diff --git a/ext/zlib/config0.m4 b/ext/zlib/config0.m4 index 6138cb9debbb0..04949a4355bf2 100644 --- a/ext/zlib/config0.m4 +++ b/ext/zlib/config0.m4 @@ -1,7 +1,7 @@ PHP_ARG_WITH([zlib], [for ZLIB support], [AS_HELP_STRING([--with-zlib], - [Include ZLIB support (requires zlib >= 1.2.0.4)])]) + [Include ZLIB support (requires zlib library)])]) if test "$PHP_ZLIB" != "no"; then PHP_SETUP_ZLIB([ZLIB_SHARED_LIBADD], [dnl From 0696992045314c40459fe64bfed2fec9f14bbcca Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Mon, 17 Jun 2024 18:49:38 +0200 Subject: [PATCH 3/4] Bump minimum zlib version to 1.2.11 This is aligned with CentOS 8, which has 1.2.11 in the default packages. --- UPGRADING.INTERNALS | 2 +- build/php.m4 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 27b1ef87c561f..39182b61db6a2 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -142,7 +142,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES - PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path directory anymore. - M4 macro PHP_SETUP_OPENSSL doesn't accept the 3rd argument anymore. - - Minimum required zlib library version is 1.2.3.1. + - Minimum required zlib library version is 1.2.11. c. Windows build system changes - The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19 have diff --git a/build/php.m4 b/build/php.m4 index a888f7116014b..22b7f73528810 100644 --- a/build/php.m4 +++ b/build/php.m4 @@ -1937,7 +1937,7 @@ dnl default error by PKG_CHECK_MODULES is emitted, unless the action-not-found dnl is given. dnl AC_DEFUN([PHP_SETUP_ZLIB], [dnl -PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3.1], [dnl +PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.11], [dnl PHP_EVAL_INCLINE([$ZLIB_CFLAGS]) PHP_EVAL_LIBLINE([$ZLIB_LIBS], [$1]) $2], [$3])dnl From 435cd6c9b312b23b790ccd8be33877f451be064f Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Wed, 19 Jun 2024 23:05:03 +0200 Subject: [PATCH 4/4] [skip ci] Move zlib version change to UPGRADING This matches the OpenSSL style version change notice already done in this file. --- UPGRADING | 3 +++ UPGRADING.INTERNALS | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/UPGRADING b/UPGRADING index 0df93a766aab9..bc843b512ca00 100644 --- a/UPGRADING +++ b/UPGRADING @@ -662,6 +662,9 @@ PHP 8.4 UPGRADE NOTES . The typed properties XSLTProcessor::$cloneDocument and XSLTProcessor::$doXInclude are now declared. +- zlib: + . The zlib extension now requires at least zlib 1.2.11. + ======================================== 10. New Global Constants ======================================== diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 39182b61db6a2..10e4ac250b281 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -142,7 +142,6 @@ PHP 8.4 INTERNALS UPGRADE NOTES - PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path directory anymore. - M4 macro PHP_SETUP_OPENSSL doesn't accept the 3rd argument anymore. - - Minimum required zlib library version is 1.2.11. c. Windows build system changes - The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19 have