Mercurial > hg > octave-lyh > gnulib-hg
changeset 9340:0a3ccd66183f
A different way to test for getaddrinfo, so that it works on OSF/1 5.1.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 13 Oct 2007 16:26:13 +0200 |
parents | 06538f749e42 |
children | 212d6f041290 |
files | ChangeLog m4/getaddrinfo.m4 |
diffstat | 2 files changed, 24 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-10-13 Albert Chin <china@thewrittenword.com> + Bruno Haible <bruno@clisp.org> + + * m4/getaddrinfo.m4 (gl_GETADDRINFO): Perform the test for getaddrinfo + through a link check that includes <netdb.h>. Needed for OSF/1 5.1. + 2007-10-13 Bruno Haible <bruno@clisp.org> * lib/argp-fmtstream.h (ARGP_FS_EI): If __GNUC_STDC_INLINE__ is
--- a/m4/getaddrinfo.m4 +++ b/m4/getaddrinfo.m4 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 13 +# getaddrinfo.m4 serial 14 dnl Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,8 +9,23 @@ AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) + AC_CHECK_HEADERS_ONCE(netdb.h) + AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) - AC_CHECK_FUNCS(getaddrinfo,, [ + AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ + AC_TRY_LINK([ +#include <sys/types.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETDB_H +#include <netdb.h> +#endif +#include <stdlib.h> +], [getaddrinfo("", "", NULL, NULL);], + [gl_cv_func_getaddrinfo=yes], + [gl_cv_func_getaddrinfo=no])]) + if test $gl_cv_func_getaddrinfo = no; then AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32, gl_cv_w32_getaddrinfo, [ gl_cv_w32_getaddrinfo=no @@ -27,12 +42,11 @@ else AC_LIBOBJ(getaddrinfo) fi - ]) + fi # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an # inline function declared in ws2tcpip.h, so we need to get that # header included somehow. - AC_CHECK_HEADERS_ONCE(netdb.h) AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], gl_cv_func_gai_strerror, [ AC_TRY_LINK([