Add check for finding libgcc.
Fix pcre checks to work on visual studio builds using pcre static libraries built using mingw toolchain.
Provide better check for when libpcreposix is to be used for regex support.

On Windows, if the static libraries for PCRE are to be used and the PCRE static libs were built
using the mingw toolchain, libgcc must also be linked for resolving the symbol ___chkstk_ms.