]> granicus.if.org Git - neomutt/commitdiff
Make iconv mandatory (no more --disable-iconv) 472/head
authorPietro Cerutti <gahr@gahr.ch>
Wed, 15 Mar 2017 19:34:58 +0000 (19:34 +0000)
committerRichard Russon <rich@flatcap.org>
Fri, 17 Mar 2017 02:19:58 +0000 (02:19 +0000)
Issue: #460

Makefile.am
charset.c
charset.h
configure.ac
hcache.c
init.h
mutt_idna.h
sendlib.c
version.c

index 1883e26bdcf340a18baab54532851959c4880c27..eb1117487d980090c2e96f8b34facfa839d726fb 100644 (file)
@@ -41,8 +41,8 @@ mutt_SOURCES = \
        edit.c enter.c flags.c init.c filter.c from.c \
        getdomain.c group.c \
        handler.c hash.c hdrline.c headers.c help.c hook.c keymap.c \
-       main.c mbox.c menu.c mh.c mutt_sasl_plain.c mx.c pager.c parse.c pattern.c \
-       postpone.c query.c recvattach.c recvcmd.c \
+       main.c mbox.c menu.c mh.c mutt_idna.c mutt_sasl_plain.c mx.c pager.c \
+       parse.c pattern.c postpone.c query.c recvattach.c recvcmd.c \
        rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
        score.c send.c sendlib.c signal.c sort.c \
        status.c system.c thread.c charset.c history.c lib.c \
index e2e21bcb69ce7c367b2892ed054393277b4a4932..6a4d2fe14ed4dd4e15bee87d2c475b1498a53a7a 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -325,27 +325,6 @@ char *mutt_get_default_charset ()
   return strcpy (fcharset, "us-ascii"); /* __STRCPY_CHECKED__ */
 }
 
-#ifndef HAVE_ICONV
-
-iconv_t iconv_open (const char *tocode, const char *fromcode)
-{
-  return (iconv_t)(-1);
-}
-
-size_t iconv (iconv_t cd, ICONV_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, applies charset-hooks,
  * recanonicalises, and finally applies iconv-hooks. Parameter flags=0 skips
index 54891f0e64a456127a039a2009a82e767e3aedae..890c9f31cfb4e18c18da37c9a744e06e29a5ed8d 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 1aa73d3106ce3a9da7363a71282544bed7083b4d..bb9f59dc4a60ebb68b48834bffcf7166be49d9e3 100644 (file)
@@ -1183,29 +1183,14 @@ AC_SUBST(NOTMUCH_LIBS)
 
 dnl -- iconv/gettext --
 
-AC_ARG_ENABLE(iconv, AS_HELP_STRING([--disable-iconv],[Disable iconv support]),
-       [if test x$enableval = xno; then
-               am_cv_func_iconv=no
-       fi
-])
-
 AM_GNU_GETTEXT_VERSION([0.18])
 AM_GNU_GETTEXT([external])
 AC_CHECK_HEADERS([locale.h])
 
-if test "$am_cv_func_iconv" = "no"; then
-       AC_MSG_WARN([Configuring without iconv support. See INSTALL for details])
-else
-
 AM_ICONV
-
-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([An iconv implementation is required])
+fi
 
 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
@@ -1266,17 +1251,6 @@ else
        AC_DEFINE(ICONV_NONTRANS, 0)
 fi
 
-fi # libiconv
-
-dnl -- IDN depends on iconv
-
-dnl mutt_idna.c will perform charset transformations (for smtputf8
-dnl support) as long as at least iconv is installed.  If there is no
-dnl iconv, then it doesn't need to be included in the build.
-if test "$am_cv_func_iconv" = yes; then
-       MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_idna.o"
-fi
-
 AC_ARG_WITH(idn, AS_HELP_STRING([--with-idn=@<:@PFX@:>@],[Use GNU libidn for internationalized domain names]),
                [
                if test "$with_idn" != "no"; then
@@ -1289,41 +1263,35 @@ AC_ARG_WITH(idn, AS_HELP_STRING([--with-idn=@<:@PFX@:>@],[Use GNU libidn for int
                [with_idn=auto])
 
 if test "x$with_idn" != "xno"; then
-       if test "$am_cv_func_iconv" != "yes"; then
-               if test "$with_idn" != "auto"; then
-                       AC_MSG_ERROR([IDN requested but iconv is disabled or unavailable])
-               fi
-       else
-               dnl Solaris 11 has /usr/include/idn
-               have_stringprep_h=no
-               AC_CHECK_HEADERS([stringprep.h idn/stringprep.h], [
-                                       have_stringprep_h=yes
-                                       break])
-               have_idna_h=no
-               AC_CHECK_HEADERS([idna.h idn/idna.h], [
-                                       have_idna_h=yes
-                                       break])
-
-               mutt_save_LIBS="$LIBS"
-               LIBS=
-
-               AC_SEARCH_LIBS([stringprep_check_version], [idn], [
-                       AC_DEFINE([HAVE_LIBIDN], 1, [Define to 1 if you have the GNU idn library])
-                       MUTTLIBS="$MUTTLIBS $LIBS"
-
-                       LIBS="$LIBS $LIBICONV"
-                       AC_CHECK_FUNCS(idna_to_unicode_utf8_from_utf8 idna_to_unicode_8z8z)
-                       AC_CHECK_FUNCS(idna_to_ascii_from_utf8 idna_to_ascii_8z)
-                       AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
-               ])
-
-               LIBS="$mutt_save_LIBS"
-
-               if test "$with_idn" != auto; then
-                       if test $have_stringprep_h = no || test $have_idna_h = no || test $ac_cv_search_stringprep_check_version = no; then
-                               AC_MSG_ERROR([IDN was requested, but libidn was not usable on this system])
-                       fi
-               fi
+    dnl Solaris 11 has /usr/include/idn
+    have_stringprep_h=no
+    AC_CHECK_HEADERS([stringprep.h idn/stringprep.h], [
+                have_stringprep_h=yes
+                break])
+    have_idna_h=no
+    AC_CHECK_HEADERS([idna.h idn/idna.h], [
+                have_idna_h=yes
+                break])
+
+    mutt_save_LIBS="$LIBS"
+    LIBS=
+
+    AC_SEARCH_LIBS([stringprep_check_version], [idn], [
+        AC_DEFINE([HAVE_LIBIDN], 1, [Define to 1 if you have the GNU idn library])
+        MUTTLIBS="$MUTTLIBS $LIBS"
+
+        LIBS="$LIBS $LIBICONV"
+        AC_CHECK_FUNCS(idna_to_unicode_utf8_from_utf8 idna_to_unicode_8z8z)
+        AC_CHECK_FUNCS(idna_to_ascii_from_utf8 idna_to_ascii_8z)
+        AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
+    ])
+
+    LIBS="$mutt_save_LIBS"
+
+    if test "$with_idn" != auto; then
+        if test $have_stringprep_h = no || test $have_idna_h = no || test $ac_cv_search_stringprep_check_version = no; then
+            AC_MSG_ERROR([IDN was requested, but libidn was not usable on this system])
+        fi
        fi
 fi
 
index eb2aa8ba8fadf88064e1565e87b3b1dcee8468e6..c015d3f73f883ba8759d598f81f168b84979df74 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -588,11 +588,6 @@ static const char *mutt_hcache_per_folder(const char *path, const char *folder,
   int ret = stat(path, &sb);
   int slash = (path[plen - 1] == '/');
 
-#ifndef HAVE_ICONV
-  snprintf(suffix, sizeof(suffix), "-%s",
-      Charset && *Charset ? Charset : mutt_get_default_charset());
-#endif
-
   if (((ret == 0) && !S_ISDIR(sb.st_mode)) || ((ret == -1) && !slash))
   {
       /* An existing file or a non-existing path not ending with a slash */
diff --git a/init.h b/init.h
index 97b00f65dc7f12509dfb465cb67eccd1a2767aa9..4980957118e7517f77747f9a8c6a610f062cf4ed 100644 (file)
--- a/init.h
+++ b/init.h
@@ -4459,9 +4459,7 @@ const struct command_t Commands[] = {
   { "ifdef",           parse_ifdef,            0 },
   { "ifndef",          parse_ifdef,            1 },
   { "finish",          finish_source,          0 },
-#ifdef HAVE_ICONV
   { "iconv-hook",      mutt_parse_hook,        MUTT_ICONVHOOK },
-#endif
   { "ignore",          parse_ignore,           0 },
   { "lists",           parse_lists,            0 },
 #ifdef USE_LUA
index 1681a12bb8c0fb95c7f89e30e716df4f32cfdeb3..5765641f074c1f7735da95ac18d990cba2e8b552 100644 (file)
@@ -45,7 +45,6 @@
 #endif /* HAVE_LIBIDN */
 
 
-#ifdef HAVE_ICONV
 int mutt_addrlist_to_intl (ADDRESS *, char **);
 int mutt_addrlist_to_local (ADDRESS *);
 
@@ -53,32 +52,5 @@ void mutt_env_to_local (ENVELOPE *);
 int mutt_env_to_intl (ENVELOPE *, char **, char **);
 
 const char *mutt_addr_for_display (ADDRESS *a);
-#else
-static inline int mutt_addrlist_to_intl (ADDRESS *addr, char **err)
-{
-  return 0;
-}
-
-static inline int mutt_addrlist_to_local (ADDRESS *addr)
-{
-  return 0;
-}
-
-static inline void mutt_env_to_local (ENVELOPE *env)
-{
-  return;
-}
-
-static inline int mutt_env_to_intl (ENVELOPE *env, char **tag, char **err)
-{
-  return 0;
-}
-
-static inline const char *mutt_addr_for_display (ADDRESS *a)
-{
-  return a->mailbox;
-}
-#endif /* HAVE_LIBICONV */
-
 
 #endif
index 90fc58f0267ba5cc1db1e79e0459f61175a56557..d348163873092689919a668f826f16f21f5583be 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -637,7 +637,6 @@ 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;
@@ -762,9 +761,6 @@ static size_t convert_file_to (FILE *file, const char *fromcode,
   FREE (&states);
 
   return ret;
-#else
-  return -1;
-#endif /* !HAVE_ICONV */
 }
 
 /*
index 40417f5a7ece5c1f17996c6607d0b9b316251e98..6845a8db22e128918d6fcaf792ec3554c2dcf910 100644 (file)
--- a/version.c
+++ b/version.c
@@ -184,11 +184,6 @@ static struct compile_options comp_opts[] =
 #else
   { "HAVE_GETSID", 0 },
 #endif
-#ifdef HAVE_ICONV
-  { "HAVE_ICONV", 1 },
-#else
-  { "HAVE_ICONV", 0 },
-#endif
 #ifdef HAVE_LANGINFO_CODESET
   { "HAVE_LANGINFO_CODESET", 1 },
 #else