From: Collin Funk Date: Wed, 24 Jul 2024 04:31:06 +0000 (-0700) Subject: Detect UNIX domain sockets supported by recent Windows versions. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=d3efdd55f36a01118ed936da25633858a5757897;p=gnulib.git Detect UNIX domain sockets supported by recent Windows versions. * m4/sockpfaf.m4 (gl_SOCKET_FAMILY_UNIX): Check for afunix.h if winsock2.h is found. Include it in the compile check. --- diff --git a/ChangeLog b/ChangeLog index 5910b4699c..3e9d691efa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2024-07-23 Collin Funk + Detect UNIX domain sockets supported by recent Windows versions. + * m4/sockpfaf.m4 (gl_SOCKET_FAMILY_UNIX): Check for afunix.h if + winsock2.h is found. Include it in the compile check. + sys_socket tests: Fix mistake in previous commit. * modules/sys_socket-tests (configure.ac): Invoke gl_SOCKET_FAMILY_UNIX. diff --git a/m4/sockpfaf.m4 b/m4/sockpfaf.m4 index c68b3abbce..44ac7fd947 100644 --- a/m4/sockpfaf.m4 +++ b/m4/sockpfaf.m4 @@ -1,5 +1,5 @@ # sockpfaf.m4 -# serial 10 +# serial 11 dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -64,6 +64,13 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], AC_REQUIRE([gl_SYS_SOCKET_H]) AC_CHECK_HEADERS_ONCE([sys/un.h]) + dnl Windows versions released after 2017 may have support for AF_UNIX. + dnl Including it requires types from to be defined. + dnl . + if test "$ac_cv_header_winsock2_h" = yes; then + AC_CHECK_HEADERS([afunix.h], [], [], [#include ]) + fi + AC_CACHE_CHECK([for UNIX domain sockets], [gl_cv_socket_unix], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include @@ -75,6 +82,9 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], #endif #ifdef HAVE_WINSOCK2_H #include +#endif +#ifdef HAVE_AFUNIX_H +#include #endif]], [[int x = AF_UNIX; struct sockaddr_un y; if (&x && &y) return 0;]])],