Use pkg-config for zlib.

Helps cope with zlib being in weird places (eg, ps3toolchain)
This commit is contained in:
Bill Currie 2012-08-18 21:41:33 +09:00
parent 3b047a3cc1
commit 7f805c2527
3 changed files with 19 additions and 15 deletions

View file

@ -63,21 +63,25 @@ AC_ARG_ENABLE(zlib, [ --disable-zlib disable zlib support])
HAVE_ZLIB=no
Z_LIBS=""
if test "x$enable_zlib" != "xno"; then
dnl Check for working -lz
dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h
AC_CHECK_LIB(z, gztell, HAVE_ZLIB=yes, HAVE_ZLIB=no, [$LIBS])
if test "x$HAVE_ZLIB" = "xyes"; then
AC_CHECK_LIB(z, gzgets, HAVE_ZLIB=yes, HAVE_ZLIB=no, [$LIBS])
if test "x$HAVE_ZLIB" = "xyes"; then
AC_CHECK_HEADER(zlib.h, HAVE_ZLIB=yes, HAVE_ZLIB=no)
if test "x$HAVE_ZLIB" = "xyes"; then
Z_LIBS="-lz"
AC_DEFINE(HAVE_ZLIB, 1, [Define if you have zlib])
fi
fi
fi
if test "x$PKG_CONFIG" != "x"; then
PKG_CHECK_MODULES([Z], [zlib], HAVE_ZLIB=yes, HAVE_ZLIB=no)
else
dnl Check for working -lz
dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h
AC_CHECK_LIB(z, gztell, HAVE_ZLIB=yes, HAVE_ZLIB=no, [$LIBS])
if test "x$HAVE_ZLIB" = "xyes"; then
AC_CHECK_LIB(z, gzgets, HAVE_ZLIB=yes, HAVE_ZLIB=no, [$LIBS])
if test "x$HAVE_ZLIB" = "xyes"; then
AC_CHECK_HEADER(zlib.h, HAVE_ZLIB=yes Z_LIBS=-lz,
HAVE_ZLIB=no)
fi
fi
fi
fi
AC_SUBST(Z_LIBS)
if test "x$HAVE_ZLIB" = "xyes"; then
AC_DEFINE(HAVE_ZLIB, 1, [Define if you have zlib])
fi
AC_ARG_ENABLE(png,
[ --disable-png disable png support],

View file

@ -1,5 +1,5 @@
AUTOMAKE_OPTIONS= foreign
AM_CFLAGS= @PREFER_PIC@ $(PNG_CFLAGS)
AM_CFLAGS= @PREFER_PIC@ $(Z_CFLAGS) $(PNG_CFLAGS)
AM_CPPFLAGS= -I$(top_srcdir)/include
lib_ldflags=-version-info $(QUAKE_LIBRARY_VERSION_INFO) \

View file

@ -4,7 +4,7 @@ SUBDIRS= . test
AM_CFLAGS= @PREFER_PIC@
CCASFLAGS+= @PREFER_PIC@
INCLUDES= -I$(top_srcdir)/include
INCLUDES= -I$(top_srcdir)/include $(Z_CFLAGS)
lib_LTLIBRARIES= libQFutil.la