aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStuart Hastings <stuart@apple.com>2009-09-28 22:17:53 +0000
committerStuart Hastings <stuart@apple.com>2009-09-28 22:17:53 +0000
commitdc3d8cc6a62fb42ddde8df9d544828798aa6365b (patch)
treeea56653c23ce5b70e49dd4e6317163a7478a2936
parentec9eef4a15157fc0a05feff933848aa9283bd1af (diff)
downloadexternal_llvm-dc3d8cc6a62fb42ddde8df9d544828798aa6365b.zip
external_llvm-dc3d8cc6a62fb42ddde8df9d544828798aa6365b.tar.gz
external_llvm-dc3d8cc6a62fb42ddde8df9d544828798aa6365b.tar.bz2
For B&I-style builds, tweak build_llvm script to prefer LLVM-G++ if
available. Override by setting CC and CXX in the environment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83024 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-xutils/buildit/build_llvm14
1 files changed, 10 insertions, 4 deletions
diff --git a/utils/buildit/build_llvm b/utils/buildit/build_llvm
index 1c2b480..8d8c755 100755
--- a/utils/buildit/build_llvm
+++ b/utils/buildit/build_llvm
@@ -56,9 +56,6 @@ DIR=`pwd`
DARWIN_VERS=`uname -r | sed 's/\..*//'`
echo DARWIN_VERS = $DARWIN_VERS
-# If the user has CC set in their environment unset it now
-unset CC
-
if [ "x$RC_ProjectName" = "xllvmCore_Embedded" ]; then
DT_HOME=$DEST_DIR/Developer/Platforms/iPhoneOS.platform/Developer/usr
DEST_ROOT="/Developer/Platforms/iPhoneOS.platform/Developer$DEST_ROOT"
@@ -90,6 +87,15 @@ ln -s $ORIG_SRC_DIR/* $SRC_DIR/ || exit 1
mkdir -p $DIR/obj-llvm || exit 1
cd $DIR/obj-llvm || exit 1
+# If the user has set CC or CXX, respect their wishes. If not,
+# compile with LLVM-GCC/LLVM-G++ if available; if LLVM is not
+# available, fall back to usual GCC/G++ default.
+XTMPCC=$(which llvm-gcc)
+if [ x$CC = x -a x$XTMPCC != x ] ; then export CC=$XTMPCC ; fi
+XTMPCC=$(which llvm-g++)
+if [ x$CXX = x -a x$XTMPCC != x ] ; then export CXX=$XTMPCC ; fi
+unset XTMPCC
+
if [ \! -f Makefile.config ]; then
$SRC_DIR/configure --prefix=$DT_HOME/local \
--enable-targets=arm,x86,powerpc,cbe \
@@ -152,7 +158,7 @@ make $JOBS_FLAG $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$TARGETS" \
CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" \
VERBOSE=1
-if ! test $? == 0 ; then
+if [ $? != 0 ] ; then
echo "error: LLVM 'make' failed!"
exit 1
fi