From cbfcb7d517745373dffb506687da52d427ac0817 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sat, 20 Dec 2008 16:08:46 +0100
Subject: [PATCH] Avoid false report of ja_JP.EUC-JP locale under Cygwin.

---
 ChangeLog       | 6 ++++++
 m4/locale-ja.m4 | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index b64554b4ff..3c94385a8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-20  Bruno Haible  <bruno@clisp.org>
+
+	Don't pretend that Cygwin has a ja_JP.EUC-JP locale.
+	* m4/locale-ja.m4 (gt_LOCALE_JA): Add test for MB_CUR_MAX. Needed on
+	Cygwin 1.5.x.
+
 2008-12-20  Bruno Haible  <bruno@clisp.org>
 
 	Ensure mbstate_t is defined on HP-UX 11.11.
diff --git a/m4/locale-ja.m4 b/m4/locale-ja.m4
index cb85ed335b..c42064f721 100644
--- a/m4/locale-ja.m4
+++ b/m4/locale-ja.m4
@@ -1,4 +1,4 @@
-# locale-ja.m4 serial 4
+# locale-ja.m4 serial 5
 dnl Copyright (C) 2003, 2005-2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -65,6 +65,10 @@ int main ()
      LC_ALL is set on the command line.  */
   if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
 #endif
+  /* Check whether MB_CUR_MAX is > 1.  This excludes the dysfunctional locales
+     on Cygwin 1.5.x.  */
+  if (MB_CUR_MAX == 1)
+    return 1;
   /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
      This excludes the UTF-8 encoding.  */
   t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
-- 
2.30.2