diff --git a/configure.in b/configure.in
index ec147bd..7d60247 100644
--- a/configure.in
+++ b/configure.in
@@ -527,6 +527,19 @@ AC_CHECK_LIB(xml2, xmlElemDump, [:], [
 LIBS="$oLIBS"
 
 ### --------------------------------------------------------------------------
+### Zlib
+
+ZLIB_LIBS=-lz
+AC_SUBST(ZLIB_LIBS)
+
+oLIBS="$LIBS"
+LIBS="$LIBS $ZLIB_LIBS"
+AC_CHECK_LIB(z, gzopen, [:], [
+  AC_MSG_ERROR([zlib is required for GnuCash])
+])
+LIBS="$oLIBS"
+
+### --------------------------------------------------------------------------
 ### QOF, the Query Object Framework.  Check if there is a native version.
 
 dnl XXX: FIXME: RELEASE HACK
diff --git a/src/backend/file/Makefile.am b/src/backend/file/Makefile.am
index d2b7af3..ce1b736 100644
--- a/src/backend/file/Makefile.am
+++ b/src/backend/file/Makefile.am
@@ -59,14 +59,14 @@ noinst_HEADERS = \
   sixtp-utils.h
 
 libgnc_backend_xml_utils_la_LIBADD = \
-   ${GLIB_LIBS} ${GCONF_LIBS} ${LIBXML2_LIBS} \
+   ${GLIB_LIBS} ${GCONF_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS} \
    ${top_builddir}/src/engine/libgncmod-engine.la \
    ${top_builddir}/src/core-utils/libgnc-core-utils.la \
    ${QOF_LIBS}
 
 libgncmod_backend_xml_la_LDFLAGS = -module -avoid-version
 libgncmod_backend_xml_la_LIBADD = \
-   ${GLIB_LIBS} ${GCONF_LIBS} ${LIBXML2_LIBS} \
+   ${GLIB_LIBS} ${GCONF_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS} \
    ${top_builddir}/src/engine/libgncmod-engine.la \
    ${top_builddir}/src/core-utils/libgnc-core-utils.la \
    libgnc-backend-xml-utils.la \
