changeset 12870:e72f3991a813

netdb.h: Define AI_V4MAPPED, AI_ALL, AI_ADDRCONFIG when needed.
author Simon Josefsson <simon@josefsson.org>
date Wed, 17 Feb 2010 09:19:03 +0100
parents f95da3d36673
children a83b252424b6
files ChangeLog lib/netdb.in.h
diffstat 2 files changed, 23 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-17  Simon Josefsson  <simon@josefsson.org>
+
+	* lib/netdb.in.h (AI_V4MAPPED, AI_ALL, AI_ADDRCONFIG): Define to 0
+	if not provided by the system's netdb.h.  Reported by
+	ludo@gnu.org (Ludovic Courtès).
+
 2010-02-15  Jim Meyering  <meyering@redhat.com>
 
 	maint.mk: mark syntax-check sc_*.m rules as .PHONY
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -74,18 +74,24 @@
 # endif
 
 # if 0
-/* The commented out definitions below are not yet implemented in the
-   GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact,
-   cause conflicts on systems with a getaddrinfo() function which does not
-   define them.
+#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
+# endif
 
-   If they are restored, be sure to protect the definitions with #ifndef.  */
-#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
-#  define AI_V4MAPPED   0x0008  /* IPv4 mapped addresses are acceptable.  */
-#  define AI_ALL                0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
-#  define AI_ADDRCONFIG 0x0020  /* Use configuration of this host to choose
-                                   returned address type..  */
-# endif /* 0 */
+/* These symbolic constants are required to be present by POSIX, but
+   our getaddrinfo replacement doesn't use them (yet).  Setting them
+   to 0 on systems that doesn't have them avoids causing problems for
+   system getaddrinfo implementations that would be confused by
+   unknown values.  */
+# ifndef AI_V4MAPPED
+#  define AI_V4MAPPED    0 /* 0x0008: IPv4 mapped addresses are acceptable.  */
+# endif
+# ifndef AI_ALL
+#  define AI_ALL         0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */
+# endif
+# ifndef AI_ADDRCONFIG
+#  define AI_ADDRCONFIG  0 /* 0x0020: Use configuration of this host to choose
+                                      returned address type..  */
+# endif
 
 /* Error values for `getaddrinfo' function.  */
 # ifndef EAI_BADFLAGS