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.m449
1 files changed, 31 insertions, 18 deletions
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index 98a10416..fb69209b 100644
--- a/gl/m4/sys_socket_h.m4
+++ b/gl/m4/sys_socket_h.m4
@@ -1,8 +1,10 @@
1# sys_socket_h.m4 serial 29 1# sys_socket_h.m4
2dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. 2# serial 31
3dnl Copyright (C) 2005-2025 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
5dnl 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.
6 8
7dnl From Simon Josefsson. 9dnl From Simon Josefsson.
8 10
@@ -51,24 +53,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
51 fi 53 fi
52 # We need to check for ws2tcpip.h now. 54 # We need to check for ws2tcpip.h now.
53 gl_PREREQ_SYS_H_SOCKET 55 gl_PREREQ_SYS_H_SOCKET
54 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ 56 gl_PREREQ_SYS_SA_FAMILY
55 /* sys/types.h is not needed according to POSIX, but the
56 sys/socket.h in i386-unknown-freebsd4.10 and
57 powerpc-apple-darwin5.5 required it. */
58#include <sys/types.h>
59#ifdef HAVE_SYS_SOCKET_H
60#include <sys/socket.h>
61#endif
62#ifdef HAVE_WS2TCPIP_H
63#include <ws2tcpip.h>
64#endif
65])
66 if test $ac_cv_type_struct_sockaddr_storage = no; then 57 if test $ac_cv_type_struct_sockaddr_storage = no; then
67 HAVE_STRUCT_SOCKADDR_STORAGE=0 58 HAVE_STRUCT_SOCKADDR_STORAGE=0
68 fi 59 fi
69 if test $ac_cv_type_sa_family_t = no; then
70 HAVE_SA_FAMILY_T=0
71 fi
72 if test $ac_cv_type_struct_sockaddr_storage != no; then 60 if test $ac_cv_type_struct_sockaddr_storage != no; then
73 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], 61 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
74 [], 62 [],
@@ -157,6 +145,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
157 AC_SUBST([HAVE_WS2TCPIP_H]) 145 AC_SUBST([HAVE_WS2TCPIP_H])
158]) 146])
159 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
160# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) 174# gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
161# 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
162# to a C preprocessor expression that will evaluate to 1. 176# to a C preprocessor expression that will evaluate to 1.
@@ -201,6 +215,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
201 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 215 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
202 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; 216 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
203 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) 217 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
204 HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
205 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) 218 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
206]) 219])