Hi,

I use this to check for zlib; it now works on most systems even on
very broken installations.  You have to include zlib with your
distribution.

=======================
AC_MSG_CHECKING([whether included zlib is requested])
AC_ARG_WITH(included-zlib,
    [  --with-included-zlib    use the zlib code included here],
[g10_force_zlib=yes], [g10_force_zlib=no] )
AC_MSG_RESULT($g10_force_zlib)


dnl Do we have zlib? Must do it here because Solaris failed
dnl when compiling a conftest (due to the "-lz" from LIBS).
use_local_zlib=yes
if test "$g10_force_zlib" = "yes"; then
  :
else
  AC_CHECK_HEADERS(zlib.h)
  if test "$ac_cv_header_zlib_h" = yes ; then
      AC_CHECK_LIB(z,deflateInit2_,use_local_zlib=no,:)
  fi
fi

if test "$use_local_zlib" = yes ; then
    AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
    GNUPG_LINK_FILES(zlib/zlib.h, zlib.h )
    GNUPG_LINK_FILES(zlib/zconf.h, zconf.h )
    ZLIBS="../zlib/libzlib.a"
else
    AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
    ZLIBS=
    LIBS="-lz $LIBS"
fi
AC_SUBST(ZLIBS)
=====================

and zlib/Makefile.am should be:
========================

EXTRA_DIST = README algorithm.doc ChangeLog

# I found no other easy way to use this only if zlib is needed.
# Doing this with SUBDIR = @xxx@  in the top Makefile.am does not
# work because automake doesn't scan this Makefile.am here.
if ENABLE_LOCAL_ZLIB
noinst_LIBRARIES = libzlib.a
endif


libzlib_a_SOURCES = adler32.c compress.c crc32.c \
                    uncompr.c deflate.c trees.c zutil.c \
                    inflate.c infblock.c inftrees.c \
                    infcodes.c infutil.c inffast.c \
                    deflate.h infblock.h infcodes.h inffast.h \
                    inffixed.h inftrees.h infutil.h trees.h \
                    zconf.h zlib.h zutil.h


CLEANFILES = foo.gz
=================================




-- 
Werner Koch at guug.de           www.gnupg.org           keyid 621CC013

Reply via email to