* lib/localcharset.c.diff: New patch originally posted to Gnulib
<https://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00091.html>.
+2013-06-25 Daiki Ueno <ueno@gnu.org>
+
+ Work around localcharset issue under OS X multi-threaded scenario.
+ * lib/localcharset.c.diff: New patch originally posted to Gnulib
+ <https://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00091.html>.
+
2013-06-16 Andreas Schwab <schwab@linux-m68k.org> (tiny change)
* m4/libxml.m4 (gl_LIBXML): Remove extra quotes.
--- /dev/null
+diff --git a/localcharset.c b/localcharset.c
+index 6b0153e..bfd9a03 100644
+--- a/localcharset.c
++++ b/localcharset.c
+@@ -65,6 +65,11 @@
+ # include <os2.h>
+ #endif
+
++/* For MB_CUR_MAX_L */
++#if defined DARWIN7
++# include <xlocale.h>
++#endif
++
+ #if ENABLE_RELOCATABLE
+ # include "relocatable.h"
+ #else
+@@ -545,7 +550,7 @@ locale_charset (void)
+ #ifdef DARWIN7
+ /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8"
+ (the default codeset) does not work when MB_CUR_MAX is 1. */
+- if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX <= 1)
++ if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX_L (uselocale (NULL)) <= 1)
+ codeset = "ASCII";
+ #endif
+