diff mbox

sparse{i,c}: use LLVM_CONFIG to find llc and lli

Message ID 1397591489-17411-1-git-send-email-cody@linux.vnet.ibm.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

cody@linux.vnet.ibm.com April 15, 2014, 7:51 p.m. UTC
Some systems have multiple llvm versions installed, and have prefixed
executables ("<exec>-<version>"). While we could require the user to
specify a variable for each executable (LLC, LLI), using llvm-config
--bindir to locate them and allowing them to override using LLVM_CONFIG
makes much less work.

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
---
 sparsec | 6 +++++-
 sparsei | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/sparsec b/sparsec
index 9c90b30..f8e7256 100755
--- a/sparsec
+++ b/sparsec
@@ -34,7 +34,11 @@  TMPFILE=`mktemp -t tmp.XXXXXX`".o"
 
 $DIRNAME/sparse-llvm $SPARSEOPTS > $TMPLLVM
 
-llc -o - $TMPLLVM | as -o $TMPFILE
+if [ -z "$LLVM_CONFIG" ]; then
+  LLVM_CONFIG=llvm-config
+fi
+
+`"$LLVM_CONFIG" --bindir`/llc -o - $TMPLLVM | as -o $TMPFILE
 
 if [ $NEED_LINK -eq 1 ]; then
 	if [ -z $OUTFILE ]; then
diff --git a/sparsei b/sparsei
index 4632154..7a2e0f1 100755
--- a/sparsei
+++ b/sparsei
@@ -3,7 +3,10 @@ 
 set +e
 
 DIRNAME=`dirname $0`
-LLI=`llvm-config --bindir`/lli
+if [ -z "$LLVM_CONFIG" ]; then
+    LLVM_CONFIG=llvm-config
+fi
+LLI=`"$LLVM_CONFIG" --bindir`/lli
 
 if [ $# -eq 0 ]; then
   echo "`basename $0`: no input files"