X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FSysTools.lhs;h=436cfa6c4ce0950513e1d7a93704d10afb04cb49;hb=ea94a66d93047a9b0cd4532645eb1e9be04888e1;hp=cd19945c0a952a42a0560cb7f13cf3a90b9e63eb;hpb=d1941af03f22f52cbd806f97641243f160fbc99b;p=ghc-hetmet.git diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index cd19945..436cfa6 100644 --- a/compiler/main/SysTools.lhs +++ b/compiler/main/SysTools.lhs @@ -159,6 +159,11 @@ initSysTools mbMinusB -- format, '/' separated ; let settingsFile = top_dir "settings" + installed :: FilePath -> FilePath + installed file = top_dir file + installed_mingw_bin file = top_dir ".." "mingw" "bin" file + installed_perl_bin file = top_dir ".." "perl" file + ; settingsStr <- readFile settingsFile ; mySettings <- case maybeReadFuzzy settingsStr of Just s -> @@ -170,11 +175,19 @@ initSysTools mbMinusB return xs Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile) ; myExtraGccViaCFlags <- getSetting "GCC extra via C opts" - - ; let installed :: FilePath -> FilePath - installed file = top_dir file - installed_mingw_bin file = top_dir ".." "mingw" "bin" file - installed_perl_bin file = top_dir ".." "perl" file + -- On Windows, mingw is distributed with GHC, + -- so we look in TopDir/../mingw/bin + -- 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" + ; let gcc_args = map Option (words gcc_args_str) + ; perl_path <- if isWindowsHost + then return $ installed_perl_bin "perl" + else getSetting "perl command" ; let pkgconfig_path = installed "package.conf.d" ghc_usage_msg_path = installed "ghc-usage.txt" @@ -191,15 +204,7 @@ initSysTools mbMinusB ; tmpdir <- getTemporaryDirectory - -- On Windows, mingw is distributed with GHC, - -- so we look in TopDir/../mingw/bin ; let - gcc_prog - | isWindowsHost = installed_mingw_bin "gcc" - | otherwise = cGCC - perl_path - | isWindowsHost = installed_perl_bin cGHC_PERL - | otherwise = cGHC_PERL -- 'touch' is a GHC util for Windows touch_path | isWindowsHost = installed cGHC_TOUCHY_PGM @@ -222,14 +227,18 @@ initSysTools mbMinusB -- cpp is derived from gcc on all platforms -- HACK, see setPgmP below. We keep 'words' here to remember to fix -- Config.hs one day. - ; let cpp_path = (gcc_prog, - (Option "-E"):(map Option (words cRAWCPP_FLAGS))) + ; let cpp_prog = gcc_prog + cpp_args = Option "-E" + : map Option (words cRAWCPP_FLAGS) + ++ gcc_args -- Other things being equal, as and ld are simply gcc ; let as_prog = gcc_prog + as_args = gcc_args ld_prog = gcc_prog + ld_args = gcc_args - -- figure out llvm location. (TODO: Acutally implement). + -- We just assume on command line ; let lc_prog = "llc" lo_prog = "opt" @@ -242,12 +251,12 @@ initSysTools mbMinusB sExtraGccViaCFlags = words myExtraGccViaCFlags, sSystemPackageConfig = pkgconfig_path, sPgm_L = unlit_path, - sPgm_P = cpp_path, + sPgm_P = (cpp_prog, cpp_args), sPgm_F = "", - sPgm_c = (gcc_prog,[]), + sPgm_c = (gcc_prog, gcc_args), sPgm_s = (split_prog,split_args), - sPgm_a = (as_prog,[]), - sPgm_l = (ld_prog,[]), + sPgm_a = (as_prog, as_args), + sPgm_l = (ld_prog, ld_args), sPgm_dll = (mkdll_prog,mkdll_args), sPgm_T = touch_path, sPgm_sysman = top_dir ++ "/ghc/rts/parallel/SysMan",