]> diplodocus.org Git - nmh/commitdiff
If we don't have iconv, skip the multibyte test that requires character
authorKen Hornstein <kenh@pobox.com>
Fri, 1 Feb 2013 18:25:17 +0000 (13:25 -0500)
committerKen Hornstein <kenh@pobox.com>
Fri, 1 Feb 2013 18:25:17 +0000 (13:25 -0500)
set conversion.

Makefile.am
m4/iconv.m4
test/common.sh.in
test/scan/test-scan-multibyte

index 40dcdcad02127a23ee9424281c7a3011bb771b87..29e3be90bb40758680ad19ce34601eeaa05f77fc 100644 (file)
@@ -38,6 +38,7 @@ TESTS_ENVIRONMENT = MH_OBJ_DIR="@abs_builddir@" \
                    auxexecdir="$(auxexecdir)" bindir="$(bindir)" \
                    mandir="$(mandir)" sysconfdir="$(sysconfdir)" \
                    MULTIBYTE_ENABLED=$(MULTIBYTE_ENABLED) \
                    auxexecdir="$(auxexecdir)" bindir="$(bindir)" \
                    mandir="$(mandir)" sysconfdir="$(sysconfdir)" \
                    MULTIBYTE_ENABLED=$(MULTIBYTE_ENABLED) \
+                   ICONV_ENABLED=$(ICONV_ENABLED) \
                    $(TESTS_SHELL) ## Keep at end of TESTS_ENVIRONMENT.
 ##
 ## Important note: the "cleanup" test should always be last
                    $(TESTS_SHELL) ## Keep at end of TESTS_ENVIRONMENT.
 ##
 ## Important note: the "cleanup" test should always be last
index 949c746da827e6417ef5976b752109f4f451b087..efa6939fcfd6f96e29a721e48c677b0f7e566ce6 100644 (file)
@@ -21,9 +21,11 @@ AC_DEFUN([NMH_CHECK_ICONV],
     AS_IF([test "x$nmh_found_iconv" = "xyes"], [ICONVLIB="-liconv"])])
   dnl If we came out of that by finding iconv in some form, define
   dnl HAVE_ICONV
     AS_IF([test "x$nmh_found_iconv" = "xyes"], [ICONVLIB="-liconv"])])
   dnl If we came out of that by finding iconv in some form, define
   dnl HAVE_ICONV
+  ICONV_ENABLED=0
   AS_IF([test "x$nmh_found_iconv" = "xyes"],
     [AC_DEFINE([HAVE_ICONV], [1],
                   [Define if you have the iconv() function.])
   AS_IF([test "x$nmh_found_iconv" = "xyes"],
     [AC_DEFINE([HAVE_ICONV], [1],
                   [Define if you have the iconv() function.])
+    ICONV_ENABLED=1
     AC_CACHE_CHECK([for iconv declaration], [nmh_cv_iconv_const],
       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
           #include <iconv.h>]],
     AC_CACHE_CHECK([for iconv declaration], [nmh_cv_iconv_const],
       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
           #include <iconv.h>]],
@@ -40,3 +42,4 @@ AC_DEFUN([NMH_CHECK_ICONV],
     AC_DEFINE_UNQUOTED([ICONV_CONST], [$nmh_cv_iconv_const],
       [Define as const if the declaration of iconv() needs const.])])])
 AC_SUBST([ICONVLIB])])
     AC_DEFINE_UNQUOTED([ICONV_CONST], [$nmh_cv_iconv_const],
       [Define as const if the declaration of iconv() needs const.])])])
 AC_SUBST([ICONVLIB])])
+AC_SUBST([ICONV_ENABLED])
index 4c804155b3145470fba944f052a940fac9f8defe..5a5a223b57148f896dfa8b3175c25b80fcc67c1a 100644 (file)
@@ -14,8 +14,9 @@ test -z "$bindir"  &&  bindir="@bindir@"
 test -z "$mandir"  &&  mandir="@mandir@"
 test -z "$sysconfdir"  &&  sysconfdir="@sysconfdir@"
 test -z "$MULTIBYTE_ENABLED"  &&  MULTIBYTE_ENABLED="@MULTIBYTE_ENABLED@"
 test -z "$mandir"  &&  mandir="@mandir@"
 test -z "$sysconfdir"  &&  sysconfdir="@sysconfdir@"
 test -z "$MULTIBYTE_ENABLED"  &&  MULTIBYTE_ENABLED="@MULTIBYTE_ENABLED@"
+test -z "$ICONV_ENABLED"  &&  ICONV_ENABLED="@ICONV_ENABLED@"
 export MH_TEST_DIR auxexecdir bindir mandir sysconfdir
 export MH_TEST_DIR auxexecdir bindir mandir sysconfdir
-export MULTIBYTE_ENABLED
+export MULTIBYTE_ENABLED ICONV_ENABLED
 
 test -z "$MH_INST_DIR"  &&  MH_INST_DIR="${MH_TEST_DIR}/inst"
 export MH_INST_DIR
 
 test -z "$MH_INST_DIR"  &&  MH_INST_DIR="${MH_TEST_DIR}/inst"
 export MH_INST_DIR
index 1e9349a09163476e360554be40aae00b856a5bbc..819c34c0abd1f42e9e8b60a14b6e02a6e06322bd 100755 (executable)
@@ -72,8 +72,14 @@ fi
 scan -width 80 +inbox 11 > $actual || exit 1
 check "$expected" "$actual"
 
 scan -width 80 +inbox 11 > $actual || exit 1
 check "$expected" "$actual"
 
-# check decoding with an invalid multibyte sequence
-cat >`mhpath new` <<EOF
+#
+# Check decoding with an invalid multibyte sequence.  We skip this test
+# if we don't have iconv support, since it requires converting from one
+# character set to another
+#
+
+if test "$ICONV_ENABLED" -eq 1; then
+    cat >`mhpath new` <<EOF
 From: Test12 <test12@example.com>
 To: Some User <user@example.com>
 Date: Mon, 31 Dec 2012 00:00:00
 From: Test12 <test12@example.com>
 To: Some User <user@example.com>
 Date: Mon, 31 Dec 2012 00:00:00
@@ -85,12 +91,13 @@ This message has an encoded Subject with an invalid character for the
 ISO-8859-1 character set, but it (U+2019) is valid UTF-8.
 EOF
 
 ISO-8859-1 character set, but it (U+2019) is valid UTF-8.
 EOF
 
-cat >"$expected" <<EOF
+    cat >"$expected" <<EOF
   12  12/31 Test12             2013 New Year?s Deals! Start the year right
 EOF
 
   12  12/31 Test12             2013 New Year?s Deals! Start the year right
 EOF
 
-LC_CTYPE=ISO-8859-1 MM_CHARSET=ISO-8859-1 scan -width 75 last >"$actual"
-check "$expected" "$actual"
+    LC_CTYPE=ISO-8859-1 MM_CHARSET=ISO-8859-1 scan -width 75 last >"$actual"
+    check "$expected" "$actual"
+fi
 
 # check scan width with a valid multibyte sequence
 cat >"$expected" <<EOF
 
 # check scan width with a valid multibyte sequence
 cat >"$expected" <<EOF