##===----------------------------------------------------------------------===##
if test $# -lt 1 ; then
- echo "Usage: llvmdo [-dirs "DIRNAMES..."] PROGRAM ARGS...";
- exit 1;
+ echo "Usage: llvmdo [-dirs "DIRNAMES..."] PROGRAM ARGS..."
+ exit 1
fi
if test "$1" = "-dirs" ; then
elif test -z "$LLVMDO_DIRS" ; then
LLVMDO_DIRS="include lib tools utils runtime autoconf docs test examples projects"
fi
+if test "$1" = "" ; then
+ echo "Missing program name to run"
+ exit 1
+fi
+
PROGRAM=`which $1`
if test ! -x "$PROGRAM" ; then
echo "Can't execute $1"
exit 1
fi
shift;
-TOPDIR=`pwd | sed -e 's#\(.*/llvm[0-9]*\).*#\1#'`
+
+TOPDIR=`llvm-config --src-root`
+
if test -d "$TOPDIR" ; then
cd $TOPDIR
case `uname -s` in
# details.
##===----------------------------------------------------------------------===##
-TOPDIR=`pwd | sed -e 's#\(.*/llvm[0-9]*\).*#\1#'`
-echo $TOPDIR
+TOPDIR=`llvm-config --src-root`
if test -d "$TOPDIR" ; then
cd $TOPDIR
case `uname -s` in