]> granicus.if.org Git - neomutt/commitdiff
The noiconv patch.
authorLars Hecking <lhecking@nmrc.ucc.ie>
Mon, 25 Nov 2002 14:16:46 +0000 (14:16 +0000)
committerLars Hecking <lhecking@nmrc.ucc.ie>
Mon, 25 Nov 2002 14:16:46 +0000 (14:16 +0000)
ChangeLog
INSTALL
charset.h
configure.in
sendlib.c

index 8b38d6e8a6142542cea63ab6b49cabd65e9def55..e4a436431efb447d5abfe6517ef16e644a010c03 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Tue May  7 15:42:37 IST 2002  Lars Hecking  <lhecking@nmrc.ie>
+
+       * 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  <roessler@does-not-exist.org>
 
        * smime.c: From: Thomas Roessler <roessler@does-not-exist.org>
diff --git a/INSTALL b/INSTALL
index 7590fffa2513c46f5eea71bd24e55d9d3e1d9a24..787b5e3892bafe6d13ea4b17b47d9558f515d46f 100644 (file)
--- 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.
 
 
index fa2f20e5cabb7f95529bf247ab7bb3ba3495a9ec..43f6f98296b79f53b9ab9fdeaefe6b66ae183afc 100644 (file)
--- a/charset.h
+++ b/charset.h
 #ifndef _CHARSET_H
 #define _CHARSET_H
 
+#ifdef HAVE_ICONV_H
 #include <iconv.h>
+#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);
 
index fd9115cdfb51ad26c2c5d26f8c4bcf1fc9699cb3..01fdfec7cd4a5a812b76526b4235bf5f4deaf14b 100644 (file)
@@ -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 <iconv.h> 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)
index 5df8368b93787d314227ef6a5fa2f33d26c78543..c9a18481d15634d849eba2f3df868632c2396f61 100644 (file)
--- 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 */
 }
 
 /*