summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--doc/posix-functions/iconv_open.texi2
-rw-r--r--lib/iconv_open-solaris.gperf30
-rw-r--r--m4/iconv_open.m411
-rw-r--r--modules/iconv_open12
5 files changed, 55 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 50ac840389..7ddaf51091 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-08-30 Bruno Haible <bruno@clisp.org>
+
+ 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 <meyering@redhat.com>
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 a630901254..74e8106258 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 0000000000..7d7da38e6e
--- /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 c7b948e904..8eeef9fcf6 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 9800dce641..c85e660216 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:
<iconv.h>