Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/1003471ce94d752eda3977c9fa07cbe32ac149f2

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

commit 1003471ce94d752eda3977c9fa07cbe32ac149f2
Author: Ian Lynagh <[email protected]>
Date:   Tue Jun 21 00:58:32 2011 +0100

    Move some Windows special-casing out of the compiler
    
    This is a little cleaner, and removes a barrier to cross-compiling
    to/from Windows. There are a few more tools that still need to be
    handled in the same way.

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

 compiler/main/SysTools.lhs |   15 ++++++++++-----
 configure.ac               |   13 +++++++++++++
 settings.in                |    4 ++--
 3 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index e40312c..edc580c 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -173,7 +173,14 @@ initSysTools mbMinusB
                             pgmError ("Can't parse " ++ show settingsFile)
         ; let getSetting key = case lookup key mySettings of
                                Just xs ->
-                                   return xs
+                                   return $ case stripPrefix "$topdir" xs of
+                                            Just [] ->
+                                                top_dir
+                                            Just xs'@(c:_)
+                                             | isPathSeparator c ->
+                                                top_dir ++ xs'
+                                            _ ->
+                                                xs
                                Nothing -> pgmError ("No entry for " ++ show 
key ++ " in " ++ show settingsFile)
         ; myExtraGccViaCFlags <- getSetting "GCC extra via C opts"
         -- On Windows, mingw is distributed with GHC,
@@ -181,10 +188,8 @@ initSysTools mbMinusB
         -- It would perhaps be nice to be able to override this
         -- with the settings file, but it would be a little fiddly
         -- to make that possible, so for now you can't.
-        ; gcc_prog <- if isWindowsHost then return $ installed_mingw_bin "gcc"
-                                       else getSetting "C compiler command"
-        ; gcc_args_str <- if isWindowsHost then return []
-                                           else getSetting "C compiler flags"
+        ; gcc_prog <- getSetting "C compiler command"
+        ; gcc_args_str <- getSetting "C compiler flags"
         ; let gcc_args = map Option (words gcc_args_str)
         ; perl_path <- if isWindowsHost
                        then return $ installed_perl_bin "perl"
diff --git a/configure.ac b/configure.ac
index b634bbf..680456d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,6 +207,7 @@ AC_CANONICAL_TARGET
 
 FPTOOLS_SET_PLATFORM_VARS
 
+windows=NO
 exeext=''
 soext='.so'
 case $host in
@@ -216,6 +217,7 @@ case $host in
     exit 1
     ;;
 *-unknown-mingw32)
+    windows=YES
     exeext='.exe'
     soext='.dll'
     ;;
@@ -570,6 +572,17 @@ AC_SUBST(CONF_CPP_OPTS_STAGE0)
 AC_SUBST(CONF_CPP_OPTS_STAGE1)
 AC_SUBST(CONF_CPP_OPTS_STAGE2)
 
+if test "$windows" = YES
+then
+    SettingsCCompilerCommand='$topdir/../mingw/bin/gcc.exe'
+    SettingsCCompilerFlags=''
+else
+    SettingsCCompilerCommand="$WhatGccIsCalled"
+    SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2"
+fi
+AC_SUBST(SettingsCCompilerCommand)
+AC_SUBST(SettingsCCompilerFlags)
+
 dnl ** figure out how to do context diffs
 FP_PROG_CONTEXT_DIFF
 
diff --git a/settings.in b/settings.in
index 5d4e1d3..a82bd35 100644
--- a/settings.in
+++ b/settings.in
@@ -1,6 +1,6 @@
 [("GCC extra via C opts", "@GccExtraViaCOpts@"),
- ("C compiler command", "@WhatGccIsCalled@"),
- ("C compiler flags", "@CONF_CC_OPTS_STAGE2@"),
+ ("C compiler command", "@SettingsCCompilerCommand@"),
+ ("C compiler flags", "@SettingsCCompilerFlags@"),
  ("ar command", "@ArCmd@"),
  ("ar flags", "@ArArgs@"),
  ("ar supports at file", "@ArSupportsAtFile@"),



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to