4545# exit 1
4646# fi
4747
48- # we depend on C++17 , but should be compatible with newer standards
48+ # we depend on C++20 , but should be compatible with newer standards
4949if [ " $ROCKSDB_CXX_STANDARD " ]; then
5050 PLATFORM_CXXFLAGS=" -std=$ROCKSDB_CXX_STANDARD "
5151else
52- PLATFORM_CXXFLAGS=" -std=c++17 "
52+ PLATFORM_CXXFLAGS=" -std=c++20 "
5353fi
5454
5555# we currently depend on POSIX platform
5656COMMON_FLAGS=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX"
5757
58- # Default to fbcode gcc on internal fb machines
59- if [ -z " $ROCKSDB_NO_FBCODE " -a -d /mnt/gvfs/third-party ]; then
58+ # Default to fbcode gcc on Meta internal machines
59+ IS_META_HOST=" $( hostname | grep -E ' (facebook|meta).com|fbinfra.net' ) "
60+ if [ -z " $ROCKSDB_NO_FBCODE " -a " $IS_META_HOST " ]; then
61+ if [ -d /mnt/gvfs/third-party ]; then
62+ echo " NOTE: Using fbcode build" >&2
6063 FBCODE_BUILD=" true"
6164 # If we're compiling with TSAN or shared lib, we need pic build
6265 PIC_BUILD=$COMPILE_WITH_TSAN
6366 if [ " $LIB_MODE " == " shared" ]; then
6467 PIC_BUILD=1
6568 fi
6669 source " $PWD /build_tools/fbcode_config_platform010.sh"
70+ else
71+ echo " ************************************************************************" >&2
72+ echo " WARNING: -d /mnt/gvfs/third-party failed; no fbcode build" >&2
73+ echo " ************************************************************************" >&2
74+ fi
6775fi
6876
6977# Delete existing output, if it exists
7078# rm -f "$OUTPUT"
7179# touch "$OUTPUT"
7280
7381if test -z " $CC " ; then
74- if [ -x " $( command -v cc) " ]; then
82+ if [ " $USE_CLANG " -a -x " $( command -v clang) " ]; then
83+ CC=clang
84+ elif [ -x " $( command -v cc) " ]; then
7585 CC=cc
7686 elif [ -x " $( command -v clang) " ]; then
7787 CC=clang
@@ -81,7 +91,9 @@ if test -z "$CC"; then
8191fi
8292
8393if test -z " $CXX " ; then
84- if [ -x " $( command -v g++) " ]; then
94+ if [ " $USE_CLANG " -a -x " $( command -v clang++) " ]; then
95+ CXX=clang++
96+ elif [ -x " $( command -v g++) " ]; then
8597 CXX=g++
8698 elif [ -x " $( command -v clang++) " ]; then
8799 CXX=clang++
@@ -91,7 +103,9 @@ if test -z "$CXX"; then
91103fi
92104
93105if test -z " $AR " ; then
94- if [ -x " $( command -v gcc-ar) " ]; then
106+ if [ " $USE_CLANG " -a -x " $( command -v llvm-ar) " ]; then
107+ AR=llvm-ar
108+ elif [ -x " $( command -v gcc-ar) " ]; then
95109 AR=gcc-ar
96110 elif [ -x " $( command -v llvm-ar) " ]; then
97111 AR=llvm-ar
360374 fi
361375
362376 if ! test $ROCKSDB_DISABLE_ZSTD ; then
363- # Test whether zstd library is installed
377+ # Test whether zstd library is installed with minimum version
378+ # (Keep in sync with compression.h)
364379 $CXX $PLATFORM_CXXFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2> /dev/null << EOF
365380 #include <zstd.h>
381+ #if ZSTD_VERSION_NUMBER < 10400
382+ #error "ZSTD support requires version >= 1.4.0 (libzstd-devel)"
383+ #endif // ZSTD_VERSION_NUMBER
366384 int main() {}
367385EOF
368386 if [ " $? " = 0 ]; then
0 commit comments