Move MinGW compatibility options to a dedicated Makefile.

Add fallback for some functions not supported by MinGW.