diff -Naur cfitsio/Makefile.in cfitsio.zlib/Makefile.in
--- cfitsio/Makefile.in	2018-05-09 21:16:01.000000000 +0200
+++ cfitsio.zlib/Makefile.in	2018-05-23 13:54:43.878032943 +0200
@@ -67,9 +67,7 @@
 		pliocomp.c fits_hcompress.c fits_hdecompress.c \
 		simplerng.c @GSIFTP_SRC@
 
-ZLIB_SOURCES =	zlib/adler32.c zlib/crc32.c zlib/deflate.c zlib/infback.c \
-		zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c \
-		zlib/uncompr.c zlib/zcompress.c zlib/zuncompress.c zlib/zutil.c
+ZLIB_SOURCES =	zlib/zcompress.c zlib/zuncompress.c
 
 SOURCES = ${CORE_SOURCES} ${ZLIB_SOURCES} @F77_WRAPPERS@
 
@@ -102,7 +100,7 @@
 shared: lib${PACKAGE}${SHLIB_SUFFIX}
 
 lib${PACKAGE}${SHLIB_SUFFIX}: ${OBJECTS}
-		${SHLIB_LD} ${LDFLAGS} -o ${CFITSIO_SHLIB} ${OBJECTS} -lm ${LIBS}
+		${SHLIB_LD} ${LDFLAGS} -o ${CFITSIO_SHLIB} ${OBJECTS} -lm -lz -lbz2 ${LIBS}
 		@if [ "x${CFITSIO_SHLIB_SONAME}" != x ]; then \
 			ln -sf ${CFITSIO_SHLIB} ${CFITSIO_SHLIB_SONAME}; \
 			ln -sf ${CFITSIO_SHLIB_SONAME} $@; \
@@ -139,28 +137,28 @@
 		${CC} -c ${CFLAGS} ${CPPFLAGS} ${SSE_FLAGS} ${DEFS} $<
 
 smem:		smem.o lib${PACKAGE}.a ${OBJECTS}
-		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm
+		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm -lz
 
 testprog:	testprog.o lib${PACKAGE}.a ${OBJECTS}
-		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm ${LIBS}
+		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm -lz ${LIBS}
 
 fpack:		fpack.o fpackutil.o lib${PACKAGE}.a ${OBJECTS}
-		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o fpackutil.o -L. -l${PACKAGE} -lm ${LIBS}
+		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o fpackutil.o -L. -l${PACKAGE} -lm -lz ${LIBS}
 
 funpack:	funpack.o fpackutil.o lib${PACKAGE}.a ${OBJECTS}
-		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o fpackutil.o -L. -l${PACKAGE} -lm ${LIBS}
+		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o fpackutil.o -L. -l${PACKAGE} -lm -lz ${LIBS}
 
 fitscopy:	fitscopy.o lib${PACKAGE}.a ${OBJECTS}
-		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm ${LIBS}
+		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm -lz ${LIBS}
 
 speed:		speed.o lib${PACKAGE}.a ${OBJECTS}
-		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm ${LIBS}
+		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm -lz ${LIBS}
 
 imcopy:		imcopy.o lib${PACKAGE}.a ${OBJECTS}
-		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm ${LIBS}
+		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm -lz ${LIBS}
 
 cookbook:	cookbook.o lib${PACKAGE}.a ${OBJECTS}
-		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm ${LIBS}
+		${CC} ${LDFLAGS_BIN} ${DEFS} -o $@ ${@}.o -L. -l${PACKAGE} -lm -lz ${LIBS}
 
 eval:		# Rebuild eval_* files from flex/bison source
 		${FLEX} -t eval.l > eval_l.c1
