Modifications to allow crosscompiling with mingw

Reviewed-by: bjorn.