+2019-06-30 Bruno Haible <bruno@clisp.org>
+
+ inet_ntop, inet_pton: Avoid conflict with native Windows functions.
+ * m4/sys_socket_h.m4 (gl_PREREQ_SYS_H_WS2TCPIP): New macro, extracted
+ from gl_PREREQ_SYS_H_SOCKET.
+ (gl_PREREQ_SYS_H_SOCKET): Invoke it.
+ * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Invoke
+ gl_PREREQ_SYS_H_WS2TCPIP.
+ * modules/arpa_inet (Files): Add m4/sys_socket_h.m4, m4/socklen.m4.
+ (Makefile.am): Substitute HAVE_WS2TCPIP_H.
+ * lib/arpa_inet.in.h: Include <ws2tcpip.h>.
+
2019-06-30 Bruno Haible <bruno@clisp.org>
inet_ntop, inet_pton: Forward-compatibility with newer Windows versions.
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
#define _@GUARD_PREFIX@_ARPA_INET_H
+/* Get all possible declarations of inet_ntop() and inet_pton(). */
+#if (@GNULIB_INET_NTOP@ || @GNULIB_INET_PTON@ || defined GNULIB_POSIXCHECK) \
+ && @HAVE_WS2TCPIP_H@
+# include <ws2tcpip.h>
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
-# arpa_inet_h.m4 serial 13
+# arpa_inet_h.m4 serial 14
dnl Copyright (C) 2006, 2008-2019 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_REQUIRE([gl_FEATURES_H])
+ gl_PREREQ_SYS_H_WS2TCPIP
+
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[
-# sys_socket_h.m4 serial 23
+# sys_socket_h.m4 serial 24
dnl Copyright (C) 2005-2019 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_CHECK_NEXT_HEADERS([sys/socket.h])
if test $ac_cv_header_sys_socket_h = yes; then
HAVE_SYS_SOCKET_H=1
- HAVE_WS2TCPIP_H=0
else
HAVE_SYS_SOCKET_H=0
- if test $ac_cv_header_ws2tcpip_h = yes; then
- HAVE_WS2TCPIP_H=1
- else
- HAVE_WS2TCPIP_H=0
- fi
fi
AC_SUBST([HAVE_SYS_SOCKET_H])
- AC_SUBST([HAVE_WS2TCPIP_H])
+ gl_PREREQ_SYS_H_WS2TCPIP
])
# Common prerequisites of the <sys/socket.h> replacement and of the
AC_SUBST([HAVE_WINSOCK2_H])
])
+# Common prerequisites of the <sys/socket.h> replacement and of the
+# <arpa/inet.h> replacement.
+# Sets and substitutes HAVE_WS2TCPIP_H.
+AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
+[
+ AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
+ if test $ac_cv_header_sys_socket_h = yes; then
+ HAVE_WS2TCPIP_H=0
+ else
+ if test $ac_cv_header_ws2tcpip_h = yes; then
+ HAVE_WS2TCPIP_H=1
+ else
+ HAVE_WS2TCPIP_H=0
+ fi
+ fi
+ AC_SUBST([HAVE_WS2TCPIP_H])
+])
+
AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
Files:
lib/arpa_inet.in.h
m4/arpa_inet_h.m4
+m4/sys_socket_h.m4
+m4/socklen.m4
Depends-on:
include_next
-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_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
-e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
-e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
-e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \