Respect --disable-threads on native MS-Windows.
* lib/localename-unsafe.c (GLWTHREAD_MUTEX_INIT, glwthread_mutex_t)
(glwthread_mutex_lock, glwthread_mutex_unlock)
[AVOID_ANY_THREADS && _WIN32 && !__CYGWIN]:
Instead of including "windows-mutex.h", provide no-op substitutes
for its symbols used here.
---
 ChangeLog               | 10 ++++++++++
 lib/localename-unsafe.c |  9 ++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 454b9983ad..72b45b1eb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-04-26  Paul Eggert  <[email protected]>
+
+       localename-unsafe: respect --disable-threads
+       Respect --disable-threads on native MS-Windows.
+       * lib/localename-unsafe.c (GLWTHREAD_MUTEX_INIT, glwthread_mutex_t)
+       (glwthread_mutex_lock, glwthread_mutex_unlock)
+       [AVOID_ANY_THREADS && _WIN32 && !__CYGWIN]:
+       Instead of including "windows-mutex.h", provide no-op substitutes
+       for its symbols used here.
+
 2026-04-25  Paul Eggert  <[email protected]>
 
        c-strtod-tests: port to single-threaded builds
diff --git a/lib/localename-unsafe.c b/lib/localename-unsafe.c
index d490fe89be..137d551edb 100644
--- a/lib/localename-unsafe.c
+++ b/lib/localename-unsafe.c
@@ -53,7 +53,14 @@
 # define WINDOWS_NATIVE
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
-# include "windows-mutex.h"
+/* The option '--disable-threads' explicitly requests no locking.  */
+# if AVOID_ANY_THREADS
+typedef enum { GLWTHREAD_MUTEX_INIT } glwthread_mutex_t;
+static int glwthread_mutex_lock (glwthread_mutex_t *m) { return 0; }
+static int glwthread_mutex_unlock (glwthread_mutex_t *m) { return 0; }
+# else
+#  include "windows-mutex.h"
+# endif
 #endif
 
 #if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Native Windows or Cygwin */
-- 
2.53.0


Reply via email to