aboutsummaryrefslogtreecommitdiff
path: root/src/leveldb/build_detect_platform
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-08-18 00:58:04 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2013-08-18 00:58:04 +0200
commit4a9a8f3f48f7820cff2964489f09a34160b1671b (patch)
tree417244fb281fca8d19efcbbae5fa6d371ff89ba4 /src/leveldb/build_detect_platform
parent317f57ec87da566ee2ae648853a9105a4136efef (diff)
parent84d6d69fc69662b2709fffbeaf3c3b4f53c535b1 (diff)
Merge commit '84d6d69fc69662b2709fffbeaf3c3b4f53c535b1'
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"