Add explicit check for libz

Fixes static linking and libpng won't link without it anyway.