Mercurial > gnulib
changeset 39257:e942d3d6f756
localename: Add support for musl libc.
* m4/localename.m4 (gl_LOCALENAME): Check for <langinfo.h>.
* lib/localename.c (gl_locale_name_thread_unsafe): Use NL_LOCALE_NAME
on Linux platforms which define NL_LOCALE_NAME.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 24 Feb 2018 12:59:59 +0100 |
parents | 46635573662a |
children | 2c0d93773aca |
files | ChangeLog lib/localename.c m4/localename.m4 |
diffstat | 3 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Feb 24 12:01:30 2018 +0100 +++ b/ChangeLog Sat Feb 24 12:59:59 2018 +0100 @@ -1,3 +1,10 @@ +2018-02-24 Bruno Haible <bruno@clisp.org> + + localename: Add support for musl libc. + * m4/localename.m4 (gl_LOCALENAME): Check for <langinfo.h>. + * lib/localename.c (gl_locale_name_thread_unsafe): Use NL_LOCALE_NAME + on Linux platforms which define NL_LOCALE_NAME. + 2018-02-24 Bruno Haible <bruno@clisp.org> mbrtowc tests: Don't make assumptions about the charset the C locale.
--- a/lib/localename.c Sat Feb 24 12:01:30 2018 +0100 +++ b/lib/localename.c Sat Feb 24 12:59:59 2018 +0100 @@ -40,7 +40,7 @@ # if defined __APPLE__ && defined __MACH__ # include <xlocale.h> # endif -# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || defined __CYGWIN__ +# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || (defined __linux__ && HAVE_LANGINFO_H) || defined __CYGWIN__ # include <langinfo.h> # endif # if !defined IN_LIBINTL @@ -2703,6 +2703,9 @@ nl_langinfo (_NL_LOCALE_NAME (category)). */ name = thread_locale->__names[category]; return name; +# elif defined __linux__ && HAVE_LANGINFO_H && defined NL_LOCALE_NAME + /* musl libc */ + return nl_langinfo_l (NL_LOCALE_NAME (category), thread_locale); # elif (defined __FreeBSD__ || defined __DragonFly__) || (defined __APPLE__ && defined __MACH__) /* FreeBSD, Mac OS X */ int mask;
--- a/m4/localename.m4 Sat Feb 24 12:01:30 2018 +0100 +++ b/m4/localename.m4 Sat Feb 24 12:59:59 2018 +0100 @@ -1,4 +1,4 @@ -# localename.m4 serial 2 +# localename.m4 serial 3 dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,6 +8,7 @@ [ AC_REQUIRE([gt_LC_MESSAGES]) AC_REQUIRE([gt_INTL_MACOSX]) + AC_CHECK_HEADERS_ONCE([langinfo.h]) AC_CHECK_FUNCS([setlocale uselocale]) dnl Solaris 12 provides getlocalename_l, while Illumos doesn't have dnl it nor the equivalent.