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 1 commit
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
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.0.4], [dnl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated but 1.2.0.4 seems really old :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Released in 2003 🙈 oh my... yes, this can be also bumped.

Copy link
Member Author

@petk petk Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting info is that pkg-config support was added in 1.2.3.1, so PHP already kind of requires 1.2.3.1 already :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And Windows zlib package is at 1.2.12 https://github.com/winlibs/zlib

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've for now bumped this to 1.2.3.1 version... Probably could be bumped way more here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that centos 8 seems to use the 1.2.11 version, that might be a starting point as you re targetting master. Just my 2 cents :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. Added in the next commit.

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
16 changes: 7 additions & 9 deletions ext/zlib/config0.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading