Explicitly link libelf and libdw with -lz.

Signed-off-by: Mark Wielaard <m...@redhat.com>
---
 ChangeLog          |  4 ++++
 configure.ac       | 10 ++++++++--
 libdw/ChangeLog    |  4 ++++
 libdw/Makefile.am  |  2 +-
 libelf/ChangeLog   |  4 ++++
 libelf/Makefile.am |  2 +-
 src/ChangeLog      |  5 +++++
 src/Makefile.am    |  4 ++--
 tests/ChangeLog    |  5 +++++
 tests/Makefile.am  |  4 ++--
 10 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index db1b3b2..bbe0b8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-16  Mark Wielaard  <m...@redhat.com>
+
+       * configure.ac: Make zlib mandatory.
+
 2015-10-15  Mark Wielaard  <m...@redhat.com>
 
        * configure.ac: Set version to 0.164.
diff --git a/configure.ac b/configure.ac
index 5d691c9..e010754 100644
--- a/configure.ac
+++ b/configure.ac
@@ -240,11 +240,17 @@ AC_SUBST([LIBEBL_SUBDIR])
 AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
 AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
 
-dnl Test for zlib and bzlib, gives ZLIB/BZLIB .am
-dnl conditional and config.h USE_ZLIB/USE_BZLIB #define.
+dnl zlib is mandatory.
 save_LIBS="$LIBS"
 LIBS=
 eu_ZIPLIB(zlib,ZLIB,z,gzdirect,gzip)
+AS_IF([test "x$with_zlib" = xno], [AC_MSG_ERROR("zlib not found")])
+LIBS="$save_LIBS"
+
+dnl Test for bzlib and xz/lzma, gives BZLIB/LZMALIB .am
+dnl conditional and config.h USE_BZLIB/USE_LZMALIB #define.
+save_LIBS="$LIBS"
+LIBS=
 eu_ZIPLIB(bzlib,BZLIB,bz2,BZ2_bzdopen,bzip2)
 eu_ZIPLIB(lzma,LZMA,lzma,lzma_auto_decoder,[LZMA (xz)])
 zip_LIBS="$LIBS"
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 39c49aa..f0605c8 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-16  Mark Wielaard  <m...@redhat.com>
+
+       * Makefile.am (libdw.so): Add -lz.
+
 2015-10-09  Josh Stone  <jist...@redhat.com>
 
        * dwarf_begin.c (dwarf_begin): Replace stat64 and fstat64 with stat
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 2da0db6..082d96c 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -112,7 +112,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a 
../libdwelf/libdwelf_pic.a \
                -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
                -Wl,--version-script,$<,--no-undefined \
                -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-               -ldl $(argp_LDADD) $(zip_LIBS)
+               -ldl -lz $(argp_LDADD) $(zip_LIBS)
        @$(textrel_check)
        $(AM_V_at)ln -fs $@ $@.$(VERSION)
 
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 932ac1a..ea76c2d 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-16  Mark Wielaard  <m...@redhat.com>
+
+       * Makefile.am (libelf_so_LDLIBS): Add -lz.
+
 2015-10-14  Mark Wielaard  <m...@redhat.com>
 
        * libelf.h (elf32_getchdr): New declaration.
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index 0a2586e..e2d7549 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -94,7 +94,7 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c 
elf_fill.c \
 libelf_pic_a_SOURCES =
 am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
 
-libelf_so_LDLIBS =
+libelf_so_LDLIBS = -lz
 if USE_LOCKS
 libelf_so_LDLIBS += -lpthread
 endif
diff --git a/src/ChangeLog b/src/ChangeLog
index eff42df..70d3288 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
 2015-10-16  Mark Wielaard  <m...@redhat.com>
 
+       * Makefile.am [BUILD_STATIC](libdw): Add -lz.
+       [BUILD_STATIC](libelf): Likewise.
+
+2015-10-16  Mark Wielaard  <m...@redhat.com>
+
        * readelf.c (argp_option): Describe --decompress,-z.
        (print_decompress): New bool.
        (parse_opt): Handle -z.
diff --git a/src/Makefile.am b/src/Makefile.am
index 04ae3cb..e2c494c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,8 +72,8 @@ CLEANFILES += make-debug-archive
 
 if BUILD_STATIC
 libasm = ../libasm/libasm.a
-libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl
-libelf = ../libelf/libelf.a
+libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl
+libelf = ../libelf/libelf.a -lz
 else
 libasm = ../libasm/libasm.so
 libdw = ../libdw/libdw.so
diff --git a/tests/ChangeLog b/tests/ChangeLog
index cbe7084..a3e5a16 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-16  Mark Wielaard  <m...@redhat.com>
+
+       * Makefile.am [BUILD_STATIC] (libdw): Add -lz.
+       [BUILD_STATIC] (libelf): Likewise.
+
 2015-10-14  Mark Wielaard  <m...@redhat.com>
 
        * run-readelf-z.sh: New test.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a81817f..364d0f2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -357,8 +357,8 @@ libasm = -lasm
 libebl = -lebl
 else !STANDALONE
 if BUILD_STATIC
-libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl
-libelf = ../libelf/libelf.a
+libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl
+libelf = ../libelf/libelf.a -lz
 libasm = ../libasm/libasm.a
 else
 libdw = ../libdw/libdw.so
-- 
1.8.3.1

Reply via email to