diff options
Diffstat (limited to 'gl/m4/sys_socket_h.m4')
-rw-r--r-- | gl/m4/sys_socket_h.m4 | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 9f4db56..9486377 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 17 | 1 | # sys_socket_h.m4 serial 23 |
2 | dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005-2013 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. |
@@ -9,7 +9,18 @@ dnl From Simon Josefsson. | |||
9 | AC_DEFUN([gl_HEADER_SYS_SOCKET], | 9 | AC_DEFUN([gl_HEADER_SYS_SOCKET], |
10 | [ | 10 | [ |
11 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) |
12 | AC_REQUIRE([AC_C_INLINE]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | |||
14 | dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have | ||
15 | dnl old-style declarations (with return type 'int' instead of 'ssize_t') | ||
16 | dnl unless _POSIX_PII_SOCKET is defined. | ||
17 | case "$host_os" in | ||
18 | osf*) | ||
19 | AC_DEFINE([_POSIX_PII_SOCKET], [1], | ||
20 | [Define to 1 in order to get the POSIX compatible declarations | ||
21 | of socket functions.]) | ||
22 | ;; | ||
23 | esac | ||
13 | 24 | ||
14 | AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], | 25 | AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], |
15 | [gl_cv_header_sys_socket_h_selfcontained], | 26 | [gl_cv_header_sys_socket_h_selfcontained], |
@@ -57,6 +68,23 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
57 | if test $ac_cv_type_sa_family_t = no; then | 68 | if test $ac_cv_type_sa_family_t = no; then |
58 | HAVE_SA_FAMILY_T=0 | 69 | HAVE_SA_FAMILY_T=0 |
59 | fi | 70 | fi |
71 | if test $ac_cv_type_struct_sockaddr_storage != no; then | ||
72 | AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], | ||
73 | [], | ||
74 | [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0], | ||
75 | [#include <sys/types.h> | ||
76 | #ifdef HAVE_SYS_SOCKET_H | ||
77 | #include <sys/socket.h> | ||
78 | #endif | ||
79 | #ifdef HAVE_WS2TCPIP_H | ||
80 | #include <ws2tcpip.h> | ||
81 | #endif | ||
82 | ]) | ||
83 | fi | ||
84 | if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ | ||
85 | || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then | ||
86 | SYS_SOCKET_H='sys/socket.h' | ||
87 | fi | ||
60 | gl_PREREQ_SYS_H_WINSOCK2 | 88 | gl_PREREQ_SYS_H_WINSOCK2 |
61 | 89 | ||
62 | dnl Check for declarations of anything we want to poison if the | 90 | dnl Check for declarations of anything we want to poison if the |
@@ -64,10 +92,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
64 | gl_WARN_ON_USE_PREPARE([[ | 92 | gl_WARN_ON_USE_PREPARE([[ |
65 | /* Some systems require prerequisite headers. */ | 93 | /* Some systems require prerequisite headers. */ |
66 | #include <sys/types.h> | 94 | #include <sys/types.h> |
67 | #if !defined __GLIBC__ && HAVE_SYS_TIME_H | 95 | #include <sys/socket.h> |
68 | # include <sys/time.h> | ||
69 | #endif | ||
70 | #include <sys/select.h> | ||
71 | ]], [socket connect accept bind getpeername getsockname getsockopt | 96 | ]], [socket connect accept bind getpeername getsockname getsockopt |
72 | listen recv send recvfrom sendto setsockopt shutdown accept4]) | 97 | listen recv send recvfrom sendto setsockopt shutdown accept4]) |
73 | ]) | 98 | ]) |
@@ -75,17 +100,13 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
75 | AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], | 100 | AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], |
76 | [ | 101 | [ |
77 | dnl Check prerequisites of the <sys/socket.h> replacement. | 102 | dnl Check prerequisites of the <sys/socket.h> replacement. |
103 | AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) | ||
78 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) | 104 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) |
79 | if test $ac_cv_header_sys_socket_h = yes; then | 105 | if test $ac_cv_header_sys_socket_h = yes; then |
80 | HAVE_SYS_SOCKET_H=1 | 106 | HAVE_SYS_SOCKET_H=1 |
81 | HAVE_WS2TCPIP_H=0 | 107 | HAVE_WS2TCPIP_H=0 |
82 | else | 108 | else |
83 | HAVE_SYS_SOCKET_H=0 | 109 | HAVE_SYS_SOCKET_H=0 |
84 | dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make | ||
85 | dnl the check for those headers unconditional; yet cygwin reports | ||
86 | dnl that the headers are present but cannot be compiled (since on | ||
87 | dnl cygwin, all socket information should come from sys/socket.h). | ||
88 | AC_CHECK_HEADERS([ws2tcpip.h]) | ||
89 | if test $ac_cv_header_ws2tcpip_h = yes; then | 110 | if test $ac_cv_header_ws2tcpip_h = yes; then |
90 | HAVE_WS2TCPIP_H=1 | 111 | HAVE_WS2TCPIP_H=1 |
91 | else | 112 | else |
@@ -148,6 +169,8 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], | |||
148 | GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) | 169 | GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) |
149 | GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) | 170 | GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) |
150 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) | 171 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) |
172 | HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; | ||
173 | AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) | ||
151 | HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) | 174 | HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) |
152 | HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) | 175 | HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) |
153 | ]) | 176 | ]) |