[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: autoconf test for conversion from EUC-CN to UTF-8
From: |
Patrice Dumas |
Subject: |
branch master updated: autoconf test for conversion from EUC-CN to UTF-8 by iconv |
Date: |
Sat, 22 Jul 2023 17:30:27 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new c36daa31fa autoconf test for conversion from EUC-CN to UTF-8 by iconv
c36daa31fa is described below
commit c36daa31faf0d4799f6f2b09aca02a6b909898de
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jul 22 23:30:17 2023 +0200
autoconf test for conversion from EUC-CN to UTF-8 by iconv
* configure.ac, tp/Makefile.am, tp/Texinfo/ModulePath.pm.in,
tp/t/formats_encodings.t (multiple_include_encodings),
tp/t/info_tests.t (chinese_mixed_with_en_EUC_CN): add a runtime check
whether iconv converts EUC-CN to UTF-8. Pass the result through
Makefile.am and Texinfo::ModulePath.
---
ChangeLog | 10 +++++++
configure.ac | 67 +++++++++++++++++++++++++++++++++++++++++----
tp/Makefile.am | 1 +
tp/Texinfo/ModulePath.pm.in | 2 ++
tp/t/formats_encodings.t | 4 ++-
tp/t/info_tests.t | 4 ++-
6 files changed, 81 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2c85f008b3..5d1ccdc354 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-07-22 Patrice Dumas <pertusus@free.fr>
+
+ autoconf test for conversion from EUC-CN to UTF-8 by iconv
+
+ * configure.ac, tp/Makefile.am, tp/Texinfo/ModulePath.pm.in,
+ tp/t/formats_encodings.t (multiple_include_encodings),
+ tp/t/info_tests.t (chinese_mixed_with_en_EUC_CN): add a runtime check
+ whether iconv converts EUC-CN to UTF-8. Pass the result through
+ Makefile.am and Texinfo::ModulePath.
+
2023-07-22 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/api.c (parse_file),
diff --git a/configure.ac b/configure.ac
index b8c3f16503..02194d3060 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,6 +100,63 @@ gl_EARLY
# Rest of Gnulib.
gl_INIT
+ICONV_CONVERTS_EUC_CN=no
+# partly based on gnulib/m4/iconv.m4
+if test "x$am_func_iconv" = "xyes" ; then
+ AC_CACHE_CHECK([whether iconv converts EUC-CN to UTF-8],
[texinfo_cv_sys_iconv_converts_euc_cn], [
+ euc_cn_save_LIBS="$LIBS"
+ #if test $am_cv_lib_iconv = yes; then
+ LIBS="$LIBS $LIBICONV"
+ #fi
+ texinfo_cv_sys_iconv_converts_euc_cn=no
+ for euc_cn_iconv_const in '' 'const'; do
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <iconv.h>
+#include <string.h>
+
+#ifndef ICONV_CONST
+# define ICONV_CONST $euc_cn_iconv_const
+#endif
+ ]],
+ [[int result = 0;
+ {
+ iconv_t cd_euc_cn_to_utf8 = iconv_open ("UTF-8", "EUC-CN");
+ if (cd_euc_cn_to_utf8 != (iconv_t)(-1))
+ {
+ static ICONV_CONST char input[] = "abc";
+ char buf[10];
+ ICONV_CONST char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_euc_cn_to_utf8,
+ &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res != 0)
+ result |= 2;
+ if (strcmp(buf, input))
+ result |= 4;
+ iconv_close (cd_euc_cn_to_utf8);
+ }
+ else
+ result |= 1;
+ }
+ return result;
+]])],
+ [texinfo_cv_sys_iconv_converts_euc_cn=yes], ,)
+ test "$texinfo_cv_sys_iconv_converts_euc_cn" = no || break
+ done
+ LIBS="$euc_cn_save_LIBS"
+ ])
+ if test "$texinfo_cv_sys_iconv_converts_euc_cn" = yes; then
+ ICONV_CONVERTS_EUC_CN=yes
+ fi
+fi
+
+AC_SUBST([ICONV_CONVERTS_EUC_CN])
+
# To generate man pages.
AM_MISSING_PROG(HELP2MAN, help2man)
AM_MISSING_PROG(POD2MAN, pod2man)
@@ -319,7 +376,7 @@ AC_SUBST([USE_UNICODE])
AC_SUBST([USE_EXTERNAL_UNIDECODE])
# i18n support. To update to a new version of gettext, run:
-# gettextize -f --po-dir=po --po-dir=po_document
+# gettextize -f --po-dir=po --po-dir=po_document
# See http://gnu.org/s/gnulib/manual/html_node/gettextize-and-autopoint.html.
AM_GNU_GETTEXT_VERSION([0.21])
AM_GNU_GETTEXT([external])
@@ -349,7 +406,7 @@ case $srcdir in
xs_srcdir=../../../$srcdir/tp ;;
esac
-# Pass on all the options we were given to the subsidiary configure
+# Pass on all the options we were given to the subsidiary configure
# script.
# Don't use AC_CONFIG_SUBDIRS for this because it isn't done right away,
# and we need it for the check that follows.
@@ -437,7 +494,7 @@ AC_ARG_ENABLE([tp-tests],
elif $PERL -e "use 5.007_003; use Encode; use Test::More; use
File::Basename; use File::Copy; use Data::Dumper; use Data::Compare; use
Test::Deep; use Storable qw(dclone); use Getopt::Long qw(GetOptions);" >
/dev/null 2>&1;
then
tp_tests='yes'
- else
+ else
tp_tests='no'
fi
])
@@ -458,7 +515,7 @@ AC_ARG_ENABLE([perl-api-texi-build],
if $PERL -e "use 5.007_003; use Encode; use Pod::Simple::PullParser;" >
/dev/null 2>&1;
then
build_perl_api_texi='yes'
- else
+ else
build_perl_api_texi='no'
fi
])
@@ -503,7 +560,7 @@ AM_CONDITIONAL([POD_SIMPLE_TEXINFO_TESTS], [test
"z$pod_simple_texinfo_tests" =
host_is_windows=no
case "$host" in
*-mingw32 | *-mingw64 | *-msdosdjgpp ) host_is_windows=yes ;;
-esac
+esac
AM_CONDITIONAL([HOST_IS_WINDOWS], [test "x$host_is_windows" = "xyes"])
HOST_IS_WINDOWS_VARIABLE=
if test "x$host_is_windows" = "xyes" ; then
diff --git a/tp/Makefile.am b/tp/Makefile.am
index 2254d0b065..2aa375e419 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -333,6 +333,7 @@ Texinfo/ModulePath.pm: Texinfo/ModulePath.pm.in Makefile
sed -e 's|[@]USE_EXTERNAL_LIBINTL[@]|$(USE_EXTERNAL_LIBINTL)|' \
-e
's|[@]USE_EXTERNAL_EASTASIANWIDTH[@]|$(USE_EXTERNAL_EASTASIANWIDTH)|' \
-e 's|[@]USE_EXTERNAL_UNIDECODE[@]|$(USE_EXTERNAL_UNIDECODE)|' \
+ -e 's|[@]ICONV_CONVERTS_EUC_CN[@]|$(ICONV_CONVERTS_EUC_CN)|' \
$(srcdir)/Texinfo/ModulePath.pm.in >$@
Texinfo/Commands.pm: Texinfo/command_data.txt
diff --git a/tp/Texinfo/ModulePath.pm.in b/tp/Texinfo/ModulePath.pm.in
index c87ed9bde8..d96ffc3f62 100644
--- a/tp/Texinfo/ModulePath.pm.in
+++ b/tp/Texinfo/ModulePath.pm.in
@@ -31,6 +31,8 @@ our $top_srcdir;
# installed locations paths, if not $Texinfo::ModulePath::texinfo_uninstalled
our $pkgdatadir;
+our $conversion_from_euc_cn = '@ICONV_CONVERTS_EUC_CN@';
+
# If $LIB_DIR and $LIBEXEC_DIR are given,
# (likely the installation directories)
# use them to add directories
diff --git a/tp/t/formats_encodings.t b/tp/t/formats_encodings.t
index 86693f8ed6..089c64c334 100644
--- a/tp/t/formats_encodings.t
+++ b/tp/t/formats_encodings.t
@@ -391,7 +391,9 @@ undef, {'test_file' => 'manual_simple_utf8_with_error.texi'}
undef, {'test_file' => 'manual_simple_latin1_with_error.texi'}
],
['multiple_include_encodings',
-undef, {'test_file' => 'multiple_include_encodings.texi'}
+undef, {'test_file' => 'multiple_include_encodings.texi',
+ 'skip' => $Texinfo::ModulePath::conversion_from_euc_cn ne 'yes'
+ ? 'No conversion from UEC-CN' : undef, }
],
['at_commands_in_refs_utf8',
'@setfilename at_commands_in_refs_utf8.info
diff --git a/tp/t/info_tests.t b/tp/t/info_tests.t
index 3ab958c408..3606412198 100644
--- a/tp/t/info_tests.t
+++ b/tp/t/info_tests.t
@@ -1083,7 +1083,9 @@ text @* f nl Something? @* After punct
@end menu
'],
['chinese_mixed_with_en_EUC_CN',
-undef, {'test_file' => 'chinese_mixed_with_en_EUC_CN.texi'}
+undef, {'test_file' => 'chinese_mixed_with_en_EUC_CN.texi',
+ 'skip' => $Texinfo::ModulePath::conversion_from_euc_cn ne 'yes'
+ ? 'No conversion from UEC-CN' : undef, }
],
);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: autoconf test for conversion from EUC-CN to UTF-8 by iconv,
Patrice Dumas <=