bug-gnulib
[Top][All Lists]
Advanced

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

Re: getaddrinfo, netdb, canon-host


From: Bruno Haible
Subject: Re: getaddrinfo, netdb, canon-host
Date: Tue, 11 Nov 2008 01:23:57 +0100
User-agent: KMail/1.5.4

Simon Josefsson wrote on 2008-10-20:
>  * lib/getaddrinfo.h: Remove file.
>  * modules/getaddrinfo: Reflect move from getaddrinfo.h to netdb.h.
>  * m4/getaddrinfo.m4: Call gl_HEADER_NETDB.  Don't check for netdb.h.
>  * lib/netdb.in.h: Add declarations from getaddrinfo.h.

In order to keep gnulib-generated header files as independent from config.h
as possible, I'm applying this. Simon, I hope it's right?


2008-11-10  Bruno Haible  <address@hidden>

        * lib/netdb.in.h: Use HAVE_STRUCT_ADDRINFO, HAVE_DECL_GETADDRINFO,
        HAVE_DECL_FREEADDRINFO, HAVE_DECL_GAI_STRERROR, HAVE_DECL_GETNAMEINFO
        as autoconf-substituted macros.
        * m4/netdb_h.m4 (gl_NETDB_H_DEFAULTS): Initialize these variables to 1.
        * m4/getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): Require
        gl_NETDB_H_DEFAULTS. Set these variables.
        * modules/netdb (Makefile.am): Substitute these variables.

--- lib/netdb.in.h.orig 2008-11-11 01:18:34.000000000 +0100
+++ lib/netdb.in.h      2008-11-11 00:25:45.000000000 +0100
@@ -36,7 +36,7 @@
 #ifndef _GL_NETDB_H
 #define _GL_NETDB_H
 
-#if @HAVE_NETDB_H@ && HAVE_STRUCT_ADDRINFO
+#if @HAVE_NETDB_H@ && @HAVE_STRUCT_ADDRINFO@
 
 /* Declarations for a platform that has <netdb.h>.  */
 
@@ -50,7 +50,7 @@
 
 #if @GNULIB_GETADDRINFO@
 
-# ifndef HAVE_STRUCT_ADDRINFO
+# if address@hidden@
 
 /* Structure to contain information about address of a service provider.  */
 struct addrinfo
@@ -139,7 +139,7 @@
 #  endif
 # endif
 
-# if !HAVE_DECL_GETADDRINFO
+# if address@hidden@
 /* Translate name of a service location and/or a service name to set of
    socket addresses.
    For more details, see the POSIX:2001 specification
@@ -150,21 +150,21 @@
                        struct addrinfo **restrict res);
 # endif
 
-# if !HAVE_DECL_FREEADDRINFO
+# if address@hidden@
 /* Free `addrinfo' structure AI including associated storage.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
 extern void freeaddrinfo (struct addrinfo *ai);
 # endif
 
-# if !HAVE_DECL_GAI_STRERROR
+# if address@hidden@
 /* Convert error return from getaddrinfo() to a string.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/gai_strerror.html>.  */
 extern const char *gai_strerror (int ecode);
 # endif
 
-# if !HAVE_DECL_GETNAMEINFO
+# if address@hidden@
 /* Convert socket address to printable node and service names.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
--- m4/netdb_h.m4.orig  2008-11-11 01:18:34.000000000 +0100
+++ m4/netdb_h.m4       2008-11-11 00:28:49.000000000 +0100
@@ -1,4 +1,4 @@
-# netdb_h.m4 serial 3
+# netdb_h.m4 serial 4
 dnl Copyright (C) 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,
@@ -30,4 +30,10 @@
 AC_DEFUN([gl_NETDB_H_DEFAULTS],
 [
   GNULIB_GETADDRINFO=0; AC_SUBST([GNULIB_GETADDRINFO])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_STRUCT_ADDRINFO=1;   AC_SUBST([HAVE_STRUCT_ADDRINFO])
+  HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO])
+  HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR])
+  HAVE_DECL_GETADDRINFO=1;  AC_SUBST([HAVE_DECL_GETADDRINFO])
+  HAVE_DECL_GETNAMEINFO=1;  AC_SUBST([HAVE_DECL_GETNAMEINFO])
 ])
--- m4/getaddrinfo.m4.orig      2008-11-11 01:18:34.000000000 +0100
+++ m4/getaddrinfo.m4   2008-11-11 01:12:44.000000000 +0100
@@ -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,
@@ -71,8 +71,9 @@
   gl_PREREQ_GETADDRINFO
 ])
 
-# Prerequisites of lib/getaddrinfo.c.
+# Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c.
 AC_DEFUN([gl_PREREQ_GETADDRINFO], [
+  AC_REQUIRE([gl_NETDB_H_DEFAULTS])
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
   AC_SEARCH_LIBS(gethostbyname, [inet nsl])
   AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
@@ -104,6 +105,7 @@
   AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>])
 
   AC_CHECK_HEADERS_ONCE(netinet/in.h)
+
   AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
   /* sys/types.h is not needed according to POSIX, but the
      sys/socket.h in i386-unknown-freebsd4.10 and
@@ -119,6 +121,19 @@
 #include <ws2tcpip.h>
 #endif
 ])
+  if test $ac_cv_have_decl_getaddrinfo = no; then
+    HAVE_DECL_GETADDRINFO=0
+  fi
+  if test $ac_cv_have_decl_freeaddrinfo = no; then
+    HAVE_DECL_FREEADDRINFO=0
+  fi
+  if test $ac_cv_have_decl_gai_strerror = no; then
+    HAVE_DECL_GAI_STRERROR=0
+  fi
+  if test $ac_cv_have_decl_getnameinfo = no; then
+    HAVE_DECL_GETNAMEINFO=0
+  fi
+
   AC_CHECK_TYPES([struct addrinfo],,,[
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
@@ -131,4 +146,7 @@
 #include <ws2tcpip.h>
 #endif
 ])
+  if test $ac_cv_type_struct_addrinfo = no; then
+    HAVE_STRUCT_ADDRINFO=0
+  fi
 ])
--- modules/netdb.orig  2008-11-11 01:18:34.000000000 +0100
+++ modules/netdb       2008-11-11 00:27:16.000000000 +0100
@@ -25,6 +25,11 @@
              -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
              -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
              -e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \
+             -e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \
+             -e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \
+             -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
+             -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
+             -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
              < $(srcdir)/netdb.in.h; \
        } > address@hidden
        mv address@hidden $@





reply via email to

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