Skip to content

Commit f5772a9

Browse files
committed
Extract SETUP_ZLIB_LIB() configuration function
This is a mere refactoring for core readability and maintainability reasons. Note that this function is similar to `SETUP_OPENSSL`, but since the zlib headers are not necessarily required, we append `_LIB`.
1 parent 2d1c382 commit f5772a9

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ 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)
2120
) {
2221

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

ext/mysqlnd/config.w32

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ 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)
3533
)
3634
{

win32/build/confutils.js

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

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

0 commit comments

Comments
 (0)