summaryrefslogtreecommitdiffstats
path: root/gl/m4/sockpfaf.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/sockpfaf.m4')
-rw-r--r--gl/m4/sockpfaf.m415
1 files changed, 13 insertions, 2 deletions
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
index c68b3abb..08ce843d 100644
--- a/gl/m4/sockpfaf.m4
+++ b/gl/m4/sockpfaf.m4
@@ -1,9 +1,10 @@
1# sockpfaf.m4 1# sockpfaf.m4
2# serial 10 2# serial 11
3dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) 9dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...)
9dnl and some common address families (AF_INET, AF_INET6, ...). 10dnl and some common address families (AF_INET, AF_INET6, ...).
@@ -64,6 +65,13 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
64 AC_REQUIRE([gl_SYS_SOCKET_H]) 65 AC_REQUIRE([gl_SYS_SOCKET_H])
65 AC_CHECK_HEADERS_ONCE([sys/un.h]) 66 AC_CHECK_HEADERS_ONCE([sys/un.h])
66 67
68 dnl Windows versions released after 2017 may have support for AF_UNIX.
69 dnl Including it requires types from <winsock2.h> to be defined.
70 dnl <https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/>.
71 if test "$ac_cv_header_winsock2_h" = yes; then
72 AC_CHECK_HEADERS([afunix.h], [], [], [#include <winsock2.h>])
73 fi
74
67 AC_CACHE_CHECK([for UNIX domain sockets], 75 AC_CACHE_CHECK([for UNIX domain sockets],
68 [gl_cv_socket_unix], 76 [gl_cv_socket_unix],
69 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 77 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
@@ -75,6 +83,9 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
75#endif 83#endif
76#ifdef HAVE_WINSOCK2_H 84#ifdef HAVE_WINSOCK2_H
77#include <winsock2.h> 85#include <winsock2.h>
86#endif
87#ifdef HAVE_AFUNIX_H
88#include <afunix.h>
78#endif]], 89#endif]],
79[[int x = AF_UNIX; struct sockaddr_un y; 90[[int x = AF_UNIX; struct sockaddr_un y;
80 if (&x && &y) return 0;]])], 91 if (&x && &y) return 0;]])],