SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
# We need System.Posix (or Posix when ghc < 6.2)
-ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
+ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
+ifeq "$(bootstrapped)" "YES"
+SRC_HC_OPTS += -package Win32
+PKG_DEPENDS += Win32
+endif
+else
ifeq "$(bootstrapped) $(ghc_ge_601)" "NO NO"
SRC_HC_OPTS += -package posix
else
#endif
#else
import GHC.ConsoleHandler ( flushConsole )
+import System.Win32 ( setConsoleCP, setConsoleOutputCP )
#endif
#ifdef USE_READLINE
| otherwise -> io (ioError err)
Right () -> return ()
#endif
+ -- initialise the console if necessary
+ io setUpConsole
+
-- enter the interactive loop
interactiveLoop is_tty show_prompt
Just expr -> do
foreign import ccall "revertCAFs" rts_revertCAFs :: IO ()
-- Make it "safe", just in case
--- -----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
-- Utils
expandPath :: String -> GHCi String
return (tilde ++ '/':d)
other ->
return other
+
+-- ----------------------------------------------------------------------------
+-- Windows console setup
+
+setUpConsole :: IO ()
+setUpConsole = do
+#ifdef mingw32_HOST_OS
+ -- On Windows we need to set a known code page, otherwise the characters
+ -- we read from the console will be be in some strange encoding, and
+ -- similarly for characters we write to the console.
+ --
+ -- At the moment, GHCi pretends all input is Latin-1. In the
+ -- future we should support UTF-8, but for now we set the code pages
+ -- to Latin-1.
+ --
+ -- It seems you have to set the font in the console window to
+ -- a Unicode font in order for output to work properly,
+ -- otherwise non-ASCII characters are mapped wrongly. sigh.
+ -- (see MSDN for SetConsoleOutputCP()).
+ --
+ setConsoleCP 28591 -- ISO Latin-1
+ setConsoleOutputCP 28591 -- ISO Latin-1
+#endif
+ return ()
ifeq "$(GhcLibsWithUnix)" "YES"
SUBDIRS += unix
endif
+ifeq "$(Windows)" "YES"
+SUBDIRS += $(wildcard Win32)
+endif
SUBDIRS += Cabal
SUBDIRS += $(wildcard mtl)
SUBDIRS += $(wildcard fgl)
SUBDIRS += $(wildcard X11)
-ifeq "$(Windows)" "YES"
-SUBDIRS += $(wildcard Win32)
-endif
SUBDIRS += $(wildcard time)
SUBDIRS += $(wildcard HGL)
SUBDIRS += $(wildcard OpenGL)