[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Test for getaddrinfo() broken on Tru64 UNIX 5.1
From: |
Bruno Haible |
Subject: |
Re: Test for getaddrinfo() broken on Tru64 UNIX 5.1 |
Date: |
Sat, 13 Oct 2007 16:25:21 +0200 |
User-agent: |
KMail/1.5.4 |
Hi Albert,
Simon has not taken this up in 3 days, so I'm doing it.
Albert Chin wrote:
> m4/getaddrinfo.m4 tests for getaddrinfo with:
> AC_CHECK_FUNCS(getaddrinfo
>
> This assumes getaddrinfo is available on the system under the name
> `getaddrinfo'. Not so on Tru64 UNIX 5.1 where <netdb.h> has:
> #if defined (_SOCKADDR_LEN) || defined (_XOPEN_SOURCE_EXTENDED)
> #define getaddrinfo ngetaddrinfo
> #else
> #define getaddrinfo ogetaddrinfo
> #endif
>
> The correct method to test for getaddrinfo on this system is to
> include <netdb.h> and try linking a program using getaddrinfo().
This is all right. Thanks for the report and patch.
> Patch attached.
I'm applying your patch, with modifications:
1) You are using HAVE_NETDB_H without checking for netdb.h before.
Move the AC_CHECK_HEADERS_ONCE(netdb.h) before it.
2) Use AC_CACHE_CHECK to avoid rerunning the check when reconfiguring and
when caches are enabled (since a link check is quite slow).
3) Don't define HAVE_GETADDRINFO. Nothing in gnulib uses it.
4) Don't use 0 to designate null pointers. That doesn't sit well with
C++ compilers.
2007-10-13 Albert Chin <address@hidden>
Bruno Haible <address@hidden>
* m4/getaddrinfo.m4 (gl_GETADDRINFO): Perform the test for getaddrinfo
through a link check that includes <netdb.h>. Needed for OSF/1 5.1.
*** m4/getaddrinfo.m4.orig 2007-10-13 16:24:07.000000000 +0200
--- m4/getaddrinfo.m4 2007-10-13 16:24:03.000000000 +0200
***************
*** 1,4 ****
! # getaddrinfo.m4 serial 13
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,
--- 1,4 ----
! # 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,16 ****
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_SEARCH_LIBS(getaddrinfo, [nsl socket])
! AC_CHECK_FUNCS(getaddrinfo,, [
AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
gl_cv_w32_getaddrinfo, [
gl_cv_w32_getaddrinfo=no
--- 9,31 ----
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_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,38 ****
else
AC_LIBOBJ(getaddrinfo)
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([
--- 42,52 ----
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_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
gl_cv_func_gai_strerror, [
AC_TRY_LINK([
- Test for getaddrinfo() broken on Tru64 UNIX 5.1, Albert Chin, 2007/10/10
- Re: Test for getaddrinfo() broken on Tru64 UNIX 5.1,
Bruno Haible <=
- Re: Test for getaddrinfo() broken on Tru64 UNIX 5.1, Benoit SIGOURE, 2007/10/13
- Re: Test for getaddrinfo() broken on Tru64 UNIX 5.1, Ben Pfaff, 2007/10/13
- Re: 0 vs. NULL (was: Re: Test for getaddrinfo() broken on Tru64 UNIX 5.1), Bruno Haible, 2007/10/13
- Re: 0 vs. NULL, Micah Cowan, 2007/10/13
- Re: 0 vs. NULL, Bruno Haible, 2007/10/13
- Re: 0 vs. NULL, Paul Eggert, 2007/10/15