From: Bruno Haible Date: Sat, 24 Feb 2018 11:59:59 +0000 (+0100) Subject: localename: Add support for musl libc. X-Git-Tag: v1.0~5723 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=ddd23eb80039b54284e18cba299a5764f1b65bc6;p=gnulib.git localename: Add support for musl libc. * m4/localename.m4 (gl_LOCALENAME): Check for . * lib/localename.c (gl_locale_name_thread_unsafe): Use NL_LOCALE_NAME on Linux platforms which define NL_LOCALE_NAME. --- diff --git a/ChangeLog b/ChangeLog index 0c1ebc057e..58d9971414 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-02-24 Bruno Haible + + localename: Add support for musl libc. + * m4/localename.m4 (gl_LOCALENAME): Check for . + * 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 mbrtowc tests: Don't make assumptions about the charset the C locale. diff --git a/lib/localename.c b/lib/localename.c index 2133cbc7cc..74c8ee0011 100644 --- a/lib/localename.c +++ b/lib/localename.c @@ -40,7 +40,7 @@ # if defined __APPLE__ && defined __MACH__ # include # endif -# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || defined __CYGWIN__ +# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || (defined __linux__ && HAVE_LANGINFO_H) || defined __CYGWIN__ # include # endif # if !defined IN_LIBINTL @@ -2703,6 +2703,9 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname) 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; diff --git a/m4/localename.m4 b/m4/localename.m4 index 0ac4529a06..a0e136754e 100644 --- a/m4/localename.m4 +++ b/m4/localename.m4 @@ -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_DEFUN([gl_LOCALENAME], [ 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.