Blame SOURCES/bz682771-3-Don-t-link-with-libz-when-not-needed.patch

f1cb04
From 4d228554d977327fe089b8ec3cb2ced649091560 Mon Sep 17 00:00:00 2001
f1cb04
From: Jan Friesse <jfriesse@redhat.com>
f1cb04
Date: Mon, 22 Jun 2015 16:00:07 +0200
f1cb04
Subject: [PATCH] Don't link with libz when not needed
f1cb04
f1cb04
Commit 8cc8e513633a1a8b12c416e32fb5362fcf4d65dd added check for libz
f1cb04
resulting in linking with lib z for all libraries. This is not expected
f1cb04
behavior. Patch solves it by making defining automake conditional so
f1cb04
cpghum is linked only if libz is available and LIBS variable is not
f1cb04
modified at all.
f1cb04
f1cb04
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
f1cb04
---
f1cb04
 configure.ac     |    4 +++-
f1cb04
 test/Makefile.am |    8 ++++++--
f1cb04
 2 files changed, 9 insertions(+), 3 deletions(-)
f1cb04
f1cb04
diff --git a/configure.ac b/configure.ac
f1cb04
index 4b640fc..922b439 100644
f1cb04
--- a/configure.ac
f1cb04
+++ b/configure.ac
f1cb04
@@ -163,7 +163,9 @@ AC_CHECK_LIB([pthread], [pthread_create])
f1cb04
 AC_CHECK_LIB([socket], [socket])
f1cb04
 AC_CHECK_LIB([nsl], [t_open])
f1cb04
 AC_CHECK_LIB([rt], [sched_getscheduler])
f1cb04
-AC_CHECK_LIB([z], [crc32])
f1cb04
+AC_CHECK_LIB([z], [crc32],
f1cb04
+    AM_CONDITIONAL([BUILD_CPGHUM], true),
f1cb04
+    AM_CONDITIONAL([BUILD_CPGHUM], false))
f1cb04
 
f1cb04
 # Checks for library functions.
f1cb04
 AC_FUNC_ALLOCA
f1cb04
diff --git a/test/Makefile.am b/test/Makefile.am
f1cb04
index bb11518..ad1489d 100644
f1cb04
--- a/test/Makefile.am
f1cb04
+++ b/test/Makefile.am
f1cb04
@@ -34,7 +34,7 @@ MAINTAINERCLEANFILES	= Makefile.in
f1cb04
 
f1cb04
 EXTRA_DIST		= ploadstart.sh
f1cb04
 
f1cb04
-noinst_PROGRAMS		= cpgverify testcpg testcpg2 cpgbench cpghum \
f1cb04
+noinst_PROGRAMS		= cpgverify testcpg testcpg2 cpgbench \
f1cb04
 			  testquorum testvotequorum1 testvotequorum2	\
f1cb04
 			  stress_cpgfdget stress_cpgcontext cpgbound testsam \
f1cb04
 			  testcpgzc cpgbenchzc testzcgc stress_cpgzc
f1cb04
@@ -48,7 +48,6 @@ testzcgc_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
f1cb04
 stress_cpgzc_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
f1cb04
 stress_cpgfdget_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
f1cb04
 stress_cpgcontext_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
f1cb04
-cpghum_LDADD            = $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la -lz
f1cb04
 testquorum_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libquorum.la
f1cb04
 testvotequorum1_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libvotequorum.la
f1cb04
 testvotequorum2_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libvotequorum.la
f1cb04
@@ -59,6 +58,11 @@ cpgbench_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
f1cb04
 cpgbenchzc_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
f1cb04
 testsam_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libsam.la
f1cb04
 
f1cb04
+if BUILD_CPGHUM
f1cb04
+noinst_PROGRAMS	        += cpghum
f1cb04
+cpghum_LDADD            = $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la -lz
f1cb04
+endif
f1cb04
+
f1cb04
 ploadstart: ploadstart.sh
f1cb04
 	sed -e 's#@''BASHPATH@#${BASHPATH}#g' $< > $@
f1cb04
 	chmod 755 $@
f1cb04
-- 
f1cb04
1.7.1
f1cb04