Wild stab at fixing builds across GCC and various mingw flavors.

This has a good chance of working I think, but I can't test it.