From: Thomas Roessler Date: Mon, 10 Jul 2000 09:37:57 +0000 (+0000) Subject: Some changes from EGE. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9aab0a6d5042eaccdb8c88fad16ae56da0b4965d;p=neomutt Some changes from EGE. --- diff --git a/INSTALL b/INSTALL index 7ad44fd89..ac8bc8b2e 100644 --- a/INSTALL +++ b/INSTALL @@ -169,21 +169,22 @@ Please note that "VPATH" builds currently do _not_ work. 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 diff --git a/acconfig.h b/acconfig.h index 7cd4151c9..04e5d59aa 100644 --- a/acconfig.h +++ b/acconfig.h @@ -192,6 +192,9 @@ /* Define if you have 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 diff --git a/charset.c b/charset.c index a8ee59851..4046e6516 100644 --- a/charset.c +++ b/charset.c @@ -123,6 +123,27 @@ int mutt_is_utf8 (const char *s) } +#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 */ diff --git a/configure.in b/configure.in index 148ca120c..743b5b3f7 100644 --- a/configure.in +++ b/configure.in @@ -396,15 +396,16 @@ sharedir=$mutt_cv_sharedir 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 @@ -429,6 +430,8 @@ fi if test "$mutt_cv_lib_iconv" = yes; then LIBICONV="-liconv" fi +AC_DEFINE(HAVE_ICONV) +fi AC_SUBST(LIBICONV) @@ -449,10 +452,10 @@ changequote([, ])dnl 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, diff --git a/main.c b/main.c index b63752d5d..74c1ce547 100644 --- a/main.c +++ b/main.c @@ -360,6 +360,12 @@ static void show_version (void) "\n" +#if HAVE_ICONV + "+HAVE_ICONV " +#else + "-HAVE_ICONV " +#endif + #if ICONV_NONTRANS "+ICONV_NONTRANS " #else