diff options
Diffstat (limited to 'gl/m4/sys_socket_h.m4')
-rw-r--r-- | gl/m4/sys_socket_h.m4 | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 85a0ace..d1cb9c2 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 12 |
2 | dnl Copyright (C) 2005-2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005-2009 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. |
@@ -40,32 +40,54 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
40 | else | 40 | else |
41 | SYS_SOCKET_H='sys/socket.h' | 41 | SYS_SOCKET_H='sys/socket.h' |
42 | fi | 42 | fi |
43 | # We need to check for ws2tcpip.h now. | ||
44 | gl_PREREQ_SYS_H_SOCKET | ||
45 | AC_CHECK_TYPES([struct sockaddr_storage],,,[ | ||
46 | /* sys/types.h is not needed according to POSIX, but the | ||
47 | sys/socket.h in i386-unknown-freebsd4.10 and | ||
48 | powerpc-apple-darwin5.5 required it. */ | ||
49 | #include <sys/types.h> | ||
50 | #ifdef HAVE_SYS_SOCKET_H | ||
51 | #include <sys/socket.h> | ||
52 | #endif | ||
53 | #ifdef HAVE_WS2TCPIP_H | ||
54 | #include <ws2tcpip.h> | ||
55 | #endif | ||
56 | ]) | ||
57 | if test $ac_cv_type_struct_sockaddr_storage = no; then | ||
58 | HAVE_STRUCT_SOCKADDR_STORAGE=0 | ||
59 | SYS_SOCKET_H='sys/socket.h' | ||
60 | fi | ||
43 | if test -n "$SYS_SOCKET_H"; then | 61 | if test -n "$SYS_SOCKET_H"; then |
44 | dnl Check prerequisites of the <sys/socket.h> replacement. | ||
45 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) | ||
46 | if test $ac_cv_header_sys_socket_h = yes; then | ||
47 | HAVE_SYS_SOCKET_H=1 | ||
48 | HAVE_WS2TCPIP_H=0 | ||
49 | else | ||
50 | HAVE_SYS_SOCKET_H=0 | ||
51 | dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make | ||
52 | dnl the check for those headers unconditional; yet cygwin reports | ||
53 | dnl that the headers are present but cannot be compiled (since on | ||
54 | dnl cygwin, all socket information should come from sys/socket.h). | ||
55 | AC_CHECK_HEADERS([ws2tcpip.h]) | ||
56 | if test $ac_cv_header_ws2tcpip_h = yes; then | ||
57 | HAVE_WS2TCPIP_H=1 | ||
58 | else | ||
59 | HAVE_WS2TCPIP_H=0 | ||
60 | fi | ||
61 | fi | ||
62 | gl_PREREQ_SYS_H_WINSOCK2 | 62 | gl_PREREQ_SYS_H_WINSOCK2 |
63 | AC_SUBST([HAVE_SYS_SOCKET_H]) | ||
64 | AC_SUBST([HAVE_WS2TCPIP_H]) | ||
65 | fi | 63 | fi |
66 | AC_SUBST([SYS_SOCKET_H]) | 64 | AC_SUBST([SYS_SOCKET_H]) |
67 | ]) | 65 | ]) |
68 | 66 | ||
67 | AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], | ||
68 | [ | ||
69 | dnl Check prerequisites of the <sys/socket.h> replacement. | ||
70 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) | ||
71 | if test $ac_cv_header_sys_socket_h = yes; then | ||
72 | HAVE_SYS_SOCKET_H=1 | ||
73 | HAVE_WS2TCPIP_H=0 | ||
74 | else | ||
75 | HAVE_SYS_SOCKET_H=0 | ||
76 | dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make | ||
77 | dnl the check for those headers unconditional; yet cygwin reports | ||
78 | dnl that the headers are present but cannot be compiled (since on | ||
79 | dnl cygwin, all socket information should come from sys/socket.h). | ||
80 | AC_CHECK_HEADERS([ws2tcpip.h]) | ||
81 | if test $ac_cv_header_ws2tcpip_h = yes; then | ||
82 | HAVE_WS2TCPIP_H=1 | ||
83 | else | ||
84 | HAVE_WS2TCPIP_H=0 | ||
85 | fi | ||
86 | fi | ||
87 | AC_SUBST([HAVE_SYS_SOCKET_H]) | ||
88 | AC_SUBST([HAVE_WS2TCPIP_H]) | ||
89 | ]) | ||
90 | |||
69 | # Common prerequisites of of the <sys/socket.h> replacement and of the | 91 | # Common prerequisites of of the <sys/socket.h> replacement and of the |
70 | # <sys/select.h> replacement. | 92 | # <sys/select.h> replacement. |
71 | # Sets and substitutes HAVE_WINSOCK2_H. | 93 | # Sets and substitutes HAVE_WINSOCK2_H. |
@@ -114,4 +136,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], | |||
114 | GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) | 136 | GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) |
115 | GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) | 137 | GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) |
116 | GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) | 138 | GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) |
139 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) | ||
117 | ]) | 140 | ]) |