From 225f50ea9626b9a2813820cf1e03bb82f337f959 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 2 Nov 2011 14:07:32 -0700 Subject: [PATCH] Begin remove old LLVM configuration code --- configure | 150 +++++++++++++++++++----------------------------------- 1 file changed, 53 insertions(+), 97 deletions(-) diff --git a/configure b/configure index 3a5017a59c7..ebdea8c89be 100755 --- a/configure +++ b/configure @@ -306,50 +306,20 @@ fi if [ ! -z "$CFG_LLVM_ROOT" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ] then - CFG_LLVM_CONFIG="$CFG_LLVM_ROOT/bin/llvm-config" -fi + step_msg "using custom LLVM" -if [ ! -z "$CFG_LLVM_ROOT" -a -z "$CFG_LLVM_CONFIG" ] -then - CFG_LLVM_INCDIR="$CFG_LLVM_ROOT/include" - CFG_LLVM_BINDIR="$CFG_LLVM_ROOT/bin" - CFG_LLVM_LIBDIR="$CFG_LLVM_ROOT/lib" - CFG_LLVM_CXXFLAGS="-I$CFG_LLVM_INCDIR" - CFG_LLVM_LDFLAGS="" - CFG_LLVM_LIBS=$(find "$CFG_LLVM_LIBDIR" \ - -name '*.lib' \ - -exec echo '\"{}\"' ';' \ - | xargs echo) - CFG_LLVM_VERSION=$("$CFG_LLVM_BINDIR/llc" \ - --version \ - | grep version \ - | cut -d ' ' -f 5-) - CFG_LLVM_TRIPLE=$("$CFG_LLVM_BINDIR/llc" \ - --version \ - | grep Host: \ - | cut -d ' ' -f 4-) -elif [ ! -z "$CFG_LLVM_CONFIG" ] -then - CFG_LLVM_VERSION=$($CFG_LLVM_CONFIG --version) - CFG_LLVM_INCDIR=$($CFG_LLVM_CONFIG --includedir) - CFG_LLVM_BINDIR=$($CFG_LLVM_CONFIG --bindir) - CFG_LLVM_LIBDIR=$($CFG_LLVM_CONFIG --libdir) - CFG_LLVM_CXXFLAGS=$($CFG_LLVM_CONFIG --cxxflags) - CFG_LLVM_LDFLAGS=$($CFG_LLVM_CONFIG --ldflags) - CFG_LLVM_LIBS=$($CFG_LLVM_CONFIG --libs) - CFG_LLVM_TRIPLE=$($CFG_LLVM_CONFIG --host-target) -else - err "no llvm-config found and no --llvm-root specified" -fi + LLVM_CONFIG="$CFG_LLVM_ROOT/bin/llvm-config" + LLVM_VERSION=$($CFG_LLVM_CONFIG --version) -case $CFG_LLVM_VERSION in - (3.0svn | 3.0 | 3.1svn) - step_msg "found ok version of LLVM: $CFG_LLVM_VERSION" - ;; - (*) - err "bad LLVM version: $CFG_LLVM_VERSION, need >=3.0svn" - ;; -esac + case $LLVM_VERSION in + (3.0svn | 3.0 | 3.1svn) + step_msg "found ok version of LLVM: $CFG_LLVM_VERSION" + ;; + (*) + err "bad LLVM version: $CFG_LLVM_VERSION, need >=3.0svn" + ;; + esac +fi if [ ! -z "$CFG_ENABLE_CLANG" ] then @@ -381,18 +351,6 @@ then CFG_PREFIX=/usr/local fi -if [ ! -z "$CFG_LLVM_TRIPLE" ] -then - if [ $CFG_HOST_TRIPLE != $CFG_LLVM_TRIPLE ] - then - warn "LLVM host-triple $CFG_LLVM_TRIPLE differs from" - warn "detected host triple $CFG_HOST_TRIPLE" - warn "choosing LLVM host-triple instead" - msg "" - CFG_HOST_TRIPLE=$CFG_LLVM_TRIPLE - fi -fi - if [ -z "$CFG_TARGET_TRIPLES" ] then CFG_TARGET_TRIPLES="${CFG_HOST_TRIPLE}" @@ -405,14 +363,6 @@ putvar CFG_C_COMPILER putvar CFG_PREFIX putvar CFG_LLVM_ROOT -putvar CFG_LLVM_CONFIG -putvar CFG_LLVM_INCDIR -putvar CFG_LLVM_BINDIR -putvar CFG_LLVM_LIBDIR -putvar CFG_LLVM_CXXFLAGS -putvar CFG_LLVM_LDFLAGS -putvar CFG_LLVM_LIBS -putvar CFG_LLVM_TRIPLE step_msg "making directories" @@ -494,53 +444,59 @@ msg # Configure llvm. Here we go... -step_msg "configuring LLVM" - CFG_LLVM_SRC_DIR=${CFG_SRC_DIR}src/llvm CFG_LLVM_BUILD_DIR=${CFG_BUILD_DIR}/llvm # Just use LLVM straight from its build directory to avoid 'make install' time CFG_LLVM_INST_DIR=${CFG_LLVM_BUILD_DIR}/Release+Asserts -LLVM_TARGETS="--enable-targets=x86,x86_64" -LLVM_BUILD="--build=${CFG_HOST_TRIPLE}" -LLVM_HOST="--host=${CFG_HOST_TRIPLE}" -LLVM_TARGET="--target=${CFG_HOST_TRIPLE}" -LLVM_OPTS="--enable-optimized --disable-docs" +if [ -z $CFG_LLVM_ROOT ] +then + step_msg "configuring LLVM" -LLVM_CXX_32="g++ -m32" -LLVM_CC_32="gcc -m32" -LLVM_CFLAGS_32="-m32" -LLVM_CXXFLAGS_32="-m32" -LLVM_LDFLAGS_32="-m32" + LLVM_TARGETS="--enable-targets=x86,x86_64" + LLVM_BUILD="--build=${CFG_HOST_TRIPLE}" + LLVM_HOST="--host=${CFG_HOST_TRIPLE}" + LLVM_TARGET="--target=${CFG_HOST_TRIPLE}" + LLVM_OPTS="--enable-optimized --disable-docs" -# FIXME: Need to change flags for x64 -LLVM_CXX=$LLVM_CXX_32 -LLVM_CC=$LLVM_CC_32 -LLVM_CFLAGS=$LLVM_CFLAGS_32 -LLVM_CXXFLAGS=$LLVM_CXXFLAGS_32 -LLVM_LDFLAGS=$LLVM_LDFLAGS_32 + LLVM_CXX_32="g++ -m32" + LLVM_CC_32="gcc -m32" + LLVM_CFLAGS_32="-m32" + LLVM_CXXFLAGS_32="-m32" + LLVM_LDFLAGS_32="-m32" -CXX=$LLVM_CXX -CC=$LLVM_CC -CFLAGS=$LLVM_CFLAGS -CXXFLAGS=$LLVM_CXXFLAGS -LDFLAGS=$LLVM_LDFLAGS + # FIXME: Need to change flags for x64 + LLVM_CXX=$LLVM_CXX_32 + LLVM_CC=$LLVM_CC_32 + LLVM_CFLAGS=$LLVM_CFLAGS_32 + LLVM_CXXFLAGS=$LLVM_CXXFLAGS_32 + LLVM_LDFLAGS=$LLVM_LDFLAGS_32 -LLVM_FLAGS="$LLVM_TARGETS $LLVM_OPTS $LLVM_BUILD $LLVM_HOST $LLVM_TARGET" + CXX=$LLVM_CXX + CC=$LLVM_CC + CFLAGS=$LLVM_CFLAGS + CXXFLAGS=$LLVM_CXXFLAGS + LDFLAGS=$LLVM_LDFLAGS -msg "configuring LLVM with:" -msg "$LLVM_FLAGS" + LLVM_FLAGS="$LLVM_TARGETS $LLVM_OPTS $LLVM_BUILD $LLVM_HOST $LLVM_TARGET" -export CXX -export CC -export CFLAGS -export CXXFLAGS -export LDFLAGS + msg "configuring LLVM with:" + msg "$LLVM_FLAGS" -cd $CFG_LLVM_BUILD_DIR -# FIXME: This won't work if CFG_SRC_DIR is absolute -${CFG_BUILD_DIR}/${CFG_LLVM_SRC_DIR}/configure $LLVM_FLAGS -cd $CFG_BUILD_DIR + export CXX + export CC + export CFLAGS + export CXXFLAGS + export LDFLAGS + + cd $CFG_LLVM_BUILD_DIR + # FIXME: This won't work if CFG_SRC_DIR is absolute + ${CFG_BUILD_DIR}/${CFG_LLVM_SRC_DIR}/configure $LLVM_FLAGS + cd $CFG_BUILD_DIR +else + # The user is using their own LLVM + CFG_LLVM_INST_DIR=$CFG_LLVM_ROOT +fi putvar CFG_LLVM_SRC_DIR putvar CFG_LLVM_BUILD_DIR