+2008-11-10 Bruno Haible <bruno@clisp.org>
+
+ * lib/netdb.in.h: Use HAVE_STRUCT_ADDRINFO, HAVE_DECL_GETADDRINFO,
+ HAVE_DECL_FREEADDRINFO, HAVE_DECL_GAI_STRERROR, HAVE_DECL_GETNAMEINFO
+ as autoconf-substituted macros.
+ * m4/netdb_h.m4 (gl_NETDB_H_DEFAULTS): Initialize these variables to 1.
+ * m4/getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): Require
+ gl_NETDB_H_DEFAULTS. Set these variables.
+ * modules/netdb (Makefile.am): Substitute these variables.
+
2008-11-10 Eric Blake <ebb9@byu.net>
standards.texi: include correct file for FDL 1.3
#ifndef _GL_NETDB_H
#define _GL_NETDB_H
-#if @HAVE_NETDB_H@ && HAVE_STRUCT_ADDRINFO
+#if @HAVE_NETDB_H@ && @HAVE_STRUCT_ADDRINFO@
/* Declarations for a platform that has <netdb.h>. */
#if @GNULIB_GETADDRINFO@
-# ifndef HAVE_STRUCT_ADDRINFO
+# if !@HAVE_STRUCT_ADDRINFO@
/* Structure to contain information about address of a service provider. */
struct addrinfo
# endif
# endif
-# if !HAVE_DECL_GETADDRINFO
+# if !@HAVE_DECL_GETADDRINFO@
/* Translate name of a service location and/or a service name to set of
socket addresses.
For more details, see the POSIX:2001 specification
struct addrinfo **restrict res);
# endif
-# if !HAVE_DECL_FREEADDRINFO
+# if !@HAVE_DECL_FREEADDRINFO@
/* Free `addrinfo' structure AI including associated storage.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
extern void freeaddrinfo (struct addrinfo *ai);
# endif
-# if !HAVE_DECL_GAI_STRERROR
+# if !@HAVE_DECL_GAI_STRERROR@
/* Convert error return from getaddrinfo() to a string.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/gai_strerror.html>. */
extern const char *gai_strerror (int ecode);
# endif
-# if !HAVE_DECL_GETNAMEINFO
+# if !@HAVE_DECL_GETNAMEINFO@
/* Convert socket address to printable node and service names.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
-# getaddrinfo.m4 serial 16
+# getaddrinfo.m4 serial 17
dnl Copyright (C) 2004, 2005, 2006, 2007, 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,
gl_PREREQ_GETADDRINFO
])
-# Prerequisites of lib/getaddrinfo.c.
+# Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c.
AC_DEFUN([gl_PREREQ_GETADDRINFO], [
+ AC_REQUIRE([gl_NETDB_H_DEFAULTS])
AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
AC_SEARCH_LIBS(gethostbyname, [inet nsl])
AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>])
AC_CHECK_HEADERS_ONCE(netinet/in.h)
+
AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
/* sys/types.h is not needed according to POSIX, but the
sys/socket.h in i386-unknown-freebsd4.10 and
#include <ws2tcpip.h>
#endif
])
+ if test $ac_cv_have_decl_getaddrinfo = no; then
+ HAVE_DECL_GETADDRINFO=0
+ fi
+ if test $ac_cv_have_decl_freeaddrinfo = no; then
+ HAVE_DECL_FREEADDRINFO=0
+ fi
+ if test $ac_cv_have_decl_gai_strerror = no; then
+ HAVE_DECL_GAI_STRERROR=0
+ fi
+ if test $ac_cv_have_decl_getnameinfo = no; then
+ HAVE_DECL_GETNAMEINFO=0
+ fi
+
AC_CHECK_TYPES([struct addrinfo],,,[
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <ws2tcpip.h>
#endif
])
+ if test $ac_cv_type_struct_addrinfo = no; then
+ HAVE_STRUCT_ADDRINFO=0
+ fi
])
-# netdb_h.m4 serial 3
+# netdb_h.m4 serial 4
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,
AC_DEFUN([gl_NETDB_H_DEFAULTS],
[
GNULIB_GETADDRINFO=0; AC_SUBST([GNULIB_GETADDRINFO])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_STRUCT_ADDRINFO=1; AC_SUBST([HAVE_STRUCT_ADDRINFO])
+ HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO])
+ HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR])
+ HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO])
+ HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO])
])
-e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
-e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
-e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \
+ -e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \
+ -e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \
+ -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
+ -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
+ -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
< $(srcdir)/netdb.in.h; \
} > $@-t
mv $@-t $@