summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-06-20 12:30:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-06-20 12:30:41 -0700
commit5cb3b8809b9f141a2cf8a4e00a8387c75dc6bc10 (patch)
treed791116f50066869625f66da48cf990d79056a53
parent12bed78985af1da2d1f4954a3491ee497a878b23 (diff)
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>
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac7
-rw-r--r--xfont2.pc.in2
3 files changed, 8 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 5af2e23..62ac7e2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 += \
diff --git a/configure.ac b/configure.ac
index 0361d69..3dbad9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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],
diff --git a/xfont2.pc.in b/xfont2.pc.in
index ac3f53a..aa754a6 100644
--- a/xfont2.pc.in
+++ b/xfont2.pc.in
@@ -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