1 # getaddrinfo.m4 serial 7
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
21 ], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes)
23 if test "$gl_cv_w32_getaddrinfo" = "yes"; then
26 AC_LIBOBJ(getaddrinfo)
30 AC_REPLACE_FUNCS(gai_strerror)
34 # Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
35 AC_DEFUN([gl_PREREQ_GETADDRINFO], [
36 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
37 AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
38 AC_REQUIRE([gl_C_RESTRICT])
39 AC_REQUIRE([gl_SOCKET_FAMILIES])
40 AC_REQUIRE([AC_C_INLINE])
41 AC_REQUIRE([AC_GNU_SOURCE])
42 AC_CHECK_HEADERS_ONCE(netinet/in.h sys/socket.h netdb.h ws2tcpip.h)
43 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror],,,[
44 /* sys/types.h is not needed according to POSIX, but the
45 sys/socket.h in i386-unknown-freebsd4.10 and
46 powerpc-apple-darwin5.5 required it. */
47 #include <sys/types.h>
48 #ifdef HAVE_SYS_SOCKET_H
49 #include <sys/socket.h>
54 #ifdef HAVE_WS2TCPIP_H
59 AC_CHECK_TYPES([struct addrinfo],,,[
60 #include <sys/types.h>
61 #ifdef HAVE_SYS_SOCKET_H
62 #include <sys/socket.h>
67 #ifdef HAVE_WS2TCPIP_H