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.m459
1 files changed, 30 insertions, 29 deletions
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index 3bf3cb47..cdc374e4 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 32
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2026 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
@@ -12,17 +13,6 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
12 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) 13 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
13 AC_REQUIRE([AC_CANONICAL_HOST]) 14 AC_REQUIRE([AC_CANONICAL_HOST])
14 15
15 dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
16 dnl old-style declarations (with return type 'int' instead of 'ssize_t')
17 dnl unless _POSIX_PII_SOCKET is defined.
18 case "$host_os" in
19 osf*)
20 AC_DEFINE([_POSIX_PII_SOCKET], [1],
21 [Define to 1 in order to get the POSIX compatible declarations
22 of socket functions.])
23 ;;
24 esac
25
26 GL_GENERATE_SYS_SOCKET_H=false 16 GL_GENERATE_SYS_SOCKET_H=false
27 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], 17 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
28 [gl_cv_header_sys_socket_h_selfcontained], 18 [gl_cv_header_sys_socket_h_selfcontained],
@@ -52,24 +42,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
52 fi 42 fi
53 # We need to check for ws2tcpip.h now. 43 # We need to check for ws2tcpip.h now.
54 gl_PREREQ_SYS_H_SOCKET 44 gl_PREREQ_SYS_H_SOCKET
55 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ 45 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 46 if test $ac_cv_type_struct_sockaddr_storage = no; then
68 HAVE_STRUCT_SOCKADDR_STORAGE=0 47 HAVE_STRUCT_SOCKADDR_STORAGE=0
69 fi 48 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 49 if test $ac_cv_type_struct_sockaddr_storage != no; then
74 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], 50 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
75 [], 51 [],
@@ -158,6 +134,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
158 AC_SUBST([HAVE_WS2TCPIP_H]) 134 AC_SUBST([HAVE_WS2TCPIP_H])
159]) 135])
160 136
137# Common prerequisites of the <sys/socket.h> replacement and of the <sys/un.h>
138# replacement.
139# Sets and substitutes HAVE_SA_FAMILY_T.
140AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY],
141[
142 AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
143 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
144 /* sys/types.h is not needed according to POSIX, but the
145 sys/socket.h in i386-unknown-freebsd4.10 and
146 powerpc-apple-darwin5.5 required it. */
147#include <sys/types.h>
148#ifdef HAVE_SYS_SOCKET_H
149#include <sys/socket.h>
150#endif
151#ifdef HAVE_WS2TCPIP_H
152#include <ws2tcpip.h>
153#endif
154])
155 if test $ac_cv_type_sa_family_t = yes; then
156 HAVE_SA_FAMILY_T=1
157 else
158 HAVE_SA_FAMILY_T=0
159 fi
160 AC_SUBST([HAVE_SA_FAMILY_T])
161])
162
161# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) 163# gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
162# sets the shell variable that indicates the presence of the given module 164# sets the shell variable that indicates the presence of the given module
163# to a C preprocessor expression that will evaluate to 1. 165# to a C preprocessor expression that will evaluate to 1.
@@ -202,6 +204,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
202 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 204 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
203 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; 205 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
204 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) 206 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]) 207 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
207]) 208])