Completely new treatment of INLINE pragmas (big patch)
[ghc-hetmet.git] / compiler / main / SysTools.lhs
index 3c465ed..d1fd9f7 100644 (file)
@@ -225,6 +225,7 @@ initSysTools mbMinusB dflags0
               -- gcc can cope
               --      (see comments with declarations of global variables)
               gcc_b_arg = Option ("-B" ++ installed "gcc-lib/")
+              gcc_mingw_include_arg = Option ("-I" ++ installed "include/mingw/")
               (gcc_prog,gcc_args)
                 | isWindowsHost && am_installed
                     -- We tell gcc where its specs file + exes are (-B)
@@ -236,7 +237,7 @@ initSysTools mbMinusB dflags0
                     -- the path, possibly including those from a cygwin
                     -- install on the target, which is exactly what we're
                     -- trying to avoid.
-                    = (installed_bin "gcc", [gcc_b_arg])
+                    = (installed_bin "gcc", [gcc_b_arg, gcc_mingw_include_arg])
                 | otherwise = (cGCC, [])
               perl_path
                 | isWindowsHost && am_installed = installed_bin cGHC_PERL
@@ -268,7 +269,7 @@ initSysTools mbMinusB dflags0
                      [ Option "--dlltool-name",
                        Option (installed "gcc-lib/" </> "dlltool"),
                        Option "--driver-name",
-                       Option gcc_prog, gcc_b_arg ])
+                       Option gcc_prog, gcc_b_arg, gcc_mingw_include_arg ])
                 | otherwise    = (cMKDLL, [])
 
         -- cpp is derived from gcc on all platforms
@@ -843,16 +844,17 @@ getBaseDir = do let len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32.
                                     return (Just (rootDir s))
   where
     rootDir s = case splitFileName $ normalise s of
-                (d, "ghc.exe") ->
+                (d, ghc_exe) | lower ghc_exe == "ghc.exe" ->
                     case splitFileName $ takeDirectory d of
                     -- installed ghc.exe is in $topdir/bin/ghc.exe
-                    (d', "bin") -> takeDirectory d'
+                    (d', bin) | lower bin == "bin" -> takeDirectory d'
                     -- inplace ghc.exe is in $topdir/ghc/stage1-inplace/ghc.exe
-                    (d', x) | "-inplace" `isSuffixOf` x -> 
+                    (d', x) | "-inplace" `isSuffixOf` lower x -> 
                         takeDirectory d' </> ".."
                     _ -> fail
                 _ -> fail
         where fail = panic ("can't decompose ghc.exe path: " ++ show s)
+              lower = map toLower
 
 foreign import stdcall unsafe "GetModuleFileNameA"
   getModuleFileName :: Ptr () -> CString -> Int -> IO Int32