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.m437
1 files changed, 25 insertions, 12 deletions
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index d1cb9c20..9f4db562 100644
--- a/gl/m4/sys_socket_h.m4
+++ b/gl/m4/sys_socket_h.m4
@@ -1,5 +1,5 @@
1# sys_socket_h.m4 serial 12 1# sys_socket_h.m4 serial 17
2dnl Copyright (C) 2005-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -19,7 +19,6 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
19 [gl_cv_header_sys_socket_h_selfcontained=no]) 19 [gl_cv_header_sys_socket_h_selfcontained=no])
20 ]) 20 ])
21 if test $gl_cv_header_sys_socket_h_selfcontained = yes; then 21 if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
22 SYS_SOCKET_H=''
23 dnl If the shutdown function exists, <sys/socket.h> should define 22 dnl If the shutdown function exists, <sys/socket.h> should define
24 dnl SHUT_RD, SHUT_WR, SHUT_RDWR. 23 dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
25 AC_CHECK_FUNCS([shutdown]) 24 AC_CHECK_FUNCS([shutdown])
@@ -37,12 +36,10 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
37 SYS_SOCKET_H='sys/socket.h' 36 SYS_SOCKET_H='sys/socket.h'
38 fi 37 fi
39 fi 38 fi
40 else
41 SYS_SOCKET_H='sys/socket.h'
42 fi 39 fi
43 # We need to check for ws2tcpip.h now. 40 # We need to check for ws2tcpip.h now.
44 gl_PREREQ_SYS_H_SOCKET 41 gl_PREREQ_SYS_H_SOCKET
45 AC_CHECK_TYPES([struct sockaddr_storage],,,[ 42 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
46 /* sys/types.h is not needed according to POSIX, but the 43 /* sys/types.h is not needed according to POSIX, but the
47 sys/socket.h in i386-unknown-freebsd4.10 and 44 sys/socket.h in i386-unknown-freebsd4.10 and
48 powerpc-apple-darwin5.5 required it. */ 45 powerpc-apple-darwin5.5 required it. */
@@ -56,12 +53,23 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
56]) 53])
57 if test $ac_cv_type_struct_sockaddr_storage = no; then 54 if test $ac_cv_type_struct_sockaddr_storage = no; then
58 HAVE_STRUCT_SOCKADDR_STORAGE=0 55 HAVE_STRUCT_SOCKADDR_STORAGE=0
59 SYS_SOCKET_H='sys/socket.h'
60 fi 56 fi
61 if test -n "$SYS_SOCKET_H"; then 57 if test $ac_cv_type_sa_family_t = no; then
62 gl_PREREQ_SYS_H_WINSOCK2 58 HAVE_SA_FAMILY_T=0
63 fi 59 fi
64 AC_SUBST([SYS_SOCKET_H]) 60 gl_PREREQ_SYS_H_WINSOCK2
61
62 dnl Check for declarations of anything we want to poison if the
63 dnl corresponding gnulib module is not in use.
64 gl_WARN_ON_USE_PREPARE([[
65/* Some systems require prerequisite headers. */
66#include <sys/types.h>
67#if !defined __GLIBC__ && HAVE_SYS_TIME_H
68# include <sys/time.h>
69#endif
70#include <sys/select.h>
71 ]], [socket connect accept bind getpeername getsockname getsockopt
72 listen recv send recvfrom sendto setsockopt shutdown accept4])
65]) 73])
66 74
67AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], 75AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
@@ -88,7 +96,7 @@ AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
88 AC_SUBST([HAVE_WS2TCPIP_H]) 96 AC_SUBST([HAVE_WS2TCPIP_H])
89]) 97])
90 98
91# Common prerequisites of of the <sys/socket.h> replacement and of the 99# Common prerequisites of the <sys/socket.h> replacement and of the
92# <sys/select.h> replacement. 100# <sys/select.h> replacement.
93# Sets and substitutes HAVE_WINSOCK2_H. 101# Sets and substitutes HAVE_WINSOCK2_H.
94AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], 102AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
@@ -117,7 +125,9 @@ AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
117[ 125[
118 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 126 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
119 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) 127 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
120 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 128 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
129 dnl Define it also as a C macro, for the benefit of the unit tests.
130 gl_MODULE_INDICATOR_FOR_TESTS([$1])
121]) 131])
122 132
123AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], 133AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
@@ -136,5 +146,8 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
136 GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) 146 GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO])
137 GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) 147 GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT])
138 GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) 148 GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN])
149 GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4])
139 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 150 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
151 HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
152 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
140]) 153])