Skip to content

Commit 7e1d035

Browse files
authored
Factor out SETUP_ZLIB_LIB() (phpGH-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).
1 parent 0800c68 commit 7e1d035

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

ext/curl/config.w32

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ if (PHP_CURL != "no") {
88
SETUP_OPENSSL("curl", PHP_CURL) >= 2 &&
99
CHECK_LIB("winmm.lib", "curl", PHP_CURL) &&
1010
CHECK_LIB("wldap32.lib", "curl", PHP_CURL) &&
11-
(((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "curl", PHP_CURL))) ||
12-
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "curl", PHP_CURL)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
11+
SETUP_ZLIB_LIB("curl", PHP_CURL) &&
1312
(CHECK_LIB("normaliz.lib", "curl", PHP_CURL) &&
1413
CHECK_LIB("libssh2.lib", "curl", PHP_CURL) &&
1514
CHECK_LIB("nghttp2.lib", "curl", PHP_CURL))

ext/gd/config.w32

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ if (PHP_GD != "no") {
1616
CHECK_HEADER_ADD_INCLUDE("png.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\libpng12")) &&
1717
(CHECK_LIB("libiconv_a.lib;libiconv.lib", "gd", PHP_GD) || CHECK_LIB("iconv_a.lib;iconv.lib", "gd", PHP_GD)) &&
1818
CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_GD", PHP_GD) &&
19-
(((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "gd", PHP_GD) )) ||
20-
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "gd", PHP_GD)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED)))
19+
SETUP_ZLIB_LIB("gd", PHP_GD) &&
20+
CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects)
2121
) {
2222

2323
if (CHECK_LIB("libXpm_a.lib", "gd", PHP_GD) &&

ext/mysqlnd/config.w32

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@ if (PHP_MYSQLND != "no") {
2828
"mysqlnd_wireprotocol.c " +
2929
"php_mysqlnd.c ";
3030
EXTENSION("mysqlnd", mysqlnd_source, false, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
31-
if ((((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "mysqlnd", PHP_MYSQLND))) ||
32-
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "mysqlnd", PHP_MYSQLND)) ||
33-
(PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
31+
if (SETUP_ZLIB_LIB("mysqlnd", PHP_MYSQLND) &&
3432
CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects)
35-
)
36-
{
33+
) {
3734
AC_DEFINE("MYSQLND_COMPRESSION_ENABLED", 1, "Define to 1 if mysqlnd has compressed protocol support.");
3835
AC_DEFINE("MYSQLND_SSL_SUPPORTED", 1, "Define to 1 if mysqlnd core SSL is enabled.");
3936
if (CHECK_LIB("crypt32.lib", "mysqlnd")) {

win32/build/confutils.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3626,6 +3626,11 @@ function ADD_MAKEFILE_FRAGMENT(src_file)
36263626
}
36273627
}
36283628

3629+
function SETUP_ZLIB_LIB(target, path_to_check)
3630+
{
3631+
return (PHP_ZLIB != "no" && !PHP_ZLIB_SHARED) || CHECK_LIB("zlib_a.lib;zlib.lib", target, path_to_check);
3632+
}
3633+
36293634
function SETUP_OPENSSL(target, path_to_check, common_name, use_env, add_dir_part, add_to_flag_only)
36303635
{
36313636
var ret = 0;

0 commit comments

Comments
 (0)