[commit: ghc] ghc-7.8: --with-gcc overrides CC_STAGE0 when not cross-compiling (#8498) (4395a06)

git at git.haskell.org git at git.haskell.org
Mon Apr 14 13:53:16 UTC 2014


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

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/4395a0624e1eac71bf891f2633cf92754267a604/ghc

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

commit 4395a0624e1eac71bf891f2633cf92754267a604
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Thu Mar 20 15:47:18 2014 +0000

    --with-gcc overrides CC_STAGE0 when not cross-compiling (#8498)
    
    (cherry picked from commit 6189c7674fc5c735db1a446d0b222369a3767369)


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

4395a0624e1eac71bf891f2633cf92754267a604
 aclocal.m4   |   18 +++++++++++++++++-
 configure.ac |    7 ++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index c2a7ba2..be38031 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -643,6 +643,10 @@ AC_ARG_WITH($2,
     else
         $1=$withval
     fi
+
+    # Remember that we set this manually.  Used to override CC_STAGE0
+    # and friends later, if we are not cross-compiling.
+    With_$2=$withval
 ],
 [
     if test "$HostOS" != "mingw32"
@@ -685,6 +689,10 @@ AC_ARG_WITH($2,
     else
         $1=$withval
     fi
+
+    # Remember that we set this manually.  Used to override CC_STAGE0
+    # and friends later, if we are not cross-compiling.
+    With_$2=$withval
 ],
 [
     if test "$HostOS" != "mingw32"
@@ -2058,7 +2066,8 @@ AC_DEFUN([FIND_GCC],[
         $1="$CC"
     else
         FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [$2], [$3])
-        # From Xcode 5 on, OS X command line tools do not include gcc anymore. Use clang.
+        # From Xcode 5 on, OS X command line tools do not include gcc
+        # anymore. Use clang.
         if test -z "$$1"
         then
             FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [clang], [clang])
@@ -2071,4 +2080,11 @@ AC_DEFUN([FIND_GCC],[
     AC_SUBST($1)
 ])
 
+AC_DEFUN([MAYBE_OVERRIDE_STAGE0],[
+  if test ! -z "$With_$1" -a "$CrossCompiling" != "YES"; then
+      AC_MSG_NOTICE([Not cross-compiling, so --with-$1 also sets $2])
+      $2=$With_$1
+  fi
+])
+
 # LocalWords:  fi
diff --git a/configure.ac b/configure.ac
index 4428dfd..d6477d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -474,6 +474,11 @@ FIND_GCC([WhatGccIsCalled], [gcc], [gcc])
 CC="$WhatGccIsCalled"
 export CC
 
+# If --with-gcc was used, and we're not cross-compiling, then it also
+# applies to the stage0 compiler.
+MAYBE_OVERRIDE_STAGE0([gcc],[CC_STAGE0])
+MAYBE_OVERRIDE_STAGE0([ar],[AR_STAGE0])
+
 dnl ** Which ld to use?
 dnl --------------------------------------------------------------
 FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld])
@@ -584,8 +589,8 @@ FP_PROG_LD_FILELIST
 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
 FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
-# Stage 3 won't be supported by cross-compilation
 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
+# Stage 3 won't be supported by cross-compilation
 
 FP_GCC_EXTRA_FLAGS
 



More information about the ghc-commits mailing list