summaryrefslogtreecommitdiffstats
path: root/gl/m4/sys_socket_h.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/sys_socket_h.m4')
-rw-r--r--gl/m4/sys_socket_h.m448
1 files changed, 30 insertions, 18 deletions
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index 3bf3cb47..fb69209b 100644
--- a/gl/m4/sys_socket_h.m4
+++ b/gl/m4/sys_socket_h.m4
@@ -1,9 +1,10 @@
1# sys_socket_h.m4 1# sys_socket_h.m4
2# serial 29 2# serial 31
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-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 From Simon Josefsson. 9dnl From Simon Josefsson.
9 10
@@ -52,24 +53,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
52 fi 53 fi
53 # We need to check for ws2tcpip.h now. 54 # We need to check for ws2tcpip.h now.
54 gl_PREREQ_SYS_H_SOCKET 55 gl_PREREQ_SYS_H_SOCKET
55 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ 56 gl_PREREQ_SYS_SA_FAMILY
56 /* sys/types.h is not needed according to POSIX, but the
57 sys/socket.h in i386-unknown-freebsd4.10 and
58 powerpc-apple-darwin5.5 required it. */
59#include <sys/types.h>
60#ifdef HAVE_SYS_SOCKET_H
61#include <sys/socket.h>
62#endif
63#ifdef HAVE_WS2TCPIP_H
64#include <ws2tcpip.h>
65#endif
66])
67 if test $ac_cv_type_struct_sockaddr_storage = no; then 57 if test $ac_cv_type_struct_sockaddr_storage = no; then
68 HAVE_STRUCT_SOCKADDR_STORAGE=0 58 HAVE_STRUCT_SOCKADDR_STORAGE=0
69 fi 59 fi
70 if test $ac_cv_type_sa_family_t = no; then
71 HAVE_SA_FAMILY_T=0
72 fi
73 if test $ac_cv_type_struct_sockaddr_storage != no; then 60 if test $ac_cv_type_struct_sockaddr_storage != no; then
74 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], 61 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
75 [], 62 [],
@@ -158,6 +145,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
158 AC_SUBST([HAVE_WS2TCPIP_H]) 145 AC_SUBST([HAVE_WS2TCPIP_H])
159]) 146])
160 147
148# Common prerequisites of the <sys/socket.h> replacement and of the <sys/un.h>
149# replacement.
150# Sets and substitutes HAVE_SA_FAMILY_T.
151AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY],
152[
153 AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
154 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
155 /* sys/types.h is not needed according to POSIX, but the
156 sys/socket.h in i386-unknown-freebsd4.10 and
157 powerpc-apple-darwin5.5 required it. */
158#include <sys/types.h>
159#ifdef HAVE_SYS_SOCKET_H
160#include <sys/socket.h>
161#endif
162#ifdef HAVE_WS2TCPIP_H
163#include <ws2tcpip.h>
164#endif
165])
166 if test $ac_cv_type_sa_family_t = yes; then
167 HAVE_SA_FAMILY_T=1
168 else
169 HAVE_SA_FAMILY_T=0
170 fi
171 AC_SUBST([HAVE_SA_FAMILY_T])
172])
173
161# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) 174# gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
162# sets the shell variable that indicates the presence of the given module 175# sets the shell variable that indicates the presence of the given module
163# to a C preprocessor expression that will evaluate to 1. 176# to a C preprocessor expression that will evaluate to 1.
@@ -202,6 +215,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
202 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 215 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
203 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; 216 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
204 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) 217 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
205 HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
206 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) 218 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
207]) 219])