From 555629c070c880ec843eab0dcf05952efeefbeb9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 30 Aug 2009 14:29:34 +0200 Subject: [PATCH] Work around iconv_open problem on Solaris. --- ChangeLog | 10 ++++++++++ doc/posix-functions/iconv_open.texi | 2 +- lib/iconv_open-solaris.gperf | 30 ++++++++++++++++++++++++++++++ m4/iconv_open.m4 | 11 ++++++----- modules/iconv_open | 12 ++++++++---- 5 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 lib/iconv_open-solaris.gperf diff --git a/ChangeLog b/ChangeLog index 50ac84038..7ddaf5109 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-08-30 Bruno Haible + + Work around iconv_open problem on Solaris. + * lib/iconv_open-solaris.gperf: New file. + * m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN): Also handle Solaris. + * modules/iconv_open (Files): Add lib/iconv_open-solaris.gperf. + (Makefile.am): Add rule for iconv_open-solaris.h. Augment + BUILT_SOURCES, MOSTLYCLEANFILES, MAINTAINERCLEANFILES, EXTRA_DIST. + * doc/posix-functions/iconv_open.texi: Mention the Solaris problem. + 2009-08-29 Jim Meyering maint.mk: remove more coreutils-specific targets; XZ_OPT=-9ev diff --git a/doc/posix-functions/iconv_open.texi b/doc/posix-functions/iconv_open.texi index a63090125..74e810625 100644 --- a/doc/posix-functions/iconv_open.texi +++ b/doc/posix-functions/iconv_open.texi @@ -20,7 +20,7 @@ Portability problems fixed by Gnulib module @code{iconv_open}: @item This function recognizes only non-standard aliases for many encodings (not the IANA registered encoding names) on many platforms: -AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1. +AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10. @end itemize Portability problems fixed by Gnulib module @code{iconv_open-utf}: diff --git a/lib/iconv_open-solaris.gperf b/lib/iconv_open-solaris.gperf new file mode 100644 index 000000000..7d7da38e6 --- /dev/null +++ b/lib/iconv_open-solaris.gperf @@ -0,0 +1,30 @@ +struct mapping { int standard_name; const char vendor_name[10 + 1]; }; +%struct-type +%language=ANSI-C +%define slot-name standard_name +%define hash-function-name mapping_hash +%define lookup-function-name mapping_lookup +%readonly-tables +%global-table +%define word-array-name mappings +%pic +%% +# On Solaris 10, look in the "iconv -l" output. Some aliases are advertised but +# not actually supported by the iconv() function and by the 'iconv' program. +# For example: +# $ echo abc | iconv -f 646 -t ISO-8859-1 +# Not supported 646 to ISO-8859-1 +# $ echo abc | iconv -f 646 -t ISO8859-1 +$ abc +ASCII, "646" +ISO-8859-1, "ISO8859-1" +ISO-8859-2, "ISO8859-2" +ISO-8859-3, "ISO8859-3" +ISO-8859-4, "ISO8859-4" +ISO-8859-5, "ISO8859-5" +ISO-8859-6, "ISO8859-6" +ISO-8859-7, "ISO8859-7" +ISO-8859-8, "ISO8859-8" +ISO-8859-9, "ISO8859-9" +ISO-8859-15, "ISO8859-15" +CP1251, "ansi-1251" diff --git a/m4/iconv_open.m4 b/m4/iconv_open.m4 index c7b948e90..8eeef9fcf 100644 --- a/m4/iconv_open.m4 +++ b/m4/iconv_open.m4 @@ -1,4 +1,4 @@ -# iconv_open.m4 serial 5 +# iconv_open.m4 serial 6 dnl Copyright (C) 2007-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, @@ -21,10 +21,11 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN], if test $gl_func_iconv_gnu = no; then iconv_flavor= case "$host_os" in - aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; - irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; - hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; - osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; + aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; + irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; + hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; + osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; + solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;; esac if test -n "$iconv_flavor"; then AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor], diff --git a/modules/iconv_open b/modules/iconv_open index 9800dce64..c85e66021 100644 --- a/modules/iconv_open +++ b/modules/iconv_open @@ -8,6 +8,7 @@ lib/iconv_open-aix.gperf lib/iconv_open-hpux.gperf lib/iconv_open-irix.gperf lib/iconv_open-osf.gperf +lib/iconv_open-solaris.gperf m4/iconv_h.m4 m4/iconv_open.m4 @@ -54,10 +55,13 @@ iconv_open-irix.h: iconv_open-irix.gperf iconv_open-osf.h: iconv_open-osf.gperf $(GPERF) -m 10 $(srcdir)/iconv_open-osf.gperf > $(srcdir)/iconv_open-osf.h-t mv $(srcdir)/iconv_open-osf.h-t $(srcdir)/iconv_open-osf.h -BUILT_SOURCES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h -MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h-t iconv_open-osf.h-t -MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h -EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h +iconv_open-solaris.h: iconv_open-solaris.gperf + $(GPERF) -m 10 $(srcdir)/iconv_open-solaris.gperf > $(srcdir)/iconv_open-solaris.h-t + mv $(srcdir)/iconv_open-solaris.h-t $(srcdir)/iconv_open-solaris.h +BUILT_SOURCES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h +MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h-t iconv_open-osf.h-t iconv_open-solaris.h-t +MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h +EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h Include: -- 2.11.0