From: Bruno Haible <bruno@clisp.org>
Date: Wed, 24 Jul 2024 22:49:21 +0000 (+0200)
Subject: Avoid false bind_used_without_requesting_gnulib_module_bind.
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=4844c04339f74b3812f0a1d952b99c263b3a9a8e;p=gnulib.git

Avoid false bind_used_without_requesting_gnulib_module_bind.

* modules/bind (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (bind): Don't define to
bind_used_without_requesting_gnulib_module_bind if the gnulib module
'bind' is in use under the same configure.ac.
---

diff --git a/ChangeLog b/ChangeLog
index 5bfb08662e..9d63b78e25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2024-07-24  Bruno Haible  <bruno@clisp.org>
 
+	Avoid false bind_used_without_requesting_gnulib_module_bind.
+	* modules/bind (configure.ac): Invoke gl_MODULE_INDICATOR.
+	* lib/sys_socket.in.h (bind): Don't define to
+	bind_used_without_requesting_gnulib_module_bind if the gnulib module
+	'bind' is in use under the same configure.ac.
+
 	Avoid false accept_used_without_requesting_gnulib_module_accept.
 	* modules/accept (configure.ac): Invoke gl_MODULE_INDICATOR.
 	* lib/sys_socket.in.h (accept): Don't define to
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index cf20718ade..bc57bd2b9e 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -398,8 +398,10 @@ _GL_CXXALIAS_SYS_CAST (bind, int,
 # endif
 _GL_CXXALIASWARN (bind);
 #elif @HAVE_WINSOCK2_H@
-# undef bind
-# define bind bind_used_without_requesting_gnulib_module_bind
+# if !GNULIB_BIND
+#  undef bind
+#  define bind bind_used_without_requesting_gnulib_module_bind
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef bind
 # if HAVE_RAW_DECL_BIND
diff --git a/modules/bind b/modules/bind
index f58407830e..6d2b888b0d 100644
--- a/modules/bind
+++ b/modules/bind
@@ -15,6 +15,7 @@ configure.ac:
 AC_REQUIRE([gl_SYS_SOCKET_H])
 gl_CONDITIONAL([GL_COND_OBJ_BIND], [test "$ac_cv_header_winsock2_h" = yes])
 gl_SYS_SOCKET_MODULE_INDICATOR([bind])
+gl_MODULE_INDICATOR([bind])
 
 Makefile.am:
 if GL_COND_OBJ_BIND