Add support for gzipped input

This adds zlib as a dependency, but supports both gzipped and non-gzipped input now (zlib automatically decides if the file is gzipped).