bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getaddrinfo, netdb, canon-host


From: Simon Josefsson
Subject: Re: getaddrinfo, netdb, canon-host
Date: Thu, 16 Oct 2008 13:50:00 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

>>  /* Declarations for a platform that lacks <netdb.h>.  */
>>  
>> +#if @GNULIB_GETADDRINFO@
>> +
>> +# ifndef HAVE_STRUCT_ADDRINFO
>> +
>
> I think these definitions need to be moved after this line:
>
>>  #endif /* HAVE_NETDB_H */
>
> because they apply also to systems that *do* have netdb.h but lack
> getaddrinfo.

Good catch.

If the systems do not have getaddrinfo but have netdb.h, gnulib's
declarations won't be visible unless netdb.h is created.  So
getaddrinfo.m4 needs to replace netdb.h in some additional cases, it
seems.

The patch below, on top of the previous, should fix this, I believe.

/Simon

>From 35782ed924ad5c696f81e9743214c7db842d0b9a Mon Sep 17 00:00:00 2001
From: Simon Josefsson <address@hidden>
Date: Thu, 16 Oct 2008 13:48:20 +0200
Subject: [PATCH] Replace netdb.h on systems that has it but do not have 
getaddrinfo.
 Suggested by Paolo Bonzini <address@hidden>.

---
 lib/netdb.in.h    |   11 ++++++-----
 m4/getaddrinfo.m4 |    4 +++-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index 9e51fea..b0188aa 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -16,9 +16,10 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-/* This file is supposed to be used on platforms that lack <netdb.h>.
-   It is intended to provide definitions and prototypes needed by an
-   application.  */
+/* This file is supposed to be used on platforms that lack <netdb.h>,
+   and on platforms where <netdb.h> does not provide all necessary
+   definitions.  It is intended to provide definitions and prototypes
+   needed by an application.  */
 
 #ifndef _GL_NETDB_H
 
@@ -45,6 +46,8 @@
 
 /* Declarations for a platform that lacks <netdb.h>.  */
 
+#endif /* HAVE_NETDB_H */
+
 #if @GNULIB_GETADDRINFO@
 
 # ifndef HAVE_STRUCT_ADDRINFO
@@ -177,7 +180,5 @@ extern int getnameinfo(const struct sockaddr *restrict sa, 
socklen_t salen,
 
 #endif /* @GNULIB_GETADDRINFO@ */
 
-#endif /* HAVE_NETDB_H */
-
 #endif /* _GL_NETDB_H */
 #endif /* _GL_NETDB_H */
diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4
index c184c6f..46d6fff 100644
--- a/m4/getaddrinfo.m4
+++ b/m4/getaddrinfo.m4
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 16
+# getaddrinfo.m4 serial 17
 dnl Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,6 +25,7 @@ AC_DEFUN([gl_GETADDRINFO],
       [gl_cv_func_getaddrinfo=yes],
       [gl_cv_func_getaddrinfo=no])])
   if test $gl_cv_func_getaddrinfo = no; then
+    NETDB_H='netdb.h'
     AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
                   gl_cv_w32_getaddrinfo, [
       gl_cv_w32_getaddrinfo=no
@@ -65,6 +66,7 @@ AC_DEFUN([gl_GETADDRINFO],
         [gl_cv_func_gai_strerror=yes],
         [gl_cv_func_gai_strerror=no])])
   if test $gl_cv_func_gai_strerror = no; then
+    NETDB_H='netdb.h'
     AC_LIBOBJ(gai_strerror)
   fi
 
-- 
1.5.6.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]