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"
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 \
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