From: Bruno Haible Date: Sat, 15 Nov 2008 20:17:23 +0000 (+0100) Subject: Make the netdb.h replacement work on Haiku. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=394c5a6e3419bf5042ab9bc3f78d724dbeac5ff3;p=pspp Make the netdb.h replacement work on Haiku. --- diff --git a/ChangeLog b/ChangeLog index f60579df50..9c1c6d7577 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +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. 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 . */ - -#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 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 ]]) + 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'