Added system availability check for libpng.
Added libpng link to zlib.
Added system availability check for zlib.
Added tiff system check and some other fixes.