[darcs-users] MinGW compile problem

David Roundy droundy at abridgegame.org
Tue Nov 18 13:15:55 UTC 2003

On Sun, Nov 16, 2003 at 09:46:45PM +0100, Peter Strand wrote:
> On Sun, Nov 16, 2003 at 01:01:42PM -0500, David Roundy wrote:
> > I have an alternative fix for this, assuming you are using ghc6.  The
> > latest darcs uses System.Posix.Signals for the signals stuff, which
> > should mean that they can be moved out of win32/Posix.hs entirely, if
> > we're willing to drop win32 ghc5 support.
> System.Posix.Signals is empty in windows-ghc  :(
> But I'm all for removing win32-specific workarounds, even if it
> means that we have to drop support for certain versions of ghc.

I've made an attempt at doing the POSIX signals stuff via an autoconf
configure test.  It's not pretty, and I'd welcome suggestions as to how to
better do this.  I created an autoconf macro to test to see if a program
(inlined in the macro) compiles, and another to use this to see if a module
is supported (and try looking in a package for the module).

The ugly part is what to do when I need to deal with a module that may have
more than one name in different versions of ghc, and which may not exist at
all.  The current plan (and here is where it gets ugly) is to generate a
file called Workaround.hs that either reexports the desired functions, or
implements them itself.  The problem is that this will only work if each
function we use has a unique name, which isn't always the case.  For
example, Control.Exception exports catch, but it's a different catch from
the one exported by the prelude.

Anyhow, it's the best I was able to come up with.  I think it should work
fine for windows, and my plan is to add more macros to work around other
problems.  For example, I should be able to test for the rename bug that
shows up on windows, and work around it by defining it in Workaround.  The
catch is that everywhere I use renameFile I'd need to import Workaround (
renameFile ), which seems a tad ugly.

Suggestions and criticisms welcome (and the code probably won't be up on
the server for another hour).
David Roundy

More information about the darcs-users mailing list