Skip to content

Add PHP_SETUP_ZLIB M4 macro #14591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -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
========================================
Expand Down
14 changes: 14 additions & 0 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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.11], [dnl
PHP_EVAL_INCLINE([$ZLIB_CFLAGS])
PHP_EVAL_LIBLINE([$ZLIB_LIBS], [$1])
$2], [$3])dnl
])

dnl ----------------------------------------------------------------------------
dnl Misc. macros
dnl ----------------------------------------------------------------------------
Expand Down
9 changes: 1 addition & 8 deletions ext/gd/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqlnd/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
11 changes: 4 additions & 7 deletions ext/mysqlnd/config9.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
2 changes: 1 addition & 1 deletion ext/zlib/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
18 changes: 8 additions & 10 deletions ext/zlib/config0.m4
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
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
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