annotate m4/sys_socket_h.m4 @ 40196:e63f5d3edab5

relocatable-prog: Update documentation. * doc/relocatable-maint.texi (Supporting Relocation): Update to match the recent changes.
author Bruno Haible <bruno@clisp.org>
date Sun, 24 Feb 2019 01:49:15 +0100
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17173
69d9b9c93232 sys_socket: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
1 # sys_socket_h.m4 serial 23
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 dnl Copyright (C) 2005-2019 Free Software Foundation, Inc.
6536
169ab032c734 Add sys_socket module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
169ab032c734 Add sys_socket module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
169ab032c734 Add sys_socket module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
169ab032c734 Add sys_socket module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
6
169ab032c734 Add sys_socket module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
7 dnl From Simon Josefsson.
169ab032c734 Add sys_socket module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
8
169ab032c734 Add sys_socket module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
9 AC_DEFUN([gl_HEADER_SYS_SOCKET],
169ab032c734 Add sys_socket module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
10 [
10594
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
11 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
13956
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
12 AC_REQUIRE([AC_CANONICAL_HOST])
9994
d45f5069548a Move AC_REQUIRE([AC_C_INLINE]) to top.
Simon Josefsson <simon@josefsson.org>
parents: 9992
diff changeset
13
13956
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
14 dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
15 dnl old-style declarations (with return type 'int' instead of 'ssize_t')
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
16 dnl unless _POSIX_PII_SOCKET is defined.
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
17 case "$host_os" in
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
18 osf*)
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
19 AC_DEFINE([_POSIX_PII_SOCKET], [1],
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
20 [Define to 1 in order to get the POSIX compatible declarations
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
21 of socket functions.])
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
22 ;;
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
23 esac
318a73c424b0 sys_socket: Use POSIX compatible declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13910
diff changeset
24
8377
a8e9ed7caeae Make <sys/socket.h> self-contained, so that it can be included without
Bruno Haible <bruno@clisp.org>
parents: 6646
diff changeset
25 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
a8e9ed7caeae Make <sys/socket.h> self-contained, so that it can be included without
Bruno Haible <bruno@clisp.org>
parents: 6646
diff changeset
26 [gl_cv_header_sys_socket_h_selfcontained],
a8e9ed7caeae Make <sys/socket.h> self-contained, so that it can be included without
Bruno Haible <bruno@clisp.org>
parents: 6646
diff changeset
27 [
9921
01cfd65cc7e0 Fix underquoting of AC_LANG_PROGRAM arguments.
Bruno Haible <bruno@clisp.org>
parents: 9907
diff changeset
28 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[]])],
8377
a8e9ed7caeae Make <sys/socket.h> self-contained, so that it can be included without
Bruno Haible <bruno@clisp.org>
parents: 6646
diff changeset
29 [gl_cv_header_sys_socket_h_selfcontained=yes],
a8e9ed7caeae Make <sys/socket.h> self-contained, so that it can be included without
Bruno Haible <bruno@clisp.org>
parents: 6646
diff changeset
30 [gl_cv_header_sys_socket_h_selfcontained=no])
a8e9ed7caeae Make <sys/socket.h> self-contained, so that it can be included without
Bruno Haible <bruno@clisp.org>
parents: 6646
diff changeset
31 ])
a8e9ed7caeae Make <sys/socket.h> self-contained, so that it can be included without
Bruno Haible <bruno@clisp.org>
parents: 6646
diff changeset
32 if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
9907
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
33 dnl If the shutdown function exists, <sys/socket.h> should define
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
34 dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
35 AC_CHECK_FUNCS([shutdown])
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
36 if test $ac_cv_func_shutdown = yes; then
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
37 AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros],
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
38 [gl_cv_header_sys_socket_h_shut],
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
39 [
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
40 AC_COMPILE_IFELSE(
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
41 [AC_LANG_PROGRAM([[#include <sys/socket.h>]],
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
42 [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])],
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
43 [gl_cv_header_sys_socket_h_shut=yes],
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
44 [gl_cv_header_sys_socket_h_shut=no])
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
45 ])
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
46 if test $gl_cv_header_sys_socket_h_shut = no; then
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
47 SYS_SOCKET_H='sys/socket.h'
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
48 fi
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
49 fi
be905220886f Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents: 8998
diff changeset
50 fi
11558
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
51 # We need to check for ws2tcpip.h now.
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
52 gl_PREREQ_SYS_H_SOCKET
11577
40afcbcc19ed sys_socket: MinGW and IRIX does not have sa_family_t type.
Simon Josefsson <simon@josefsson.org>
parents: 11558
diff changeset
53 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
11555
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
54 /* sys/types.h is not needed according to POSIX, but the
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
55 sys/socket.h in i386-unknown-freebsd4.10 and
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
56 powerpc-apple-darwin5.5 required it. */
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
57 #include <sys/types.h>
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
58 #ifdef HAVE_SYS_SOCKET_H
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
59 #include <sys/socket.h>
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
60 #endif
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
61 #ifdef HAVE_WS2TCPIP_H
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
62 #include <ws2tcpip.h>
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
63 #endif
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
64 ])
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
65 if test $ac_cv_type_struct_sockaddr_storage = no; then
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
66 HAVE_STRUCT_SOCKADDR_STORAGE=0
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
67 fi
11577
40afcbcc19ed sys_socket: MinGW and IRIX does not have sa_family_t type.
Simon Josefsson <simon@josefsson.org>
parents: 11558
diff changeset
68 if test $ac_cv_type_sa_family_t = no; then
40afcbcc19ed sys_socket: MinGW and IRIX does not have sa_family_t type.
Simon Josefsson <simon@josefsson.org>
parents: 11558
diff changeset
69 HAVE_SA_FAMILY_T=0
40afcbcc19ed sys_socket: MinGW and IRIX does not have sa_family_t type.
Simon Josefsson <simon@josefsson.org>
parents: 11558
diff changeset
70 fi
13910
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
71 if test $ac_cv_type_struct_sockaddr_storage != no; then
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
72 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
73 [],
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
74 [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0],
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
75 [#include <sys/types.h>
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
76 #ifdef HAVE_SYS_SOCKET_H
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
77 #include <sys/socket.h>
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
78 #endif
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
79 #ifdef HAVE_WS2TCPIP_H
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
80 #include <ws2tcpip.h>
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
81 #endif
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
82 ])
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
83 fi
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
84 if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
85 || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
86 SYS_SOCKET_H='sys/socket.h'
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
87 fi
12995
6991d7777e06 Fix bug introduced on 2009-12-31.
Bruno Haible <bruno@clisp.org>
parents: 12969
diff changeset
88 gl_PREREQ_SYS_H_WINSOCK2
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
89
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
90 dnl Check for declarations of anything we want to poison if the
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
91 dnl corresponding gnulib module is not in use.
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
92 gl_WARN_ON_USE_PREPARE([[
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
93 /* Some systems require prerequisite headers. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
94 #include <sys/types.h>
13900
b3c2041856e7 sys_socket: Fix test whether the functions are declared.
Bruno Haible <bruno@clisp.org>
parents: 13885
diff changeset
95 #include <sys/socket.h>
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
96 ]], [socket connect accept bind getpeername getsockname getsockopt
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
97 listen recv send recvfrom sendto setsockopt shutdown accept4])
6536
169ab032c734 Add sys_socket module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
98 ])
10535
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
99
11558
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
100 AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
101 [
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
102 dnl Check prerequisites of the <sys/socket.h> replacement.
14440
2081227303c5 socklen: do not depend on sys_socket
Paul Eggert <eggert@cs.ucla.edu>
parents: 14079
diff changeset
103 AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
11558
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
104 gl_CHECK_NEXT_HEADERS([sys/socket.h])
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
105 if test $ac_cv_header_sys_socket_h = yes; then
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
106 HAVE_SYS_SOCKET_H=1
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
107 HAVE_WS2TCPIP_H=0
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
108 else
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
109 HAVE_SYS_SOCKET_H=0
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
110 if test $ac_cv_header_ws2tcpip_h = yes; then
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
111 HAVE_WS2TCPIP_H=1
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
112 else
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
113 HAVE_WS2TCPIP_H=0
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
114 fi
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
115 fi
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
116 AC_SUBST([HAVE_SYS_SOCKET_H])
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
117 AC_SUBST([HAVE_WS2TCPIP_H])
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
118 ])
3ee72ca3f3ad m4/sys_socket_h.m4: Test for ws2tcpip.h earlier.
Simon Josefsson <simon@josefsson.org>
parents: 11555
diff changeset
119
11799
4956134d1aaf Typo in comment.
Bruno Haible <bruno@clisp.org>
parents: 11577
diff changeset
120 # Common prerequisites of the <sys/socket.h> replacement and of the
10535
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
121 # <sys/select.h> replacement.
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
122 # Sets and substitutes HAVE_WINSOCK2_H.
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
123 AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
124 [
10715
6549114b70b4 Reduce the dependencies of m4/sys_socket_h.m4.
Bruno Haible <bruno@clisp.org>
parents: 10714
diff changeset
125 m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
6549114b70b4 Reduce the dependencies of m4/sys_socket_h.m4.
Bruno Haible <bruno@clisp.org>
parents: 10714
diff changeset
126 m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
10535
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
127 AC_CHECK_HEADERS_ONCE([sys/socket.h])
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
128 if test $ac_cv_header_sys_socket_h != yes; then
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
129 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
130 dnl the check for those headers unconditional; yet cygwin reports
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
131 dnl that the headers are present but cannot be compiled (since on
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
132 dnl cygwin, all socket information should come from sys/socket.h).
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
133 AC_CHECK_HEADERS([winsock2.h])
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
134 fi
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
135 if test "$ac_cv_header_winsock2_h" = yes; then
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
136 HAVE_WINSOCK2_H=1
10610
9202c6340cce Combine the two replacements of 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10603
diff changeset
137 UNISTD_H_HAVE_WINSOCK2_H=1
10616
df8ab5d7dc3e New module 'ioctl'.
Bruno Haible <bruno@clisp.org>
parents: 10610
diff changeset
138 SYS_IOCTL_H_HAVE_WINSOCK2_H=1
10535
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
139 else
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
140 HAVE_WINSOCK2_H=0
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
141 fi
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
142 AC_SUBST([HAVE_WINSOCK2_H])
b74323a08ed4 Ensure correct syntax when sys/select.h is replaced but sys/socket.h is not.
Bruno Haible <bruno@clisp.org>
parents: 10466
diff changeset
143 ])
10594
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
144
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
145 AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
146 [
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
147 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
148 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
13066
fc8c984b0733 Factorize common .m4 code.
Bruno Haible <bruno@clisp.org>
parents: 12995
diff changeset
149 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
12969
c587d7959480 Tests of module 'sys_socket' in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
150 dnl Define it also as a C macro, for the benefit of the unit tests.
13071
b2385e7b332e Distinguish two kinds of module indicators.
Bruno Haible <bruno@clisp.org>
parents: 13066
diff changeset
151 gl_MODULE_INDICATOR_FOR_TESTS([$1])
10594
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
152 ])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
153
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
154 AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
155 [
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
156 GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
157 GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
158 GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
159 GNULIB_BIND=0; AC_SUBST([GNULIB_BIND])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
160 GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
161 GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
162 GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
163 GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
164 GNULIB_RECV=0; AC_SUBST([GNULIB_RECV])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
165 GNULIB_SEND=0; AC_SUBST([GNULIB_SEND])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
166 GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
167 GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO])
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
168 GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT])
10624
175cb8a02a3e New module 'shutdown'.
Bruno Haible <bruno@clisp.org>
parents: 10616
diff changeset
169 GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN])
11898
90fb3f330caf New module 'accept4'.
Bruno Haible <bruno@clisp.org>
parents: 11799
diff changeset
170 GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4])
11555
7612308943f7 sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents: 10715
diff changeset
171 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
13910
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
172 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
d2ab80f79a05 sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents: 13900
diff changeset
173 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
11577
40afcbcc19ed sys_socket: MinGW and IRIX does not have sa_family_t type.
Simon Josefsson <simon@josefsson.org>
parents: 11558
diff changeset
174 HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
11898
90fb3f330caf New module 'accept4'.
Bruno Haible <bruno@clisp.org>
parents: 11799
diff changeset
175 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
10594
43282f926709 New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents: 10535
diff changeset
176 ])