From 5110a172f3d61db20179648d18fb07607022d6ee Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Thu, 25 Jul 2024 01:19:20 +0200
Subject: [PATCH] Avoid false
 recvfrom_used_without_requesting_gnulib_module_recvfrom.

* modules/recvfrom (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (recvfrom): Don't define to
recvfrom_used_without_requesting_gnulib_module_recvfrom if the gnulib
module 'recvfrom' is in use under the same configure.ac.
---
 ChangeLog           | 6 ++++++
 lib/sys_socket.in.h | 6 ++++--
 modules/recvfrom    | 1 +
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 92094d00ba..73933068b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2024-07-24  Bruno Haible  <bruno@clisp.org>
 
+	Avoid false recvfrom_used_without_requesting_gnulib_module_recvfrom.
+	* modules/recvfrom (configure.ac): Invoke gl_MODULE_INDICATOR.
+	* lib/sys_socket.in.h (recvfrom): Don't define to
+	recvfrom_used_without_requesting_gnulib_module_recvfrom if the gnulib
+	module 'recvfrom' is in use under the same configure.ac.
+
 	Avoid false send_used_without_requesting_gnulib_module_send.
 	* modules/send (configure.ac): Invoke gl_MODULE_INDICATOR.
 	* lib/sys_socket.in.h (send): Don't define to
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index 72907ffb34..f8ed41d8ec 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -629,8 +629,10 @@ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
 _GL_CXXALIASWARN (recvfrom);
 # endif
 #elif @HAVE_WINSOCK2_H@
-# undef recvfrom
-# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
+# if !GNULIB_RECVFROM
+#  undef recvfrom
+#  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef recvfrom
 # if HAVE_RAW_DECL_RECVFROM
diff --git a/modules/recvfrom b/modules/recvfrom
index cbf7e3a663..3cdd0a70a6 100644
--- a/modules/recvfrom
+++ b/modules/recvfrom
@@ -17,6 +17,7 @@ configure.ac:
 AC_REQUIRE([gl_SYS_SOCKET_H])
 gl_CONDITIONAL([GL_COND_OBJ_RECVFROM], [test "$ac_cv_header_winsock2_h" = yes])
 gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom])
+gl_MODULE_INDICATOR([recvfrom])
 
 Makefile.am:
 if GL_COND_OBJ_RECVFROM
-- 
2.39.5