From: Lars Hecking Date: Mon, 25 Nov 2002 14:16:46 +0000 (+0000) Subject: The noiconv patch. X-Git-Tag: mutt-1-5-2-rel~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=accd3163cc59cb411579c46f74035efe725f6807;p=mutt The noiconv patch. --- diff --git a/ChangeLog b/ChangeLog index 8b38d6e8..e4a43643 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Tue May 7 15:42:37 IST 2002 Lars Hecking + + * INSTALL: Document new --disable-iconv configure option. + + * charset.h: Conditionalise inclusion of iconv.h. Define iconv_t + if not found by configure. Define ICONV_CONST and declare iconv + functions if not found by configure. + + * configure.in: New --disable-iconv configure option. Warn instead + error if iconv not found. New tests for iconv.h and iconv_t. + + * sendlib.c(convert_file_to): Allow compilation without system + iconv and return -1 if no iconv available. + Wed May 1 23:21:10 2002 Thomas Roessler * smime.c: From: Thomas Roessler diff --git a/INSTALL b/INSTALL index 7590fffa..787b5e38 100644 --- a/INSTALL +++ b/INSTALL @@ -237,7 +237,7 @@ into your system's global Muttrc, which normally resides in /etc or /usr/local/etc. -If you really want to, you can configure Mutt --without-iconv, but +If you really want to, you can configure Mutt --disable-iconv, but there will then be no character set conversion. diff --git a/charset.h b/charset.h index fa2f20e5..43f6f982 100644 --- a/charset.h +++ b/charset.h @@ -19,7 +19,20 @@ #ifndef _CHARSET_H #define _CHARSET_H +#ifdef HAVE_ICONV_H #include +#endif + +#ifndef HAVE_ICONV_T_DEF +typedef void *iconv_t; +#endif + +#ifndef HAVE_ICONV +#define ICONV_CONST /**/ +iconv_t iconv_open (const char *, const char *); +size_t iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *); +int iconv_close (iconv_t); +#endif int mutt_convert_string (char **, const char *, const char *, int); diff --git a/configure.in b/configure.in index fd9115cd..01fdfec7 100644 --- a/configure.in +++ b/configure.in @@ -750,11 +750,26 @@ AC_SUBST(LIBIMAPDEPS) dnl -- iconv/gettext -- +AC_ARG_ENABLE(iconv, [ --disable-iconv Disable iconv support], + [if test x$enableval = xno ; then + am_cv_func_iconv=no + fi +]) + MUTT_AM_GNU_GETTEXT + if test "$am_cv_func_iconv" != "yes" then - AC_MSG_ERROR([Unable to find an iconv function. See INSTALL for help]) -fi + AC_MSG_WARN([Configuring without iconv support. See INSTALL for details]) +else + +AC_CHECK_HEADERS(iconv.h, + [AC_MSG_CHECKING(whether iconv.h defines iconv_t) + AC_EGREP_HEADER([typedef.*iconv_t],iconv.h, + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ICONV_T_DEF, 1, + [Define if defines iconv_t.])], + AC_MSG_RESULT(no))]) dnl (1) Some implementations of iconv won't convert from UTF-8 to UTF-8. dnl (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and @@ -830,6 +845,8 @@ else AC_CHECK_FUNCS(bind_textdomain_codeset) fi +fi # libiconv + dnl -- locales -- AC_CHECK_HEADERS(wchar.h) diff --git a/sendlib.c b/sendlib.c index 5df8368b..c9a18481 100644 --- a/sendlib.c +++ b/sendlib.c @@ -690,6 +690,7 @@ static size_t convert_file_to (FILE *file, const char *fromcode, int ncodes, const char **tocodes, int *tocode, CONTENT *info) { +#ifdef HAVE_ICONV iconv_t cd1, *cd; char bufi[256], bufu[512], bufo[4 * sizeof (bufi)]; ICONV_CONST char *ib, *ub; @@ -814,6 +815,9 @@ static size_t convert_file_to (FILE *file, const char *fromcode, safe_free ((void **) &states); return ret; +#else + return -1; +#endif /* !HAVE_ICONV */ } /*