aboutsummaryrefslogtreecommitdiff
path: root/src/leveldb/build_detect_platform
diff options
context:
space:
mode:
Diffstat (limited to 'src/leveldb/build_detect_platform')
-rwxr-xr-xsrc/leveldb/build_detect_platform12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/leveldb/build_detect_platform b/src/leveldb/build_detect_platform
index a3ad057eee..bdfd64172c 100755
--- a/src/leveldb/build_detect_platform
+++ b/src/leveldb/build_detect_platform
@@ -44,6 +44,10 @@ if test -z "$CXX"; then
CXX=g++
fi
+if test -z "$TMPDIR"; then
+ TMPDIR=/tmp
+fi
+
# Detect OS
if test -z "$TARGET_OS"; then
TARGET_OS=`uname -s`
@@ -169,8 +173,10 @@ if [ "$CROSS_COMPILE" = "true" ]; then
# Cross-compiling; do not try any compilation tests.
true
else
+ CXXOUTPUT="${TMPDIR}/leveldb_build_detect_platform-cxx.$$"
+
# If -std=c++0x works, use <cstdatomic>. Otherwise use port_posix.h.
- $CXX $CXXFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
+ $CXX $CXXFLAGS -std=c++0x -x c++ - -o $CXXOUTPUT 2>/dev/null <<EOF
#include <cstdatomic>
int main() {}
EOF
@@ -182,12 +188,14 @@ EOF
fi
# Test whether tcmalloc is available
- $CXX $CXXFLAGS -x c++ - -o /dev/null -ltcmalloc 2>/dev/null <<EOF
+ $CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT -ltcmalloc 2>/dev/null <<EOF
int main() {}
EOF
if [ "$?" = 0 ]; then
PLATFORM_LIBS="$PLATFORM_LIBS -ltcmalloc"
fi
+
+ rm -f $CXXOUTPUT 2>/dev/null
fi
PLATFORM_CCFLAGS="$PLATFORM_CCFLAGS $COMMON_FLAGS"