-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Factor out SETUP_ZLIB_LIB() #16798
base: master
Are you sure you want to change the base?
Factor out SETUP_ZLIB_LIB() #16798
Conversation
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`.
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).
The bundled libgd relies on zlib; we're setting up the library, but don't check for the header (which is included by gd_gd2.c), which may pass configure, although the build fails. We better fail early if the required header is not available.
win32/build/confutils.js
Outdated
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)) || | ||
(PHP_ZLIB == "yes" && !PHP_ZLIB_SHARED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might need some explanation. zlib (like a couple of other extensions) is a bit special, because if PHP with zlib as static extension, php8.dll provides the functions as if they had been built as shared extension. Thus, there is no need to involve zlib.lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct; see #16801 (comment).
looks good but @petk might be more appropriate I think. |
I've just noticed that there is (and was) a glitch. If a user enables zlib and curl, but zlib can't be enabled because zlib.h is not found, configure would still pass (since curl is checked before zlib; there is no extension dependency), although the build would fail. I think we can stick with this, though. |
The code is repetitive, and had some minor bugs regarding edge-cases. Thus we rework a bit. The messages of the individual commits contain some more information.