-----------------------------------------------------------------------------
--- $Id: DriverFlags.hs,v 1.112 2003/02/07 09:39:02 simonpj Exp $
+-- $Id: DriverFlags.hs,v 1.113 2003/02/21 13:26:58 simonpj Exp $
--
-- Driver flags
--
-- on all other systems, quoting is necessary, to avoid interpretation
-- of shell metacharacters in the arguments (e.g. green-card's
-- -DBEGIN_GHC_ONLY='}-' trick).
-#ifndef mingw32_HOST_OS
+#ifndef mingw32_TARGET_OS
, ( "D", Prefix (\s -> addOpt_P ("-D'"++s++"'") ) )
, ( "U", Prefix (\s -> addOpt_P ("-U'"++s++"'") ) )
#else
isFunTyCon, isPrimTyCon, isNewTyCon, isClassTyCon,
isSynTyCon, isAlgTyCon, isForeignTyCon,
getSynTyConDefn, tyConGenInfo, tyConDataConDetails, tyConArity )
-import Class ( classExtraBigSig, classTyCon, DefMeth(..) )
+import Class ( classExtraBigSig, classTyCon )
import FieldLabel ( fieldLabelType )
import TcType ( tcSplitForAllTys, tcFunResultTy, tidyTopType, deNoteType, tyClsNamesOfDFunHead )
import SrcLoc ( noSrcLoc )
-- GHC <= 4.08 didn't have rawSystem, and runs into problems with long command
-- lines on mingw32, so we disallow it now.
-#if defined(mingw32_HOST_OS) && (__GLASGOW_HASKELL__ <= 408)
+#if defined(mingw32_TARGET_OS) && (__GLASGOW_HASKELL__ <= 408)
#error GHC <= 4.08 is not supported for bootstrapping GHC on i386-unknown-mingw32
#endif
-#ifndef mingw32_HOST_OS
+#ifndef mingw32_TARGET_OS
#if __GLASGOW_HASKELL__ > 504
import qualified GHC.Posix
#else
import CString ( CString, peekCString )
#endif
-#ifdef mingw32_HOST_OS
+#ifdef mingw32_TARGET_OS
#if __GLASGOW_HASKELL__ > 504
import System.Cmd ( rawSystem )
#else
| am_installed = installed_bin cGHC_MANGLER_PGM
| otherwise = inplace cGHC_MANGLER_DIR_REL cGHC_MANGLER_PGM
-#ifndef mingw32_HOST_OS
+#ifndef mingw32_TARGET_OS
-- check whether TMPDIR is set in the environment
; IO.try (do dir <- getEnv "TMPDIR" -- fails if not set
setTmpDir dir
throwDyn (InstallationError
("Can't find package.conf as " ++ pkgconfig_path))
-#if defined(mingw32_HOST_OS)
+#if defined(mingw32_TARGET_OS)
-- WINDOWS-SPECIFIC STUFF
-- On Windows, gcc and friends are distributed with GHC,
-- so when "installed" we look in TopDir/bin
; return ()
}
-#if defined(mingw32_HOST_OS)
-foreign import stdcall unsafe "GetTempPathA" getTempPath :: Int -> CString -> IO Int32
+#if defined(mingw32_TARGET_OS)
+foreign import stdcall "GetTempPathA" unsafe getTempPath :: Int -> CString -> IO Int32
#endif
\end{code}
runSomething phase_name pgm args
= traceCmd phase_name cmd_line $
do {
-#ifndef mingw32_HOST_OS
+#ifndef mingw32_TARGET_OS
exit_code <- system cmd_line
#else
exit_code <- rawSystem cmd_line
-#if defined(mingw32_HOST_OS)
+#if defined(mingw32_TARGET_OS)
--------------------- Windows version ------------------
dosifyPaths xs = map dosifyPath xs
-----------------------------------------------------------------------------
-- Define getExecDir :: IO (Maybe String)
-#if defined(mingw32_HOST_OS)
+#if defined(mingw32_TARGET_OS)
getExecDir :: IO (Maybe String)
getExecDir = do let len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32.
buf <- mallocArray len
return (Just (reverse (dropList "/bin/ghc.exe" (reverse (unDosifyPath s)))))
-foreign import stdcall unsafe "GetModuleFileNameA"
+foreign import stdcall "GetModuleFileNameA" unsafe
getModuleFileName :: Ptr () -> CString -> Int -> IO Int32
#else
getExecDir :: IO (Maybe String) = do return Nothing
#endif
-#ifdef mingw32_HOST_OS
-foreign import ccall unsafe "_getpid" getProcessID :: IO Int -- relies on Int == Int32 on Windows
+#ifdef mingw32_TARGET_OS
+foreign import ccall "_getpid" unsafe getProcessID :: IO Int -- relies on Int == Int32 on Windows
#elif __GLASGOW_HASKELL__ > 504
getProcessID :: IO Int
getProcessID = GHC.Posix.c_getpid >>= return . fromIntegral
#endif
quote :: String -> String
-#if defined(mingw32_HOST_OS)
+#if defined(mingw32_TARGET_OS)
quote "" = ""
quote s = "\"" ++ s ++ "\""
#else
import IdInfo {- loads of stuff -}
import NewDemand ( isBottomingSig, topSig )
import BasicTypes ( isNeverActive )
-import Name ( getOccName, nameOccName, mkInternalName, mkExternalName,
+import Name ( getOccName, nameOccName, mkInternalName,
localiseName, isExternalName, nameSrcLoc
)
import RnEnv ( lookupOrigNameCache, newExternalName )
import NameEnv ( filterNameEnv )
import OccName ( TidyOccEnv, initTidyOccEnv, tidyOccName )
import Type ( tidyTopType )
-import Module ( Module, moduleName )
+import Module ( Module )
import HscTypes ( PersistentCompilerState( pcs_nc ),
NameCache( nsNames, nsUniqs ),
TypeEnv, extendTypeEnvList, typeEnvIds,
ModGuts(..), ModGuts, TyThing(..)
)
-import FiniteMap ( lookupFM, addToFM )
import Maybes ( orElse )
import ErrUtils ( showPass, dumpIfSet_core )
import UniqFM ( mapUFM )