Better handling of find llvm tools. Use IFS as opposed to more hacky tr
authorDavid Terei <davidterei@gmail.com>
Wed, 20 Feb 2013 12:05:50 +0000 (04:05 -0800)
committerDavid Terei <davidterei@gmail.com>
Wed, 20 Feb 2013 12:07:12 +0000 (04:07 -0800)
approach. This way can handle spaces in paths.

aclocal.m4

index deedafe..b38418b 100644 (file)
@@ -1963,9 +1963,16 @@ AC_DEFUN([XCODE_VERSION],[
 #
 AC_DEFUN([FIND_LLVM_PROG],[
     FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [$2], [$3])
-    if test "$$1" == ""; then
-        GOOD_PATH=`echo $PATH | tr ':,;' '   '`
-        $1=`${FindCmd} ${GOOD_PATH} -type f -perm +111 -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' -or -type l -perm +111 -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' | ${SortCmd} -n | tail -1`
+    if test "$$1" != ""; then
+        save_IFS=$IFS
+        IFS=":;"
+        for p in ${PATH}; do
+            $1=`${FindCmd} ${p} -type f -perm +111 -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' -or -type l -perm +111 -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' | ${SortCmd} -n | tail -1`
+            if test -n "${LLC}"; then
+                break
+            fi
+        done
+        IFS=$save_IFS
     fi
 ])