Character set support
=====================
-Mutt has extensive support for doing character set conversions. To
-use this, you'll need the proper character set definition files.
-
-If these files are already installed on your system (glibc 2.0
-includes them), you can tell the configure script this by using the
---with-charmaps option. As an argument, it takes the directory in
-which the character set definition files have been installed. By
-default, configure looks into /usr/share/i18n/charmaps.
-
-If these files are not present on your system, you can download a
-charmaps tar-ball from the same place from which you got mutt (e.g.,
-ftp.guug.de/pub/mutt/). Unpack it under the mutt toplevel source
-directory, and re-configure mutt. configure will detect this; the
-character set definition files should be automatically installed in
-the proper place.
+Mutt no longer contains functions for doing character set conversion.
+Instead, it expects the iconv functions (iconv_open, iconv,
+iconv_close) to be provided. Most up-to-date systems provide these
+functions, often as part of the C library. If you are installing Mutt
+on a system which does not have them, it is recommended that you
+install Bruno Haible's portable libiconv library, which you can obtain
+from:
+
+ftp://ftp.ilog.fr/pub/Users/haible/gnu/
+
+Even if your system does provide the iconv functions, you might want
+to install libiconv, as some systems provide only a very limited
+version of iconv.
+
+If you really want to, you can configure Mutt --without-iconv, but
+there will then be no character set conversion.
Platform Notes
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
+/* Define if you have iconv(). */
+#undef HAVE_ICONV
+
/* Define as 1 if iconv() only converts exactly and we should treat
* all return values other than (size_t)(-1) as equivalent. */
#undef ICONV_NONTRANS
}
+#ifndef HAVE_ICONV
+
+iconv_t iconv_open (const char *tocode, const char *fromcode)
+{
+ return (iconv_t)(-1);
+}
+
+size_t iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft)
+{
+ return 0;
+}
+
+int iconv_close (iconv_t cd)
+{
+ return 0;
+}
+
+#endif /* !HAVE_ICONV */
+
+
/*
* Like iconv_open, but canonicalises the charsets
*/
AC_SUBST(sharedir)
AC_ARG_WITH(iconv, [ --with-iconv=DIR Where libiconv is installed ],
- [if test $withval != yes; then
- mutt_cv_iconv=$withval
- fi
- if test x$mutt_cv_iconv != x/usr; then
+ [mutt_cv_iconv=$withval
+ if test "$mutt_cv_iconv" != yes -a \
+ "$mutt_cv_iconv" != no -a \
+ "$mutt_cv_iconv" != /usr; then
CPPFLAGS="$CPPFLAGS -I${mutt_cv_iconv}/include"
LDFLAGS="-L${mutt_cv_iconv}/lib $LDFLAGS"
fi])
LIBICONV=
+if test "$mutt_cv_iconv" != no; then
AC_CACHE_CHECK(for iconv, mutt_cv_func_iconv,
[ mutt_cv_func_iconv=no
mutt_cv_lib_iconv=no
if test "$mutt_cv_lib_iconv" = yes; then
LIBICONV="-liconv"
fi
+AC_DEFINE(HAVE_ICONV)
+fi
AC_SUBST(LIBICONV)
char *ob;
size_t obl;
ob = buf, obl = sizeof(buf);
- return ((cd = iconv_open("UTF-8", "UTF-8")) == (iconv_t)(-1) ||
- iconv(cd, 0, 0, &ob, &obl) ||
- !(ob == buf && obl == sizeof(buf)) ||
- iconv_close(cd));
+ return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
+ (iconv(cd, 0, 0, &ob, &obl) ||
+ !(ob == buf && obl == sizeof(buf)) ||
+ iconv_close(cd)));
}
],
mutt_cv_iconv_good=yes,
"\n"
+#if HAVE_ICONV
+ "+HAVE_ICONV "
+#else
+ "-HAVE_ICONV "
+#endif
+
#if ICONV_NONTRANS
"+ICONV_NONTRANS "
#else