configure: Use pkg-config to handle zlib dependency if possible

Preserves fallback for systems like darwin without zlib.pc

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
Alan Coopersmith
2022-06-20 12:30:41 -07:00
parent 12bed78985
commit 5cb3b8809b
3 changed files with 8 additions and 3 deletions

View File

@@ -66,7 +66,7 @@ libXfont2_la_SOURCES = \
libXfont2_la_LDFLAGS = -version-number 2:0:0 -no-undefined
libXfont2_la_LIBADD = $(Z_LIBS) $(MATH_LIBS) $(XFONT_LIBS) $(LTLIBOBJS)
libXfont2_la_LIBADD = $(ZLIB_LIBS) $(Z_LIBS) $(MATH_LIBS) $(XFONT_LIBS) $(LTLIBOBJS)
if XFONT_FONTFILE
libXfont2_la_SOURCES += \

View File

@@ -128,7 +128,12 @@ AC_SUBST(FREETYPE_REQUIRES)
AC_DEFINE(X_GZIP_FONT_COMPRESSION,1,[Support gzip for bitmap fonts])
X_GZIP_FONT_COMPRESSION=1
AC_SUBST(X_GZIP_FONT_COMPRESSION)
AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz], AC_MSG_ERROR([*** zlib is required]))
PKG_CHECK_MODULES(ZLIB, [zlib], [Z_REQUIRES=zlib], [Z_REQUIRES=""])
if test "x$Z_REQUIRES" = "x"; then
AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz],
AC_MSG_ERROR([*** zlib is required]))
fi
AC_SUBST(Z_REQUIRES)
AC_ARG_WITH(bzip2,
AS_HELP_STRING([--with-bzip2],

View File

@@ -7,7 +7,7 @@ Name: Xfont2
Description: X font Library version 2
Version: @VERSION@
Requires: xproto fontsproto
Requires.private: fontenc @FREETYPE_REQUIRES@
Requires.private: fontenc @FREETYPE_REQUIRES@ @Z_REQUIRES@
Cflags: -I${includedir}
Libs: -L${libdir} -lXfont2
Libs.private: @Z_LIBS@ -lm