Make autotools build system work with MinGW

Extracted from https://github.com/JuliaLang/libuv/tree/julia-uv0.10.13