summaryrefslogtreecommitdiffstats
path: root/gl/m4/getaddrinfo.m4
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 23:27:12 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 23:27:12 +0200
commit26fbe7f1e68bb0c96da32491efcf3696fe6c299b (patch)
treec4d95289187a64e9c7517bf73d8208026c3d2fb3 /gl/m4/getaddrinfo.m4
parent5f79e3e9f62ca5487d9881973149136ba1d19d3e (diff)
downloadmonitoring-plugins-26fbe7f1e68bb0c96da32491efcf3696fe6c299b.tar.gz
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/m4/getaddrinfo.m4')
-rw-r--r--gl/m4/getaddrinfo.m466
1 files changed, 51 insertions, 15 deletions
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
index bc3066db..1d631f8c 100644
--- a/gl/m4/getaddrinfo.m4
+++ b/gl/m4/getaddrinfo.m4
@@ -1,5 +1,5 @@
1# getaddrinfo.m4 serial 23 1# getaddrinfo.m4 serial 30
2dnl Copyright (C) 2004-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2013 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.
@@ -24,6 +24,7 @@ AC_DEFUN([gl_GETADDRINFO],
24 fi]) 24 fi])
25 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" 25 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
26 26
27 HAVE_GETADDRINFO=1
27 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ 28 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
28 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 29 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
29#include <sys/types.h> 30#include <sys/types.h>
@@ -55,16 +56,14 @@ AC_DEFUN([gl_GETADDRINFO],
55 GETADDRINFO_LIB="-lws2_32" 56 GETADDRINFO_LIB="-lws2_32"
56 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" 57 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
57 else 58 else
58 AC_LIBOBJ([getaddrinfo]) 59 HAVE_GETADDRINFO=0
59 fi 60 fi
60 fi 61 fi
61 62
62 # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an 63 # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
63 # inline function declared in ws2tcpip.h, so we need to get that 64 # inline function declared in ws2tcpip.h, so we need to get that
64 # header included somehow. 65 # header included somehow.
65 AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], 66 AC_CHECK_DECLS([gai_strerror], [], [], [[
66 gl_cv_func_gai_strerror, [
67 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
68#include <sys/types.h> 67#include <sys/types.h>
69#ifdef HAVE_SYS_SOCKET_H 68#ifdef HAVE_SYS_SOCKET_H
70#include <sys/socket.h> 69#include <sys/socket.h>
@@ -76,11 +75,46 @@ AC_DEFUN([gl_GETADDRINFO],
76#include <ws2tcpip.h> 75#include <ws2tcpip.h>
77#endif 76#endif
78#include <stddef.h> 77#include <stddef.h>
79]], [[gai_strerror (NULL);]])], 78]])
80 [gl_cv_func_gai_strerror=yes], 79 if test $ac_cv_have_decl_gai_strerror = yes; then
81 [gl_cv_func_gai_strerror=no])]) 80 AC_CHECK_DECLS([gai_strerrorA], [], [], [[
82 if test $gl_cv_func_gai_strerror = no; then 81#include <sys/types.h>
83 AC_LIBOBJ([gai_strerror]) 82#ifdef HAVE_SYS_SOCKET_H
83#include <sys/socket.h>
84#endif
85#ifdef HAVE_NETDB_H
86#include <netdb.h>
87#endif
88#ifdef HAVE_WS2TCPIP_H
89#include <ws2tcpip.h>
90#endif
91#include <stddef.h>
92]])
93 dnl check for correct signature
94 AC_CACHE_CHECK([for gai_strerror with POSIX signature],
95 [gl_cv_func_gai_strerror_posix_signature], [
96 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
97#include <sys/types.h>
98#ifdef HAVE_SYS_SOCKET_H
99#include <sys/socket.h>
100#endif
101#ifdef HAVE_NETDB_H
102#include <netdb.h>
103#endif
104#ifdef HAVE_WS2TCPIP_H
105#include <ws2tcpip.h>
106#endif
107#include <stddef.h>
108extern
109#ifdef __cplusplus
110"C"
111#endif
112const char *gai_strerror(int);]])],
113 [gl_cv_func_gai_strerror_posix_signature=yes],
114 [gl_cv_func_gai_strerror_posix_signature=no])])
115 if test $gl_cv_func_gai_strerror_posix_signature = no; then
116 REPLACE_GAI_STRERROR=1
117 fi
84 fi 118 fi
85 119
86 LIBS="$gai_saved_LIBS" 120 LIBS="$gai_saved_LIBS"
@@ -100,16 +134,18 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
100 AC_REQUIRE([AC_C_RESTRICT]) 134 AC_REQUIRE([AC_C_RESTRICT])
101 AC_REQUIRE([gl_SOCKET_FAMILIES]) 135 AC_REQUIRE([gl_SOCKET_FAMILIES])
102 AC_REQUIRE([gl_HEADER_SYS_SOCKET]) 136 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
103 AC_REQUIRE([AC_C_INLINE])
104 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 137 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
105 138
106 dnl Including sys/socket.h is wrong for Windows, but Windows does not 139 dnl Including sys/socket.h is wrong for Windows, but Windows does not
107 dnl have sa_len so the result is correct anyway. 140 dnl have sa_len so the result is correct anyway.
108 AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>]) 141 AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [
142#include <sys/types.h>
143#include <sys/socket.h>
144])
109 145
110 AC_CHECK_HEADERS_ONCE([netinet/in.h]) 146 AC_CHECK_HEADERS_ONCE([netinet/in.h])
111 147
112 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ 148 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[[
113 /* sys/types.h is not needed according to POSIX, but the 149 /* sys/types.h is not needed according to POSIX, but the
114 sys/socket.h in i386-unknown-freebsd4.10 and 150 sys/socket.h in i386-unknown-freebsd4.10 and
115 powerpc-apple-darwin5.5 required it. */ 151 powerpc-apple-darwin5.5 required it. */
@@ -123,7 +159,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
123#ifdef HAVE_WS2TCPIP_H 159#ifdef HAVE_WS2TCPIP_H
124#include <ws2tcpip.h> 160#include <ws2tcpip.h>
125#endif 161#endif
126]) 162]])
127 if test $ac_cv_have_decl_getaddrinfo = no; then 163 if test $ac_cv_have_decl_getaddrinfo = no; then
128 HAVE_DECL_GETADDRINFO=0 164 HAVE_DECL_GETADDRINFO=0
129 fi 165 fi