|
|
|
@ -210,6 +210,7 @@ EOF |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_SNAPPY; then |
|
|
|
|
# Test whether Snappy library is installed |
|
|
|
|
# http://code.google.com/p/snappy/ |
|
|
|
|
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
@ -221,7 +222,9 @@ EOF |
|
|
|
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lsnappy" |
|
|
|
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -lsnappy" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_GFLAGS; then |
|
|
|
|
# Test whether gflags library is installed |
|
|
|
|
# http://gflags.github.io/gflags/ |
|
|
|
|
# check if the namespace is gflags |
|
|
|
@ -232,8 +235,21 @@ EOF |
|
|
|
|
if [ "$?" = 0 ]; then |
|
|
|
|
COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=1" |
|
|
|
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" |
|
|
|
|
else |
|
|
|
|
# check if namespace is google |
|
|
|
|
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF |
|
|
|
|
#include <gflags/gflags.h> |
|
|
|
|
using namespace google; |
|
|
|
|
int main() {} |
|
|
|
|
EOF |
|
|
|
|
if [ "$?" = 0 ]; then |
|
|
|
|
COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=google" |
|
|
|
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_ZLIB; then |
|
|
|
|
# Test whether zlib library is installed |
|
|
|
|
$CXX $CFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
#include <zlib.h> |
|
|
|
@ -244,7 +260,9 @@ EOF |
|
|
|
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lz" |
|
|
|
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -lz" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_BZIP; then |
|
|
|
|
# Test whether bzip library is installed |
|
|
|
|
$CXX $CFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
#include <bzlib.h> |
|
|
|
@ -255,7 +273,9 @@ EOF |
|
|
|
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lbz2" |
|
|
|
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -lbz2" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_LZ4; then |
|
|
|
|
# Test whether lz4 library is installed |
|
|
|
|
$CXX $CFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
#include <lz4.h> |
|
|
|
@ -267,7 +287,9 @@ EOF |
|
|
|
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -llz4" |
|
|
|
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -llz4" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_ZSTD; then |
|
|
|
|
# Test whether zstd library is installed |
|
|
|
|
$CXX $CFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
#include <zstd.h> |
|
|
|
@ -278,7 +300,9 @@ EOF |
|
|
|
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lzstd" |
|
|
|
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -lzstd" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_NUMA; then |
|
|
|
|
# Test whether numa is available |
|
|
|
|
$CXX $CFLAGS -x c++ - -o /dev/null -lnuma 2>/dev/null <<EOF |
|
|
|
|
#include <numa.h> |
|
|
|
@ -290,7 +314,9 @@ EOF |
|
|
|
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lnuma" |
|
|
|
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -lnuma" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_TBB; then |
|
|
|
|
# Test whether tbb is available |
|
|
|
|
$CXX $CFLAGS $LDFLAGS -x c++ - -o /dev/null -ltbb 2>/dev/null <<EOF |
|
|
|
|
#include <tbb/tbb.h> |
|
|
|
@ -301,7 +327,9 @@ EOF |
|
|
|
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -ltbb" |
|
|
|
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -ltbb" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_JEMALLOC; then |
|
|
|
|
# Test whether jemalloc is available |
|
|
|
|
if echo 'int main() {}' | $CXX $CFLAGS -x c++ - -o /dev/null -ljemalloc \ |
|
|
|
|
2>/dev/null; then |
|
|
|
@ -310,7 +338,9 @@ EOF |
|
|
|
|
# JEMALLOC can be enabled either using the flag (like here) or by |
|
|
|
|
# providing direct link to the jemalloc library |
|
|
|
|
WITH_JEMALLOC_FLAG=1 |
|
|
|
|
else |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
if ! test $JEMALLOC && ! test $ROCKSDB_DISABLE_TCMALLOC; then |
|
|
|
|
# jemalloc is not available. Let's try tcmalloc |
|
|
|
|
if echo 'int main() {}' | $CXX $CFLAGS -x c++ - -o /dev/null \ |
|
|
|
|
-ltcmalloc 2>/dev/null; then |
|
|
|
@ -319,6 +349,7 @@ EOF |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_MALLOC_USABLE_SIZE; then |
|
|
|
|
# Test whether malloc_usable_size is available |
|
|
|
|
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
#include <malloc.h> |
|
|
|
@ -330,7 +361,9 @@ EOF |
|
|
|
|
if [ "$?" = 0 ]; then |
|
|
|
|
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_MALLOC_USABLE_SIZE" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_PTHREAD_MUTEX_ADAPTIVE_NP; then |
|
|
|
|
# Test whether PTHREAD_MUTEX_ADAPTIVE_NP mutex type is available |
|
|
|
|
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
#include <pthread.h> |
|
|
|
@ -342,7 +375,9 @@ EOF |
|
|
|
|
if [ "$?" = 0 ]; then |
|
|
|
|
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_BACKTRACE; then |
|
|
|
|
# Test whether backtrace is available |
|
|
|
|
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
#include <execinfo.h>> |
|
|
|
@ -369,7 +404,9 @@ EOF |
|
|
|
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -lexecinfo" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_PG; then |
|
|
|
|
# Test if -pg is supported |
|
|
|
|
$CXX $CFLAGS -pg -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
int main() { |
|
|
|
@ -379,7 +416,9 @@ EOF |
|
|
|
|
if [ "$?" = 0 ]; then |
|
|
|
|
PROFILING_FLAGS=-pg |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_SYNC_FILE_RANGE; then |
|
|
|
|
# Test whether sync_file_range is supported for compatibility with an old glibc |
|
|
|
|
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
#include <fcntl.h> |
|
|
|
@ -391,7 +430,9 @@ EOF |
|
|
|
|
if [ "$?" = 0 ]; then |
|
|
|
|
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_RANGESYNC_PRESENT" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! test $ROCKSDB_DISABLE_SCHED_GETCPU; then |
|
|
|
|
# Test whether sched_getcpu is supported |
|
|
|
|
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF |
|
|
|
|
#include <sched.h> |
|
|
|
@ -403,6 +444,7 @@ EOF |
|
|
|
|
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_SCHED_GETCPU_PRESENT" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# TODO(tec): Fix -Wshorten-64-to-32 errors on FreeBSD and enable the warning. |
|
|
|
|
# -Wshorten-64-to-32 breaks compilation on FreeBSD i386 |
|
|
|
|