configure: link against bz2 and lz4 if detected

if we configure --with-librocksdb-static, the rocksdb's Makefile
will detect the installed libbz2 and libz4 by its own. if the
building env happens to have these libraries installed, a link
time dependency is introduced. so we are forced to link against
them.

Fixes: #13850
Fixes: #13981
Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2015-12-23 01:32:46 -08:00
parent f14fe56d0c
commit 911e7a02a2
2 changed files with 14 additions and 1 deletions

View File

@ -819,6 +819,13 @@ AS_IF([test "x$with_librocksdb_static" = "xyes"],
AM_CONDITIONAL(WITH_SLIBROCKSDB, [ test "x$with_librocksdb_static" = "xyes" ])
AM_CONDITIONAL(WITH_LIBROCKSDB, [ test "x$with_librocksdb_static" = "xyes" -o "x$with_librocksdb" = "xyes" ])
# rocksdb detects bzlib and lz4 in its Makefile, which forces us to do the same.
AS_IF([test "x$with_librocksdb_static" = "xyes"], [
AC_CHECK_HEADER([bzlib.h], [have_bzlib=yes])
AC_CHECK_HEADER([lz4.h], [have_lz4=yes])])
AM_CONDITIONAL(HAVE_BZLIB, [test "x$have_bzlib" = "xyes"])
AM_CONDITIONAL(HAVE_LZ4, [test "x$have_lz4" = "xyes"])
# error out if --with-jemalloc and --with-librocksdb_static as rocksdb uses tcmalloc
if test "x$with_jemalloc" = "xyes"; then
if test "x$with_librocksdb_static" != "xno"; then

View File

@ -266,8 +266,14 @@ LIBOSD += $(LIBOSD_TYPES) $(LIBOS_TYPES)
# libkv/libos linking order is ornery
if WITH_SLIBROCKSDB
LIBKV += rocksdb/librocksdb.a
if HAVE_BZLIB
LIBKV += -lbz2
endif
LIBKV += -lbz2 -lz -lleveldb -lsnappy
if HAVE_LZ4
LIBKV += -llz4
endif
endif # WITH_SLIBROCKSDB
LIBKV += -lz -lleveldb -lsnappy
LIBOS += $(LIBOS_TYPES) $(LIBKV)
LIBMON += $(LIBMON_TYPES)