diff options
Diffstat (limited to 'gl/m4/sys_socket_h.m4')
-rw-r--r-- | gl/m4/sys_socket_h.m4 | 83 |
1 files changed, 56 insertions, 27 deletions
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 94863776..5676a0d2 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 | |||
@@ -1,12 +1,12 @@ | |||
1 | # sys_socket_h.m4 serial 23 | 1 | # sys_socket_h.m4 serial 28 |
2 | dnl Copyright (C) 2005-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Simon Josefsson. | 7 | dnl From Simon Josefsson. |
8 | 8 | ||
9 | AC_DEFUN([gl_HEADER_SYS_SOCKET], | 9 | AC_DEFUN_ONCE([gl_SYS_SOCKET_H], |
10 | [ | 10 | [ |
11 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) |
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
@@ -95,6 +95,8 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
95 | #include <sys/socket.h> | 95 | #include <sys/socket.h> |
96 | ]], [socket connect accept bind getpeername getsockname getsockopt | 96 | ]], [socket connect accept bind getpeername getsockname getsockopt |
97 | listen recv send recvfrom sendto setsockopt shutdown accept4]) | 97 | listen recv send recvfrom sendto setsockopt shutdown accept4]) |
98 | |||
99 | AC_REQUIRE([AC_C_RESTRICT]) | ||
98 | ]) | 100 | ]) |
99 | 101 | ||
100 | AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], | 102 | AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], |
@@ -104,17 +106,11 @@ AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], | |||
104 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) | 106 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) |
105 | if test $ac_cv_header_sys_socket_h = yes; then | 107 | if test $ac_cv_header_sys_socket_h = yes; then |
106 | HAVE_SYS_SOCKET_H=1 | 108 | HAVE_SYS_SOCKET_H=1 |
107 | HAVE_WS2TCPIP_H=0 | ||
108 | else | 109 | else |
109 | HAVE_SYS_SOCKET_H=0 | 110 | HAVE_SYS_SOCKET_H=0 |
110 | if test $ac_cv_header_ws2tcpip_h = yes; then | ||
111 | HAVE_WS2TCPIP_H=1 | ||
112 | else | ||
113 | HAVE_WS2TCPIP_H=0 | ||
114 | fi | ||
115 | fi | 111 | fi |
116 | AC_SUBST([HAVE_SYS_SOCKET_H]) | 112 | AC_SUBST([HAVE_SYS_SOCKET_H]) |
117 | AC_SUBST([HAVE_WS2TCPIP_H]) | 113 | gl_PREREQ_SYS_H_WS2TCPIP |
118 | ]) | 114 | ]) |
119 | 115 | ||
120 | # Common prerequisites of the <sys/socket.h> replacement and of the | 116 | # Common prerequisites of the <sys/socket.h> replacement and of the |
@@ -142,32 +138,65 @@ AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], | |||
142 | AC_SUBST([HAVE_WINSOCK2_H]) | 138 | AC_SUBST([HAVE_WINSOCK2_H]) |
143 | ]) | 139 | ]) |
144 | 140 | ||
141 | # Common prerequisites of the <sys/socket.h> replacement and of the | ||
142 | # <arpa/inet.h> replacement. | ||
143 | # Sets and substitutes HAVE_WS2TCPIP_H. | ||
144 | AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], | ||
145 | [ | ||
146 | AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) | ||
147 | if test $ac_cv_header_sys_socket_h = yes; then | ||
148 | HAVE_WS2TCPIP_H=0 | ||
149 | else | ||
150 | if test $ac_cv_header_ws2tcpip_h = yes; then | ||
151 | HAVE_WS2TCPIP_H=1 | ||
152 | else | ||
153 | HAVE_WS2TCPIP_H=0 | ||
154 | fi | ||
155 | fi | ||
156 | AC_SUBST([HAVE_WS2TCPIP_H]) | ||
157 | ]) | ||
158 | |||
159 | # gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) | ||
160 | # sets the shell variable that indicates the presence of the given module | ||
161 | # to a C preprocessor expression that will evaluate to 1. | ||
162 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
145 | AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], | 163 | AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], |
146 | [ | 164 | [ |
147 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 165 | dnl Ensure to expand the default settings once only. |
148 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) | 166 | gl_SYS_SOCKET_H_REQUIRE_DEFAULTS |
149 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 167 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
150 | dnl Define it also as a C macro, for the benefit of the unit tests. | 168 | dnl Define it also as a C macro, for the benefit of the unit tests. |
151 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 169 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
152 | ]) | 170 | ]) |
153 | 171 | ||
172 | # Initializes the default values for AC_SUBSTed shell variables. | ||
173 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
174 | # outside of macros or in macros that are not AC_REQUIREd. | ||
175 | AC_DEFUN([gl_SYS_SOCKET_H_REQUIRE_DEFAULTS], | ||
176 | [ | ||
177 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS], [ | ||
178 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SOCKET]) | ||
179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CONNECT]) | ||
180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT]) | ||
181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BIND]) | ||
182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPEERNAME]) | ||
183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKNAME]) | ||
184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKOPT]) | ||
185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LISTEN]) | ||
186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECV]) | ||
187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SEND]) | ||
188 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECVFROM]) | ||
189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SENDTO]) | ||
190 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETSOCKOPT]) | ||
191 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SHUTDOWN]) | ||
192 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT4]) | ||
193 | ]) | ||
194 | m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS]) | ||
195 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) | ||
196 | ]) | ||
197 | |||
154 | AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], | 198 | AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], |
155 | [ | 199 | [ |
156 | GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) | ||
157 | GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) | ||
158 | GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) | ||
159 | GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) | ||
160 | GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) | ||
161 | GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) | ||
162 | GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) | ||
163 | GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) | ||
164 | GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) | ||
165 | GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) | ||
166 | GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) | ||
167 | GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) | ||
168 | GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) | ||
169 | GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) | ||
170 | GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) | ||
171 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) | 200 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) |
172 | HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; | 201 | HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; |
173 | AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) | 202 | AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) |