From 394c5a6e3419bf5042ab9bc3f78d724dbeac5ff3 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 15 Nov 2008 21:17:23 +0100 Subject: [PATCH] Make the netdb.h replacement work on Haiku. --- ChangeLog | 8 ++++++++ doc/posix-headers/netdb.texi | 2 +- lib/netdb.in.h | 10 +--------- m4/netdb_h.m4 | 12 +++++++++--- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index f60579df5..9c1c6d757 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2008-11-15 Bruno Haible + * lib/netdb.in.h: Activate the definitions also when the system's + 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 + * tests/test-sched.c: Test also the existence of the SCHED_* macros. Make the 'sched' module work on platforms where exists but diff --git a/doc/posix-headers/netdb.texi b/doc/posix-headers/netdb.texi index caef8e247..f27446f05 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 b0ee28679..c6aff668b 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 . */ - -#else - /* Get netdb.h definitions such as struct hostent for MinGW. */ #include @@ -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 6ae124817..5a12251f9 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 ]]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include + 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' -- 2.11.0