From: Ian Lynagh Date: Fri, 18 Jul 2008 21:08:36 +0000 (+0000) Subject: Change how inplace detection works, so that it also works on Windows X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=aa4a905d69a7325fc22f917a41a82f9e19146fcd Change how inplace detection works, so that it also works on Windows --- diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index c418789..3937aa4 100644 --- a/compiler/main/SysTools.lhs +++ b/compiler/main/SysTools.lhs @@ -325,11 +325,14 @@ findTopDir :: Maybe String -- Maybe TopDir path (without the '-B' prefix). findTopDir mbMinusB = do { top_dir <- get_proto - -- Discover whether we're running in a build tree or in an installation, - -- by looking for a file we use for that purpose - ; am_inplace <- doesFileExist (top_dir "inplace") - - ; return (not am_inplace, top_dir) + ; exists1 <- doesFileExist (top_dir "package.conf") + ; exists2 <- doesFileExist (top_dir "inplace") + ; let amInplace = not exists1 -- On Windows, package.conf doesn't exist + -- when we are inplace + || exists2 -- On Linux, the presence of inplace signals + -- that we are inplace + + ; return (not amInplace, top_dir) } where -- get_proto returns a Unix-format path (relying on getBaseDir to do so too) @@ -522,7 +525,13 @@ copyWithHeader dflags purpose maybe_header from to = do getExtraViaCOpts :: DynFlags -> IO [String] getExtraViaCOpts dflags = do - f <- readFile (topDir dflags "extra-gcc-opts") + (am_installed, top_dir) <- findTopDir (Just (topDir dflags)) + let top_dir' + -- XXX Euch: + | isWindowsHost && not am_installed + = top_dir ".." ".." "inplace-datadir" + | otherwise = top_dir + f <- readFile (top_dir' "extra-gcc-opts") return (words f) \end{code}