When configure checks for zlib, it automaticaly prepends /usr/local/lib to the linker search path, even when --with zlib is set. This messes up cross compiles on HP Nonstop. Similarly, when it's checking for OpenSSL, it does the same thing, even when --with-ssl-dir is set. Configure should check use the withval's for zlib and OpenSSL, and only if they're not specified, use /usr/local/[whatever].
Or alternatively, at least put /usr/local at the END of the library search path instead of the front.
This not uncommon. I suspect it is in the autoconf code to always put it there as a possibility. However, looking through many config.log files I do believe it is convention to look at the --with... variables first. What I have also needed to do is add LDFLAGS to get the linking to do what I want/expect - this is how I have been able to keep /usr/local/anything out of anything I package.