diff options
Diffstat (limited to 'gl/m4/getaddrinfo.m4')
-rw-r--r-- | gl/m4/getaddrinfo.m4 | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 1d631f8c..65a0fd0e 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 | |||
@@ -1,14 +1,13 @@ | |||
1 | # getaddrinfo.m4 serial 30 | 1 | # getaddrinfo.m4 serial 34 |
2 | dnl Copyright (C) 2004-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2004-2022 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 | AC_DEFUN([gl_GETADDRINFO], | 7 | AC_DEFUN([gl_GETADDRINFO], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H | 9 | AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H |
10 | AC_REQUIRE([gl_HEADER_NETDB])dnl for HAVE_NETDB_H | 10 | AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H |
11 | AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) | ||
12 | GETADDRINFO_LIB= | 11 | GETADDRINFO_LIB= |
13 | gai_saved_LIBS="$LIBS" | 12 | gai_saved_LIBS="$LIBS" |
14 | 13 | ||
@@ -55,10 +54,40 @@ AC_DEFUN([gl_GETADDRINFO], | |||
55 | if test "$gl_cv_w32_getaddrinfo" = "yes"; then | 54 | if test "$gl_cv_w32_getaddrinfo" = "yes"; then |
56 | GETADDRINFO_LIB="-lws2_32" | 55 | GETADDRINFO_LIB="-lws2_32" |
57 | LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" | 56 | LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" |
57 | dnl Check for correct signature, in particular for a cdecl-compatible | ||
58 | dnl calling convention. | ||
59 | AC_CACHE_CHECK([for getaddrinfo with POSIX signature], | ||
60 | [gl_cv_func_getaddrinfo_posix_signature], | ||
61 | [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | ||
62 | #include <sys/types.h> | ||
63 | #ifdef HAVE_SYS_SOCKET_H | ||
64 | #include <sys/socket.h> | ||
65 | #endif | ||
66 | #ifdef HAVE_NETDB_H | ||
67 | #include <netdb.h> | ||
68 | #endif | ||
69 | #ifdef HAVE_WS2TCPIP_H | ||
70 | #include <ws2tcpip.h> | ||
71 | #endif | ||
72 | #include <stddef.h> | ||
73 | extern | ||
74 | #ifdef __cplusplus | ||
75 | "C" | ||
76 | #endif | ||
77 | int getaddrinfo (const char *, const char *, const struct addrinfo *, struct addrinfo **); | ||
78 | ]])], | ||
79 | [gl_cv_func_getaddrinfo_posix_signature=yes], | ||
80 | [gl_cv_func_getaddrinfo_posix_signature=no]) | ||
81 | ]) | ||
82 | if test $gl_cv_func_getaddrinfo_posix_signature = no; then | ||
83 | REPLACE_GETADDRINFO=1 | ||
84 | fi | ||
58 | else | 85 | else |
59 | HAVE_GETADDRINFO=0 | 86 | HAVE_GETADDRINFO=0 |
60 | fi | 87 | fi |
61 | fi | 88 | fi |
89 | AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], | ||
90 | [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) | ||
62 | 91 | ||
63 | # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an | 92 | # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an |
64 | # inline function declared in ws2tcpip.h, so we need to get that | 93 | # inline function declared in ws2tcpip.h, so we need to get that |
@@ -127,13 +156,13 @@ const char *gai_strerror(int);]])], | |||
127 | # Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c. | 156 | # Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c. |
128 | AC_DEFUN([gl_PREREQ_GETADDRINFO], [ | 157 | AC_DEFUN([gl_PREREQ_GETADDRINFO], [ |
129 | AC_REQUIRE([gl_NETDB_H_DEFAULTS]) | 158 | AC_REQUIRE([gl_NETDB_H_DEFAULTS]) |
130 | AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H | 159 | AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H |
131 | AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB | 160 | AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB |
132 | AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB | 161 | AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB |
133 | AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB | 162 | AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB |
134 | AC_REQUIRE([AC_C_RESTRICT]) | 163 | AC_REQUIRE([AC_C_RESTRICT]) |
135 | AC_REQUIRE([gl_SOCKET_FAMILIES]) | 164 | AC_REQUIRE([gl_SOCKET_FAMILIES]) |
136 | AC_REQUIRE([gl_HEADER_SYS_SOCKET]) | 165 | AC_REQUIRE([gl_SYS_SOCKET_H]) |
137 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | 166 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
138 | 167 | ||
139 | dnl Including sys/socket.h is wrong for Windows, but Windows does not | 168 | dnl Including sys/socket.h is wrong for Windows, but Windows does not |