contrib: Fix mingw builds with latest Clang 15, avoid implicit declarations
Since Clang 15 (which still is under development, so this may still change before it's released) [1], implicit function declarations are a hard error by default, when building code in C99 mode (or newer).
This causes issues building a number of the contrib libraries, most of which seem to mess up getting a declaration of the gettimeofday function. Where applicable, I've sent these patches upstream first, but they haven't been merged upstream anywhere yet. For zvbi and regex, the patches haven't been sent upstream, as either the upstream code doesn't support building for Windows at all (zvbi), or is a stale copy of files picked from glibc.
See the individual commit messages for the full explanation for each of the patches.
[1] https://github.com/llvm/llvm-project/commit/7d644e1215b376ec5e915df9ea2eeb56e2d94626