[Haskell-cafe] Windows console

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sat Sep 13 09:01:56 EDT 2008

On Sat, 2008-09-13 at 13:41 +0100, Andrew Coppin wrote:

> > If you mean "how do I compile the ANSI emulator on Windows but the
> > actual ANSI stuff on Unix", most of the magic is in the .cabal file:
> > I simply turn on the C-preprocessor (CPP) and then supply -DWINDOWS on
> > Windows and -DUNIX on anything else.

> Anyway, that still leaves one question: how do you figure out which 
> platform you're on so you can set the right options?

As Max suggested, look in the .cabal file. You'll find this snippet:

  if os(windows)
    Build-Depends:          Win32 >= 2.0
    Cpp-Options:            -DWINDOWS
    [... other stuff ...]
    -- We assume any non-Windows platform is Unix
    Build-Depends:          unix >=
    Cpp-Options:            -DUNIX
    [... other stuff ...]

  Extensions:             CPP


More information about the Haskell-Cafe mailing list