+2008-04-29 Bruno Haible <bruno@clisp.org>
+
+ * lib/arpa_inet.in.h: Include system's <arpa/inet.h> if it exists.
+ (inet_ntop, inet_pton): Change portability warning's wording.
+ * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Set HAVE_ARPA_INET_H.
+ Invoke gl_CHECK_NEXT_HEADERS.
+ (gl_ARPA_INET_H_DEFAULTS): Initialize ARPA_INET_H.
+ * m4/inet_ntop.m4 (gl_INET_NTOP): Require gl_ARPA_INET_H_DEFAULTS and
+ set ARPA_INET_H.
+ * m4/inet_pton.m4 (gl_INET_PTON): Likewise.
+ * modules/arpa_inet (Description): No longer only for systems that
+ lack it.
+ (Depends-on): Add include_next.
+ (Makeile.am): Substitute INCLUDE_NEXT, NEXT_ARPA_INET_H,
+ HAVE_ARPA_INET_H.
+
2008-04-29 Jim Meyering <meyering@redhat.com>
* modules/mkdir (License): Re-license as LGPLv2+.
-/* Provide a arpa/inet header file for systems lacking it (read: MinGW)
- Copyright (C) 2008 Free Software Foundation, Inc.
+/* A GNU-like <arpa/inet.h>.
+
+ Copyright (C) 2005-2006, 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
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_ARPA_INET_H
-#define _GL_ARPA_INET_H
/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
under MinGW. */
#include <sys/socket.h>
+#if @HAVE_ARPA_INET_H@
+
+/* The include_next requires a split double-inclusion guard. */
+# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
+
+#endif
+
+#ifndef _GL_ARPA_INET_H
+#define _GL_ARPA_INET_H
+
#if @GNULIB_INET_NTOP@
# if !@HAVE_DECL_INET_NTOP@
/* Converts an internet address from internal format to a printable,
# endif
#elif defined GNULIB_POSIXCHECK
# undef inet_ntop
-# define inet_ntop(af,src,dst,cnt) \
- (GL_LINK_WARNING ("inet_ntop doesn't exist on mingw - " \
+# define inet_ntop(af,src,dst,cnt) \
+ (GL_LINK_WARNING ("inet_ntop is unportable - " \
"use gnulib module inet_ntop for portability"), \
inet_ntop (af, src, dst, cnt))
#endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef inet_pton
-# define inet_pton(af,src,dst) \
- (GL_LINK_WARNING ("inet_pton doesn't exist on mingw - " \
- "use gnulib module inet_pton for portability"), \
+# define inet_pton(af,src,dst) \
+ (GL_LINK_WARNING ("inet_pton is unportable - " \
+ "use gnulib module inet_pton for portability"), \
inet_pton (af, src, dst))
#endif
#endif /* _GL_ARPA_INET_H */
+#endif /* _GL_ARPA_INET_H */
-# arpa_inet_h.m4 serial 2
+# arpa_inet_h.m4 serial 3
dnl Copyright (C) 2006, 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.
-dnl Written by Simon Josefsson
+dnl Written by Simon Josefsson and Bruno Haible
AC_DEFUN([gl_HEADER_ARPA_INET],
[
AC_CHECK_HEADERS_ONCE([arpa/inet.h])
if test $ac_cv_header_arpa_inet_h = yes; then
- ARPA_INET_H=''
+ HAVE_ARPA_INET_H=1
else
ARPA_INET_H='arpa/inet.h'
+ HAVE_ARPA_INET_H=0
fi
- AC_SUBST(ARPA_INET_H)
+ AC_SUBST([HAVE_ARPA_INET_H])
+ dnl Execute this unconditionally, because ARPA_INET_H may be set by other
+ dnl modules, after this code is executed.
+ gl_CHECK_NEXT_HEADERS([arpa/inet.h])
+
])
AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
+ ARPA_INET_H=''; AC_SUBST([ARPA_INET_H])
])
-# inet_ntop.m4 serial 4
+# inet_ntop.m4 serial 5
dnl Copyright (C) 2005, 2006, 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_INET_NTOP],
[
+ AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+ ARPA_INET_H='arpa/inet.h'
+
AC_REPLACE_FUNCS(inet_ntop)
gl_PREREQ_INET_NTOP
])
-# inet_pton.m4 serial 3
+# inet_pton.m4 serial 4
dnl Copyright (C) 2006, 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_INET_PTON],
[
+ AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+ ARPA_INET_H='arpa/inet.h'
+
AC_REPLACE_FUNCS(inet_pton)
gl_PREREQ_INET_PTON
])
Description:
-A <arpa/inet.h> for systems lacking it (e.g., Mingw).
+A GNU-like <arpa/inet.h>.
Files:
lib/arpa_inet.in.h
m4/arpa_inet_h.m4
Depends-on:
+include_next
sys_socket
configure.ac:
@MKDIR_P@ arpa
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed \
+ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+ -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
+ -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
-e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \
-e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
-e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \