summaryrefslogtreecommitdiffstats
path: root/gl/m4/getaddrinfo.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/getaddrinfo.m4')
-rw-r--r--gl/m4/getaddrinfo.m425
1 files changed, 16 insertions, 9 deletions
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
index 4088671..bc3066d 100644
--- a/gl/m4/getaddrinfo.m4
+++ b/gl/m4/getaddrinfo.m4
@@ -1,5 +1,5 @@
1# getaddrinfo.m4 serial 20 1# getaddrinfo.m4 serial 23
2dnl Copyright (C) 2004-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2010 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.
@@ -25,7 +25,7 @@ AC_DEFUN([gl_GETADDRINFO],
25 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" 25 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
26 26
27 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ 27 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
28 AC_TRY_LINK([ 28 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
29#include <sys/types.h> 29#include <sys/types.h>
30#ifdef HAVE_SYS_SOCKET_H 30#ifdef HAVE_SYS_SOCKET_H
31#include <sys/socket.h> 31#include <sys/socket.h>
@@ -34,21 +34,21 @@ AC_DEFUN([gl_GETADDRINFO],
34#include <netdb.h> 34#include <netdb.h>
35#endif 35#endif
36#include <stddef.h> 36#include <stddef.h>
37], [getaddrinfo("", "", NULL, NULL);], 37]], [[getaddrinfo("", "", NULL, NULL);]])],
38 [gl_cv_func_getaddrinfo=yes], 38 [gl_cv_func_getaddrinfo=yes],
39 [gl_cv_func_getaddrinfo=no])]) 39 [gl_cv_func_getaddrinfo=no])])
40 if test $gl_cv_func_getaddrinfo = no; then 40 if test $gl_cv_func_getaddrinfo = no; then
41 AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32], 41 AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32],
42 gl_cv_w32_getaddrinfo, [ 42 gl_cv_w32_getaddrinfo, [
43 gl_cv_w32_getaddrinfo=no 43 gl_cv_w32_getaddrinfo=no
44 am_save_LIBS="$LIBS" 44 am_save_LIBS="$LIBS"
45 LIBS="$LIBS -lws2_32" 45 LIBS="$LIBS -lws2_32"
46 AC_TRY_LINK([ 46 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
47#ifdef HAVE_WS2TCPIP_H 47#ifdef HAVE_WS2TCPIP_H
48#include <ws2tcpip.h> 48#include <ws2tcpip.h>
49#endif 49#endif
50#include <stddef.h> 50#include <stddef.h>
51], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes) 51]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes])
52 LIBS="$am_save_LIBS" 52 LIBS="$am_save_LIBS"
53 ]) 53 ])
54 if test "$gl_cv_w32_getaddrinfo" = "yes"; then 54 if test "$gl_cv_w32_getaddrinfo" = "yes"; then
@@ -64,7 +64,7 @@ AC_DEFUN([gl_GETADDRINFO],
64 # header included somehow. 64 # header included somehow.
65 AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], 65 AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
66 gl_cv_func_gai_strerror, [ 66 gl_cv_func_gai_strerror, [
67 AC_TRY_LINK([ 67 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
68#include <sys/types.h> 68#include <sys/types.h>
69#ifdef HAVE_SYS_SOCKET_H 69#ifdef HAVE_SYS_SOCKET_H
70#include <sys/socket.h> 70#include <sys/socket.h>
@@ -76,7 +76,7 @@ AC_DEFUN([gl_GETADDRINFO],
76#include <ws2tcpip.h> 76#include <ws2tcpip.h>
77#endif 77#endif
78#include <stddef.h> 78#include <stddef.h>
79], [gai_strerror (NULL);], 79]], [[gai_strerror (NULL);]])],
80 [gl_cv_func_gai_strerror=yes], 80 [gl_cv_func_gai_strerror=yes],
81 [gl_cv_func_gai_strerror=no])]) 81 [gl_cv_func_gai_strerror=no])])
82 if test $gl_cv_func_gai_strerror = no; then 82 if test $gl_cv_func_gai_strerror = no; then
@@ -96,6 +96,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
96 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H 96 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
97 AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB 97 AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB
98 AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB 98 AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB
99 AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB
99 AC_REQUIRE([AC_C_RESTRICT]) 100 AC_REQUIRE([AC_C_RESTRICT])
100 AC_REQUIRE([gl_SOCKET_FAMILIES]) 101 AC_REQUIRE([gl_SOCKET_FAMILIES])
101 AC_REQUIRE([gl_HEADER_SYS_SOCKET]) 102 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
@@ -163,4 +164,10 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
163 *" $SERVENT_LIB "*) ;; 164 *" $SERVENT_LIB "*) ;;
164 *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;; 165 *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;;
165 esac 166 esac
167
168 dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
169 case " $GETADDRINFO_LIB " in
170 *" $INET_NTOP_LIB "*) ;;
171 *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;;
172 esac
166]) 173])