diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2015-03-20 12:16:23 +1100 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2015-03-24 08:53:46 +1100 |
commit | 42448e3757f25735a0a5b5e2b7ee456b5e8b0039 (patch) | |
tree | 1694578206b2b111472aa6dd843a6d0792c6cfd9 /aclocal.m4 | |
parent | aef4de4765187ba85b8a08de83c245c6bc8e372e (diff) | |
download | haskell-42448e3757f25735a0a5b5e2b7ee456b5e8b0039.tar.gz |
Do version specific detection of LLVM tools (#10170).
The LLVM developers seem to make breaking changes in the LLVM IR
language between major releases. As a consumer of the LLVM tools
GHC now needs to be locked more tightly to a single version of
the LLVM tools.
GHC HEAD currently only supports LLVM version 3.6. This commit
changes the configure script to look for `llc-3.6` and `opt-3.6`
before looking for `llc` and `opt`. If the former are not found,
but the later are, check that they actually are version 3.6.
At the same time, when detecting known problems with the LLVM
tools (ie #9439) test for it using the versions of the LLVM tools
retrieved from the bootstrap compiler's settings file.
Test Plan: Manual testing.
Reviewers: thomie, rwbarton, nomeata, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D745
GHC Trac Issues: #10170
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 871dacc370..5726a3feec 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2096,38 +2096,43 @@ AC_DEFUN([XCODE_VERSION],[ # $1 = the variable to set # $2 = the with option name # $3 = the command to look for +# $4 = the version of the command to look for # AC_DEFUN([FIND_LLVM_PROG],[ - FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) + # Test for program with version name. + FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3-$4]) if test "$$1" = ""; then - echo -n "checking for $3-x.x... " - save_IFS=$IFS - IFS=":;" - if test "$windows" = YES; then - PERM= - MODE= + # Test for program without version name. + FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) + AC_MSG_CHECKING([$$1 is version $4]) + if test `$$1 --version | grep -c "version $4"` -gt 0 ; then + AC_MSG_RESULT(yes) else - # Search for executables. - PERM="-perm" - MODE="/+x" - fi - for p in ${PATH}; do - if test -d "${p}"; then - $1=`${FindCmd} "${p}" -maxdepth 1 \( -type f -o -type l \) ${PERM} ${MODE} -regex ".*/$3-[[0-9]]\.[[0-9]]" | ${SortCmd} -n | tail -1` - if test -n "$$1"; then - break - fi - fi - done - IFS=$save_IFS - if test -n "$$1"; then - echo "$$1" - else - echo "no" - fi + AC_MSG_RESULT(no) + $1="" + fi fi ]) +# FIND_GHC_BOOTSTRAP_PROG() +# -------------------------------- +# Parse the bootstrap GHC's compier settings file for the location of things +# like the `llc` and `opt` commands. +# +# $1 = the variable to set +# $2 = The bootstrap compiler. +# $3 = The string to grep for to find the correct line. +# +AC_DEFUN([FIND_GHC_BOOTSTRAP_PROG],[ + BootstrapTmpCmd=`grep $3 $($2 --print-libdir)/settings 2>/dev/null | sed 's/.*", "//;s/".*//'` + if test -n "$BootstrapTmpCmd" && test `basename $BootstrapTmpCmd` = $BootstrapTmpCmd ; then + AC_PATH_PROG([$1], [$BootstrapTmpCmd], "") + else + $1=$BootstrapTmpCmd + fi +]) + + # FIND_GCC() # -------------------------------- # Finds where gcc is |