changeset 30500:079187e6951e

Make the netdb.h replacement work on Haiku.
author Bruno Haible <bruno@clisp.org>
date Sat, 15 Nov 2008 21:17:23 +0100
parents 99ec2aa4f78e
children ab4d86cbcaee
files ChangeLog doc/posix-headers/netdb.texi lib/netdb.in.h m4/netdb_h.m4
diffstat 4 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Nov 15 13:33:04 2008 +0100
+++ b/ChangeLog	Sat Nov 15 21:17:23 2008 +0100
@@ -1,3 +1,11 @@
+2008-11-15  Bruno Haible  <bruno@clisp.org>
+
+	* lib/netdb.in.h: Activate the definitions also when the system's
+	<netdb.h> has 'struct addrinfo'.
+	* m4/netdb_h.m4 (gl_HEADER_NETDB): Replace netdb.h also when it lacks
+	EAI_OVERFLOW or AI_NUMERICSERV.
+	* doc/posix-headers/netdb.texi: Document the problem.
+
 2008-11-15  Bruno Haible  <bruno@clisp.org>
 
 	* tests/test-sched.c: Test also the existence of the SCHED_* macros.
--- a/doc/posix-headers/netdb.texi	Sat Nov 15 13:33:04 2008 +0100
+++ b/doc/posix-headers/netdb.texi	Sat Nov 15 21:17:23 2008 +0100
@@ -13,7 +13,7 @@
 
 @item
 This header file is incomplete on some platforms:
-Cygwin 1.5.x
+Cygwin 1.5.x, Haiku.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/lib/netdb.in.h	Sat Nov 15 13:33:04 2008 +0100
+++ b/lib/netdb.in.h	Sat Nov 15 21:17:23 2008 +0100
@@ -36,12 +36,6 @@
 #ifndef _GL_NETDB_H
 #define _GL_NETDB_H
 
-#if @HAVE_NETDB_H@ && @HAVE_STRUCT_ADDRINFO@
-
-/* Declarations for a platform that has <netdb.h>.  */
-
-#else
-
 /* Get netdb.h definitions such as struct hostent for MinGW.  */
 #include <sys/socket.h>
 
@@ -112,7 +106,7 @@
 # endif
 
 # ifndef EAI_OVERFLOW
-/* Not defined on mingw32. */
+/* Not defined on mingw32 and Haiku. */
 #  define EAI_OVERFLOW	  -12	/* Argument buffer overflow.  */
 # endif
 # ifndef EAI_ADDRFAMILY
@@ -184,7 +178,5 @@
 
 #endif /* @GNULIB_GETADDRINFO@ */
 
-#endif /* HAVE_NETDB_H */
-
 #endif /* _GL_NETDB_H */
 #endif /* _GL_NETDB_H */
--- a/m4/netdb_h.m4	Sat Nov 15 13:33:04 2008 +0100
+++ b/m4/netdb_h.m4	Sat Nov 15 21:17:23 2008 +0100
@@ -1,4 +1,4 @@
-# netdb_h.m4 serial 4
+# netdb_h.m4 serial 5
 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,
@@ -9,8 +9,14 @@
   AC_REQUIRE([gl_NETDB_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([netdb.h])
   if test $ac_cv_header_netdb_h = yes; then
-    AC_CHECK_TYPES([struct addrinfo], [NETDB_H=''], [NETDB_H='netdb.h'],
-                   [[#include <netdb.h>]])
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[
+         #include <netdb.h>
+         struct addrinfo a;
+         int b = EAI_OVERFLOW;
+         int c = AI_NUMERICSERV;
+       ]])],
+      [NETDB_H=''], [NETDB_H='netdb.h'])
     HAVE_NETDB_H=1
   else
     NETDB_H='netdb.h'