From c8ee562d7cff829433b61971123a980660c109fb Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 4 Jul 2011 13:09:37 +0200 Subject: [PATCH] configure: avoid using zlib's pkgconfig file, fixes issue 6. Not all systems provide a zlib.pc file, so explicitly check for InflateInit2() which is what we use in XBPS. Thanks to str1ngs for finding this error on Ubuntu. --- configure | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 8ec5eb30..da27ceaa 100755 --- a/configure +++ b/configure @@ -374,6 +374,39 @@ else echo "CPPFLAGS += -DHAVE_STRLCAT" >>$CONFIG_MK fi +# +# zlib is required. +# +func=InflateInit2 +printf "Checking for zlib $func() ... " +cat < _$func.c +#include +int main(void) { + z_stream strm; + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + strm.avail_in = 0; + strm.next_in = Z_NULL; + inflateInit2(&strm, 15+16); + return 0; +} +EOF +if $XCC -lz _$func.c -o _$func 2>/dev/null; then + ZLIB=yes +else + ZLIB=no +fi +echo "$ZLIB." +rm -f _$func.c _$func +if [ "$ZLIB" = "no" ]; then + echo "Failed to link with your system's zlib, can't continue..." + exit 1 +else + echo "LDFLAGS += -lz" >>$CONFIG_MK + echo "STATIC_LIBS += -lz" >>$CONFIG_MK +fi + # # If building API library documentation, doxygen and graphviz are required. # @@ -430,21 +463,6 @@ else echo "STATIC_LIBS = \$(TOPDIR)/lib/libxbps.a -lfetch" >>$CONFIG_MK fi -# -# zlib with pkg-config support is required. -# -printf "Checking for zlib via pkg-config ... " -if ! $PKGCONFIG_BIN --exists zlib; then - echo "zlib.pc file not found, exiting." - exit 1 -else - echo "found version $($PKGCONFIG_BIN --modversion zlib)." - echo "CFLAGS += $($PKGCONFIG_BIN --cflags zlib)" >>$CONFIG_MK - echo "LDFLAGS += $($PKGCONFIG_BIN --libs zlib)" >>$CONFIG_MK - echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static zlib)" \ - >>$CONFIG_MK -fi - # # Check if external proplib via pkg-config should be used instead. #