summaryrefslogtreecommitdiff
path: root/build_tools
diff options
context:
space:
mode:
authorAdam Retter <adam.retter@googlemail.com>2018-04-02 23:45:39 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-04-02 23:57:41 -0700
commit12b400e814977a82a384af62d9c02610954b0648 (patch)
tree0c181148ba1fcd72acb9d815ddd50f123236add8 /build_tools
parent04c11b867df9190da204e38357a14d20296fb244 (diff)
Some small improvements to the build_tools
Summary: Closes https://github.com/facebook/rocksdb/pull/3664 Differential Revision: D7459433 Pulled By: sagar0 fbshipit-source-id: 3817e5d45fc70e83cb26f9800eaa0f4566c8dc0e
Diffstat (limited to 'build_tools')
-rwxr-xr-xbuild_tools/build_detect_platform24
-rwxr-xr-xbuild_tools/version.sh2
2 files changed, 19 insertions, 7 deletions
diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform
index 743082485..480e7a962 100755
--- a/build_tools/build_detect_platform
+++ b/build_tools/build_detect_platform
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
#
# Detects OS we're compiling on and outputs a file specified by the first
# argument, which in turn gets read while processing Makefile.
@@ -66,11 +66,23 @@ rm -f "$OUTPUT"
touch "$OUTPUT"
if test -z "$CC"; then
- CC=cc
+ if [ -x "$(command -v cc)" ]; then
+ CC=cc
+ elif [ -x "$(command -v clang)" ]; then
+ CC=clang
+ else
+ CC=cc
+ fi
fi
if test -z "$CXX"; then
- CXX=g++
+ if [ -x "$(command -v g++)" ]; then
+ CXX=g++
+ elif [ -x "$(command -v clang++)" ]; then
+ CXX=clang++
+ else
+ CXX=g++
+ fi
fi
# Detect OS
@@ -87,7 +99,7 @@ if test -z "$CLANG_SCAN_BUILD"; then
fi
if test -z "$CLANG_ANALYZER"; then
- CLANG_ANALYZER=$(which clang++ 2> /dev/null)
+ CLANG_ANALYZER=$(command -v clang++ 2> /dev/null)
fi
if test -z "$FIND"; then
@@ -498,9 +510,9 @@ if test -z "$PORTABLE"; then
elif test -n "`echo $TARGET_ARCHITECTURE | grep ^arm`"; then
# TODO: Handle this with approprite options.
COMMON_FLAGS="$COMMON_FLAGS"
- elif [ "$TARGET_OS" == IOS ]; then
+ elif [ "$TARGET_OS" == "IOS" ]; then
COMMON_FLAGS="$COMMON_FLAGS"
- elif [ "$TARGET_OS" != AIX ] && [ "$TARGET_OS" != SunOS ]; then
+ elif [ "$TARGET_OS" != "AIX" ] && [ "$TARGET_OS" != "SunOS" ]; then
COMMON_FLAGS="$COMMON_FLAGS -march=native "
elif test "$USE_SSE"; then
COMMON_FLAGS="$COMMON_FLAGS -msse4.2 -mpclmul"
diff --git a/build_tools/version.sh b/build_tools/version.sh
index f3ca98cf6..4e3b9f20d 100755
--- a/build_tools/version.sh
+++ b/build_tools/version.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
if [ "$#" = "0" ]; then
echo "Usage: $0 major|minor|patch|full"
exit 1