Support older versions of zlib

we manually check for the new function gzbuffer, which is the only
reason we needed the newer versions of the library