[commit: ghc] ghc-7.10: Fix detection of llvm-x.x (335c025)

git at git.haskell.org git at git.haskell.org
Tue Apr 14 12:53:50 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/335c02562af599434ff42e5f3dac160a76229999/ghc

>---------------------------------------------------------------

commit 335c02562af599434ff42e5f3dac160a76229999
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Mon Mar 2 11:09:33 2015 -0600

    Fix detection of llvm-x.x
    
    Summary:
    Four bug fixes and a little refactoring.
    * `find -perm \mode` should be `find -perm /mode` (#9697)
    
    * `find -regex '$3' should be `find -regex "$3"` (#7661)
    
    From `man sh` on my system (Ubuntu 14.04):
    "Enclosing characters in single quotes preserves the literal meaning of all
    the characters ..."
    
    * LlcCmd and OptCmd should be passed to ghc, using `-pgmlo` and `-pgmlc`, for
      detection of #9439.
    
    * -pgmlo and -pgmlc were undocumented because of an xml tag misplacement.
    
    Test Plan:
    The aclocal.m4 macro has seen about 10 iterations since its inception. Without a
    testsuite, I can't guarantee this version is bug free either. It's all pretty
    frustrating.
    
    Reviewers: bgamari, austin
    
    Reviewed By: austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D683
    
    GHC Trac Issues: #9697, #7661, #9439
    
    (cherry picked from commit 1dfab7a8ace5f09f00f8fb695932b4324e88b822)


>---------------------------------------------------------------

335c02562af599434ff42e5f3dac160a76229999
 aclocal.m4                 | 20 +++++++++++++++-----
 configure.ac               |  4 ++--
 docs/users_guide/flags.xml |  2 +-
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index f3f7406..049a846 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -2100,21 +2100,31 @@ AC_DEFUN([XCODE_VERSION],[
 AC_DEFUN([FIND_LLVM_PROG],[
     FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3])
     if test "$$1" = ""; then
+        echo -n "checking for $3-x.x... "
         save_IFS=$IFS
         IFS=":;"
+        if test "$windows" = YES; then
+            PERM=
+            MODE=
+        else
+            # Search for executables.
+            PERM="-perm"
+            MODE="/+x"
+        fi
         for p in ${PATH}; do
             if test -d "${p}"; then
-                if test "$windows" = YES; then
-                    $1=`${FindCmd} "${p}" -type f -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' -or -type l -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' | ${SortCmd} -n | tail -1`
-                else
-                    $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`
-                fi
+                $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
     fi
 ])
 
diff --git a/configure.ac b/configure.ac
index 4f88de0..b25e3ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -514,7 +514,7 @@ then
     echo "main = putStrLn \"%function\"" > conftestghc.hs
 
     # Check whether LLVM backend is default for this platform
-    "${WithGhc}" conftestghc.hs 2>&1 >/dev/null
+    "${WithGhc}" -pgmlc="${LlcCmd}" -pgmlo="${OptCmd}" conftestghc.hs 2>&1 >/dev/null
     res=`./conftestghc`
     if test "x$res" = "x%object"
     then
@@ -531,7 +531,7 @@ then
 
     # -fllvm is not the default, but set a flag so the Makefile can check
     # -for it in the build flags later on
-    "${WithGhc}" -fforce-recomp -fllvm conftestghc.hs 2>&1 >/dev/null
+    "${WithGhc}" -fforce-recomp -pgmlc="${LlcCmd}" -pgmlo="${OptCmd}" -fllvm conftestghc.hs 2>&1 >/dev/null
     if test $? = 0
     then
         res=`./conftestghc`
diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml
index a7f4473..f019854 100644
--- a/docs/users_guide/flags.xml
+++ b/docs/users_guide/flags.xml
@@ -2722,6 +2722,7 @@
             <entry>Use <replaceable>cmd</replaceable> as the C compiler</entry>
             <entry>dynamic</entry>
             <entry>-</entry>
+          </row>
             <row>
               <entry><option>-pgmlo</option> <replaceable>cmd</replaceable></entry>
               <entry>Use <replaceable>cmd</replaceable> as the LLVM optimiser</entry>
@@ -2734,7 +2735,6 @@
               <entry>dynamic</entry>
               <entry>-</entry>
             </row>
-          </row>
           <row>
             <entry><option>-pgms</option> <replaceable>cmd</replaceable></entry>
             <entry>Use <replaceable>cmd</replaceable> as the splitter</entry>



More information about the ghc-commits mailing list