summaryrefslogtreecommitdiffstats
path: root/gl/m4/getaddrinfo.m4
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-02-12 11:07:18 +0000
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-02-12 11:07:18 +0000
commitbd7029a99b0c2974265c6665638ef14a052f42ab (patch)
treef5661ba73366d81ef6e91f889ea7fec5ebe07b6b /gl/m4/getaddrinfo.m4
parentf99612320d6eda67644c07be04bb21aa4d7789db (diff)
downloadmonitoring-plugins-bd7029a99b0c2974265c6665638ef14a052f42ab.tar.gz
Sync to latest Gnulib
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1925 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'gl/m4/getaddrinfo.m4')
-rw-r--r--gl/m4/getaddrinfo.m458
1 files changed, 50 insertions, 8 deletions
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
index db285d94..5d36c195 100644
--- a/gl/m4/getaddrinfo.m4
+++ b/gl/m4/getaddrinfo.m4
@@ -1,15 +1,31 @@
1# getaddrinfo.m4 serial 11 1# getaddrinfo.m4 serial 15
2dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2004, 2005, 2006, 2007 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.
6 6
7AC_DEFUN([gl_GETADDRINFO], 7AC_DEFUN([gl_GETADDRINFO],
8[ 8[
9 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
9 AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) 10 AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
10 11
12 AC_CHECK_HEADERS_ONCE(netdb.h)
13
11 AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) 14 AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
12 AC_CHECK_FUNCS(getaddrinfo,, [ 15 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
16 AC_TRY_LINK([
17#include <sys/types.h>
18#ifdef HAVE_SYS_SOCKET_H
19#include <sys/socket.h>
20#endif
21#ifdef HAVE_NETDB_H
22#include <netdb.h>
23#endif
24#include <stddef.h>
25], [getaddrinfo("", "", NULL, NULL);],
26 [gl_cv_func_getaddrinfo=yes],
27 [gl_cv_func_getaddrinfo=no])])
28 if test $gl_cv_func_getaddrinfo = no; then
13 AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32, 29 AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
14 gl_cv_w32_getaddrinfo, [ 30 gl_cv_w32_getaddrinfo, [
15 gl_cv_w32_getaddrinfo=no 31 gl_cv_w32_getaddrinfo=no
@@ -19,21 +35,46 @@ AC_DEFUN([gl_GETADDRINFO],
19#ifdef HAVE_WS2TCPIP_H 35#ifdef HAVE_WS2TCPIP_H
20#include <ws2tcpip.h> 36#include <ws2tcpip.h>
21#endif 37#endif
22], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes) 38#include <stddef.h>
39], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes)
23 LIBS="$am_save_LIBS"]) 40 LIBS="$am_save_LIBS"])
24 if test "$gl_cv_w32_getaddrinfo" = "yes"; then 41 if test "$gl_cv_w32_getaddrinfo" = "yes"; then
25 LIBS="$LIBS -lws2_32" 42 LIBS="$LIBS -lws2_32"
26 else 43 else
27 AC_LIBOBJ(getaddrinfo) 44 AC_LIBOBJ(getaddrinfo)
28 fi 45 fi
29 ]) 46 fi
47
48 # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
49 # inline function declared in ws2tcpip.h, so we need to get that
50 # header included somehow.
51 AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
52 gl_cv_func_gai_strerror, [
53 AC_TRY_LINK([
54#include <sys/types.h>
55#ifdef HAVE_SYS_SOCKET_H
56#include <sys/socket.h>
57#endif
58#ifdef HAVE_NETDB_H
59#include <netdb.h>
60#endif
61#ifdef HAVE_WS2TCPIP_H
62#include <ws2tcpip.h>
63#endif
64#include <stddef.h>
65], [gai_strerror (NULL);],
66 [gl_cv_func_gai_strerror=yes],
67 [gl_cv_func_gai_strerror=no])])
68 if test $gl_cv_func_gai_strerror = no; then
69 AC_LIBOBJ(gai_strerror)
70 fi
30 71
31 AC_REPLACE_FUNCS(gai_strerror)
32 gl_PREREQ_GETADDRINFO 72 gl_PREREQ_GETADDRINFO
33]) 73])
34 74
35# Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c. 75# Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
36AC_DEFUN([gl_PREREQ_GETADDRINFO], [ 76AC_DEFUN([gl_PREREQ_GETADDRINFO], [
77 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
37 AC_SEARCH_LIBS(gethostbyname, [inet nsl]) 78 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
38 AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet]) 79 AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
39 AC_CHECK_FUNCS(gethostbyname,, [ 80 AC_CHECK_FUNCS(gethostbyname,, [
@@ -46,7 +87,8 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
46#ifdef HAVE_WINSOCK2_H 87#ifdef HAVE_WINSOCK2_H
47#include <winsock2.h> 88#include <winsock2.h>
48#endif 89#endif
49], [gethostbyname(0);], gl_cv_w32_gethostbyname=yes) 90#include <stddef.h>
91], [gethostbyname(NULL);], gl_cv_w32_gethostbyname=yes)
50 LIBS="$am_save_LIBS"]) 92 LIBS="$am_save_LIBS"])
51 if test "$gl_cv_w32_gethostbyname" = "yes"; then 93 if test "$gl_cv_w32_gethostbyname" = "yes"; then
52 LIBS="$LIBS -lws2_32" 94 LIBS="$LIBS -lws2_32"
@@ -56,7 +98,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
56 AC_REQUIRE([gl_SOCKET_FAMILIES]) 98 AC_REQUIRE([gl_SOCKET_FAMILIES])
57 AC_REQUIRE([gl_HEADER_SYS_SOCKET]) 99 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
58 AC_REQUIRE([AC_C_INLINE]) 100 AC_REQUIRE([AC_C_INLINE])
59 AC_REQUIRE([AC_GNU_SOURCE]) 101 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
60 AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h) 102 AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h)
61 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ 103 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
62 /* sys/types.h is not needed according to POSIX, but the 104 /* sys/types.h is not needed according to POSIX, but the