Commit b6628dee authored by Thomas Roessler's avatar Thomas Roessler

The noiconv patch.

From: Lars Hecking <lhecking@nmrc.ie>
parent befd9734
......@@ -31,8 +31,6 @@
#include <unistd.h>
#include <errno.h>
#include <iconv.h>
#include "mutt.h"
#include "charset.h"
......
......@@ -19,7 +19,19 @@
#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
iconv_t iconv_open (const char *, const char *);
size_t iconv (iconv_t, const char **, size_t *, char **, size_t *);
int iconv_close (iconv_t);
#endif
int mutt_convert_string (char **, const char *, const char *, int);
......
......@@ -666,10 +666,19 @@ AC_SUBST(LIBIMAPDEPS)
dnl -- iconv/gettext --
MUTT_AM_GNU_GETTEXT
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))])
if test "$am_cv_func_iconv" != "yes"
then
AC_MSG_ERROR([Unable to find an iconv function. See INSTALL for help])
fi
# AC_MSG_ERROR([Unable to find an iconv function. See INSTALL for help])
AC_MSG_WARN([Unable to find an iconv function. See INSTALL for help])
else
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
......@@ -736,6 +745,8 @@ else
AC_DEFINE(ICONV_NONTRANS, 0)
fi
fi # libiconv
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/intl"
if test "$BUILD_INCLUDED_LIBINTL" = "yes"; then
......
......@@ -44,7 +44,6 @@
#include "mutt.h"
#include "pgp.h"
#include "charset.h"
#include "iconv.h"
/* for hexval */
#include "mime.h"
......
......@@ -2469,7 +2469,9 @@ struct command_t Commands[] = {
{ "fcc-save-hook", mutt_parse_hook, M_FCCHOOK | M_SAVEHOOK },
{ "folder-hook", mutt_parse_hook, M_FOLDERHOOK },
{ "hdr_order", parse_list, UL &HeaderOrderList },
#ifdef HAVE_ICONV
{ "iconv-hook", mutt_parse_hook, M_ICONVHOOK },
#endif
{ "ignore", parse_ignore, 0 },
{ "lists", parse_list, UL &MailLists },
{ "macro", mutt_parse_macro, 0 },
......
......@@ -24,7 +24,6 @@
#include <ctype.h>
#include <errno.h>
#include <iconv.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......
......@@ -671,6 +671,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;
......@@ -795,6 +796,9 @@ static size_t convert_file_to (FILE *file, const char *fromcode,
safe_free ((void **) &states);
return ret;
#else
return -1;
#endif /* !HAVE_ICONV */
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment