From 1ea9cb38fa399fb8a13a9c2ffaa54220691cd83a Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Wed, 24 Jul 2024 02:02:45 +0200
Subject: [PATCH] getopt-posix, getopt-gnu tests: Avoid test failure on mingw.

* tests/test-getopt.h (test_getopt): Don't special-case mingw.
---
 ChangeLog           | 5 +++++
 tests/test-getopt.h | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 95a98dc788..a1a8fb16fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-07-23  Bruno Haible  <bruno@clisp.org>
+
+	getopt-posix, getopt-gnu tests: Avoid test failure on mingw.
+	* tests/test-getopt.h (test_getopt): Don't special-case mingw.
+
 2024-07-23  Bruno Haible  <bruno@clisp.org>
 
 	strtod, strtold: Fix underflow behaviour of system function.
diff --git a/tests/test-getopt.h b/tests/test-getopt.h
index f13b59596b..43d23ca1fa 100644
--- a/tests/test-getopt.h
+++ b/tests/test-getopt.h
@@ -85,8 +85,10 @@ test_getopt (void)
   bool posixly = !!getenv ("POSIXLY_CORRECT");
   /* See comment in getopt.c:
      glibc gets a LSB-compliant getopt.
-     Standalone applications get a POSIX-compliant getopt.  */
-#if defined __GETOPT_PREFIX || !(__GLIBC__ >= 2 || defined __MINGW32__)
+     Standalone applications get a POSIX-compliant getopt.
+     Note: The 'defined __GETOPT_PREFIX' condition is equivalent to
+     $REPLACE_GETOPT = 1 at configure time.  */
+#if defined __GETOPT_PREFIX || !(__GLIBC__ >= 2)
   /* Using getopt from gnulib or from a non-glibc system.  */
   posixly = true;
 #endif
-- 
2.39.5