[commit: ghc] master: configure: Fix CC version check on Apple compilers (71a4235)

git at git.haskell.org git at git.haskell.org
Mon Oct 16 21:26:47 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/71a423562a555ef0805bba546a3a42d437803842/ghc

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

commit 71a423562a555ef0805bba546a3a42d437803842
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Oct 10 16:09:39 2017 -0400

    configure: Fix CC version check on Apple compilers
    
    It seems that some Apple LLVM wrappers emit multiple messages containing
    the string "version", which we previously used to find the version
    number.  For instance,
    
        Configured with: --prefix=/Applications/Xcode.app/Contents/...
        Apple LLVM version 9.0.0 (clang-900.0.37)
        Target: x86_64-apple-darwin16.7.0
        Thread model: posix
        InstalledDir: /Applications/Xcode.app/Contents/Developer/...
        Found CUDA installation: /usr/local/cuda, version 8.0
    
    We now take care to only look at the first occurrence of this string.
    
    New `sed` command due to @merijn.
    
    Test Plan: Validate on all the compilers
    
    Reviewers: austin, hvr
    
    Subscribers: rwbarton, thomie, merijn, erikd
    
    Differential Revision: https://phabricator.haskell.org/D4069


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

71a423562a555ef0805bba546a3a42d437803842
 aclocal.m4 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 7e1e3e1..64fa8bf 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1234,7 +1234,9 @@ GccLT44=NO
 GccLT46=NO
 AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version],
 [
-    fp_cv_gcc_version="`$CC -v 2>&1 | grep 'version ' | sed -e 's/.*version [[^0-9]]*\([[0-9.]]*\).*/\1/g'`"
+    # Be sure only to look at the first occurrence of the "version " string;
+    # Some Apple compilers emit multiple messages containing this string.
+    fp_cv_gcc_version="`$CC -v 2>&1 | sed -n -e '1,/version /s/.*version [[^0-9]]*\([[0-9.]]*\).*/\1/p'`"
     FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [3.0],
                         [AC_MSG_ERROR([Need at least gcc version 3.0 (3.4+ recommended)])])
     # See #2770: gcc 2.95 doesn't work any more, apparently.  There probably



More information about the ghc-commits mailing list