mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Use Gnulib's `duplocale' module.
* libguile/i18n.c (scm_make_locale): Simplify global locale handling, using duplocale(3) for all kinds of locales. (scm_init_i18n): Comment on why we don't just use `LC_GLOBAL_LOCALE' for `global_locale_smob'. * m4/gnulib-cache.m4: Add `duplocale'.
This commit is contained in:
parent
414e44412c
commit
c3b16a5d8e
6 changed files with 194 additions and 21 deletions
56
m4/duplocale.m4
Normal file
56
m4/duplocale.m4
Normal file
|
@ -0,0 +1,56 @@
|
|||
# duplocale.m4 serial 1
|
||||
dnl Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_DUPLOCALE],
|
||||
[
|
||||
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_CHECK_FUNCS_ONCE([duplocale])
|
||||
if test $ac_cv_func_duplocale = yes; then
|
||||
dnl Check against glibc bug where duplocale crashes.
|
||||
dnl See <http://sourceware.org/bugzilla/show_bug.cgi?id=10969>.
|
||||
AC_REQUIRE([gl_LOCALE_H])
|
||||
AC_CACHE_CHECK([whether duplocale(LC_GLOBAL_LOCALE) works],
|
||||
[gl_cv_func_duplocale_works],
|
||||
[AC_TRY_RUN([
|
||||
#include <locale.h>
|
||||
#if HAVE_XLOCALE_H
|
||||
# include <xlocale.h>
|
||||
#endif
|
||||
int main ()
|
||||
{
|
||||
(void) duplocale (LC_GLOBAL_LOCALE);
|
||||
return 0;
|
||||
}], [gl_cv_func_duplocale_works=yes], [gl_cv_func_duplocale_works=no],
|
||||
[dnl Guess it works except on glibc < 2.12.
|
||||
AC_EGREP_CPP([Unlucky GNU user], [
|
||||
#include <features.h>
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)
|
||||
Unlucky GNU user
|
||||
#endif
|
||||
#endif
|
||||
],
|
||||
[gl_cv_func_duplocale_works="guessing no"],
|
||||
[gl_cv_func_duplocale_works="guessing yes"])
|
||||
])
|
||||
])
|
||||
case "$gl_cv_func_duplocale_works" in
|
||||
*no) REPLACE_DUPLOCALE=1 ;;
|
||||
esac
|
||||
fi
|
||||
if test $REPLACE_DUPLOCALE = 1; then
|
||||
gl_REPLACE_LOCALE_H
|
||||
AC_LIBOBJ([duplocale])
|
||||
gl_PREREQ_DUPLOCALE
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/duplocale.c.
|
||||
AC_DEFUN([gl_PREREQ_DUPLOCALE],
|
||||
[
|
||||
:
|
||||
])
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stdlib strcase strftime striconveh string verify version-etc-fsf vsnprintf warnings
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stdlib strcase strftime striconveh string verify version-etc-fsf vsnprintf warnings
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([])
|
||||
|
@ -26,6 +26,7 @@ gl_MODULES([
|
|||
autobuild
|
||||
byteswap
|
||||
canonicalize-lgpl
|
||||
duplocale
|
||||
environ
|
||||
extensions
|
||||
flock
|
||||
|
|
|
@ -57,6 +57,8 @@ AC_DEFUN([gl_INIT],
|
|||
gl_MODULE_INDICATOR([canonicalize-lgpl])
|
||||
gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
|
||||
gl_STDLIB_MODULE_INDICATOR([realpath])
|
||||
gl_FUNC_DUPLOCALE
|
||||
gl_LOCALE_MODULE_INDICATOR([duplocale])
|
||||
gl_ENVIRON
|
||||
gl_UNISTD_MODULE_INDICATOR([environ])
|
||||
gl_HEADER_ERRNO_H
|
||||
|
@ -306,6 +308,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/c-strncasecmp.c
|
||||
lib/canonicalize-lgpl.c
|
||||
lib/config.charset
|
||||
lib/duplocale.c
|
||||
lib/errno.in.h
|
||||
lib/float+.h
|
||||
lib/float.in.h
|
||||
|
@ -407,6 +410,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/codeset.m4
|
||||
m4/dos.m4
|
||||
m4/double-slash-root.m4
|
||||
m4/duplocale.m4
|
||||
m4/eealloc.m4
|
||||
m4/environ.m4
|
||||
m4/errno_h.m4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue