summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-11-15 21:17:23 +0100
committerBruno Haible <bruno@clisp.org>2008-11-15 21:17:23 +0100
commit394c5a6e3419bf5042ab9bc3f78d724dbeac5ff3 (patch)
tree6083380c0a3a06a52bfdc86de01e1b5956019451
parentc571b02a40485aa46e146a68d6d47eca71a4b477 (diff)
downloadgnulib-394c5a6e3419bf5042ab9bc3f78d724dbeac5ff3.tar.gz
Make the netdb.h replacement work on Haiku.
-rw-r--r--ChangeLog8
-rw-r--r--doc/posix-headers/netdb.texi2
-rw-r--r--lib/netdb.in.h10
-rw-r--r--m4/netdb_h.m412
4 files changed, 19 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index f60579df50..9c1c6d7577 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
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.
Make the 'sched' module work on platforms where <sched.h> exists but
diff --git a/doc/posix-headers/netdb.texi b/doc/posix-headers/netdb.texi
index caef8e2470..f27446f05c 100644
--- a/doc/posix-headers/netdb.texi
+++ b/doc/posix-headers/netdb.texi
@@ -13,7 +13,7 @@ mingw, BeOS.
@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:
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index b0ee286791..c6aff668b4 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -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 @@ struct addrinfo
# 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 @@ 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/netdb_h.m4 b/m4/netdb_h.m4
index 6ae1248177..5a12251f9a 100644
--- a/m4/netdb_h.m4
+++ b/m4/netdb_h.m4
@@ -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_DEFUN([gl_HEADER_NETDB],
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'