Skip to content

Commit

Permalink
Build system: Fix failure to correctly link to zlib (#32)
Browse files Browse the repository at this point in the history
Checking for the header is NOT sufficient when utilizing its shared
library symbols. Look it up with pkg-config explicitly, and explicitly
add it to ensure that at runtime, libppd has its own DT_NEEDED
dependency on libz.so; if libppd successfully links at all -- not a
given, if -Wl,-no-undefined is used -- then it *may* transitively get
libz.so from its recursive dependencies, but this is no guarantee at
all.

Fixes failure to build discovered at https://bugs.gentoo.org/920273
  • Loading branch information
eli-schwartz committed Mar 8, 2024
1 parent c7a62e8 commit a040f26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ libppd_la_SOURCES = \
$(pkgppddefs_DATA)
libppd_la_LIBADD = \
$(LIBCUPSFILTERS_LIBS) \
$(ZLIB_LIBS) \
$(CUPS_LIBS)
libppd_la_CFLAGS = \
$(LIBCUPSFILTERS_CFLAGS) \
$(ZLIB_CFLAGS) \
$(CUPS_CFLAGS)
libppd_la_CXXFLAGS = \
$(libppd_la_CFLAGS)
Expand Down
8 changes: 7 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ AC_SUBST(CUPS_STATEDIR)
# ========================
PKG_CHECK_MODULES([LIBCUPSFILTERS], [libcupsfilters])

# ==============
# Check for zlib
# ==============
PKG_CHECK_MODULES([ZLIB], [zlib], ,[
AC_CHECK_HEADER([zlib.h])
AC_CHECK_LIB([z], [deflateInit])])

# ============================================================
# Check for whether we want to install the testppdfile utility
# ============================================================
Expand Down Expand Up @@ -220,7 +227,6 @@ AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([sys/stat.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([zlib.h])
AC_CHECK_HEADERS([endian.h])
AC_CHECK_HEADERS([dirent.h])
AC_CHECK_HEADERS([sys/ioctl.h])
Expand Down

0 comments on commit a040f26

Please sign in to comment.