Currently empty and unused, but that will change soon.
+2008-10-15 Simon Josefsson <simon@josefsson.org>
+
+ * modules/netdb, modules/netdb-tests: New file.
+ * m4/netdb_h.m4: New file.
+ * lib/netdb.in.h: Add, currently just an empty file pending
+ definitions.
+ * tests/test-netdb.c: New file.
+ * doc/posix-headers/netdb.texi: Mention that we replace it if
+ needed.
+ * MODULES.html.sh (Support for systems lacking POSIX:2001): Add
+ netdb.
+
2008-10-15 Simon Josefsson <simon@josefsson.org>
* doc/gnulib.texi (Getaddrinfo and WINVER): Sync documentation
func_module mkdir
func_module mkdtemp
func_module mkstemp
+ func_module netdb
func_module netinet_in
func_module open
func_module perror
Portability problems fixed by Gnulib:
@itemize
+@item
+This header file is missing on some platforms:
+mingw, BeOS.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
-@item
-This header file is missing on some platforms:
-mingw, BeOS.
@end itemize
--- /dev/null
+/* Provide a netdb.h header file for systems lacking it (read: MinGW).
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Written by Simon Josefsson.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* This file is supposed to be used on platforms that lack <netdb.h>.
+ It is intended to provide definitions and prototypes needed by an
+ application. */
+
+#ifndef _GL_NETDB_H
+
+#if @HAVE_NETDB_H@
+
+@PRAGMA_SYSTEM_HEADER@
+
+/* The include_next requires a split double-inclusion guard. */
+# @INCLUDE_NEXT@ @NEXT_NETDB_H@
+
+#endif
+
+#ifndef _GL_NETDB_H
+#define _GL_NETDB_H
+
+#if @HAVE_NETDB_H@
+
+/* Declarations for a platform that has <netdb.h>. */
+
+#else
+
+/* Declarations for a platform that has <netdb.h>. */
+
+#endif /* HAVE_NETDB_H */
+
+#endif /* _GL_NETDB_H */
+#endif /* _GL_NETDB_H */
--- /dev/null
+# netdb_h.m4 serial 1
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_HEADER_NETDB],
+[
+ AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+ AC_CACHE_CHECK([whether <netdb.h> is self-contained],
+ [gl_cv_header_netdb_h_selfcontained],
+ [
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
+ [[struct hostent h;]])],
+ [gl_cv_header_netdb_h_selfcontained=yes],
+ [gl_cv_header_netdb_h_selfcontained=no])
+ ])
+ if test $gl_cv_header_netdb_h_selfcontained = yes; then
+ NETDB_H=''
+ else
+ NETDB_H='netdb.h'
+ gl_CHECK_NEXT_HEADERS([netdb.h])
+ if test $ac_cv_header_netdb_h = yes; then
+ HAVE_NETDB_H=1
+ else
+ HAVE_NETDB_H=0
+ fi
+ AC_SUBST([HAVE_NETDB_H])
+ fi
+ AC_SUBST([NETDB_H])
+])
+
+AC_DEFUN([gl_NETDB_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_NETDB_H_DEFAULTS],
+[
+ :
+])
--- /dev/null
+Description:
+A <netdb.h> for systems lacking it.
+
+Files:
+lib/netdb.in.h
+m4/netdb_h.m4
+
+Depends-on:
+include_next
+
+configure.ac:
+gl_HEADER_NETDB
+
+Makefile.am:
+BUILT_SOURCES += $(NETDB_H)
+
+# We need the following in order to create <netdb.h> when the system
+# doesn't have one that works with the given compiler.
+netdb.h: netdb.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
+ -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
+ < $(srcdir)/netdb.in.h; \
+ } > $@-t
+ mv $@-t $@
+MOSTLYCLEANFILES += netdb.h netdb.h-t
+
+Include:
+#include <netdb.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Simon Josefsson
--- /dev/null
+Files:
+tests/test-netdb.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-netdb
+check_PROGRAMS += test-netdb
+
+License:
+LGPL
--- /dev/null
+/* Test of <netdb.h> substitute.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2008. */
+
+#include <config.h>
+#include <netdb.h>
+
+/* Check that the 'struct hostent' type is defined. */
+struct hostent t1;
+
+int
+main (void)
+{
+ return 0;
+}