فهرست منبع

Don't link with libz when not needed

Commit 8cc8e513633a1a8b12c416e32fb5362fcf4d65dd added check for libz
resulting in linking with lib z for all libraries. This is not expected
behavior. Patch solves it by making defining automake conditional so
cpghum is linked only if libz is available and LIBS variable is not
modified at all.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Jan Friesse 10 سال پیش
والد
کامیت
145f9279d1
2فایلهای تغییر یافته به همراه9 افزوده شده و 3 حذف شده
  1. 3 1
      configure.ac
  2. 6 2
      test/Makefile.am

+ 3 - 1
configure.ac

@@ -163,7 +163,9 @@ AC_CHECK_LIB([pthread], [pthread_create])
 AC_CHECK_LIB([socket], [socket])
 AC_CHECK_LIB([socket], [socket])
 AC_CHECK_LIB([nsl], [t_open])
 AC_CHECK_LIB([nsl], [t_open])
 AC_CHECK_LIB([rt], [sched_getscheduler])
 AC_CHECK_LIB([rt], [sched_getscheduler])
-AC_CHECK_LIB([z], [crc32])
+AC_CHECK_LIB([z], [crc32],
+    AM_CONDITIONAL([BUILD_CPGHUM], true),
+    AM_CONDITIONAL([BUILD_CPGHUM], false))
 
 
 # Checks for library functions.
 # Checks for library functions.
 AC_FUNC_ALLOCA
 AC_FUNC_ALLOCA

+ 6 - 2
test/Makefile.am

@@ -34,7 +34,7 @@ MAINTAINERCLEANFILES	= Makefile.in
 
 
 EXTRA_DIST		= ploadstart.sh
 EXTRA_DIST		= ploadstart.sh
 
 
-noinst_PROGRAMS		= cpgverify testcpg testcpg2 cpgbench cpghum \
+noinst_PROGRAMS		= cpgverify testcpg testcpg2 cpgbench \
 			  testquorum testvotequorum1 testvotequorum2	\
 			  testquorum testvotequorum1 testvotequorum2	\
 			  stress_cpgfdget stress_cpgcontext cpgbound testsam \
 			  stress_cpgfdget stress_cpgcontext cpgbound testsam \
 			  testcpgzc cpgbenchzc testzcgc stress_cpgzc
 			  testcpgzc cpgbenchzc testzcgc stress_cpgzc
@@ -48,7 +48,6 @@ testzcgc_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
 stress_cpgzc_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
 stress_cpgzc_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
 stress_cpgfdget_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
 stress_cpgfdget_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
 stress_cpgcontext_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
 stress_cpgcontext_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
-cpghum_LDADD            = $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la -lz
 testquorum_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libquorum.la
 testquorum_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libquorum.la
 testvotequorum1_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libvotequorum.la
 testvotequorum1_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libvotequorum.la
 testvotequorum2_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libvotequorum.la
 testvotequorum2_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libvotequorum.la
@@ -59,6 +58,11 @@ cpgbench_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
 cpgbenchzc_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
 cpgbenchzc_LDADD	= $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la
 testsam_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libsam.la
 testsam_LDADD		= $(LIBQB_LIBS) $(top_builddir)/lib/libsam.la
 
 
+if BUILD_CPGHUM
+noinst_PROGRAMS	        += cpghum
+cpghum_LDADD            = $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la -lz
+endif
+
 ploadstart: ploadstart.sh
 ploadstart: ploadstart.sh
 	sed -e 's#@''BASHPATH@#${BASHPATH}#g' $< > $@
 	sed -e 's#@''BASHPATH@#${BASHPATH}#g' $< > $@
 	chmod 755 $@
 	chmod 755 $@