1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-05-13 15:13:36 +00:00

setlocale: Make calls with NULL argument multithread-safe.

* lib/setlocale.c: Include <errno.h>.
(setlocale_mtsafe): New function.
(setlocale_unixlike): Invoke setlocale_mtsafe instead of setlocale.
(setlocale_improved): Renamed from rpl_setlocale.
* m4/setlocale.m4 (gl_FUNC_SETLOCALE): Require gl_FUNC_SETLOCALE_NULL.
Set and define NEED_SETLOCALE_IMPROVED and NEED_SETLOCALE_MTSAFE. Set
LIB_SETLOCALE.
* modules/setlocale (Depends-on): Add setlocale-null. Update conditions.
(Link): New section.
* tests/locale.c: Undefine setlocale.
* tests/test-setlocale_null-one.c: Likewise.
* tests/test-setlocale_null-all.c: Likewise.
* modules/setlocale-tests (Makefile.am): Link the test programs with
$(LIB_SETLOCALE).
* modules/astrxfrm-tests (Makefile.am): Likewise.
* modules/btowc-tests (Makefile.am): Likewise.
* modules/c-ctype-tests (Makefile.am): Likewise.
* modules/c-snprintf-tests (Makefile.am): Likewise.
* modules/c-strcase-tests (Makefile.am): Likewise.
* modules/c-vasprintf-tests (Makefile.am): Likewise.
* modules/c-vsnprintf-tests (Makefile.am): Likewise.
* modules/c-xvasprintf-tests (Makefile.am): Likewise.
* modules/dfa-tests (Makefile.am): Likewise.
* modules/duplocale-tests (Makefile.am): Likewise.
* modules/hard-locale-tests (Makefile.am): Likewise.
* modules/localcharset-tests (Makefile.am): Likewise.
* modules/localename-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/nl_langinfo-tests (Makefile.am): Likewise.
* modules/quotearg-tests (Makefile.am): Likewise.
* modules/regex-tests (Makefile.am): Likewise.
* modules/strfmon_l-tests (Makefile.am): Likewise.
* modules/strtod-tests (Makefile.am): Likewise.
* modules/strtold-tests (Makefile.am): Likewise.
* modules/unicase/locale-language-tests (Makefile.am): Likewise.
* modules/unicase/ulc-casecmp-tests (Makefile.am): Likewise.
* modules/unicase/ulc-casecoll-tests (Makefile.am): Likewise.
* modules/unigbrk/ulc-grapheme-breaks-tests (Makefile.am): Likewise.
* modules/unistdio/u8-vasnprintf-tests (Makefile.am): Likewise.
* modules/unistdio/u16-vasnprintf-tests (Makefile.am): Likewise.
* modules/unistdio/u32-vasnprintf-tests (Makefile.am): Likewise.
* modules/unistdio/ulc-vasnprintf-tests (Makefile.am): Likewise.
* modules/uniwbrk/ulc-wordbreaks-tests (Makefile.am): Likewise.
* modules/vasnprintf-posix-tests (Makefile.am): Likewise.
* modules/wcrtomb-tests (Makefile.am): Likewise.
* modules/wcsnrtombs-tests (Makefile.am): Likewise.
* modules/wcsrtombs-tests (Makefile.am): Likewise.
* modules/wcwidth-tests (Makefile.am): Likewise.
* doc/posix-functions/setlocale.texi: Mention that the multithread-
safety fix is also available in module 'setlocale'.
This commit is contained in:
Bruno Haible
2019-12-18 14:35:27 +01:00
parent 25d476a2b7
commit 505092c2fd
58 changed files with 360 additions and 94 deletions

View File

@@ -1,3 +1,72 @@
2019-12-18 Bruno Haible <bruno@clisp.org>
setlocale: Make calls with NULL argument multithread-safe.
* lib/setlocale.c: Include <errno.h>.
(setlocale_mtsafe): New function.
(setlocale_unixlike): Invoke setlocale_mtsafe instead of setlocale.
(setlocale_improved): Renamed from rpl_setlocale.
* m4/setlocale.m4 (gl_FUNC_SETLOCALE): Require gl_FUNC_SETLOCALE_NULL.
Set and define NEED_SETLOCALE_IMPROVED and NEED_SETLOCALE_MTSAFE. Set
LIB_SETLOCALE.
* modules/setlocale (Depends-on): Add setlocale-null. Update conditions.
(Link): New section.
* tests/locale.c: Undefine setlocale.
* tests/test-setlocale_null-one.c: Likewise.
* tests/test-setlocale_null-all.c: Likewise.
* modules/setlocale-tests (Makefile.am): Link the test programs with
$(LIB_SETLOCALE).
* modules/astrxfrm-tests (Makefile.am): Likewise.
* modules/btowc-tests (Makefile.am): Likewise.
* modules/c-ctype-tests (Makefile.am): Likewise.
* modules/c-snprintf-tests (Makefile.am): Likewise.
* modules/c-strcase-tests (Makefile.am): Likewise.
* modules/c-vasprintf-tests (Makefile.am): Likewise.
* modules/c-vsnprintf-tests (Makefile.am): Likewise.
* modules/c-xvasprintf-tests (Makefile.am): Likewise.
* modules/dfa-tests (Makefile.am): Likewise.
* modules/duplocale-tests (Makefile.am): Likewise.
* modules/hard-locale-tests (Makefile.am): Likewise.
* modules/localcharset-tests (Makefile.am): Likewise.
* modules/localename-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/nl_langinfo-tests (Makefile.am): Likewise.
* modules/quotearg-tests (Makefile.am): Likewise.
* modules/regex-tests (Makefile.am): Likewise.
* modules/strfmon_l-tests (Makefile.am): Likewise.
* modules/strtod-tests (Makefile.am): Likewise.
* modules/strtold-tests (Makefile.am): Likewise.
* modules/unicase/locale-language-tests (Makefile.am): Likewise.
* modules/unicase/ulc-casecmp-tests (Makefile.am): Likewise.
* modules/unicase/ulc-casecoll-tests (Makefile.am): Likewise.
* modules/unigbrk/ulc-grapheme-breaks-tests (Makefile.am): Likewise.
* modules/unistdio/u8-vasnprintf-tests (Makefile.am): Likewise.
* modules/unistdio/u16-vasnprintf-tests (Makefile.am): Likewise.
* modules/unistdio/u32-vasnprintf-tests (Makefile.am): Likewise.
* modules/unistdio/ulc-vasnprintf-tests (Makefile.am): Likewise.
* modules/uniwbrk/ulc-wordbreaks-tests (Makefile.am): Likewise.
* modules/vasnprintf-posix-tests (Makefile.am): Likewise.
* modules/wcrtomb-tests (Makefile.am): Likewise.
* modules/wcsnrtombs-tests (Makefile.am): Likewise.
* modules/wcsrtombs-tests (Makefile.am): Likewise.
* modules/wcwidth-tests (Makefile.am): Likewise.
* doc/posix-functions/setlocale.texi: Mention that the multithread-
safety fix is also available in module 'setlocale'.
2019-12-18 Bruno Haible <bruno@clisp.org>
hard-locale: Make multithread-safe.

View File

@@ -26,14 +26,15 @@ always fails. The replacement, however, supports only the locale names
@code{"C"} and @code{"POSIX"}.
@end itemize
Portability problems fixed by Gnulib module @code{setlocale-null}:
Portability problems fixed by Gnulib module @code{setlocale} or @code{setlocale-null}:
@itemize
@item
Invocations of @code{setlocale (..., NULL)} are not multithread-safe on some
platforms:
musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin.
To make these invocations multithread-safe, you need to change the code to
invoke @code{setlocale_null} instead.
To make these invocations multithread-safe, you need the Gnulib module
@code{setlocale}, or you need to change the code to invoke @code{setlocale_null}
instead.
@end itemize
Portability problems not fixed by Gnulib:

View File

@@ -29,6 +29,7 @@
/* Specification. */
#include <locale.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -51,6 +52,141 @@ extern void gl_locale_name_canonicalize (char *name);
# undef setlocale
/* Which of the replacements to activate? */
# if NEED_SETLOCALE_IMPROVED
# define setlocale_improved rpl_setlocale
# elif NEED_SETLOCALE_MTSAFE
# define setlocale_mtsafe rpl_setlocale
# else
# error "This file should only be compiled if NEED_SETLOCALE_IMPROVED || NEED_SETLOCALE_MTSAFE."
# endif
/* Like setlocale, but guaranteed to be multithread-safe if LOCALE == NULL. */
# if !SETLOCALE_NULL_ALL_MTSAFE || !SETLOCALE_NULL_ONE_MTSAFE /* i.e. if NEED_SETLOCALE_MTSAFE */
# if NEED_SETLOCALE_IMPROVED
static
# endif
char *
setlocale_mtsafe (int category, const char *locale)
{
if (locale == NULL)
{
/* This call must be multithread-safe. To achieve this without using
thread-local storage:
1. We use a specific static buffer for each possible CATEGORY
argument. So that different threads can call setlocale_mtsafe
with different CATEGORY arguments, without interfering.
2. We use a simple strcpy or memcpy to fill this static buffer.
Filling it through, for example, strcpy + strcat would not be
guaranteed to leave the buffer's contents intact if another thread
is currently accessing it. If necessary, the contents is first
assembled in a stack-allocated buffer. */
if (category == LC_ALL)
{
# if SETLOCALE_NULL_ALL_MTSAFE
return setlocale (LC_ALL, NULL);
# else
char buf[SETLOCALE_NULL_ALL_MAX];
static char resultbuf[SETLOCALE_NULL_ALL_MAX];
if (setlocale_null (LC_ALL, buf, sizeof (buf)))
return (char *) "C";
strcpy (resultbuf, buf);
return resultbuf;
# endif
}
else
{
# if SETLOCALE_NULL_ONE_MTSAFE
return setlocale (category, NULL);
# else
enum
{
LC_CTYPE_INDEX,
LC_NUMERIC_INDEX,
LC_TIME_INDEX,
LC_COLLATE_INDEX,
LC_MONETARY_INDEX,
LC_MESSAGES_INDEX,
# ifdef LC_PAPER
LC_PAPER_INDEX,
# endif
# ifdef LC_NAME
LC_NAME_INDEX,
# endif
# ifdef LC_ADDRESS
LC_ADDRESS_INDEX,
# endif
# ifdef LC_TELEPHONE
LC_TELEPHONE_INDEX,
# endif
# ifdef LC_MEASUREMENT
LC_MEASUREMENT_INDEX,
# endif
# ifdef LC_IDENTIFICATION
LC_IDENTIFICATION_INDEX,
# endif
LC_INDICES_COUNT
}
i;
char buf[SETLOCALE_NULL_MAX];
static char resultbuf[LC_INDICES_COUNT][SETLOCALE_NULL_MAX];
int err;
err = setlocale_null (category, buf, sizeof (buf));
if (err == EINVAL)
return NULL;
if (err)
return (char *) "C";
switch (category)
{
case LC_CTYPE: i = LC_CTYPE_INDEX; break;
case LC_NUMERIC: i = LC_NUMERIC_INDEX; break;
case LC_TIME: i = LC_TIME_INDEX; break;
case LC_COLLATE: i = LC_COLLATE_INDEX; break;
case LC_MONETARY: i = LC_MONETARY_INDEX; break;
case LC_MESSAGES: i = LC_MESSAGES_INDEX; break;
# ifdef LC_PAPER
case LC_PAPER: i = LC_PAPER_INDEX; break;
# endif
# ifdef LC_NAME
case LC_NAME: i = LC_NAME_INDEX; break;
# endif
# ifdef LC_ADDRESS
case LC_ADDRESS: i = LC_ADDRESS_INDEX; break;
# endif
# ifdef LC_TELEPHONE
case LC_TELEPHONE: i = LC_TELEPHONE_INDEX; break;
# endif
# ifdef LC_MEASUREMENT
case LC_MEASUREMENT: i = LC_MEASUREMENT_INDEX; break;
# endif
# ifdef LC_IDENTIFICATION
case LC_IDENTIFICATION: i = LC_IDENTIFICATION_INDEX; break;
# endif
default:
/* If you get here, a #ifdef LC_xxx is missing. */
abort ();
}
strcpy (resultbuf[i], buf);
return resultbuf[i];
# endif
}
}
else
return setlocale (category, locale);
}
# else /* !NEED_SETLOCALE_MTSAFE */
# define setlocale_mtsafe setlocale
# endif /* NEED_SETLOCALE_MTSAFE */
# if NEED_SETLOCALE_IMPROVED
/* Return string representation of locale category CATEGORY. */
static const char *
category_to_name (int category)
@@ -85,7 +221,7 @@ category_to_name (int category)
return retval;
}
# if defined _WIN32 && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
/* The native Windows setlocale() function expects locale names of the form
"German" or "German_Germany" or "DEU", but not "de" or "de_DE". We need
@@ -652,7 +788,7 @@ setlocale_unixlike (int category, const char *locale)
locale = "C";
/* First, try setlocale with the original argument unchanged. */
result = setlocale (category, locale);
result = setlocale_mtsafe (category, locale);
if (result != NULL)
return result;
@@ -794,13 +930,13 @@ setlocale_unixlike (int category, const char *locale)
return NULL;
}
# elif defined __ANDROID__
# elif defined __ANDROID__
/* Like setlocale, but accept also the locale names "C" and "POSIX". */
static char *
setlocale_unixlike (int category, const char *locale)
{
char *result = setlocale (category, locale);
char *result = setlocale_mtsafe (category, locale);
if (result == NULL)
switch (category)
{
@@ -825,13 +961,13 @@ setlocale_unixlike (int category, const char *locale)
}
return result;
}
# define setlocale setlocale_unixlike
# define setlocale setlocale_unixlike
# else
# define setlocale_unixlike setlocale
# endif
# else
# define setlocale_unixlike setlocale_mtsafe
# endif
# if LC_MESSAGES == 1729
# if LC_MESSAGES == 1729
/* The system does not store an LC_MESSAGES locale category. Do it here. */
static char lc_messages_name[64] = "C";
@@ -853,11 +989,11 @@ setlocale_single (int category, const char *locale)
return setlocale_unixlike (category, locale);
}
# else
# define setlocale_single setlocale_unixlike
# endif
# else
# define setlocale_single setlocale_unixlike
# endif
# if defined __APPLE__ && defined __MACH__
# if defined __APPLE__ && defined __MACH__
/* Mapping from language to main territory where that language is spoken. */
static char const locales_with_principal_territory[][6 + 1] =
@@ -1115,7 +1251,7 @@ langcmp (const char *locale1, const char *locale2)
static const char *
get_main_locale_with_same_language (const char *locale)
{
# define table locales_with_principal_territory
# define table locales_with_principal_territory
/* The table is sorted. Perform a binary search. */
size_t hi = sizeof (table) / sizeof (table[0]);
size_t lo = 0;
@@ -1142,7 +1278,7 @@ get_main_locale_with_same_language (const char *locale)
return table[mid];
}
}
# undef table
# undef table
return NULL;
}
@@ -1344,7 +1480,7 @@ get_main_locale_with_same_territory (const char *locale)
{
if (strrchr (locale, '_') != NULL)
{
# define table locales_with_principal_language
# define table locales_with_principal_language
/* The table is sorted. Perform a binary search. */
size_t hi = sizeof (table) / sizeof (table[0]);
size_t lo = 0;
@@ -1371,15 +1507,15 @@ get_main_locale_with_same_territory (const char *locale)
return table[mid];
}
}
# undef table
# undef table
}
return NULL;
}
# endif
# endif
char *
rpl_setlocale (int category, const char *locale)
setlocale_improved (int category, const char *locale)
{
if (locale != NULL && locale[0] == '\0')
{
@@ -1431,14 +1567,14 @@ rpl_setlocale (int category, const char *locale)
goto fail;
i = 0;
}
# if defined _WIN32 && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
/* On native Windows, setlocale(LC_ALL,...) may succeed but set the
LC_CTYPE category to an invalid value ("C") when it does not
support the specified encoding. Report a failure instead. */
if (strchr (base_name, '.') != NULL
&& strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
goto fail;
# endif
# endif
for (; i < sizeof (categories) / sizeof (categories[0]); i++)
{
@@ -1452,12 +1588,12 @@ rpl_setlocale (int category, const char *locale)
/* If name is the same as base_name, it has already been set
through the setlocale call before the loop. */
if (strcmp (name, base_name) != 0
# if LC_MESSAGES == 1729
# if LC_MESSAGES == 1729
|| cat == LC_MESSAGES
# endif
# endif
)
if (setlocale_single (cat, name) == NULL)
# if defined __APPLE__ && defined __MACH__
# if defined __APPLE__ && defined __MACH__
{
/* On Mac OS X 10.13, some locales can be set through
System Preferences > Language & Region, that are not
@@ -1473,11 +1609,11 @@ rpl_setlocale (int category, const char *locale)
warn = (setlocale_single (cat, "UTF-8") == NULL);
else if (cat == LC_MESSAGES)
{
# if HAVE_CFLOCALECOPYPREFERREDLANGUAGES || HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */
# if HAVE_CFLOCALECOPYPREFERREDLANGUAGES || HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */
/* Take the primary language preference. */
# if HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* MacOS X 10.5 or newer */
# if HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* MacOS X 10.5 or newer */
CFArrayRef prefArray = CFLocaleCopyPreferredLanguages ();
# elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */
# elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */
CFTypeRef preferences =
CFPreferencesCopyAppValue (CFSTR ("AppleLanguages"),
kCFPreferencesCurrentApplication);
@@ -1485,7 +1621,7 @@ rpl_setlocale (int category, const char *locale)
&& CFGetTypeID (preferences) == CFArrayGetTypeID ())
{
CFArrayRef prefArray = (CFArrayRef)preferences;
# endif
# endif
int n = CFArrayGetCount (prefArray);
if (n > 0)
{
@@ -1519,19 +1655,19 @@ rpl_setlocale (int category, const char *locale)
}
}
}
# if HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* MacOS X 10.5 or newer */
# if HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* MacOS X 10.5 or newer */
CFRelease (prefArray);
# elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */
# elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */
}
# endif
# else
# endif
# else
const char *last_try =
get_main_locale_with_same_language (name);
if (last_try == NULL
|| setlocale_single (cat, last_try) == NULL)
warn = 1;
# endif
# endif
}
else
{
@@ -1570,9 +1706,9 @@ rpl_setlocale (int category, const char *locale)
category_to_name (cat), name);
}
}
# else
# else
goto fail;
# endif
# endif
}
/* All steps were successful. */
@@ -1597,7 +1733,7 @@ rpl_setlocale (int category, const char *locale)
}
else
{
# if defined _WIN32 && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
if (category == LC_ALL && locale != NULL && strchr (locale, '.') != NULL)
{
char *saved_locale;
@@ -1632,9 +1768,11 @@ rpl_setlocale (int category, const char *locale)
return setlocale (LC_ALL, NULL);
}
else
# endif
# endif
return setlocale_single (category, locale);
}
}
# endif /* NEED_SETLOCALE_IMPROVED */
#endif

View File

@@ -1,4 +1,4 @@
# setlocale.m4 serial 6
# setlocale.m4 serial 7
dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,16 +7,20 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_SETLOCALE],
[
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
AC_REQUIRE([AC_CANONICAL_HOST])
dnl Test whether we need to improve on the general working of setlocale.
NEED_SETLOCALE_IMPROVED=0
case "$host_os" in
dnl On native Windows systems, setlocale(category,NULL) does not look at
dnl the environment variables LC_ALL, category, and LANG.
mingw*) REPLACE_SETLOCALE=1 ;;
mingw*) NEED_SETLOCALE_IMPROVED=1 ;;
dnl On Cygwin 1.5.x, setlocale always succeeds but setlocale(LC_CTYPE,NULL)
dnl is then still "C".
cygwin*)
case `uname -r` in
1.5.*) REPLACE_SETLOCALE=1 ;;
1.5.*) NEED_SETLOCALE_IMPROVED=1 ;;
esac
;;
dnl On Android 4.3, setlocale(category,"C") always fails.
@@ -42,10 +46,33 @@ int main ()
])
case "$gl_cv_func_setlocale_works" in
*yes) ;;
*) REPLACE_SETLOCALE=1 ;;
*) NEED_SETLOCALE_IMPROVED=1 ;;
esac
;;
esac
AC_DEFINE_UNQUOTED([NEED_SETLOCALE_IMPROVED], [$NEED_SETLOCALE_IMPROVED],
[Define to 1 to enable general improvements of setlocale.])
dnl Test whether we need a multithread-safe setlocale(category,NULL).
NEED_SETLOCALE_MTSAFE=0
if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then
NEED_SETLOCALE_MTSAFE=1
fi
AC_DEFINE_UNQUOTED([NEED_SETLOCALE_MTSAFE], [$NEED_SETLOCALE_MTSAFE],
[Define to 1 to enable a multithread-safety fix of setlocale.])
if test $NEED_SETLOCALE_IMPROVED = 1 || test $NEED_SETLOCALE_MTSAFE = 1; then
REPLACE_SETLOCALE=1
fi
if test $NEED_SETLOCALE_MTSAFE = 1; then
LIB_SETLOCALE="$LIB_SETLOCALE_NULL"
else
LIB_SETLOCALE=
fi
dnl LIB_SETLOCALE is expected to be '-pthread' or '-lpthread' on AIX with gcc
dnl or xlc, and empty otherwise.
AC_SUBST([LIB_SETLOCALE])
])
# Prerequisites of lib/setlocale.c.

View File

@@ -9,3 +9,4 @@ configure.ac:
Makefile.am:
TESTS += test-astrxfrm
check_PROGRAMS += test-astrxfrm
test_astrxfrm_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -18,4 +18,4 @@ Makefile.am:
TESTS += test-btowc1.sh test-btowc2.sh
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-btowc
test_btowc_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -11,3 +11,4 @@ configure.ac:
Makefile.am:
TESTS += test-c-ctype
check_PROGRAMS += test-c-ctype
test_c_ctype_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -13,5 +13,6 @@ gt_LOCALE_FR
Makefile.am:
TESTS += test-c-snprintf.sh
check_PROGRAMS += test-c-snprintf
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@'
check_PROGRAMS += test-c-snprintf
test_c_snprintf_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -19,3 +19,5 @@ Makefile.am:
TESTS += test-c-strcase.sh
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
check_PROGRAMS += test-c-strcasecmp test-c-strncasecmp
test_c_strcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE)
test_c_strncasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -13,5 +13,6 @@ gt_LOCALE_FR
Makefile.am:
TESTS += test-c-vasprintf.sh
check_PROGRAMS += test-c-vasprintf
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@'
check_PROGRAMS += test-c-vasprintf
test_c_vasprintf_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -13,5 +13,6 @@ gt_LOCALE_FR
Makefile.am:
TESTS += test-c-vsnprintf.sh
check_PROGRAMS += test-c-vsnprintf
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@'
check_PROGRAMS += test-c-vsnprintf
test_c_vsnprintf_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -14,6 +14,6 @@ gt_LOCALE_FR
Makefile.am:
TESTS += test-c-xvasprintf.sh
check_PROGRAMS += test-c-xvasprintf
test_c_xvasprintf_LDADD = $(LDADD) @LIBINTL@
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@'
check_PROGRAMS += test-c-xvasprintf
test_c_xvasprintf_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@

View File

@@ -18,4 +18,4 @@ TESTS += \
dfa-match.sh
check_PROGRAMS += dfa-match-aux
dfa_match_aux_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
dfa_match_aux_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIBTHREAD)

View File

@@ -15,4 +15,4 @@ gt_FUNC_USELOCALE
Makefile.am:
TESTS += test-duplocale
check_PROGRAMS += test-duplocale
test_duplocale_LDADD = $(LDADD) @LIB_DUPLOCALE@
test_duplocale_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIB_DUPLOCALE@

View File

@@ -16,4 +16,4 @@ Makefile.am:
TESTS += test-hard-locale
check_PROGRAMS += test-hard-locale
noinst_PROGRAMS += locale
test_hard_locale_LDADD = $(LDADD) @LIB_HARD_LOCALE@
test_hard_locale_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIB_HARD_LOCALE@

View File

@@ -7,3 +7,4 @@ configure.ac:
Makefile.am:
noinst_PROGRAMS += test-localcharset
test_localcharset_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -15,5 +15,5 @@ AC_CHECK_FUNCS_ONCE([newlocale])
Makefile.am:
TESTS += test-localename
check_PROGRAMS += test-localename
test_localename_LDADD = $(LDADD) @INTL_MACOSX_LIBS@ $(LIBTHREAD)
test_localename_LDADD = $(LDADD) $(LIB_SETLOCALE) @INTL_MACOSX_LIBS@ $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbmemcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbmemcasecoll_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -41,4 +41,4 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbrtowc test-mbrtowc-w32
test_mbrtowc_LDADD = $(LDADD) $(LIBTHREAD)
test_mbrtowc_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbscasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -25,6 +25,6 @@ TESTS += test-mbscasestr1 test-mbscasestr2.sh test-mbscasestr3.sh test-mbscasest
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) $(LIBTHREAD)
test_mbscasestr3_LDADD = $(LDADD) $(LIBTHREAD)
test_mbscasestr4_LDADD = $(LDADD) $(LIBTHREAD)
test_mbscasestr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
test_mbscasestr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
test_mbscasestr4_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbschr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbscspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbsinit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbsncasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -31,4 +31,4 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbsnrtowcs
test_mbsnrtowcs_LDADD = $(LDADD) $(LIBTHREAD)
test_mbsnrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbspbrk_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbspcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbsrchr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -31,4 +31,4 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mbsrtowcs
test_mbsrtowcs_LDADD = $(LDADD) $(LIBTHREAD)
test_mbsrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -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) $(LIBTHREAD)
test_mbsspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -21,5 +21,5 @@ 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) $(LIBTHREAD)
test_mbsstr3_LDADD = $(LDADD) $(LIBTHREAD)
test_mbsstr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
test_mbsstr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)

View File

@@ -20,4 +20,4 @@ Makefile.am:
TESTS += test-nl_langinfo.sh test-nl_langinfo-mt
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-nl_langinfo test-nl_langinfo-mt
test_nl_langinfo_mt_LDADD = $(LDADD) $(LIBMULTITHREAD) $(LIB_NANOSLEEP)
test_nl_langinfo_mt_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBMULTITHREAD) $(LIB_NANOSLEEP)

View File

@@ -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) @LIBINTL@ $(LIBTHREAD)
test_quotearg_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIBTHREAD)

View File

@@ -11,4 +11,4 @@ configure.ac:
Makefile.am:
TESTS += test-regex
check_PROGRAMS += test-regex
test_regex_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
test_regex_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIBTHREAD)

View File

@@ -7,7 +7,8 @@ m4/setlocale.m4
Depends-on:
locale
localename [test $REPLACE_SETLOCALE = 1]
localename [test $NEED_SETLOCALE_IMPROVED = 1]
setlocale-null [test $NEED_SETLOCALE_MTSAFE = 1]
configure.ac:
gl_FUNC_SETLOCALE
@@ -22,6 +23,9 @@ Makefile.am:
Include:
<locale.h>
Link:
$(LIB_SETLOCALE)
License:
LGPL

View File

@@ -27,3 +27,5 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-setlocale1 test-setlocale2
test_setlocale1_LDADD = $(LDADD) @LIB_SETLOCALE@
test_setlocale2_LDADD = $(LDADD) @LIB_SETLOCALE@

View File

@@ -10,3 +10,4 @@ configure.ac:
Makefile.am:
TESTS += test-strfmon_l
check_PROGRAMS += test-strfmon_l
test_strfmon_l_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -26,3 +26,4 @@ TESTS_ENVIRONMENT += \
LOCALE_FR='@LOCALE_FR@' \
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-strtod1
test_strtod1_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -26,3 +26,4 @@ TESTS_ENVIRONMENT += \
LOCALE_FR='@LOCALE_FR@' \
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-strtold1
test_strtold1_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -23,4 +23,4 @@ TESTS += unicase/test-locale-language.sh
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-locale-language
test_locale_language_SOURCES = unicase/test-locale-language.c
test_locale_language_LDADD = $(LDADD) $(LIBUNISTRING) @INTL_MACOSX_LIBS@ $(LIBTHREAD)
test_locale_language_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @INTL_MACOSX_LIBS@ $(LIBTHREAD)

View File

@@ -22,5 +22,5 @@ TESTS_ENVIRONMENT += \
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-ulc-casecmp
test_ulc_casecmp_SOURCES = unicase/test-ulc-casecmp.c
test_ulc_casecmp_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_ulc_casecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@

View File

@@ -22,5 +22,5 @@ TESTS_ENVIRONMENT += \
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-ulc-casecoll
test_ulc_casecoll_SOURCES = unicase/test-ulc-casecoll.c
test_ulc_casecoll_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_ulc_casecoll_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@

View File

@@ -16,4 +16,4 @@ TESTS += unigbrk/test-ulc-grapheme-breaks.sh
TESTS_ENVIRONMENT += LOCALE_AR='@LOCALE_AR@'
check_PROGRAMS += test-ulc-grapheme-breaks
test_ulc_grapheme_breaks_SOURCES = unigbrk/test-ulc-grapheme-breaks.c
test_ulc_grapheme_breaks_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_ulc_grapheme_breaks_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@

View File

@@ -28,6 +28,6 @@ check_PROGRAMS += test-u16-vasnprintf1 test-u16-vasnprintf2 test-u16-vasnprintf3
test_u16_vasnprintf1_SOURCES = unistdio/test-u16-vasnprintf1.c
test_u16_vasnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_u16_vasnprintf2_SOURCES = unistdio/test-u16-vasnprintf2.c
test_u16_vasnprintf2_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_u16_vasnprintf2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@
test_u16_vasnprintf3_SOURCES = unistdio/test-u16-vasnprintf3.c
test_u16_vasnprintf3_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_u16_vasnprintf3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@

View File

@@ -28,6 +28,6 @@ check_PROGRAMS += test-u32-vasnprintf1 test-u32-vasnprintf2 test-u32-vasnprintf3
test_u32_vasnprintf1_SOURCES = unistdio/test-u32-vasnprintf1.c
test_u32_vasnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_u32_vasnprintf2_SOURCES = unistdio/test-u32-vasnprintf2.c
test_u32_vasnprintf2_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_u32_vasnprintf2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@
test_u32_vasnprintf3_SOURCES = unistdio/test-u32-vasnprintf3.c
test_u32_vasnprintf3_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_u32_vasnprintf3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@

View File

@@ -28,6 +28,6 @@ check_PROGRAMS += test-u8-vasnprintf1 test-u8-vasnprintf2 test-u8-vasnprintf3
test_u8_vasnprintf1_SOURCES = unistdio/test-u8-vasnprintf1.c
test_u8_vasnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_u8_vasnprintf2_SOURCES = unistdio/test-u8-vasnprintf2.c
test_u8_vasnprintf2_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_u8_vasnprintf2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@
test_u8_vasnprintf3_SOURCES = unistdio/test-u8-vasnprintf3.c
test_u8_vasnprintf3_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_u8_vasnprintf3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@

View File

@@ -24,6 +24,6 @@ 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_vasnprintf2_SOURCES = unistdio/test-ulc-vasnprintf2.c
test_ulc_vasnprintf2_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
test_ulc_vasnprintf2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
test_ulc_vasnprintf3_SOURCES = unistdio/test-ulc-vasnprintf3.c
test_ulc_vasnprintf3_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
test_ulc_vasnprintf3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)

View File

@@ -16,5 +16,5 @@ TESTS += uniwbrk/test-ulc-wordbreaks.sh
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@'
check_PROGRAMS += test-ulc-wordbreaks
test_ulc_wordbreaks_SOURCES = uniwbrk/test-ulc-wordbreaks.c
test_ulc_wordbreaks_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
test_ulc_wordbreaks_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@

View File

@@ -24,3 +24,5 @@ Makefile.am:
TESTS += test-vasnprintf-posix test-vasnprintf-posix2.sh test-vasnprintf-posix3
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
check_PROGRAMS += test-vasnprintf-posix test-vasnprintf-posix2 test-vasnprintf-posix3
test_vasnprintf_posix2_LDADD = $(LDADD) $(LIB_SETLOCALE)
test_vasnprintf_posix3_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -35,4 +35,4 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-wcrtomb test-wcrtomb-w32
test_wcrtomb_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -28,4 +28,4 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-wcsnrtombs
test_wcsnrtombs_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -28,4 +28,4 @@ TESTS_ENVIRONMENT += \
LOCALE_JA='@LOCALE_JA@' \
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-wcsrtombs
test_wcsrtombs_LDADD = $(LDADD) $(LIB_SETLOCALE)

View File

@@ -12,4 +12,4 @@ configure.ac:
Makefile.am:
TESTS += test-wcwidth
check_PROGRAMS += test-wcwidth
test_wcwidth_LDADD = $(LDADD) $(LIBUNISTRING)
test_wcwidth_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING)

View File

@@ -22,6 +22,10 @@
#include <stdio.h>
#include <stdlib.h>
/* We want to use the system's setlocale() function here, not the gnulib
override. */
#undef setlocale
/* Specification:
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/locale.html>
Here we implement only the invocation without any command-line options. */

View File

@@ -28,6 +28,10 @@
#include "glthread/thread.h"
/* We want to use the system's setlocale() function here, not the gnulib
override. */
#undef setlocale
/* Some common locale names. */

View File

@@ -28,6 +28,10 @@
#include "glthread/thread.h"
/* We want to use the system's setlocale() function here, not the gnulib
override. */
#undef setlocale
/* Some common locale names. */