[commit: ghc] master: Find LLVM tools when version number at end (e.g., llc-3.0) (#7661) (64aaaa1)
David Terei
davidterei at gmail.com
Thu Feb 14 04:11:11 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/64aaaa19aa32c69a13daa375c8316041a44eed5c
>---------------------------------------------------------------
commit 64aaaa19aa32c69a13daa375c8316041a44eed5c
Author: David Terei <davidterei at gmail.com>
Date: Sun Feb 10 23:24:27 2013 -0800
Find LLVM tools when version number at end (e.g., llc-3.0) (#7661)
>---------------------------------------------------------------
aclocal.m4 | 37 +++++++++++++++++++++++++++++++++++++
configure.ac | 7 +++++--
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index eb57cbe..fca0304 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1219,6 +1219,26 @@ AC_SUBST([FindCmd])[]dnl
])# FP_PROG_FIND
+# FP_PROG_SORT
+# ------------
+# Find a Unix-like sort
+AC_DEFUN([FP_PROG_SORT],
+[AC_PATH_PROG([fp_prog_sort], [sort])
+echo conwip > conftest.txt
+$fp_prog_sort -f conftest.txt > conftest.out 2>&1
+if grep 'conwip' conftest.out > /dev/null 2>&1 ; then
+ # The goods
+ SortCmd="$fp_prog_sort"
+else
+ # Summink else..pick next one.
+ AC_MSG_WARN([$fp_prog_sort looks like a non-*nix sort, ignoring it])
+ FP_CHECK_PROG([SortCmd], [sort], [], [], [$fp_prog_sort])
+fi
+rm -f conftest.txt conftest.out
+AC_SUBST([SortCmd])[]dnl
+])# FP_PROG_SORT
+
+
dnl
dnl FPTOOLS_NOCACHE_CHECK prints a message, then sets the
dnl values of the second argument to the result of running
@@ -1960,6 +1980,23 @@ AC_DEFUN([XCODE_VERSION],[
fi
])
+# FIND_LLVM_PROG()
+# --------------------------------
+# Find where the llvm tools are. We have a special function to handle when they
+# are installed with a version suffix (e.g., llc-3.1).
+#
+# $1 = the variable to set
+# $2 = the with option name
+# $3 = the command to look for
+#
+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]]' | ${SortCmd} -n | tail -1`
+ fi
+])
+
# FIND_GCC()
# --------------------------------
# Finds where gcc is
diff --git a/configure.ac b/configure.ac
index 9409900..3aa8676 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,6 +39,7 @@ dnl ** which are needed by FP_SETUP_PROJECT_VERSION
dnl ** Find find command (for Win32's benefit)
FP_PROG_FIND
+FP_PROG_SORT
dnl ----------------------------------------------------------
FP_SETUP_PROJECT_VERSION
@@ -505,13 +506,13 @@ esac
dnl ** Which LLVM llc to use?
dnl --------------------------------------------------------------
-FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([LLC], [llc], [llc])
+FIND_LLVM_PROG([LLC], [llc], [llc])
LlcCmd="$LLC"
AC_SUBST([LlcCmd])
dnl ** Which LLVM opt to use?
dnl --------------------------------------------------------------
-FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([OPT], [opt], [opt])
+FIND_LLVM_PROG([OPT], [opt], [opt])
OptCmd="$OPT"
AC_SUBST([OptCmd])
@@ -1001,6 +1002,8 @@ echo ["\
which is version : $GccVersion
Building a cross compiler : $CrossCompiling
+ llc : $LlcCmd
+ opt : $OptCmd
ld : $LdCmd
Happy : $HappyCmd ($HappyVersion)
Alex : $AlexCmd ($AlexVersion)
More information about the ghc-commits
mailing list