summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-01-03 11:41:49 +0100
committerBruno Haible <bruno@clisp.org>2020-01-03 16:52:21 +0100
commitcf73cf0f6b799dd9b1e8fb64e573d3398a34eb8f (patch)
tree25420a0e07b4b3f2b4fd8ebc31389ab41b7fd9ce
parentd059bd2b1bc4d3ec09eabb238f9eb28c7a2fddff (diff)
downloadgnulib-cf73cf0f6b799dd9b1e8fb64e573d3398a34eb8f.tar.gz
mbrtowc: Ensure the mbtowc_lock is unique.
* lib/mbtowc-lock.c: New file, based on lib/setlocale-lock.c. * lib/mbtowc-lock.h: New file, extracted from lib/mbrtowc.c and lib/setlocale_null.c. * lib/mbrtowc.c: Include headers needed for mbtowc-lock.h. Don't include glthread/lock.h. Include mbtowc-lock.h. (mbtowc_lock): Remove declaration. (mbrtowc): Use mbtowc_with_lock. * m4/mbrtowc.m4 (gl_FUNC_MBRTOWC): Require gl_PTHREADLIB. Check for threads.h. Set LIB_MBRTOWC. (gl_PREREQ_MBTOWC_LOCK): New macro. * modules/mbrtowc (Files): Add lib/mbtowc-lock.h, lib/mbtowc-lock.c, lib/windows-initguard.h, m4/threadlib.m4, m4/visibility.m4. (Depends-on): Remove lock. (configure.ac): Arrange to compile mbtowc-lock.c. (Link): Mention $(LIB_MBRTOWC) instead of $(LIBTHREAD). * modules/acl (Link): Likewise. * modules/argmatch (Link): Likewise. * modules/backup-rename (Link): Likewise. * modules/backupfile (Link): Likewise. * modules/closein (Link): Likewise. * modules/closeout (Link): Likewise. * modules/copy-file (Link): Likewise. * modules/csharpcomp (Link): Likewise. * modules/csharpexec (Link): Likewise. * modules/dfa (Link): Likewise. * modules/exclude (Link): Likewise. * modules/fnmatch (Link): Likewise. * modules/fnmatch-gnu (Link): Likewise. * modules/fnmatch-posix (Link): Likewise. * modules/glob (Link): Likewise. * modules/human (Link): Likewise. * modules/javacomp (Link): Likewise. * modules/javaexec (Link): Likewise. * modules/javaversion (Link): Likewise. * modules/mbfile (Link): Likewise. * modules/mbiter (Link): Likewise. * modules/mbmemcasecmp (Link): Likewise. * modules/mbmemcasecoll (Link): Likewise. * modules/mbrlen (Link): Likewise. * modules/mbscasecmp (Link): Likewise. * modules/mbscasestr (Link): Likewise. * modules/mbschr (Link): Likewise. * modules/mbscspn (Link): Likewise. * modules/mbsinit (Link): Likewise. * modules/mbslen (Link): Likewise. * modules/mbsncasecmp (Link): Likewise. * modules/mbsnlen (Link): Likewise. * modules/mbsnrtowcs (Link): Likewise. * modules/mbspbrk (Link): Likewise. * modules/mbspcasecmp (Link): Likewise. * modules/mbsrchr (Link): Likewise. * modules/mbsrtowcs (Link): Likewise. * modules/mbssep (Link): Likewise. * modules/mbsspn (Link): Likewise. * modules/mbsstr (Link): Likewise. * modules/mbstok_r (Link): Likewise. * modules/mbswidth (Link): Likewise. * modules/mbuiter (Link): Likewise. * modules/mkdir-p (Link): Likewise. * modules/propername (Link): Likewise. * modules/quote (Link): Likewise. * modules/quotearg (Link): Likewise. * modules/quotearg-simple (Link): Likewise. * modules/regex-quote (Link): Likewise. * modules/rpmatch (Link): Likewise. * modules/sh-quote (Link): Likewise. * modules/system-quote (Link): Likewise. * modules/trim (Link): Likewise. * modules/unistdio/ulc-asnprintf (Link): Likewise. * modules/unistdio/ulc-fprintf (Link): Likewise. * modules/unistdio/ulc-vasnprintf (Link): Likewise. * modules/unistdio/ulc-vasprintf (Link): Likewise. * modules/unistdio/ulc-vfprintf (Link): Likewise. * modules/unistdio/ulc-vsnprintf (Link): Likewise. * modules/unistdio/ulc-vsprintf (Link): Likewise. * modules/xfreopen (Link): Likewise. * modules/xmemcoll (Link): Likewise. * modules/yesno (Link): Likewise. * modules/regex (Link): Add $(LIB_MBRTOWC). * modules/acl-tests (Makefile.am): Link the programs with $(LIB_MBRTOWC) instead of $(LIBTHREAD). * modules/argmatch-tests (Makefile.am): Likewise. * modules/closein-tests (Makefile.am): Likewise. * modules/copy-file-tests (Makefile.am): Likewise. * modules/dfa-tests (Makefile.am): Likewise. * modules/fnmatch-tests (Makefile.am): Likewise. * modules/glob-tests (Makefile.am): Likewise. * modules/mbmemcasecmp-tests (Makefile.am): Likewise. * modules/mbmemcasecoll-tests (Makefile.am): Likewise. * modules/mbrtowc-tests (Makefile.am): Likewise. * modules/mbscasecmp-tests (Makefile.am): Likewise. * modules/mbscasestr-tests (Makefile.am): Likewise. * modules/mbschr-tests (Makefile.am): Likewise. * modules/mbscspn-tests (Makefile.am): Likewise. * modules/mbsinit-tests (Makefile.am): Likewise. * modules/mbsncasecmp-tests (Makefile.am): Likewise. * modules/mbsnrtowcs-tests (Makefile.am): Likewise. * modules/mbspbrk-tests (Makefile.am): Likewise. * modules/mbspcasecmp-tests (Makefile.am): Likewise. * modules/mbsrchr-tests (Makefile.am): Likewise. * modules/mbsrtowcs-tests (Makefile.am): Likewise. * modules/mbsspn-tests (Makefile.am): Likewise. * modules/mbsstr-tests (Makefile.am): Likewise. * modules/quotearg-simple-tests (Makefile.am): Likewise. * modules/quotearg-tests (Makefile.am): Likewise. * modules/readtokens-tests (Makefile.am): Likewise. * modules/sh-quote-tests (Makefile.am): Likewise. * modules/system-quote-tests (Makefile.am): Likewise. * modules/unistdio/ulc-asnprintf-tests (Makefile.am): Likewise. * modules/unistdio/ulc-vasnprintf-tests (Makefile.am): Likewise. * modules/unistdio/ulc-vasprintf-tests (Makefile.am): Likewise. * modules/unistdio/ulc-vsnprintf-tests (Makefile.am): Likewise. * modules/unistdio/ulc-vsprintf-tests (Makefile.am): Likewise. * modules/yesno-tests (Makefile.am): Likewise. * modules/exclude-tests (Makefile.am): Link the programs with $(LIB_MBRTOWC). * modules/regex-tests (Makefile.am): Likewise. * modules/regex-quote-tests (Makefile.am): Likewise.
-rw-r--r--ChangeLog122
-rw-r--r--lib/mbrtowc.c40
-rw-r--r--lib/mbtowc-lock.c150
-rw-r--r--lib/mbtowc-lock.h115
-rw-r--r--m4/mbrtowc.m427
-rw-r--r--modules/acl2
-rw-r--r--modules/acl-tests6
-rw-r--r--modules/argmatch2
-rw-r--r--modules/argmatch-tests2
-rw-r--r--modules/backup-rename2
-rw-r--r--modules/backupfile2
-rw-r--r--modules/closein2
-rw-r--r--modules/closein-tests2
-rw-r--r--modules/closeout2
-rw-r--r--modules/copy-file2
-rw-r--r--modules/copy-file-tests2
-rw-r--r--modules/csharpcomp2
-rw-r--r--modules/csharpexec2
-rw-r--r--modules/dfa2
-rw-r--r--modules/dfa-tests2
-rw-r--r--modules/exclude2
-rw-r--r--modules/exclude-tests2
-rw-r--r--modules/fnmatch2
-rw-r--r--modules/fnmatch-gnu2
-rw-r--r--modules/fnmatch-posix2
-rw-r--r--modules/fnmatch-tests2
-rw-r--r--modules/glob2
-rw-r--r--modules/glob-tests2
-rw-r--r--modules/human2
-rw-r--r--modules/javacomp2
-rw-r--r--modules/javaexec2
-rw-r--r--modules/javaversion2
-rw-r--r--modules/mbfile2
-rw-r--r--modules/mbiter2
-rw-r--r--modules/mbmemcasecmp2
-rw-r--r--modules/mbmemcasecmp-tests2
-rw-r--r--modules/mbmemcasecoll2
-rw-r--r--modules/mbmemcasecoll-tests2
-rw-r--r--modules/mbrlen2
-rw-r--r--modules/mbrtowc10
-rw-r--r--modules/mbrtowc-tests2
-rw-r--r--modules/mbscasecmp2
-rw-r--r--modules/mbscasecmp-tests2
-rw-r--r--modules/mbscasestr2
-rw-r--r--modules/mbscasestr-tests8
-rw-r--r--modules/mbschr2
-rw-r--r--modules/mbschr-tests2
-rw-r--r--modules/mbscspn2
-rw-r--r--modules/mbscspn-tests2
-rw-r--r--modules/mbsinit2
-rw-r--r--modules/mbsinit-tests2
-rw-r--r--modules/mbslen2
-rw-r--r--modules/mbsncasecmp2
-rw-r--r--modules/mbsncasecmp-tests2
-rw-r--r--modules/mbsnlen2
-rw-r--r--modules/mbsnrtowcs2
-rw-r--r--modules/mbsnrtowcs-tests2
-rw-r--r--modules/mbspbrk2
-rw-r--r--modules/mbspbrk-tests2
-rw-r--r--modules/mbspcasecmp2
-rw-r--r--modules/mbspcasecmp-tests2
-rw-r--r--modules/mbsrchr2
-rw-r--r--modules/mbsrchr-tests2
-rw-r--r--modules/mbsrtowcs2
-rw-r--r--modules/mbsrtowcs-tests2
-rw-r--r--modules/mbssep2
-rw-r--r--modules/mbsspn2
-rw-r--r--modules/mbsspn-tests2
-rw-r--r--modules/mbsstr2
-rw-r--r--modules/mbsstr-tests6
-rw-r--r--modules/mbstok_r2
-rw-r--r--modules/mbswidth2
-rw-r--r--modules/mbuiter2
-rw-r--r--modules/mkdir-p2
-rw-r--r--modules/propername2
-rw-r--r--modules/quote2
-rw-r--r--modules/quotearg2
-rw-r--r--modules/quotearg-simple2
-rw-r--r--modules/quotearg-simple-tests2
-rw-r--r--modules/quotearg-tests2
-rw-r--r--modules/readtokens-tests2
-rw-r--r--modules/regex1
-rw-r--r--modules/regex-quote2
-rw-r--r--modules/regex-quote-tests2
-rw-r--r--modules/regex-tests2
-rw-r--r--modules/rpmatch2
-rw-r--r--modules/sh-quote2
-rw-r--r--modules/sh-quote-tests2
-rw-r--r--modules/system-quote2
-rw-r--r--modules/system-quote-tests2
-rw-r--r--modules/trim2
-rw-r--r--modules/unistdio/ulc-asnprintf2
-rw-r--r--modules/unistdio/ulc-asnprintf-tests2
-rw-r--r--modules/unistdio/ulc-fprintf2
-rw-r--r--modules/unistdio/ulc-vasnprintf2
-rw-r--r--modules/unistdio/ulc-vasnprintf-tests6
-rw-r--r--modules/unistdio/ulc-vasprintf2
-rw-r--r--modules/unistdio/ulc-vasprintf-tests2
-rw-r--r--modules/unistdio/ulc-vfprintf2
-rw-r--r--modules/unistdio/ulc-vsnprintf2
-rw-r--r--modules/unistdio/ulc-vsnprintf-tests2
-rw-r--r--modules/unistdio/ulc-vsprintf2
-rw-r--r--modules/unistdio/ulc-vsprintf-tests2
-rw-r--r--modules/xfreopen2
-rw-r--r--modules/xmemcoll2
-rw-r--r--modules/yesno2
-rw-r--r--modules/yesno-tests2
107 files changed, 555 insertions, 128 deletions
diff --git a/ChangeLog b/ChangeLog
index 0fb2e1c3bc..c18a95adf0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,127 @@
2020-01-03 Bruno Haible <bruno@clisp.org>
+ mbrtowc: Ensure the mbtowc_lock is unique.
+ * lib/mbtowc-lock.c: New file, based on lib/setlocale-lock.c.
+ * lib/mbtowc-lock.h: New file, extracted from lib/mbrtowc.c and
+ lib/setlocale_null.c.
+ * lib/mbrtowc.c: Include headers needed for mbtowc-lock.h. Don't include
+ glthread/lock.h. Include mbtowc-lock.h.
+ (mbtowc_lock): Remove declaration.
+ (mbrtowc): Use mbtowc_with_lock.
+ * m4/mbrtowc.m4 (gl_FUNC_MBRTOWC): Require gl_PTHREADLIB. Check for
+ threads.h. Set LIB_MBRTOWC.
+ (gl_PREREQ_MBTOWC_LOCK): New macro.
+ * modules/mbrtowc (Files): Add lib/mbtowc-lock.h, lib/mbtowc-lock.c,
+ lib/windows-initguard.h, m4/threadlib.m4, m4/visibility.m4.
+ (Depends-on): Remove lock.
+ (configure.ac): Arrange to compile mbtowc-lock.c.
+ (Link): Mention $(LIB_MBRTOWC) instead of $(LIBTHREAD).
+ * modules/acl (Link): Likewise.
+ * modules/argmatch (Link): Likewise.
+ * modules/backup-rename (Link): Likewise.
+ * modules/backupfile (Link): Likewise.
+ * modules/closein (Link): Likewise.
+ * modules/closeout (Link): Likewise.
+ * modules/copy-file (Link): Likewise.
+ * modules/csharpcomp (Link): Likewise.
+ * modules/csharpexec (Link): Likewise.
+ * modules/dfa (Link): Likewise.
+ * modules/exclude (Link): Likewise.
+ * modules/fnmatch (Link): Likewise.
+ * modules/fnmatch-gnu (Link): Likewise.
+ * modules/fnmatch-posix (Link): Likewise.
+ * modules/glob (Link): Likewise.
+ * modules/human (Link): Likewise.
+ * modules/javacomp (Link): Likewise.
+ * modules/javaexec (Link): Likewise.
+ * modules/javaversion (Link): Likewise.
+ * modules/mbfile (Link): Likewise.
+ * modules/mbiter (Link): Likewise.
+ * modules/mbmemcasecmp (Link): Likewise.
+ * modules/mbmemcasecoll (Link): Likewise.
+ * modules/mbrlen (Link): Likewise.
+ * modules/mbscasecmp (Link): Likewise.
+ * modules/mbscasestr (Link): Likewise.
+ * modules/mbschr (Link): Likewise.
+ * modules/mbscspn (Link): Likewise.
+ * modules/mbsinit (Link): Likewise.
+ * modules/mbslen (Link): Likewise.
+ * modules/mbsncasecmp (Link): Likewise.
+ * modules/mbsnlen (Link): Likewise.
+ * modules/mbsnrtowcs (Link): Likewise.
+ * modules/mbspbrk (Link): Likewise.
+ * modules/mbspcasecmp (Link): Likewise.
+ * modules/mbsrchr (Link): Likewise.
+ * modules/mbsrtowcs (Link): Likewise.
+ * modules/mbssep (Link): Likewise.
+ * modules/mbsspn (Link): Likewise.
+ * modules/mbsstr (Link): Likewise.
+ * modules/mbstok_r (Link): Likewise.
+ * modules/mbswidth (Link): Likewise.
+ * modules/mbuiter (Link): Likewise.
+ * modules/mkdir-p (Link): Likewise.
+ * modules/propername (Link): Likewise.
+ * modules/quote (Link): Likewise.
+ * modules/quotearg (Link): Likewise.
+ * modules/quotearg-simple (Link): Likewise.
+ * modules/regex-quote (Link): Likewise.
+ * modules/rpmatch (Link): Likewise.
+ * modules/sh-quote (Link): Likewise.
+ * modules/system-quote (Link): Likewise.
+ * modules/trim (Link): Likewise.
+ * modules/unistdio/ulc-asnprintf (Link): Likewise.
+ * modules/unistdio/ulc-fprintf (Link): Likewise.
+ * modules/unistdio/ulc-vasnprintf (Link): Likewise.
+ * modules/unistdio/ulc-vasprintf (Link): Likewise.
+ * modules/unistdio/ulc-vfprintf (Link): Likewise.
+ * modules/unistdio/ulc-vsnprintf (Link): Likewise.
+ * modules/unistdio/ulc-vsprintf (Link): Likewise.
+ * modules/xfreopen (Link): Likewise.
+ * modules/xmemcoll (Link): Likewise.
+ * modules/yesno (Link): Likewise.
+ * modules/regex (Link): Add $(LIB_MBRTOWC).
+ * modules/acl-tests (Makefile.am): Link the programs with $(LIB_MBRTOWC)
+ instead of $(LIBTHREAD).
+ * modules/argmatch-tests (Makefile.am): Likewise.
+ * modules/closein-tests (Makefile.am): Likewise.
+ * modules/copy-file-tests (Makefile.am): Likewise.
+ * modules/dfa-tests (Makefile.am): Likewise.
+ * modules/fnmatch-tests (Makefile.am): Likewise.
+ * modules/glob-tests (Makefile.am): Likewise.
+ * modules/mbmemcasecmp-tests (Makefile.am): Likewise.
+ * modules/mbmemcasecoll-tests (Makefile.am): Likewise.
+ * modules/mbrtowc-tests (Makefile.am): Likewise.
+ * modules/mbscasecmp-tests (Makefile.am): Likewise.
+ * modules/mbscasestr-tests (Makefile.am): Likewise.
+ * modules/mbschr-tests (Makefile.am): Likewise.
+ * modules/mbscspn-tests (Makefile.am): Likewise.
+ * modules/mbsinit-tests (Makefile.am): Likewise.
+ * modules/mbsncasecmp-tests (Makefile.am): Likewise.
+ * modules/mbsnrtowcs-tests (Makefile.am): Likewise.
+ * modules/mbspbrk-tests (Makefile.am): Likewise.
+ * modules/mbspcasecmp-tests (Makefile.am): Likewise.
+ * modules/mbsrchr-tests (Makefile.am): Likewise.
+ * modules/mbsrtowcs-tests (Makefile.am): Likewise.
+ * modules/mbsspn-tests (Makefile.am): Likewise.
+ * modules/mbsstr-tests (Makefile.am): Likewise.
+ * modules/quotearg-simple-tests (Makefile.am): Likewise.
+ * modules/quotearg-tests (Makefile.am): Likewise.
+ * modules/readtokens-tests (Makefile.am): Likewise.
+ * modules/sh-quote-tests (Makefile.am): Likewise.
+ * modules/system-quote-tests (Makefile.am): Likewise.
+ * modules/unistdio/ulc-asnprintf-tests (Makefile.am): Likewise.
+ * modules/unistdio/ulc-vasnprintf-tests (Makefile.am): Likewise.
+ * modules/unistdio/ulc-vasprintf-tests (Makefile.am): Likewise.
+ * modules/unistdio/ulc-vsnprintf-tests (Makefile.am): Likewise.
+ * modules/unistdio/ulc-vsprintf-tests (Makefile.am): Likewise.
+ * modules/yesno-tests (Makefile.am): Likewise.
+ * modules/exclude-tests (Makefile.am): Link the programs with
+ $(LIB_MBRTOWC).
+ * modules/regex-tests (Makefile.am): Likewise.
+ * modules/regex-quote-tests (Makefile.am): Likewise.
+
+2020-01-03 Bruno Haible <bruno@clisp.org>
+
getopt-posix: Fix compilation failure in testdirs.
* lib/unistd.in.h: Include <getopt-cdefs.h> and <getopt-pfx-core.h> only
when the gnulib module 'getopt-posix' is enabled.
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index 1cdd1af204..066d9495e3 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -32,10 +32,32 @@
# include <stdint.h>
# include <stdlib.h>
+# if defined _WIN32 && !defined __CYGWIN__
+
+# define WIN32_LEAN_AND_MEAN /* avoid including junk */
+# include <windows.h>
+
+# elif HAVE_PTHREAD_API
+
+# include <pthread.h>
+# if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS
+# include <threads.h>
+# pragma weak thrd_exit
+# define c11_threads_in_use() (thrd_exit != NULL)
+# else
+# define c11_threads_in_use() 0
+# endif
+
+# elif HAVE_THREADS_H
+
+# include <threads.h>
+
+# endif
+
# include "localcharset.h"
# include "streq.h"
# include "verify.h"
-# include "glthread/lock.h"
+# include "mbtowc-lock.h"
# ifndef FALLTHROUGH
# if __GNUC__ < 7
@@ -93,12 +115,7 @@ locale_enc_cached (void)
# define locale_enc_cached locale_enc
# endif
-/* This lock protects the internal state of mbtowc against multiple simultaneous
- calls of mbrtowc. */
-gl_lock_define_initialized(static, mbtowc_lock)
-
verify (sizeof (mbstate_t) >= 4);
-
static char internal_state[4];
size_t
@@ -286,16 +303,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
{
/* The hidden internal state of mbtowc would make this function not
multi-thread safe. Achieve multi-thread safety through a lock. */
- gl_lock_lock (mbtowc_lock);
-
- /* Put the hidden internal state of mbtowc into its initial state.
- This is needed at least with glibc, uClibc, and MSVC CRT.
- See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>. */
- mbtowc (NULL, NULL, 0);
-
- res = mbtowc (pwc, p, m);
-
- gl_lock_unlock (mbtowc_lock);
+ res = mbtowc_with_lock (pwc, p, m);
if (res >= 0)
{
diff --git a/lib/mbtowc-lock.c b/lib/mbtowc-lock.c
new file mode 100644
index 0000000000..85ad3c4c90
--- /dev/null
+++ b/lib/mbtowc-lock.c
@@ -0,0 +1,150 @@
+/* Return the internal lock used by mbrtowc and mbrtoc32.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019-2020. */
+
+#include <config.h>
+
+/* When it is known that the gl_get_mbtowc_lock function is defined
+ by a dependency library, it should not be defined here. */
+#if OMIT_MBTOWC_LOCK
+
+/* This declaration is solely to ensure that after preprocessing
+ this file is never empty. */
+typedef int dummy;
+
+#else
+
+/* This file defines the internal lock used by mbrtowc and mbrtoc32.
+ It is a separate compilation unit, so that only one copy of it is
+ present when linking statically. */
+
+/* Prohibit renaming this symbol. */
+# undef gl_get_mbtowc_lock
+
+/* Macro for exporting a symbol (function, not variable) defined in this file,
+ when compiled into a shared library. */
+# ifndef DLL_EXPORTED
+# if HAVE_VISIBILITY
+ /* Override the effect of the compiler option '-fvisibility=hidden'. */
+# define DLL_EXPORTED __attribute__((__visibility__("default")))
+# elif defined _WIN32 || defined __CYGWIN__
+# define DLL_EXPORTED __declspec(dllexport)
+# else
+# define DLL_EXPORTED
+# endif
+# endif
+
+# if defined _WIN32 && !defined __CYGWIN__
+
+# define WIN32_LEAN_AND_MEAN /* avoid including junk */
+# include <windows.h>
+
+# include "windows-initguard.h"
+
+/* The return type is a 'CRITICAL_SECTION *', not a 'glwthread_mutex_t *',
+ because the latter is not guaranteed to be a stable ABI in the future. */
+
+/* Make sure the function gets exported from DLLs. */
+DLL_EXPORTED CRITICAL_SECTION *gl_get_mbtowc_lock (void);
+
+static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT;
+static CRITICAL_SECTION lock;
+
+/* Returns the internal lock used by mbrtowc and mbrtoc32. */
+CRITICAL_SECTION *
+gl_get_mbtowc_lock (void)
+{
+ if (!guard.done)
+ {
+ if (InterlockedIncrement (&guard.started) == 0)
+ {
+ /* This thread is the first one to need the lock. Initialize it. */
+ InitializeCriticalSection (&lock);
+ guard.done = 1;
+ }
+ else
+ {
+ /* Don't let guard.started grow and wrap around. */
+ InterlockedDecrement (&guard.started);
+ /* Yield the CPU while waiting for another thread to finish
+ initializing this mutex. */
+ while (!guard.done)
+ Sleep (0);
+ }
+ }
+ return &lock;
+}
+
+# elif HAVE_PTHREAD_API
+
+# include <pthread.h>
+
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* Make sure the function gets exported from shared libraries. */
+DLL_EXPORTED pthread_mutex_t *gl_get_mbtowc_lock (void);
+
+/* Returns the internal lock used by mbrtowc and mbrtoc32. */
+pthread_mutex_t *
+gl_get_mbtowc_lock (void)
+{
+ return &mutex;
+}
+
+# elif HAVE_THREADS_H
+
+# include <threads.h>
+# include <stdlib.h>
+
+static int volatile init_needed = 1;
+static once_flag init_once = ONCE_FLAG_INIT;
+static mtx_t mutex;
+
+static void
+atomic_init (void)
+{
+ if (mtx_init (&mutex, mtx_plain) != thrd_success)
+ abort ();
+ init_needed = 0;
+}
+
+/* Make sure the function gets exported from shared libraries. */
+DLL_EXPORTED mtx_t *gl_get_mbtowc_lock (void);
+
+/* Returns the internal lock used by mbrtowc and mbrtoc32. */
+mtx_t *
+gl_get_mbtowc_lock (void)
+{
+ if (init_needed)
+ call_once (&init_once, atomic_init);
+ return &mutex;
+}
+
+# endif
+
+# if (defined _WIN32 || defined __CYGWIN__) && !defined _MSC_VER
+/* Make sure the '__declspec(dllimport)' in mbrtowc.c and mbrtoc32.c does not
+ cause a link failure when no DLLs are involved. */
+# if defined _WIN64 || defined _LP64
+# define IMP(x) __imp_##x
+# else
+# define IMP(x) _imp__##x
+# endif
+void * IMP(gl_get_mbtowc_lock) = &gl_get_mbtowc_lock;
+# endif
+
+#endif
diff --git a/lib/mbtowc-lock.h b/lib/mbtowc-lock.h
new file mode 100644
index 0000000000..e101978dfe
--- /dev/null
+++ b/lib/mbtowc-lock.h
@@ -0,0 +1,115 @@
+/* Use the internal lock used by mbrtowc and mbrtoc32.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019-2020. */
+
+/* Use a lock, so that no two threads can invoke mbtowc at the same time. */
+
+static inline int
+mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m)
+{
+ /* Put the hidden internal state of mbtowc into its initial state.
+ This is needed at least with glibc, uClibc, and MSVC CRT.
+ See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>. */
+ mbtowc (NULL, NULL, 0);
+
+ return mbtowc (pwc, p, m);
+}
+
+/* Prohibit renaming this symbol. */
+#undef gl_get_mbtowc_lock
+
+#if defined _WIN32 && !defined __CYGWIN__
+
+extern __declspec(dllimport) CRITICAL_SECTION *gl_get_mbtowc_lock (void);
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+ CRITICAL_SECTION *lock = gl_get_mbtowc_lock ();
+ int ret;
+
+ EnterCriticalSection (lock);
+ ret = mbtowc_unlocked (pwc, p, m);
+ LeaveCriticalSection (lock);
+
+ return ret;
+}
+
+#elif HAVE_PTHREAD_API /* AIX, IRIX, Cygwin */
+
+extern
+# if defined _WIN32 || defined __CYGWIN__
+ __declspec(dllimport)
+# endif
+ pthread_mutex_t *gl_get_mbtowc_lock (void);
+
+# if HAVE_WEAK_SYMBOLS /* IRIX */
+
+ /* Avoid the need to link with '-lpthread'. */
+# pragma weak pthread_mutex_lock
+# pragma weak pthread_mutex_unlock
+
+ /* Determine whether libpthread is in use. */
+# pragma weak pthread_mutexattr_gettype
+ /* See the comments in lock.h. */
+# define pthread_in_use() \
+ (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
+
+# else
+# define pthread_in_use() 1
+# endif
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+ if (pthread_in_use())
+ {
+ pthread_mutex_t *lock = gl_get_mbtowc_lock ();
+ int ret;
+
+ if (pthread_mutex_lock (lock))
+ abort ();
+ ret = mbtowc_unlocked (pwc, p, m);
+ if (pthread_mutex_unlock (lock))
+ abort ();
+
+ return ret;
+ }
+ else
+ return mbtowc_unlocked (pwc, p, m);
+}
+
+#elif HAVE_THREADS_H
+
+extern mtx_t *gl_get_mbtowc_lock (void);
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+ mtx_t *lock = gl_get_mbtowc_lock ();
+ int ret;
+
+ if (mtx_lock (lock) != thrd_success)
+ abort ();
+ ret = mbtowc_unlocked (pwc, p, m);
+ if (mtx_unlock (lock) != thrd_success)
+ abort ();
+
+ return ret;
+}
+
+#endif
diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4
index 5ad246fd4f..bd9225b754 100644
--- a/m4/mbrtowc.m4
+++ b/m4/mbrtowc.m4
@@ -1,4 +1,4 @@
-# mbrtowc.m4 serial 36 -*- coding: utf-8 -*-
+# mbrtowc.m4 serial 37 -*- coding: utf-8 -*-
dnl Copyright (C) 2001-2002, 2004-2005, 2008-2020 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -8,6 +8,8 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_MBRTOWC],
[
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+ AC_REQUIRE([gl_PTHREADLIB])
+ AC_CHECK_HEADERS_ONCE([threads.h])
AC_REQUIRE([AC_TYPE_MBSTATE_T])
gl_MBSTATE_T_BROKEN
@@ -94,6 +96,23 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
esac
fi
fi
+ if test $REPLACE_MBSTATE_T = 1; then
+ case "$host_os" in
+ mingw*) LIB_MBRTOWC= ;;
+ *)
+ gl_WEAK_SYMBOLS
+ case "$gl_cv_have_weak" in
+ *yes) LIB_MBRTOWC= ;;
+ *) LIB_MBRTOWC="$LIBPTHREAD" ;;
+ esac
+ ;;
+ esac
+ else
+ LIB_MBRTOWC=
+ fi
+ dnl LIB_MBRTOWC is expected to be '-pthread' or '-lpthread' on AIX
+ dnl with gcc or xlc, and empty otherwise.
+ AC_SUBST([LIB_MBRTOWC])
])
dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that
@@ -808,6 +827,12 @@ AC_DEFUN([gl_PREREQ_MBRTOWC], [
:
])
+# Prerequisites of lib/mbtowc-lock.c.
+AC_DEFUN([gl_PREREQ_MBTOWC_LOCK],
+[
+ gl_VISIBILITY
+])
+
dnl From Paul Eggert
diff --git a/modules/acl b/modules/acl
index 9c398dddbb..a0a5e459f1 100644
--- a/modules/acl
+++ b/modules/acl
@@ -22,7 +22,7 @@ Include:
"acl.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/acl-tests b/modules/acl-tests
index 1c6b7c41cb..e4173fe9ae 100644
--- a/modules/acl-tests
+++ b/modules/acl-tests
@@ -25,6 +25,6 @@ TESTS += \
test-copy-acl.sh test-copy-acl-1.sh test-copy-acl-2.sh
TESTS_ENVIRONMENT += USE_ACL=$(USE_ACL)
check_PROGRAMS += test-set-mode-acl test-copy-acl test-sameacls
-test_set_mode_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIBTHREAD)
-test_copy_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIBTHREAD)
-test_sameacls_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIBTHREAD)
+test_set_mode_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIB_MBRTOWC)
+test_copy_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIB_MBRTOWC)
+test_sameacls_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIB_MBRTOWC)
diff --git a/modules/argmatch b/modules/argmatch
index 7fdbe66161..97d84fbb93 100644
--- a/modules/argmatch
+++ b/modules/argmatch
@@ -27,7 +27,7 @@ Include:
"argmatch.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/argmatch-tests b/modules/argmatch-tests
index 1b2f3c4ea4..1ede023b8a 100644
--- a/modules/argmatch-tests
+++ b/modules/argmatch-tests
@@ -9,5 +9,5 @@ configure.ac:
Makefile.am:
TESTS += test-argmatch
check_PROGRAMS += test-argmatch
-test_argmatch_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
+test_argmatch_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
diff --git a/modules/backup-rename b/modules/backup-rename
index 65ebe45eb7..0d6c34bd51 100644
--- a/modules/backup-rename
+++ b/modules/backup-rename
@@ -33,7 +33,7 @@ Include:
"backupfile.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/backupfile b/modules/backupfile
index 67c79716c8..7916d6adcb 100644
--- a/modules/backupfile
+++ b/modules/backupfile
@@ -34,7 +34,7 @@ Include:
"backupfile.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/closein b/modules/closein
index a5e8a535a7..6a34d83bb6 100644
--- a/modules/closein
+++ b/modules/closein
@@ -20,7 +20,7 @@ Include:
"closein.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/closein-tests b/modules/closein-tests
index bffa63afb7..dc288f2ea0 100644
--- a/modules/closein-tests
+++ b/modules/closein-tests
@@ -12,4 +12,4 @@ configure.ac:
Makefile.am:
TESTS += test-closein.sh
check_PROGRAMS += test-closein
-test_closein_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
+test_closein_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
diff --git a/modules/closeout b/modules/closeout
index 5482357754..e51489f8bc 100644
--- a/modules/closeout
+++ b/modules/closeout
@@ -22,7 +22,7 @@ Include:
"closeout.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/copy-file b/modules/copy-file
index 36d25af8ae..cc4a3c7e75 100644
--- a/modules/copy-file
+++ b/modules/copy-file
@@ -34,7 +34,7 @@ Include:
"copy-file.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/copy-file-tests b/modules/copy-file-tests
index d33de798ad..a0788755f1 100644
--- a/modules/copy-file-tests
+++ b/modules/copy-file-tests
@@ -18,4 +18,4 @@ Makefile.am:
TESTS += test-copy-file.sh test-copy-file-1.sh test-copy-file-2.sh
TESTS_ENVIRONMENT += USE_ACL=$(USE_ACL)
check_PROGRAMS += test-copy-file
-test_copy_file_LDADD = $(LDADD) $(LIB_ACL) $(LIB_CLOCK_GETTIME) @LIBINTL@ $(LIBTHREAD)
+test_copy_file_LDADD = $(LDADD) $(LIB_ACL) $(LIB_CLOCK_GETTIME) @LIBINTL@ $(LIB_MBRTOWC)
diff --git a/modules/csharpcomp b/modules/csharpcomp
index 9afcefa44f..62163f6a6c 100644
--- a/modules/csharpcomp
+++ b/modules/csharpcomp
@@ -28,7 +28,7 @@ Include:
"csharpcomp.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/csharpexec b/modules/csharpexec
index ed1723a21d..714e0b9d3c 100644
--- a/modules/csharpexec
+++ b/modules/csharpexec
@@ -28,7 +28,7 @@ Include:
"csharpexec.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/dfa b/modules/dfa
index f1b00fe1ed..9b112afbae 100644
--- a/modules/dfa
+++ b/modules/dfa
@@ -38,7 +38,7 @@ Include:
"localeinfo.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/dfa-tests b/modules/dfa-tests
index 0128dca2b0..5855652c90 100644
--- a/modules/dfa-tests
+++ b/modules/dfa-tests
@@ -18,4 +18,4 @@ TESTS += \
dfa-match.sh
check_PROGRAMS += dfa-match-aux
-dfa_match_aux_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIBTHREAD)
+dfa_match_aux_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIB_MBRTOWC)
diff --git a/modules/exclude b/modules/exclude
index d05fdb2b85..5ff0539348 100644
--- a/modules/exclude
+++ b/modules/exclude
@@ -25,7 +25,7 @@ Include:
"exclude.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/exclude-tests b/modules/exclude-tests
index f0dffe86a8..f8372a3efb 100644
--- a/modules/exclude-tests
+++ b/modules/exclude-tests
@@ -26,4 +26,4 @@ TESTS += \
test-exclude8.sh
check_PROGRAMS += test-exclude
-test_exclude_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
+test_exclude_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC) $(LIBTHREAD)
diff --git a/modules/fnmatch b/modules/fnmatch
index 67224571f9..50a2c71830 100644
--- a/modules/fnmatch
+++ b/modules/fnmatch
@@ -34,7 +34,7 @@ Include:
<fnmatch.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv2+
diff --git a/modules/fnmatch-gnu b/modules/fnmatch-gnu
index 8a592f236e..f2c49de101 100644
--- a/modules/fnmatch-gnu
+++ b/modules/fnmatch-gnu
@@ -20,7 +20,7 @@ Include:
<fnmatch.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv2+
diff --git a/modules/fnmatch-posix b/modules/fnmatch-posix
index f1e5b69dbb..508da562e9 100644
--- a/modules/fnmatch-posix
+++ b/modules/fnmatch-posix
@@ -20,7 +20,7 @@ Include:
"fnmatch.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv2+
diff --git a/modules/fnmatch-tests b/modules/fnmatch-tests
index 55c94cb807..5fd97c7e4d 100644
--- a/modules/fnmatch-tests
+++ b/modules/fnmatch-tests
@@ -6,4 +6,4 @@ tests/macros.h
Makefile.am:
TESTS += test-fnmatch
check_PROGRAMS += test-fnmatch
-test_fnmatch_LDADD = $(LDADD) $(LIBTHREAD)
+test_fnmatch_LDADD = $(LDADD) $(LIB_MBRTOWC)
diff --git a/modules/glob b/modules/glob
index 0f7dad6f92..33d43bf394 100644
--- a/modules/glob
+++ b/modules/glob
@@ -50,7 +50,7 @@ Include:
<glob.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv2+
diff --git a/modules/glob-tests b/modules/glob-tests
index 5e83c4350c..f551f6c950 100644
--- a/modules/glob-tests
+++ b/modules/glob-tests
@@ -11,4 +11,4 @@ configure.ac:
Makefile.am:
TESTS += test-glob
check_PROGRAMS += test-glob
-test_glob_LDADD = $(LDADD) $(LIBTHREAD)
+test_glob_LDADD = $(LDADD) $(LIB_MBRTOWC)
diff --git a/modules/human b/modules/human
index 362b8582fb..58b1b79ca3 100644
--- a/modules/human
+++ b/modules/human
@@ -27,7 +27,7 @@ Include:
"human.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/javacomp b/modules/javacomp
index 082a6c599a..d1cc559733 100644
--- a/modules/javacomp
+++ b/modules/javacomp
@@ -39,7 +39,7 @@ Include:
"javacomp.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/javaexec b/modules/javaexec
index 04b997b447..773093e81d 100644
--- a/modules/javaexec
+++ b/modules/javaexec
@@ -29,7 +29,7 @@ Include:
"javaexec.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/javaversion b/modules/javaversion
index b86edb008b..d1e426c93a 100644
--- a/modules/javaversion
+++ b/modules/javaversion
@@ -26,7 +26,7 @@ Include:
"javaversion.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/mbfile b/modules/mbfile
index 386f3e93e9..ae7704b88e 100644
--- a/modules/mbfile
+++ b/modules/mbfile
@@ -25,7 +25,7 @@ Include:
"mbfile.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbiter b/modules/mbiter
index 347e7776e0..0f08040e7d 100644
--- a/modules/mbiter
+++ b/modules/mbiter
@@ -25,7 +25,7 @@ Include:
"mbiter.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv2+
diff --git a/modules/mbmemcasecmp b/modules/mbmemcasecmp
index 22075b568e..1af2b1cad5 100644
--- a/modules/mbmemcasecmp
+++ b/modules/mbmemcasecmp
@@ -17,7 +17,7 @@ Include:
"mbmemcasecmp.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbmemcasecmp-tests b/modules/mbmemcasecmp-tests
index 16a11231c2..69c1d0e17d 100644
--- a/modules/mbmemcasecmp-tests
+++ b/modules/mbmemcasecmp-tests
@@ -25,4 +25,4 @@ TESTS_ENVIRONMENT += \
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
check_PROGRAMS += test-mbmemcasecmp
-test_mbmemcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbmemcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbmemcasecoll b/modules/mbmemcasecoll
index e0674fa47f..db20df0ee7 100644
--- a/modules/mbmemcasecoll
+++ b/modules/mbmemcasecoll
@@ -24,7 +24,7 @@ Include:
"mbmemcasecoll.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/mbmemcasecoll-tests b/modules/mbmemcasecoll-tests
index 56a3db0af2..5201618048 100644
--- a/modules/mbmemcasecoll-tests
+++ b/modules/mbmemcasecoll-tests
@@ -25,4 +25,4 @@ TESTS_ENVIRONMENT += \
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
check_PROGRAMS += test-mbmemcasecoll
-test_mbmemcasecoll_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbmemcasecoll_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbrlen b/modules/mbrlen
index e1caa2a879..b06362a7bc 100644
--- a/modules/mbrlen
+++ b/modules/mbrlen
@@ -25,7 +25,7 @@ Include:
<wchar.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbrtowc b/modules/mbrtowc
index d2dc54cf9a..db10256607 100644
--- a/modules/mbrtowc
+++ b/modules/mbrtowc
@@ -3,12 +3,17 @@ mbrtowc() function: convert multibyte character to wide character.
Files:
lib/mbrtowc.c
+lib/mbtowc-lock.h
+lib/mbtowc-lock.c
+lib/windows-initguard.h
m4/mbrtowc.m4
m4/mbstate_t.m4
m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-zh.m4
m4/codeset.m4
+m4/threadlib.m4
+m4/visibility.m4
Depends-on:
wchar
@@ -19,13 +24,14 @@ mbsinit [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
localcharset [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
streq [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
verify [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
-lock [test $HAVE_MBRTOWC = 0 || { test $REPLACE_MBRTOWC = 1 && { test $HAVE_MBSINIT = 0 || test $REPLACE_MBSTATE_T = 1; }; }]
configure.ac:
gl_FUNC_MBRTOWC
if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then
AC_LIBOBJ([mbrtowc])
+ AC_LIBOBJ([mbtowc-lock])
gl_PREREQ_MBRTOWC
+ gl_PREREQ_MBTOWC_LOCK
fi
gl_WCHAR_MODULE_INDICATOR([mbrtowc])
@@ -35,7 +41,7 @@ Include:
<wchar.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv2+
diff --git a/modules/mbrtowc-tests b/modules/mbrtowc-tests
index f5c9166f1d..6331be01d0 100644
--- a/modules/mbrtowc-tests
+++ b/modules/mbrtowc-tests
@@ -45,4 +45,4 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbrtowc test-mbrtowc-w32
-test_mbrtowc_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbrtowc_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbscasecmp b/modules/mbscasecmp
index 2be11e0d10..6c4249c88d 100644
--- a/modules/mbscasecmp
+++ b/modules/mbscasecmp
@@ -18,7 +18,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbscasecmp-tests b/modules/mbscasecmp-tests
index 9f77064c3b..6894553a5e 100644
--- a/modules/mbscasecmp-tests
+++ b/modules/mbscasecmp-tests
@@ -15,4 +15,4 @@ Makefile.am:
TESTS += test-mbscasecmp.sh
TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
check_PROGRAMS += test-mbscasecmp
-test_mbscasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbscasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbscasestr b/modules/mbscasestr
index a731dd06c0..8c12c8d3b5 100644
--- a/modules/mbscasestr
+++ b/modules/mbscasestr
@@ -23,7 +23,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbscasestr-tests b/modules/mbscasestr-tests
index 3395c1fd8c..0def3bf97b 100644
--- a/modules/mbscasestr-tests
+++ b/modules/mbscasestr-tests
@@ -24,7 +24,7 @@ Makefile.am:
TESTS += test-mbscasestr1 test-mbscasestr2.sh test-mbscasestr3.sh test-mbscasestr4.sh
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbscasestr1 test-mbscasestr2 test-mbscasestr3 test-mbscasestr4
-test_mbscasestr1_LDADD = $(LDADD) $(LIBTHREAD)
-test_mbscasestr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
-test_mbscasestr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
-test_mbscasestr4_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbscasestr1_LDADD = $(LDADD) $(LIB_MBRTOWC)
+test_mbscasestr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
+test_mbscasestr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
+test_mbscasestr4_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbschr b/modules/mbschr
index ca67f300ef..dd55613e4b 100644
--- a/modules/mbschr
+++ b/modules/mbschr
@@ -18,7 +18,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbschr-tests b/modules/mbschr-tests
index 33ee83fdcf..85e30f6571 100644
--- a/modules/mbschr-tests
+++ b/modules/mbschr-tests
@@ -15,4 +15,4 @@ Makefile.am:
TESTS += test-mbschr.sh
TESTS_ENVIRONMENT += LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbschr
-test_mbschr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbschr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbscspn b/modules/mbscspn
index 6861e61a3d..95cc670d28 100644
--- a/modules/mbscspn
+++ b/modules/mbscspn
@@ -20,7 +20,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbscspn-tests b/modules/mbscspn-tests
index 8c4a3d154d..effac53d16 100644
--- a/modules/mbscspn-tests
+++ b/modules/mbscspn-tests
@@ -15,4 +15,4 @@ Makefile.am:
TESTS += test-mbscspn.sh
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-mbscspn
-test_mbscspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbscspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbsinit b/modules/mbsinit
index 941c583889..3f7596d0ee 100644
--- a/modules/mbsinit
+++ b/modules/mbsinit
@@ -26,7 +26,7 @@ Include:
<wchar.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv2+
diff --git a/modules/mbsinit-tests b/modules/mbsinit-tests
index 0674e9c610..b41fff3330 100644
--- a/modules/mbsinit-tests
+++ b/modules/mbsinit-tests
@@ -17,4 +17,4 @@ Makefile.am:
TESTS += test-mbsinit.sh
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-mbsinit
-test_mbsinit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbsinit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbslen b/modules/mbslen
index ed8dfe7fbe..41a2531ffb 100644
--- a/modules/mbslen
+++ b/modules/mbslen
@@ -20,7 +20,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbsncasecmp b/modules/mbsncasecmp
index 2857f4f816..5dc287ddaa 100644
--- a/modules/mbsncasecmp
+++ b/modules/mbsncasecmp
@@ -18,7 +18,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbsncasecmp-tests b/modules/mbsncasecmp-tests
index 050201a5c2..a18fc3b271 100644
--- a/modules/mbsncasecmp-tests
+++ b/modules/mbsncasecmp-tests
@@ -15,4 +15,4 @@ Makefile.am:
TESTS += test-mbsncasecmp.sh
TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
check_PROGRAMS += test-mbsncasecmp
-test_mbsncasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbsncasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbsnlen b/modules/mbsnlen
index fa2296400f..0d4ad37fe1 100644
--- a/modules/mbsnlen
+++ b/modules/mbsnlen
@@ -18,7 +18,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv2+
diff --git a/modules/mbsnrtowcs b/modules/mbsnrtowcs
index b1a9721c0f..2f1c52db9a 100644
--- a/modules/mbsnrtowcs
+++ b/modules/mbsnrtowcs
@@ -30,7 +30,7 @@ Include:
<wchar.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbsnrtowcs-tests b/modules/mbsnrtowcs-tests
index 4d90f17a81..ce5ae468bb 100644
--- a/modules/mbsnrtowcs-tests
+++ b/modules/mbsnrtowcs-tests
@@ -31,4 +31,4 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbsnrtowcs
-test_mbsnrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbsnrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbspbrk b/modules/mbspbrk
index 77bf03fc5a..5a167f3207 100644
--- a/modules/mbspbrk
+++ b/modules/mbspbrk
@@ -20,7 +20,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbspbrk-tests b/modules/mbspbrk-tests
index 902e5b39c5..bb001fe88d 100644
--- a/modules/mbspbrk-tests
+++ b/modules/mbspbrk-tests
@@ -15,4 +15,4 @@ Makefile.am:
TESTS += test-mbspbrk.sh
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-mbspbrk
-test_mbspbrk_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbspbrk_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbspcasecmp b/modules/mbspcasecmp
index 9e8753697b..f581f82a81 100644
--- a/modules/mbspcasecmp
+++ b/modules/mbspcasecmp
@@ -18,7 +18,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbspcasecmp-tests b/modules/mbspcasecmp-tests
index e6f11ffa4d..b6b0e2d82c 100644
--- a/modules/mbspcasecmp-tests
+++ b/modules/mbspcasecmp-tests
@@ -15,4 +15,4 @@ Makefile.am:
TESTS += test-mbspcasecmp.sh
TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
check_PROGRAMS += test-mbspcasecmp
-test_mbspcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbspcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbsrchr b/modules/mbsrchr
index b73b59f70a..6f272e0d44 100644
--- a/modules/mbsrchr
+++ b/modules/mbsrchr
@@ -18,7 +18,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbsrchr-tests b/modules/mbsrchr-tests
index 1d9780426d..d104196256 100644
--- a/modules/mbsrchr-tests
+++ b/modules/mbsrchr-tests
@@ -15,4 +15,4 @@ Makefile.am:
TESTS += test-mbsrchr.sh
TESTS_ENVIRONMENT += LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbsrchr
-test_mbsrchr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbsrchr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbsrtowcs b/modules/mbsrtowcs
index c742f49d3b..9da2d07416 100644
--- a/modules/mbsrtowcs
+++ b/modules/mbsrtowcs
@@ -33,7 +33,7 @@ Include:
<wchar.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv2+
diff --git a/modules/mbsrtowcs-tests b/modules/mbsrtowcs-tests
index 3de9d73f61..8073a53a47 100644
--- a/modules/mbsrtowcs-tests
+++ b/modules/mbsrtowcs-tests
@@ -31,4 +31,4 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbsrtowcs
-test_mbsrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbsrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbssep b/modules/mbssep
index 465dc51143..7e3726dbef 100644
--- a/modules/mbssep
+++ b/modules/mbssep
@@ -20,7 +20,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbsspn b/modules/mbsspn
index 6cec1da2e0..8d63084086 100644
--- a/modules/mbsspn
+++ b/modules/mbsspn
@@ -19,7 +19,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbsspn-tests b/modules/mbsspn-tests
index 994a7062e6..af1740144d 100644
--- a/modules/mbsspn-tests
+++ b/modules/mbsspn-tests
@@ -15,4 +15,4 @@ Makefile.am:
TESTS += test-mbsspn.sh
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-mbsspn
-test_mbsspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbsspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbsstr b/modules/mbsstr
index 5b418dce22..5458607a2b 100644
--- a/modules/mbsstr
+++ b/modules/mbsstr
@@ -23,7 +23,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbsstr-tests b/modules/mbsstr-tests
index 739e51deec..697aaf829a 100644
--- a/modules/mbsstr-tests
+++ b/modules/mbsstr-tests
@@ -20,6 +20,6 @@ Makefile.am:
TESTS += test-mbsstr1 test-mbsstr2.sh test-mbsstr3.sh
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbsstr1 test-mbsstr2 test-mbsstr3
-test_mbsstr1_LDADD = $(LDADD) $(LIBTHREAD)
-test_mbsstr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
-test_mbsstr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
+test_mbsstr1_LDADD = $(LDADD) $(LIB_MBRTOWC)
+test_mbsstr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
+test_mbsstr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
diff --git a/modules/mbstok_r b/modules/mbstok_r
index 67de3d772a..ad518bb6a5 100644
--- a/modules/mbstok_r
+++ b/modules/mbstok_r
@@ -21,7 +21,7 @@ Include:
<string.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mbswidth b/modules/mbswidth
index 934ab5924a..736d9021da 100644
--- a/modules/mbswidth
+++ b/modules/mbswidth
@@ -26,7 +26,7 @@ Include:
"mbswidth.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/mbuiter b/modules/mbuiter
index 6763f0bb56..78af61dcae 100644
--- a/modules/mbuiter
+++ b/modules/mbuiter
@@ -26,7 +26,7 @@ Include:
"mbuiter.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPL
diff --git a/modules/mkdir-p b/modules/mkdir-p
index 72f8b0987a..a9df81aed8 100644
--- a/modules/mkdir-p
+++ b/modules/mkdir-p
@@ -34,7 +34,7 @@ Include:
"mkdir-p.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/propername b/modules/propername
index 22d60735a9..e753ee7d90 100644
--- a/modules/propername
+++ b/modules/propername
@@ -36,7 +36,7 @@ Include:
"propername.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/quote b/modules/quote
index a01a16d1fc..35c30ce539 100644
--- a/modules/quote
+++ b/modules/quote
@@ -17,7 +17,7 @@ Include:
"quote.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/quotearg b/modules/quotearg
index 3d56dc53bb..9d9276ed1e 100644
--- a/modules/quotearg
+++ b/modules/quotearg
@@ -35,7 +35,7 @@ Include:
"quotearg.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/quotearg-simple b/modules/quotearg-simple
index 5ba13ce235..6a5c89296d 100644
--- a/modules/quotearg-simple
+++ b/modules/quotearg-simple
@@ -13,7 +13,7 @@ Makefile.am:
Include:
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/quotearg-simple-tests b/modules/quotearg-simple-tests
index 701da5f1e9..5470dfe3af 100644
--- a/modules/quotearg-simple-tests
+++ b/modules/quotearg-simple-tests
@@ -18,4 +18,4 @@ AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
TESTS += test-quotearg-simple
check_PROGRAMS += test-quotearg-simple
-test_quotearg_simple_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
+test_quotearg_simple_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
diff --git a/modules/quotearg-tests b/modules/quotearg-tests
index 77fde80499..aed92ce381 100644
--- a/modules/quotearg-tests
+++ b/modules/quotearg-tests
@@ -27,4 +27,4 @@ Makefile.am:
TESTS += test-quotearg.sh
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-quotearg
-test_quotearg_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIBTHREAD)
+test_quotearg_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIB_MBRTOWC)
diff --git a/modules/readtokens-tests b/modules/readtokens-tests
index 5e83e47c43..9e4c0606b9 100644
--- a/modules/readtokens-tests
+++ b/modules/readtokens-tests
@@ -11,4 +11,4 @@ configure.ac:
Makefile.am:
TESTS += test-readtokens.sh
check_PROGRAMS += test-readtokens
-test_readtokens_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
+test_readtokens_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
diff --git a/modules/regex b/modules/regex
index 42c93443cf..9d77df7aeb 100644
--- a/modules/regex
+++ b/modules/regex
@@ -49,6 +49,7 @@ Include:
<regex.h>
Link:
+$(LIB_MBRTOWC)
$(LIBTHREAD)
$(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise
diff --git a/modules/regex-quote b/modules/regex-quote
index 085e5b6bc7..9b67ca20c4 100644
--- a/modules/regex-quote
+++ b/modules/regex-quote
@@ -19,7 +19,7 @@ Include:
"regex-quote.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/regex-quote-tests b/modules/regex-quote-tests
index b396a007a7..aa99cd096e 100644
--- a/modules/regex-quote-tests
+++ b/modules/regex-quote-tests
@@ -11,4 +11,4 @@ configure.ac:
Makefile.am:
TESTS += test-regex-quote
check_PROGRAMS += test-regex-quote
-test_regex_quote_LDADD = $(LDADD) $(LIBINTL) $(LIBTHREAD)
+test_regex_quote_LDADD = $(LDADD) $(LIBINTL) $(LIB_MBRTOWC) $(LIBTHREAD)
diff --git a/modules/regex-tests b/modules/regex-tests
index e8821ec52d..711632aa06 100644
--- a/modules/regex-tests
+++ b/modules/regex-tests
@@ -11,4 +11,4 @@ configure.ac:
Makefile.am:
TESTS += test-regex
check_PROGRAMS += test-regex
-test_regex_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIBTHREAD)
+test_regex_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) @LIBINTL@ $(LIBTHREAD)
diff --git a/modules/rpmatch b/modules/rpmatch
index 3b754c6701..2e0e7e3067 100644
--- a/modules/rpmatch
+++ b/modules/rpmatch
@@ -27,7 +27,7 @@ Include:
<stdlib.h>
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
$(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise
License:
diff --git a/modules/sh-quote b/modules/sh-quote
index a95dea9af6..83fa08905c 100644
--- a/modules/sh-quote
+++ b/modules/sh-quote
@@ -18,7 +18,7 @@ Include:
"sh-quote.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/sh-quote-tests b/modules/sh-quote-tests
index 8252fee88d..2ac9722945 100644
--- a/modules/sh-quote-tests
+++ b/modules/sh-quote-tests
@@ -8,4 +8,4 @@ configure.ac:
Makefile.am:
TESTS += test-sh-quote
check_PROGRAMS += test-sh-quote
-test_sh_quote_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
+test_sh_quote_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
diff --git a/modules/system-quote b/modules/system-quote
index 09503e53ce..f34d58aff0 100644
--- a/modules/system-quote
+++ b/modules/system-quote
@@ -18,7 +18,7 @@ Include:
"system-quote.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/system-quote-tests b/modules/system-quote-tests
index 413453b081..4e2782a9a9 100644
--- a/modules/system-quote-tests
+++ b/modules/system-quote-tests
@@ -18,7 +18,7 @@ configure.ac:
Makefile.am:
TESTS += test-system-quote.sh
check_PROGRAMS += test-system-quote-main test-system-quote-child
-test_system_quote_main_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
+test_system_quote_main_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
# The test-system-quote-child program must be a real executable, not a libtool
# wrapper script, and should link against as few libraries as possible.
# Therefore don't link it against any libraries other than -lc.
diff --git a/modules/trim b/modules/trim
index 13d3579a69..3d29e3a75d 100644
--- a/modules/trim
+++ b/modules/trim
@@ -21,7 +21,7 @@ Include:
"trim.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/unistdio/ulc-asnprintf b/modules/unistdio/ulc-asnprintf
index a0c1d1fbd0..7a8255bbd0 100644
--- a/modules/unistdio/ulc-asnprintf
+++ b/modules/unistdio/ulc-asnprintf
@@ -22,7 +22,7 @@ Include:
"unistdio.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv3+ or GPLv2
diff --git a/modules/unistdio/ulc-asnprintf-tests b/modules/unistdio/ulc-asnprintf-tests
index 276c7e5bff..16699cde32 100644
--- a/modules/unistdio/ulc-asnprintf-tests
+++ b/modules/unistdio/ulc-asnprintf-tests
@@ -12,4 +12,4 @@ Makefile.am:
TESTS += test-ulc-asnprintf1
check_PROGRAMS += test-ulc-asnprintf1
test_ulc_asnprintf1_SOURCES = unistdio/test-ulc-asnprintf1.c
-test_ulc_asnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
+test_ulc_asnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
diff --git a/modules/unistdio/ulc-fprintf b/modules/unistdio/ulc-fprintf
index ad3d2d8394..74c8269dcd 100644
--- a/modules/unistdio/ulc-fprintf
+++ b/modules/unistdio/ulc-fprintf
@@ -22,7 +22,7 @@ Include:
"unistdio.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv3+ or GPLv2
diff --git a/modules/unistdio/ulc-vasnprintf b/modules/unistdio/ulc-vasnprintf
index 77a0b8c750..750602f861 100644
--- a/modules/unistdio/ulc-vasnprintf
+++ b/modules/unistdio/ulc-vasnprintf
@@ -58,7 +58,7 @@ Include:
"unistdio.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv3+ or GPLv2
diff --git a/modules/unistdio/ulc-vasnprintf-tests b/modules/unistdio/ulc-vasnprintf-tests
index 0af236161d..55e55ce84d 100644
--- a/modules/unistdio/ulc-vasnprintf-tests
+++ b/modules/unistdio/ulc-vasnprintf-tests
@@ -22,8 +22,8 @@ TESTS += test-ulc-vasnprintf1 unistdio/test-ulc-vasnprintf2.sh unistdio/test-ulc
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-ulc-vasnprintf1 test-ulc-vasnprintf2 test-ulc-vasnprintf3
test_ulc_vasnprintf1_SOURCES = unistdio/test-ulc-vasnprintf1.c
-test_ulc_vasnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
+test_ulc_vasnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
test_ulc_vasnprintf2_SOURCES = unistdio/test-ulc-vasnprintf2.c
-test_ulc_vasnprintf2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
+test_ulc_vasnprintf2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
test_ulc_vasnprintf3_SOURCES = unistdio/test-ulc-vasnprintf3.c
-test_ulc_vasnprintf3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
+test_ulc_vasnprintf3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
diff --git a/modules/unistdio/ulc-vasprintf b/modules/unistdio/ulc-vasprintf
index 19965c1aab..f84da41481 100644
--- a/modules/unistdio/ulc-vasprintf
+++ b/modules/unistdio/ulc-vasprintf
@@ -22,7 +22,7 @@ Include:
"unistdio.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv3+ or GPLv2
diff --git a/modules/unistdio/ulc-vasprintf-tests b/modules/unistdio/ulc-vasprintf-tests
index b034f3f65f..abbdfc54b0 100644
--- a/modules/unistdio/ulc-vasprintf-tests
+++ b/modules/unistdio/ulc-vasprintf-tests
@@ -11,4 +11,4 @@ Makefile.am:
TESTS += test-ulc-vasprintf1
check_PROGRAMS += test-ulc-vasprintf1
test_ulc_vasprintf1_SOURCES = unistdio/test-ulc-vasprintf1.c
-test_ulc_vasprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
+test_ulc_vasprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
diff --git a/modules/unistdio/ulc-vfprintf b/modules/unistdio/ulc-vfprintf
index 28d19ab457..590a29935f 100644
--- a/modules/unistdio/ulc-vfprintf
+++ b/modules/unistdio/ulc-vfprintf
@@ -22,7 +22,7 @@ Include:
"unistdio.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv3+ or GPLv2
diff --git a/modules/unistdio/ulc-vsnprintf b/modules/unistdio/ulc-vsnprintf
index c204b75625..5f69d4d28c 100644
--- a/modules/unistdio/ulc-vsnprintf
+++ b/modules/unistdio/ulc-vsnprintf
@@ -22,7 +22,7 @@ Include:
"unistdio.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv3+ or GPLv2
diff --git a/modules/unistdio/ulc-vsnprintf-tests b/modules/unistdio/ulc-vsnprintf-tests
index 029a825b78..735a111cfd 100644
--- a/modules/unistdio/ulc-vsnprintf-tests
+++ b/modules/unistdio/ulc-vsnprintf-tests
@@ -12,4 +12,4 @@ Makefile.am:
TESTS += test-ulc-vsnprintf1
check_PROGRAMS += test-ulc-vsnprintf1
test_ulc_vsnprintf1_SOURCES = unistdio/test-ulc-vsnprintf1.c
-test_ulc_vsnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ @LIBICONV@ $(LIBTHREAD)
+test_ulc_vsnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ @LIBICONV@ $(LIB_MBRTOWC)
diff --git a/modules/unistdio/ulc-vsprintf b/modules/unistdio/ulc-vsprintf
index b536826cd6..de233b0b8e 100644
--- a/modules/unistdio/ulc-vsprintf
+++ b/modules/unistdio/ulc-vsprintf
@@ -23,7 +23,7 @@ Include:
"unistdio.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
LGPLv3+ or GPLv2
diff --git a/modules/unistdio/ulc-vsprintf-tests b/modules/unistdio/ulc-vsprintf-tests
index 32b1b5ce39..98a6a6ce06 100644
--- a/modules/unistdio/ulc-vsprintf-tests
+++ b/modules/unistdio/ulc-vsprintf-tests
@@ -12,4 +12,4 @@ Makefile.am:
TESTS += test-ulc-vsprintf1
check_PROGRAMS += test-ulc-vsprintf1
test_ulc_vsprintf1_SOURCES = unistdio/test-ulc-vsprintf1.c
-test_ulc_vsprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ @LIBICONV@ $(LIBTHREAD)
+test_ulc_vsprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ @LIBICONV@ $(LIB_MBRTOWC)
diff --git a/modules/xfreopen b/modules/xfreopen
index 63266db52c..dfd3d9ef57 100644
--- a/modules/xfreopen
+++ b/modules/xfreopen
@@ -20,7 +20,7 @@ Include:
"xfreopen.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/xmemcoll b/modules/xmemcoll
index 4f13d85a43..97249452fa 100644
--- a/modules/xmemcoll
+++ b/modules/xmemcoll
@@ -21,7 +21,7 @@ Include:
"xmemcoll.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/yesno b/modules/yesno
index 8ae50df322..7a45e0f8bb 100644
--- a/modules/yesno
+++ b/modules/yesno
@@ -22,7 +22,7 @@ Include:
"yesno.h"
Link:
-$(LIBTHREAD)
+$(LIB_MBRTOWC)
License:
GPL
diff --git a/modules/yesno-tests b/modules/yesno-tests
index 8836ee875a..45f429fe9c 100644
--- a/modules/yesno-tests
+++ b/modules/yesno-tests
@@ -12,4 +12,4 @@ configure.ac:
Makefile.am:
TESTS += test-yesno.sh
check_PROGRAMS += test-yesno
-test_yesno_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
+test_yesno_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)