changeset 14037:3f2c77c8adb8

inet_ntop, inet_pton: Ensure declaration on NonStop Kernel. * lib/arpa_inet.in.h: On NonStop Kernel, include also <netdb.h>. * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Likewise. * m4/inet_ntop.m4 (gl_PREREQ_INET_NTOP): Include also <netdb.h> when looking for the declaration. * m4/inet_pton.m4 (gl_PREREQ_INET_PTON): Likewise. * doc/posix-functions/inet_ntop.texi: Document the NonStop Kernel problem. * doc/posix-functions/inet_pton.texi: Likewise.
author Bruno Haible <bruno@clisp.org>
date Mon, 27 Dec 2010 01:22:00 +0100
parents c475f1b6d204
children 4feba3a9f0b7
files ChangeLog doc/posix-functions/inet_ntop.texi doc/posix-functions/inet_pton.texi lib/arpa_inet.in.h m4/arpa_inet_h.m4 m4/inet_ntop.m4 m4/inet_pton.m4
diffstat 7 files changed, 46 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-26  Bruno Haible  <bruno@clisp.org>
+
+	inet_ntop, inet_pton: Ensure declaration on NonStop Kernel.
+	* lib/arpa_inet.in.h: On NonStop Kernel, include also <netdb.h>.
+	* m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Likewise.
+	* m4/inet_ntop.m4 (gl_PREREQ_INET_NTOP): Include also <netdb.h> when
+	looking for the declaration.
+	* m4/inet_pton.m4 (gl_PREREQ_INET_PTON): Likewise.
+	* doc/posix-functions/inet_ntop.texi: Document the NonStop Kernel
+	problem.
+	* doc/posix-functions/inet_pton.texi: Likewise.
+
 2010-12-26  Bruno Haible  <bruno@clisp.org>
 
 	arpa_inet: Use the common idioms with C++ support.
--- a/doc/posix-functions/inet_ntop.texi
+++ b/doc/posix-functions/inet_ntop.texi
@@ -11,6 +11,10 @@
 @item
 This function is missing on some platforms:
 HP-UX 11.00, OSF/1 4.0, Solaris 2.5.1, mingw, Interix 3.5, BeOS.
+@item
+This function is declared in @code{<netdb.h>} instead of @code{<arpa/inet.h>}
+on some platforms:
+NonStop Kernel.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/inet_pton.texi
+++ b/doc/posix-functions/inet_pton.texi
@@ -11,6 +11,10 @@
 @item
 This function is missing on some platforms:
 HP-UX 11.00, OSF/1 4.0, Solaris 2.5.1, mingw, Interix 3.5, BeOS.
+@item
+This function is declared in @code{<netdb.h>} instead of @code{<arpa/inet.h>}
+on some platforms:
+NonStop Kernel.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -34,6 +34,12 @@
 # include <sys/socket.h>
 #endif
 
+/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
+   But avoid namespace pollution on glibc systems.  */
+#if defined __TANDEM && !defined __GLIBC__
+# include <netdb.h>
+#endif
+
 #if @HAVE_ARPA_INET_H@
 
 /* The include_next requires a split double-inclusion guard.  */
--- a/m4/arpa_inet_h.m4
+++ b/m4/arpa_inet_h.m4
@@ -1,4 +1,4 @@
-# arpa_inet_h.m4 serial 10
+# arpa_inet_h.m4 serial 11
 dnl Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -31,6 +31,9 @@
 #if !(defined __GLIBC__ || defined __UCLIBC__)
 # include <sys/socket.h>
 #endif
+#ifdef __TANDEM
+# include <netdb.h>
+#endif
 #include <arpa/inet.h>
     ]], [inet_ntop inet_pton])
 ])
--- a/m4/inet_ntop.m4
+++ b/m4/inet_ntop.m4
@@ -1,4 +1,4 @@
-# inet_ntop.m4 serial 12
+# inet_ntop.m4 serial 13
 dnl Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -29,7 +29,13 @@
 
 # Prerequisites of lib/inet_ntop.c.
 AC_DEFUN([gl_PREREQ_INET_NTOP], [
-  AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
+  AC_CHECK_HEADERS_ONCE([netdb.h])
+  AC_CHECK_DECLS([inet_ntop],,,
+    [#include <arpa/inet.h>
+     #if HAVE_NETDB_H
+     # include <netdb.h>
+     #endif
+    ])
   if test $ac_cv_have_decl_inet_ntop = no; then
     HAVE_DECL_INET_NTOP=0
   fi
--- a/m4/inet_pton.m4
+++ b/m4/inet_pton.m4
@@ -1,4 +1,4 @@
-# inet_pton.m4 serial 10
+# inet_pton.m4 serial 11
 dnl Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -29,7 +29,13 @@
 
 # Prerequisites of lib/inet_pton.c.
 AC_DEFUN([gl_PREREQ_INET_PTON], [
-  AC_CHECK_DECLS([inet_pton],,,[#include <arpa/inet.h>])
+  AC_CHECK_HEADERS_ONCE([netdb.h])
+  AC_CHECK_DECLS([inet_pton],,,
+    [#include <arpa/inet.h>
+     #if HAVE_NETDB_H
+     # include <netdb.h>
+     #endif
+    ])
   if test $ac_cv_have_decl_inet_pton = no; then
     HAVE_DECL_INET_PTON=0
   fi