Add ROCKSDB_DISABLE_* environment variables

Summary:
Should fix #3036.
Closes https://github.com/facebook/rocksdb/pull/3042

Differential Revision: D6452921

Pulled By: sagar0

fbshipit-source-id: eaf11e43fee1f8747006530cfc0c7a358f1c2f0f
main
Adam Novak 7 years ago committed by Facebook Github Bot
parent 4634c735a8
commit a37d734596
  1. 44
      build_tools/build_detect_platform

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

Loading…
Cancel
Save