[flang] improve compatibility with mingw headers (#172041)
The mingw headers declare `__environ` already, leading to warnings due
to missing dllimport here. Similarly with _WIN32_WINNT may be already
defined from a header leading to nuisance warnings. And the getpid is
not defined in the current header set (it is in process.h), so that
needs to be defined, just like MSVC (this replaces
https://github.com/msys2/MINGW-packages/blob/576fc4bbfa9bff4d5ab81779a706723b5214fd7d/mingw-w64-flang/0103-fix-build-on-mingw.patch).