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
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"
......
......@@ -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
......
[("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@"),
......
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