[commit: ghc] ghc-8.0: Drop Xcode 4.1 hack and fix ignored CC var issue (56eaed1)

git at git.haskell.org git at git.haskell.org
Wed Mar 30 19:49:46 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/56eaed1d6c98febf2b3c2f80c0b1e08e13cb8c9f/ghc

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

commit 56eaed1d6c98febf2b3c2f80c0b1e08e13cb8c9f
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Mon Mar 28 12:55:21 2016 +0200

    Drop Xcode 4.1 hack and fix ignored CC var issue
    
    Xcode 4.1 was released back in 2011 for Mac OSX 10.6/10.7.
    However, OSX 10.7 reached EOL sometime around the end of 2014.
    So this `--with-gcc-4.2` hack shouldn't be needed anymore.
    
    Moreover, this patch changes ./configure to honor the CC env-var
    again (and thus fix #11231) while giving `--with-gcc=...` a higher
    priority over `CC=...`.
    
    So the following 3 invocations are equivalent now:
    
      CC=... ./configure
      ./configure CC=...
      ./configure --with-gcc=...
    
    Since `--with-{gcc,clang}=...` is a misnomer (as is made apparent by
    `--with-gcc=clang` or `--with-clang=gcc`), this would give us a neutral
    and idiomatic way to tell ./configure which C compiler to use.
    
    Moreover, `./configure --help` says at the end of its output:
    
      Some influential environment variables:
        CC		C compiler command
        CFLAGS	C compiler flags
        LDFLAGS	linker flags, e.g. -L<lib dir> if you have libraries in a
    		nonstandard directory <lib dir>
        LIBS	libraries to pass to the linker, e.g. -l<library>
        CPPFLAGS	(Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
    		you have headers in a nonstandard directory <include dir>
        CPP		C preprocessor
    
      Use these variables to override the choices made by `configure' or to help
      it to find libraries and programs with nonstandard names/locations.
    
    Consequently, by honoring CC=... (rather than ignoring it) we increase
    consistency and reduce user confusion. Ideally, CC=... would become the
    recommended way to set the C compiler, and `--with-{clang,gcc}=...`
    would be demoted to legacy aliases.
    
    Reviewed By: erikd, bgamari
    
    Differential Revision: https://phabricator.haskell.org/D2046
    
    (cherry picked from commit ffc802e8f617d11de9ece7bed438725bde0300b8)


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

56eaed1d6c98febf2b3c2f80c0b1e08e13cb8c9f
 aclocal.m4 | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index d0e7f3d..18b9529 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -2053,22 +2053,19 @@ AC_DEFUN([FIND_GHC_BOOTSTRAP_PROG],[
 # $2 = the with option name
 # $3 = the command to look for
 AC_DEFUN([FIND_GCC],[
-    if test "$TargetOS_CPP" = "darwin" &&
-       test "$XCodeVersion1" -eq 4 &&
-       test "$XCodeVersion2" -lt 2
-    then
-        # In Xcode 4.1, 'gcc-4.2' is the gcc legacy backend (rather
-        # than the LLVM backend). We prefer the legacy gcc, but in
-        # Xcode 4.2 'gcc-4.2' was removed.
-        FP_ARG_WITH_PATH_GNU_PROG([$1], [gcc-4.2], [gcc-4.2])
-    elif test "$windows" = YES
+    if test "$windows" = YES
     then
         $1="$CC"
     else
         FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [$2], [$3])
+        # fallback to CC if set and no --with-$2=... was used
+        if test -z "$With_$2" -a -n "$CC"
+        then
+            With_$2="$CC"
+            $1="$CC"
         # From Xcode 5 on/, OS X command line tools do not include gcc
         # anymore. Use clang.
-        if test -z "$$1"
+        elif test -z "$$1"
         then
             FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [clang], [clang])
         fi



More information about the ghc-commits mailing list