Factor out SETUP_ZLIB_LIB() (GH-16798)

Note that this function is similar to `SETUP_OPENSSL`, but since the
zlib headers are not necessarily required, we append `_LIB`.

We are also more liberal regarding zlib(_a).lib, because
extensions requiring zlib are looking only for zlib.lib if ext/zlib has
been built as shared extension.  This is overly restrictive at best,
and actually makes no sense, since (a) we're not shipping shared zlib
builds for years, and (b) users could have a zlib.lib which is a static
build (they could even just rename zlib_a.lib to zlib.lib).
This commit is contained in:
Christoph M. Becker 2024-11-27 18:35:34 +01:00 committed by GitHub
parent 0800c68be6
commit 7e1d035077
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 9 deletions

View file

@ -8,8 +8,7 @@ if (PHP_CURL != "no") {
SETUP_OPENSSL("curl", PHP_CURL) >= 2 &&
CHECK_LIB("winmm.lib", "curl", PHP_CURL) &&
CHECK_LIB("wldap32.lib", "curl", PHP_CURL) &&
(((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "curl", PHP_CURL))) ||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "curl", PHP_CURL)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
SETUP_ZLIB_LIB("curl", PHP_CURL) &&
(CHECK_LIB("normaliz.lib", "curl", PHP_CURL) &&
CHECK_LIB("libssh2.lib", "curl", PHP_CURL) &&
CHECK_LIB("nghttp2.lib", "curl", PHP_CURL))

View file

@ -16,8 +16,8 @@ if (PHP_GD != "no") {
CHECK_HEADER_ADD_INCLUDE("png.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\libpng12")) &&
(CHECK_LIB("libiconv_a.lib;libiconv.lib", "gd", PHP_GD) || CHECK_LIB("iconv_a.lib;iconv.lib", "gd", PHP_GD)) &&
CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_GD", PHP_GD) &&
(((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "gd", PHP_GD) )) ||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "gd", PHP_GD)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED)))
SETUP_ZLIB_LIB("gd", PHP_GD) &&
CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects)
) {
if (CHECK_LIB("libXpm_a.lib", "gd", PHP_GD) &&

View file

@ -28,12 +28,9 @@ if (PHP_MYSQLND != "no") {
"mysqlnd_wireprotocol.c " +
"php_mysqlnd.c ";
EXTENSION("mysqlnd", mysqlnd_source, false, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
if ((((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "mysqlnd", PHP_MYSQLND))) ||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "mysqlnd", PHP_MYSQLND)) ||
(PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
if (SETUP_ZLIB_LIB("mysqlnd", PHP_MYSQLND) &&
CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects)
)
{
) {
AC_DEFINE("MYSQLND_COMPRESSION_ENABLED", 1, "Define to 1 if mysqlnd has compressed protocol support.");
AC_DEFINE("MYSQLND_SSL_SUPPORTED", 1, "Define to 1 if mysqlnd core SSL is enabled.");
if (CHECK_LIB("crypt32.lib", "mysqlnd")) {

View file

@ -3626,6 +3626,11 @@ function ADD_MAKEFILE_FRAGMENT(src_file)
}
}
function SETUP_ZLIB_LIB(target, path_to_check)
{
return (PHP_ZLIB != "no" && !PHP_ZLIB_SHARED) || CHECK_LIB("zlib_a.lib;zlib.lib", target, path_to_check);
}
function SETUP_OPENSSL(target, path_to_check, common_name, use_env, add_dir_part, add_to_flag_only)
{
var ret = 0;