build: link against Winsock2 on mingw/cygwin.
tests: check for BSON_HAVE_SNPRINTF
tests: implement xplat open with macros.