In clang-cl/MSVC environments, linking against a DLL C++ standard
library requires having dllimport attributes in the headers; this
has been used for detecting whether the tests link against a DLL,
by looking at the libc++ specific define
In mingw environments, thanks to slightly different code generation
and a couple linker tricks, it's possible to link against a DLL C++
standard library without dllimport attributes. Therefore, don't
rely on the libc++ specific header define for the detection.
Replace the detection with a runtime test.
There are two potential alternatives for a test (I included both
in the patch, with one of them commented out); one simple, libc++
specific which just checks if the libc++ DLL exists loaded in the
process, and a more complex one which inspects the PE image and
checks whether the address of std::cout exists within the address
range of the EXE (which can detect whether linking against a DLL
version of other C++ standard libraries than libc++).