Bug #22289
openHAVE_AFUNIX_H is defined inconsistently by win32/Makefile.sub and ext/socket/extconf.rb
Description
win32/Makefile.sub:714 defines HAVE_AFUNIX_H only under !if $(MSC_VER) >= 1920, while ext/socket/extconf.rb:319 runs have_header on afunix.h unconditionally. afunix.h ships with Windows SDK 10.0.17063 and later, so VS2017 (MSC_VER 1910 to 1916) with a current SDK satisfies the header check but not the MSC_VER one.
In that configuration ext/socket gets HAVE_AFUNIX_H, and have_type("struct sockaddr_un") at extconf.rb:342 then succeeds through that header, so UNIXSocket is defined. win32/win32.c does not get it, so the AF_UNIX case of socketpair at win32/win32.c:4178 is compiled out and falls through to default:, making UNIXSocket.pair fail with EAFNOSUPPORT. The same macro also gates the AF_UNIX address length handling added in [Bug #21702].
Deciding HAVE_AFUNIX_H from the actual header in both places would keep them consistent.
I have not built this configuration. This is from reading the two files.
No data to display