Bug 501651 – Update glib/libcharset

2008-05-20  Behdad Esfahbod  <behdad@gnome.org>

        Bug 501651 – Update glib/libcharset

        * configure.in:
        * glib/libcharset/Makefile.am:
        * glib/libcharset/README:
        * glib/libcharset/codeset.m4:
        * glib/libcharset/config.charset:
        * glib/libcharset/glibc21.m4:
        * glib/libcharset/libcharset-glib.patch:
        * glib/libcharset/libcharset.h:
        * glib/libcharset/localcharset.c (_g_locale_get_charset_aliases),
        (_g_locale_charset_raw):
        * glib/libcharset/localcharset.h:
        * glib/libcharset/make-patch.sh:
        * glib/libcharset/ref-add.sin:
        * glib/libcharset/ref-del.sin:
        * glib/libcharset/update.sh:
        Update libcharset to the one shipped with libiconv-0.12.


svn path=/trunk/; revision=6921
This commit is contained in:
Behdad Esfahbod 2008-05-20 22:49:16 +00:00 committed by Behdad Esfahbod
parent 123dfdc5c2
commit 64e1b6d84f
15 changed files with 512 additions and 199 deletions

View File

@ -1,3 +1,24 @@
2008-05-20 Behdad Esfahbod <behdad@gnome.org>
Bug 501651 Update glib/libcharset
* configure.in:
* glib/libcharset/Makefile.am:
* glib/libcharset/README:
* glib/libcharset/codeset.m4:
* glib/libcharset/config.charset:
* glib/libcharset/glibc21.m4:
* glib/libcharset/libcharset-glib.patch:
* glib/libcharset/libcharset.h:
* glib/libcharset/localcharset.c (_g_locale_get_charset_aliases),
(_g_locale_charset_raw):
* glib/libcharset/localcharset.h:
* glib/libcharset/make-patch.sh:
* glib/libcharset/ref-add.sin:
* glib/libcharset/ref-del.sin:
* glib/libcharset/update.sh:
Update libcharset to the one shipped with libiconv-0.12.
2008-05-20 Behdad Esfahbod <behdad@gnome.org>
Bug 459905 Bug in wcwidth data

View File

@ -401,7 +401,7 @@ else
fi
fi
jm_GLIBC21
gl_GLIBC21
AC_ARG_ENABLE(iconv-cache,
[AC_HELP_STRING([--enable-iconv-cache=@<:@yes/no/auto@:>@],
[cache iconv descriptors [default=auto]])],,
@ -839,8 +839,8 @@ AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct statfs.f
#endif])
# Checks for libcharset
jm_LANGINFO_CODESET
jm_GLIBC21
AM_LANGINFO_CODESET
gl_GLIBC21
AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
AC_CHECK_FUNCS(setlocale)

View File

@ -8,6 +8,7 @@ noinst_LTLIBRARIES = libcharset.la
libcharset_la_SOURCES = \
libcharset.h \
localcharset.h \
localcharset.c
EXTRA_DIST += \

View File

@ -17,6 +17,11 @@ below.
Owen Taylor
26 September 2001
Updated to libiconv-1.12.
Behdad Esfahbod
20 May 2008
====
/* Determine a canonical name for the current locale's character encoding.

View File

@ -1,19 +1,20 @@
#serial 2
# codeset.m4 serial AM1 (gettext-0.10.40)
dnl Copyright (C) 2000-2002 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.
dnl From Bruno Haible.
AC_DEFUN([jm_LANGINFO_CODESET],
AC_DEFUN([AM_LANGINFO_CODESET],
[
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNCS(nl_langinfo)
AC_CACHE_CHECK([for nl_langinfo and CODESET], jm_cv_langinfo_codeset,
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
[AC_TRY_LINK([#include <langinfo.h>],
[char* cs = nl_langinfo(CODESET);],
jm_cv_langinfo_codeset=yes,
jm_cv_langinfo_codeset=no)
am_cv_langinfo_codeset=yes,
am_cv_langinfo_codeset=no)
])
if test $jm_cv_langinfo_codeset = yes; then
if test $am_cv_langinfo_codeset = yes; then
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
fi

View File

@ -1,7 +1,7 @@
#! /bin/sh
# Output a system dependent table of character encoding aliases.
#
# Copyright (C) 2000-2002 Free Software Foundation, Inc.
# Copyright (C) 2000-2004, 2006 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published
@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# The table consists of lines of the form
@ -30,77 +30,77 @@
# MIME charset name is preferred.
# The current list of GNU canonical charset names is as follows.
#
# name used by which systems a MIME name?
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-3 glibc solaris yes
# ISO-8859-4 osf solaris freebsd yes
# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-6 glibc aix hpux solaris yes
# ISO-8859-7 glibc aix hpux irix osf solaris yes
# ISO-8859-8 glibc aix hpux osf solaris yes
# ISO-8859-9 glibc aix hpux irix osf solaris yes
# ISO-8859-13 glibc
# ISO-8859-14 glibc
# ISO-8859-15 glibc aix osf solaris freebsd
# KOI8-R glibc solaris freebsd yes
# KOI8-U glibc freebsd yes
# KOI8-T glibc
# CP437 dos
# CP775 dos
# CP850 aix osf dos
# CP852 dos
# CP855 dos
# CP856 aix
# CP857 dos
# CP861 dos
# CP862 dos
# CP864 dos
# CP865 dos
# CP866 freebsd dos
# CP869 dos
# CP874 woe32 dos
# CP922 aix
# CP932 aix woe32 dos
# CP943 aix
# CP949 osf woe32 dos
# CP950 woe32 dos
# CP1046 aix
# CP1124 aix
# CP1125 dos
# CP1129 aix
# CP1250 woe32
# CP1251 glibc woe32 solaris
# CP1252 aix woe32
# CP1253 woe32
# CP1254 woe32
# CP1255 glibc woe32
# CP1256 woe32
# CP1257 woe32
# GB2312 glibc aix hpux irix solaris freebsd yes
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
# EUC-KR glibc aix hpux irix osf solaris freebsd yes
# EUC-TW glibc aix hpux irix osf solaris
# BIG5 glibc aix hpux osf solaris freebsd yes
# BIG5-HKSCS glibc solaris
# GBK glibc aix osf solaris woe32 dos
# GB18030 glibc solaris
# SHIFT_JIS hpux osf solaris freebsd yes
# JOHAB glibc solaris woe32
# TIS-620 glibc aix hpux osf solaris
# VISCII glibc yes
# TCVN5712-1 glibc
# GEORGIAN-PS glibc
# HP-ROMAN8 hpux
# HP-ARABIC8 hpux
# HP-GREEK8 hpux
# HP-HEBREW8 hpux
# HP-TURKISH8 hpux
# HP-KANA8 hpux
# DEC-KANJI osf
# DEC-HANYU osf
# UTF-8 glibc aix hpux osf solaris yes
# name MIME? used by which systems
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin
# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# ISO-8859-3 Y glibc solaris
# ISO-8859-4 Y osf solaris freebsd netbsd darwin
# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# ISO-8859-6 Y glibc aix hpux solaris
# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd darwin
# ISO-8859-8 Y glibc aix hpux osf solaris
# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin
# ISO-8859-13 glibc netbsd darwin
# ISO-8859-14 glibc
# ISO-8859-15 glibc aix osf solaris freebsd darwin
# KOI8-R Y glibc solaris freebsd netbsd darwin
# KOI8-U Y glibc freebsd netbsd darwin
# KOI8-T glibc
# CP437 dos
# CP775 dos
# CP850 aix osf dos
# CP852 dos
# CP855 dos
# CP856 aix
# CP857 dos
# CP861 dos
# CP862 dos
# CP864 dos
# CP865 dos
# CP866 freebsd netbsd darwin dos
# CP869 dos
# CP874 woe32 dos
# CP922 aix
# CP932 aix woe32 dos
# CP943 aix
# CP949 osf woe32 dos
# CP950 woe32 dos
# CP1046 aix
# CP1124 aix
# CP1125 dos
# CP1129 aix
# CP1250 woe32
# CP1251 glibc solaris netbsd darwin woe32
# CP1252 aix woe32
# CP1253 woe32
# CP1254 woe32
# CP1255 glibc woe32
# CP1256 woe32
# CP1257 woe32
# GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin
# EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# EUC-TW glibc aix hpux irix osf solaris netbsd
# BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin
# BIG5-HKSCS glibc solaris
# GBK glibc aix osf solaris woe32 dos
# GB18030 glibc solaris netbsd
# SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
# JOHAB glibc solaris woe32
# TIS-620 glibc aix hpux osf solaris
# VISCII Y glibc
# TCVN5712-1 glibc
# GEORGIAN-PS glibc
# HP-ROMAN8 hpux
# HP-ARABIC8 hpux
# HP-GREEK8 hpux
# HP-HEBREW8 hpux
# HP-TURKISH8 hpux
# HP-KANA8 hpux
# DEC-KANJI osf
# DEC-HANYU osf
# UTF-8 Y glibc aix hpux osf solaris netbsd darwin
#
# Note: Names which are not marked as being a MIME name should not be used in
# Internet protocols for information interchange (mail, news, etc.).
@ -121,6 +121,105 @@ echo "# It was automatically generated from config.charset."
# List of references, updated during installation:
echo "# Packages using this file: "
case "$os" in
linux-gnulibc1*)
# Linux libc5 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
echo "C ASCII"
echo "POSIX ASCII"
for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
sv_FI sv_SE; do
echo "$l ISO-8859-1"
echo "$l.iso-8859-1 ISO-8859-1"
echo "$l.iso-8859-15 ISO-8859-15"
echo "$l.iso-8859-15@euro ISO-8859-15"
echo "$l@euro ISO-8859-15"
echo "$l.cp-437 CP437"
echo "$l.cp-850 CP850"
echo "$l.cp-1252 CP1252"
echo "$l.cp-1252@euro CP1252"
#echo "$l.atari-st ATARI-ST" # not a commonly used encoding
echo "$l.utf-8 UTF-8"
echo "$l.utf-8@euro UTF-8"
done
for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
sl_SI sr sr_CS sr_YU; do
echo "$l ISO-8859-2"
echo "$l.iso-8859-2 ISO-8859-2"
echo "$l.cp-852 CP852"
echo "$l.cp-1250 CP1250"
echo "$l.utf-8 UTF-8"
done
for l in mk mk_MK ru ru_RU; do
echo "$l ISO-8859-5"
echo "$l.iso-8859-5 ISO-8859-5"
echo "$l.koi8-r KOI8-R"
echo "$l.cp-866 CP866"
echo "$l.cp-1251 CP1251"
echo "$l.utf-8 UTF-8"
done
for l in ar ar_SA; do
echo "$l ISO-8859-6"
echo "$l.iso-8859-6 ISO-8859-6"
echo "$l.cp-864 CP864"
#echo "$l.cp-868 CP868" # not a commonly used encoding
echo "$l.cp-1256 CP1256"
echo "$l.utf-8 UTF-8"
done
for l in el el_GR gr gr_GR; do
echo "$l ISO-8859-7"
echo "$l.iso-8859-7 ISO-8859-7"
echo "$l.cp-869 CP869"
echo "$l.cp-1253 CP1253"
echo "$l.cp-1253@euro CP1253"
echo "$l.utf-8 UTF-8"
echo "$l.utf-8@euro UTF-8"
done
for l in he he_IL iw iw_IL; do
echo "$l ISO-8859-8"
echo "$l.iso-8859-8 ISO-8859-8"
echo "$l.cp-862 CP862"
echo "$l.cp-1255 CP1255"
echo "$l.utf-8 UTF-8"
done
for l in tr tr_TR; do
echo "$l ISO-8859-9"
echo "$l.iso-8859-9 ISO-8859-9"
echo "$l.cp-857 CP857"
echo "$l.cp-1254 CP1254"
echo "$l.utf-8 UTF-8"
done
for l in lt lt_LT lv lv_LV; do
#echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
echo "$l ISO-8859-13"
done
for l in ru_UA uk uk_UA; do
echo "$l KOI8-U"
done
for l in zh zh_CN; do
#echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
echo "$l GB2312"
done
for l in ja ja_JP ja_JP.EUC; do
echo "$l EUC-JP"
done
for l in ko ko_KR; do
echo "$l EUC-KR"
done
for l in th th_TH; do
echo "$l TIS-620"
done
for l in fa fa_IR; do
#echo "$l ISIRI-3342" # a broken encoding
echo "$l.utf-8 UTF-8"
done
;;
linux* | *-gnu*)
# With glibc-2.1 or newer, we don't need any canonicalization,
# because glibc has iconv and both glibc and libiconv support all
@ -289,6 +388,8 @@ case "$os" in
echo "ISO8859-2 ISO-8859-2"
echo "ISO8859-4 ISO-8859-4"
echo "ISO8859-5 ISO-8859-5"
echo "ISO8859-7 ISO-8859-7"
echo "ISO8859-13 ISO-8859-13"
echo "ISO8859-15 ISO-8859-15"
echo "eucCN GB2312"
echo "eucJP EUC-JP"
@ -297,6 +398,77 @@ case "$os" in
echo "BIG5 BIG5"
echo "SJIS SHIFT_JIS"
;;
darwin[56]*)
# Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
echo "C ASCII"
for l in en_AU en_CA en_GB en_US la_LN; do
echo "$l.US-ASCII ASCII"
done
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
nl_NL no_NO pt_PT sv_SE; do
echo "$l ISO-8859-1"
echo "$l.ISO8859-1 ISO-8859-1"
echo "$l.ISO8859-15 ISO-8859-15"
done
for l in la_LN; do
echo "$l.ISO8859-1 ISO-8859-1"
echo "$l.ISO8859-15 ISO-8859-15"
done
for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
echo "$l.ISO8859-2 ISO-8859-2"
done
for l in la_LN lt_LT; do
echo "$l.ISO8859-4 ISO-8859-4"
done
for l in ru_RU; do
echo "$l.KOI8-R KOI8-R"
echo "$l.ISO8859-5 ISO-8859-5"
echo "$l.CP866 CP866"
done
for l in bg_BG; do
echo "$l.CP1251 CP1251"
done
echo "uk_UA.KOI8-U KOI8-U"
echo "zh_TW.BIG5 BIG5"
echo "zh_TW.Big5 BIG5"
echo "zh_CN.EUC GB2312"
echo "ja_JP.EUC EUC-JP"
echo "ja_JP.SJIS SHIFT_JIS"
echo "ko_KR.EUC EUC-KR"
;;
darwin*)
# Darwin 7.5 has nl_langinfo(CODESET), but it is useless:
# - It returns the empty string when LANG is set to a locale of the
# form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
# LC_CTYPE file.
# - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
# the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
# - The documentation says:
# "... all code that calls BSD system routines should ensure
# that the const *char parameters of these routines are in UTF-8
# encoding. All BSD system functions expect their string
# parameters to be in UTF-8 encoding and nothing else."
# It also says
# "An additional caveat is that string parameters for files,
# paths, and other file-system entities must be in canonical
# UTF-8. In a canonical UTF-8 Unicode string, all decomposable
# characters are decomposed ..."
# but this is not true: You can pass non-decomposed UTF-8 strings
# to file system functions, and it is the OS which will convert
# them to decomposed UTF-8 before accessing the file system.
# - The Apple Terminal application displays UTF-8 by default.
# - However, other applications are free to use different encodings:
# - xterm uses ISO-8859-1 by default.
# - TextEdit uses MacRoman by default.
# We prefer UTF-8 over decomposed UTF-8-MAC because one should
# minimize the use of decomposed Unicode. Unfortunately, through the
# Darwin file system, decomposed UTF-8 strings are leaked into user
# space nevertheless.
echo "* UTF-8"
;;
beos*)
# BeOS has a single locale, and it has UTF-8 encoding.
echo "* UTF-8"
@ -310,7 +482,7 @@ case "$os" in
echo "# If you find that the encoding given for your language and"
echo "# country is not the one your DOS machine actually uses, just"
echo "# correct it in this file, and send a mail to"
echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
echo "# and Bruno Haible <bruno@clisp.org>."
echo "#"
echo "C ASCII"
@ -410,6 +582,7 @@ case "$os" in
echo "sq CP852"
echo "sq_AL CP852"
echo "sr CP852" # CP852 or CP866 or CP855 ??
echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
# ISO-8859-3 languages
echo "mt CP850"

View File

@ -1,9 +1,13 @@
#serial 2
# glibc21.m4 serial 3
dnl Copyright (C) 2000-2002, 2004 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.
# Test for the GNU C Library, version 2.1 or newer.
# From Bruno Haible.
AC_DEFUN([jm_GLIBC21],
AC_DEFUN([gl_GLIBC21],
[
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
ac_cv_gnu_library_2_1,

View File

@ -1,18 +1,18 @@
diff -ur libcharset/localcharset.c /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/localcharset.c
--- libcharset/localcharset.c Sat Dec 14 20:04:44 2002
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/localcharset.c Sat Dec 14 20:09:45 2002
@@ -102,8 +102,8 @@
# Patch against libcharset version 1.4
--- libiconv-1.12/libcharset//lib/localcharset.c 2006-10-18 07:55:49.000000000 -0400
+++ localcharset.c 2008-05-20 18:36:24.000000000 -0400
@@ -103,8 +103,8 @@
static const char * volatile charset_aliases;
/* Return a pointer to the contents of the charset.alias file. */
-static const char *
-get_charset_aliases ()
-get_charset_aliases (void)
+const char *
+_g_locale_get_charset_aliases ()
+_g_locale_get_charset_aliases (void)
{
const char *cp;
@@ -235,14 +235,10 @@
@@ -280,14 +280,10 @@
If the canonical name cannot be determined, the result is a non-canonical
name. */
@ -20,24 +20,21 @@ diff -ur libcharset/localcharset.c /home/otaylor/cvs/gnome2/glib-head/glib/libch
-STATIC
-#endif
const char *
-locale_charset ()
+_g_locale_charset_raw ()
-locale_charset (void)
+_g_locale_charset_raw (void)
{
const char *codeset;
- const char *aliases;
#if !(defined WIN32 || defined OS2)
#if !(defined WIN32_NATIVE || defined OS2)
@@ -344,12 +340,23 @@
@@ -436,12 +432,20 @@
#endif
+ return codeset;
+}
+
+#ifdef STATIC
+STATIC
+#endif
+const char *
+_g_locale_charset_unalias (const char *codeset)
+{
@ -53,34 +50,20 @@ diff -ur libcharset/localcharset.c /home/otaylor/cvs/gnome2/glib-head/glib/libch
*aliases != '\0';
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
if (strcmp (codeset, aliases) == 0
diff -ur libcharset/glibc21.m4 /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/glibc21.m4
--- libcharset/glibc21.m4 Sat Dec 14 20:04:44 2002
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/glibc21.m4 Fri Sep 28 19:44:46 2001
@@ -3,7 +3,7 @@
# Test for the GNU C Library, version 2.1 or newer.
# From Bruno Haible.
--- libiconv-1.12/libcharset//include/libcharset.h.in 2005-05-19 13:14:56.000000000 -0400
+++ libcharset.h 2008-05-20 18:39:44.000000000 -0400
@@ -19,7 +19,7 @@
#ifndef _LIBCHARSET_H
#define _LIBCHARSET_H
-AC_DEFUN(jm_GLIBC21,
+AC_DEFUN([jm_GLIBC21],
[
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
ac_cv_gnu_library_2_1,
diff -ur libcharset/codeset.m4 /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/codeset.m4
--- libcharset/codeset.m4 Sat Dec 14 20:04:44 2002
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/codeset.m4 Fri Sep 28 19:44:46 2001
@@ -2,7 +2,7 @@
-#include <localcharset.h>
+#include "localcharset.h"
dnl From Bruno Haible.
-AC_DEFUN(jm_LANGINFO_CODESET,
+AC_DEFUN([jm_LANGINFO_CODESET],
[
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNCS(nl_langinfo)
diff -ur libcharset/libcharset.h /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/libcharset.h
--- libcharset/libcharset.h Sat Dec 14 20:04:44 2002
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/libcharset.h Sat Dec 14 19:03:11 2002
@@ -30,8 +30,9 @@
#ifdef __cplusplus
--- libiconv-1.12/libcharset//include/localcharset.h.in 2005-05-19 13:14:57.000000000 -0400
+++ localcharset.h 2008-05-20 18:36:24.000000000 -0400
@@ -31,8 +31,9 @@
The result must not be freed; it is statically allocated.
If the canonical name cannot be determined, the result is a non-canonical
name. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2001 Free Software Foundation, Inc.
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU CHARSET Library.
The GNU CHARSET Library is free software; you can redistribute it and/or
@ -13,26 +13,30 @@
You should have received a copy of the GNU Library General Public License
along with the GNU CHARSET Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _LIBCHARSET_H
#define _LIBCHARSET_H
#include "localcharset.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Determine the current locale's character encoding, and canonicalize it
into one of the canonical names listed in config.charset.
The result must not be freed; it is statically allocated.
If the canonical name cannot be determined, the result is a non-canonical
name. */
extern const char * _g_locale_charset_raw (void);
extern const char * _g_locale_charset_unalias (const char *codeset);
extern const char * _g_locale_get_charset_aliases (void);
/* Support for relocatable packages. */
/* Sets the original and the current installation prefix of the package.
Relocation simply replaces a pathname starting with the original prefix
by the corresponding pathname with the current prefix instead. Both
prefixes should be directory names without trailing slash (i.e. use ""
instead of "/"). */
extern void libcharset_set_relocation_prefix (const char *orig_prefix,
const char *curr_prefix);
#ifdef __cplusplus
}

View File

@ -1,6 +1,6 @@
/* Determine a canonical name for the current locale's character encoding.
Copyright (C) 2000-2002 Free Software Foundation, Inc.
Copyright (C) 2000-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@ -14,39 +14,23 @@
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
/* Written by Bruno Haible <bruno@clisp.org>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <config.h>
#include <glibconfig.h>
#if defined G_PLATFORM_WIN32
/* Want to use Win32-specific code in this file also on Cygwin */
# define _WIN32 1
#endif
#if HAVE_STDDEF_H
# include <stddef.h>
#endif
/* Specification. */
#include "localcharset.h"
#include <stddef.h>
#include <stdio.h>
#if HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <string.h>
#include <stdlib.h>
#if defined _WIN32 || defined __WIN32__
# undef WIN32 /* avoid warning on mingw32 */
# define WIN32
# define WIN32_NATIVE
#endif
#if defined __EMX__
@ -54,15 +38,19 @@
# define OS2
#endif
#if !defined WIN32
#if !defined WIN32_NATIVE
# if HAVE_LANGINFO_CODESET
# include <langinfo.h>
# else
# if HAVE_SETLOCALE
# if 0 /* see comment below */
# include <locale.h>
# endif
# endif
#elif defined WIN32
# ifdef __CYGWIN__
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# endif
#elif defined WIN32_NATIVE
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
@ -71,8 +59,19 @@
# include <os2.h>
#endif
#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
/* Win32, OS/2, DOS */
#if ENABLE_RELOCATABLE
# include "relocatable.h"
#else
# define relocate(pathname) (pathname)
#endif
/* Get LIBDIR. */
#ifndef LIBDIR
# include "configmake.h"
#endif
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
/* Win32, Cygwin, OS/2, DOS */
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
#endif
@ -84,16 +83,11 @@
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
#endif
#ifdef HAVE_GETC_UNLOCKED
#if HAVE_DECL_GETC_UNLOCKED
# undef getc
# define getc getc_unlocked
#endif
#ifdef __cplusplus
/* When compiling with "gcc -x c++", produce a function with C linkage. */
extern "C" const char * locale_charset (void);
#endif
/* The following static variable is declared 'volatile' to avoid a
possible multithread problem in the function get_charset_aliases. If we
are running in a threaded environment, and if two threads initialize
@ -117,14 +111,17 @@ _g_locale_get_charset_aliases (void)
cp = charset_aliases;
if (cp == NULL)
{
#if !defined WIN32
#if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
FILE *fp;
const char *dir = getenv ("LIBCHARSET_ALIAS_DIR");
const char *dir;
const char *base = "charset.alias";
char *file_name;
if (dir == NULL)
dir = LIBDIR;
/* Make it possible to override the charset.alias location. This is
necessary for running the testsuite before "make install". */
dir = getenv ("CHARSETALIASDIR");
if (dir == NULL || dir[0] == '\0')
dir = relocate (LIBDIR);
/* Concatenate dir and base into freshly allocated file_name. */
{
@ -147,15 +144,17 @@ _g_locale_get_charset_aliases (void)
else
{
/* Parse the file's contents. */
int c;
char buf1[50+1];
char buf2[50+1];
char *res_ptr = NULL;
size_t res_size = 0;
size_t l1, l2;
for (;;)
{
int c;
char buf1[50+1];
char buf2[50+1];
size_t l1, l2;
char *old_res_ptr;
c = getc (fp);
if (c == EOF)
break;
@ -176,6 +175,7 @@ _g_locale_get_charset_aliases (void)
break;
l1 = strlen (buf1);
l2 = strlen (buf2);
old_res_ptr = res_ptr;
if (res_size == 0)
{
res_size = l1 + 1 + l2 + 1;
@ -183,17 +183,15 @@ _g_locale_get_charset_aliases (void)
}
else
{
char * p = res_ptr;
res_size += l1 + 1 + l2 + 1;
res_ptr = (char *) realloc (res_ptr, res_size + 1);
if (res_ptr == NULL) {
free(p);
}
}
if (res_ptr == NULL)
{
/* Out of memory. */
res_size = 0;
if (old_res_ptr != NULL)
free (old_res_ptr);
break;
}
strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
@ -214,15 +212,41 @@ _g_locale_get_charset_aliases (void)
#else
# if defined VMS
/* To avoid the troubles of an extra file charset.alias_vms in the
sources of many GNU packages, simply inline the aliases here. */
/* The list of encodings is taken from the OpenVMS 7.3-1 documentation
"Compaq C Run-Time Library Reference Manual for OpenVMS systems"
section 10.7 "Handling Different Character Sets". */
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
"ISO8859-2" "\0" "ISO-8859-2" "\0"
"ISO8859-5" "\0" "ISO-8859-5" "\0"
"ISO8859-7" "\0" "ISO-8859-7" "\0"
"ISO8859-8" "\0" "ISO-8859-8" "\0"
"ISO8859-9" "\0" "ISO-8859-9" "\0"
/* Japanese */
"eucJP" "\0" "EUC-JP" "\0"
"SJIS" "\0" "SHIFT_JIS" "\0"
"DECKANJI" "\0" "DEC-KANJI" "\0"
"SDECKANJI" "\0" "EUC-JP" "\0"
/* Chinese */
"eucTW" "\0" "EUC-TW" "\0"
"DECHANYU" "\0" "DEC-HANYU" "\0"
"DECHANZI" "\0" "GB2312" "\0"
/* Korean */
"DECKOREAN" "\0" "EUC-KR" "\0";
# endif
# if defined WIN32_NATIVE || defined __CYGWIN__
/* To avoid the troubles of installing a separate file in the same
directory as the DLL and of retrieving the DLL's directory at
runtime, simply inline the aliases here. */
# if defined WIN32
cp = "CP936" "\0" "GBK" "\0"
"CP1361" "\0" "JOHAB" "\0"
"CP20127" "\0" "ASCII" "\0"
"CP20866" "\0" "KOI8-R" "\0"
"CP20936" "\0" "GB2312" "\0"
"CP21866" "\0" "KOI8-RU" "\0"
"CP28591" "\0" "ISO-8859-1" "\0"
"CP28592" "\0" "ISO-8859-2" "\0"
@ -233,7 +257,14 @@ _g_locale_get_charset_aliases (void)
"CP28597" "\0" "ISO-8859-7" "\0"
"CP28598" "\0" "ISO-8859-8" "\0"
"CP28599" "\0" "ISO-8859-9" "\0"
"CP28605" "\0" "ISO-8859-15" "\0";
"CP28605" "\0" "ISO-8859-15" "\0"
"CP38598" "\0" "ISO-8859-8" "\0"
"CP51932" "\0" "EUC-JP" "\0"
"CP51936" "\0" "GB2312" "\0"
"CP51949" "\0" "EUC-KR" "\0"
"CP51950" "\0" "EUC-TW" "\0"
"CP54936" "\0" "GB18030" "\0"
"CP65001" "\0" "UTF-8" "\0";
# endif
#endif
@ -254,13 +285,60 @@ _g_locale_charset_raw (void)
{
const char *codeset;
#if !(defined WIN32 || defined OS2)
#if !(defined WIN32_NATIVE || defined OS2)
# if HAVE_LANGINFO_CODESET
/* Most systems support nl_langinfo (CODESET) nowadays. */
codeset = nl_langinfo (CODESET);
# ifdef __CYGWIN__
/* Cygwin 2006 does not have locales. nl_langinfo (CODESET) always
returns "US-ASCII". As long as this is not fixed, return the suffix
of the locale name from the environment variables (if present) or
the codepage as a number. */
if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
{
const char *locale;
static char buf[2 + 10 + 1];
locale = getenv ("LC_ALL");
if (locale == NULL || locale[0] == '\0')
{
locale = getenv ("LC_CTYPE");
if (locale == NULL || locale[0] == '\0')
locale = getenv ("LANG");
}
if (locale != NULL && locale[0] != '\0')
{
/* If the locale name contains an encoding after the dot, return
it. */
const char *dot = strchr (locale, '.');
if (dot != NULL)
{
const char *modifier;
dot++;
/* Look for the possible @... trailer and remove it, if any. */
modifier = strchr (dot, '@');
if (modifier == NULL)
return dot;
if (modifier - dot < sizeof (buf))
{
memcpy (buf, dot, modifier - dot);
buf [modifier - dot] = '\0';
return buf;
}
}
}
/* Woe32 has a function returning the locale's codepage as a number. */
sprintf (buf, "CP%u", GetACP ());
codeset = buf;
}
# endif
# else
/* On old systems which lack it, use setlocale or getenv. */
@ -270,7 +348,7 @@ _g_locale_charset_raw (void)
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
use setlocale here; it would return "C" when it doesn't support the
locale name the user has set. */
# if HAVE_SETLOCALE && 0
# if 0
locale = setlocale (LC_CTYPE, NULL);
# endif
if (locale == NULL || locale[0] == '\0')
@ -291,7 +369,7 @@ _g_locale_charset_raw (void)
# endif
#elif defined WIN32
#elif defined WIN32_NATIVE
static char buf[2 + 10 + 1];
@ -357,9 +435,6 @@ _g_locale_charset_raw (void)
return codeset;
}
#ifdef STATIC
STATIC
#endif
const char *
_g_locale_charset_unalias (const char *codeset)
{

View File

@ -0,0 +1,43 @@
/* Determine a canonical name for the current locale's character encoding.
Copyright (C) 2000-2003 Free Software Foundation, Inc.
This file is part of the GNU CHARSET Library.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
#ifndef _LOCALCHARSET_H
#define _LOCALCHARSET_H
#ifdef __cplusplus
extern "C" {
#endif
/* Determine the current locale's character encoding, and canonicalize it
into one of the canonical names listed in config.charset.
The result must not be freed; it is statically allocated.
If the canonical name cannot be determined, the result is a non-canonical
name. */
extern const char * _g_locale_charset_raw (void);
extern const char * _g_locale_charset_unalias (const char *codeset);
extern const char * _g_locale_get_charset_aliases (void);
#ifdef __cplusplus
}
#endif
#endif /* _LOCALCHARSET_H */

View File

@ -12,7 +12,7 @@ if test -f $ORIGINAL/lib/localcharset.c ; then : ; else
exit 1
fi
VERSION=`grep VERSION= $ORIGINAL/configure.in | sed s/VERSION=//`
VERSION=`grep VERSION= $ORIGINAL/configure.ac | sed s/VERSION=//`
echo "# Patch against libcharset version $VERSION" > libcharset-glib.patch
@ -25,3 +25,4 @@ for i in glibc21.m4 codeset.m4 ; do
done
diff -u $ORIGINAL/include/libcharset.h.in libcharset.h >> libcharset-glib.patch
diff -u $ORIGINAL/include/localcharset.h.in localcharset.h >> libcharset-glib.patch

View File

@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# Written by Bruno Haible <bruno@clisp.org>.

View File

@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# Written by Bruno Haible <bruno@clisp.org>.

View File

@ -12,13 +12,15 @@ if test -f $ORIGINAL/lib/localcharset.c ; then : ; else
exit 1
fi
VERSION=`grep VERSION= $ORIGINAL/configure.in | sed s/VERSION=//`
VERSION=`grep VERSION= $ORIGINAL/configure.ac | sed s/VERSION=//`
for i in localcharset.c ref-add.sin ref-del.sin config.charset ; do
cp $ORIGINAL/lib/$i .
done
cp $ORIGINAL/include/libcharset.h.in ./libcharset.h
for i in libcharset.h localcharset.h ; do
cp $ORIGINAL/include/$i.in ./$i
done
for i in codeset.m4 glibc21.m4 ; do
cp $ORIGINAL/m4/$i .