1 # getaddrinfo.m4 serial 8
2 dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_GETADDRINFO],
9 AC_MSG_NOTICE([checking how to do getaddrinfo])
11 AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
12 AC_CHECK_FUNCS(getaddrinfo,, [
13 AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
14 gl_cv_w32_getaddrinfo, [
15 gl_cv_w32_getaddrinfo=no
19 #ifdef HAVE_WS2TCPIP_H
23 ], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes)
25 if test "$gl_cv_w32_getaddrinfo" = "yes"; then
28 AC_LIBOBJ(getaddrinfo)
32 AC_REPLACE_FUNCS(gai_strerror)
36 # Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
37 AC_DEFUN([gl_PREREQ_GETADDRINFO], [
38 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
39 AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
40 AC_REQUIRE([gl_C_RESTRICT])
41 AC_REQUIRE([gl_SOCKET_FAMILIES])
42 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
43 AC_REQUIRE([AC_C_INLINE])
44 AC_REQUIRE([AC_GNU_SOURCE])
45 AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h)
46 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror],,,[
47 /* sys/types.h is not needed according to POSIX, but the
48 sys/socket.h in i386-unknown-freebsd4.10 and
49 powerpc-apple-darwin5.5 required it. */
50 #include <sys/types.h>
51 #ifdef HAVE_SYS_SOCKET_H
52 #include <sys/socket.h>
57 #ifdef HAVE_WS2TCPIP_H
62 AC_CHECK_TYPES([struct addrinfo],,,[
63 #include <sys/types.h>
64 #ifdef HAVE_SYS_SOCKET_H
65 #include <sys/socket.h>
70 #ifdef HAVE_WS2TCPIP_H