Commit 1003471c authored by Ian Lynagh's avatar Ian Lynagh

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.
parent 0033d5a4
...@@ -173,7 +173,14 @@ initSysTools mbMinusB ...@@ -173,7 +173,14 @@ initSysTools mbMinusB
pgmError ("Can't parse " ++ show settingsFile) pgmError ("Can't parse " ++ show settingsFile)
; let getSetting key = case lookup key mySettings of ; let getSetting key = case lookup key mySettings of
Just xs -> 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) Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile)
; myExtraGccViaCFlags <- getSetting "GCC extra via C opts" ; myExtraGccViaCFlags <- getSetting "GCC extra via C opts"
-- On Windows, mingw is distributed with GHC, -- On Windows, mingw is distributed with GHC,
...@@ -181,10 +188,8 @@ initSysTools mbMinusB ...@@ -181,10 +188,8 @@ initSysTools mbMinusB
-- It would perhaps be nice to be able to override this -- It would perhaps be nice to be able to override this
-- with the settings file, but it would be a little fiddly -- with the settings file, but it would be a little fiddly
-- to make that possible, so for now you can't. -- to make that possible, so for now you can't.
; gcc_prog <- if isWindowsHost then return $ installed_mingw_bin "gcc" ; gcc_prog <- getSetting "C compiler command"
else getSetting "C compiler command" ; gcc_args_str <- getSetting "C compiler flags"
; gcc_args_str <- if isWindowsHost then return []
else getSetting "C compiler flags"
; let gcc_args = map Option (words gcc_args_str) ; let gcc_args = map Option (words gcc_args_str)
; perl_path <- if isWindowsHost ; perl_path <- if isWindowsHost
then return $ installed_perl_bin "perl" then return $ installed_perl_bin "perl"
......
...@@ -207,6 +207,7 @@ AC_CANONICAL_TARGET ...@@ -207,6 +207,7 @@ AC_CANONICAL_TARGET
FPTOOLS_SET_PLATFORM_VARS FPTOOLS_SET_PLATFORM_VARS
windows=NO
exeext='' exeext=''
soext='.so' soext='.so'
case $host in case $host in
...@@ -216,6 +217,7 @@ case $host in ...@@ -216,6 +217,7 @@ case $host in
exit 1 exit 1
;; ;;
*-unknown-mingw32) *-unknown-mingw32)
windows=YES
exeext='.exe' exeext='.exe'
soext='.dll' soext='.dll'
;; ;;
...@@ -570,6 +572,17 @@ AC_SUBST(CONF_CPP_OPTS_STAGE0) ...@@ -570,6 +572,17 @@ AC_SUBST(CONF_CPP_OPTS_STAGE0)
AC_SUBST(CONF_CPP_OPTS_STAGE1) AC_SUBST(CONF_CPP_OPTS_STAGE1)
AC_SUBST(CONF_CPP_OPTS_STAGE2) 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 dnl ** figure out how to do context diffs
FP_PROG_CONTEXT_DIFF FP_PROG_CONTEXT_DIFF
......
[("GCC extra via C opts", "@GccExtraViaCOpts@"), [("GCC extra via C opts", "@GccExtraViaCOpts@"),
("C compiler command", "@WhatGccIsCalled@"), ("C compiler command", "@SettingsCCompilerCommand@"),
("C compiler flags", "@CONF_CC_OPTS_STAGE2@"), ("C compiler flags", "@SettingsCCompilerFlags@"),
("ar command", "@ArCmd@"), ("ar command", "@ArCmd@"),
("ar flags", "@ArArgs@"), ("ar flags", "@ArArgs@"),
("ar supports at file", "@ArSupportsAtFile@"), ("ar supports at file", "@ArSupportsAtFile@"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment