File: recode-bugs.m4

package info (click to toggle)
enca 1.21-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,948 kB
  • sloc: ansic: 10,297; sh: 5,858; xml: 2,132; makefile: 700; perl: 261
file content (156 lines) | stat: -rw-r--r-- 5,590 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
## GNU recode well-known bugs test.  This file is in public domain.
## Defines:
## RECODE_PROG_BUGGY when at least one of the bugs is present
##
## Checks for:
## whether conversion to UTF-7 loses the `-' in `+-'
##   (reported in Feb 2001)
## whether recode crashes on i/o errors
##   (reported in Feb 2001)
## whether conversion to UCS*/CRLF forgets the last EOL
##   (reported in Mar 2001)
## whether conversion to UTF-8 corrupts files
##   (reported in Mar 2001)
## whether recode crashes on TeX/..ISO-8859-2 conversions
##   (reported in Jul 2001)
## whether recode MacCE map is broken for Latvian
## whether recode built-in KOI8-U map is broken
## whether recode ISO8859-13 to Unicode map is broken.

## GNU recode broken test.
## Prints a warning for broken recode -- no sensible workaround known ;-(
## Maybe we should at least not to use recode for some conversions.
## Defines:
## RECODE_PROG_BUGGY when at least one of the bugs is present
AC_DEFUN([ye_RECODE_BROKEN],
[dnl Check for recode bugs and print a warning if found.
ye_RECODE_BROKEN_UTF8PM
if test "$yeti_cv_prog_recode_utf7pm" = "yes"; then yeti_recode_buggy=yes; fi
ye_RECODE_BROKEN_IOSEGV
if test "$yeti_cv_prog_recode_iosegv" = "yes"; then yeti_recode_buggy=yes; fi
ye_RECODE_BROKEN_UCSCRLF
if test "$yeti_cv_prog_recode_ucscrlf" = "yes"; then yeti_recode_buggy=yes; fi
ye_RECODE_BROKEN_UTF8CORR
if test "$yeti_cv_prog_recode_utf8corr" = "yes"; then yeti_recode_buggy=yes; fi
ye_RECODE_BROKEN_TEXL2SEGV
if test "$yeti_cv_prog_recode_texl2segv" = "yes"; then yeti_recode_buggy=yes; fi
ye_RECODE_BROKEN_MACCELV
if test "$yeti_cv_prog_recode_maccelv" = "yes"; then yeti_recode_buggy=yes; fi
ye_RECODE_BROKEN_KOI8U
if test "$yeti_cv_prog_recode_koi8u" = "yes"; then yeti_recode_buggy=yes; fi
ye_RECODE_BROKEN_ISO885913
if test "$yeti_cv_prog_recode_iso885913" = "yes"; then yeti_recode_buggy=yes; fi
if test "$yeti_recode_buggy" = "yes"; then
  AC_DEFINE(RECODE_PROG_BUGGY,1,[Define if the recode recoder is incredibily buggy.])
fi])

## GNU recode bug test
AC_DEFUN([ye_RECODE_BROKEN_UTF8PM],
[dnl Check whether conversion to UTF-7 loses the - in +-
AC_CACHE_CHECK([whether recode loses - in +- in to-UTF-7 conversion],
  yeti_cv_prog_recode_utf7pm,
  if test "`echo +- | recode l1..utf7 | recode utf7..l1`" = "+-"; then
    yeti_cv_prog_recode_utf7pm=no
  else
    yeti_cv_prog_recode_utf7pm=yes
  fi)
])

## GNU recode bug test
AC_DEFUN([ye_RECODE_BROKEN_IOSEGV],
[dnl Check whether recode crashes on i/o errors
dnl FIXME: this obviously can't work when one is root!
AC_CACHE_CHECK([whether recode crashes on i/o errors],
  yeti_cv_prog_recode_iosegv,
  rm -f core*
  mkdir ac_tmp_dir
  echo >ac_tmp_dir/ac_tmp.txt
  chmod 0555 ac_tmp_dir
  yeti_cv_prog_recode_iosegv=no
  { recode l2..ascii ac_tmp_dir/ac_tmp.txt; } 2>&5 || yeti_cv_prog_recode_iosegv=yes
  if test -n "`ls | grep '^core\(\.[0-9]\+\)\?'`"; then
    yeti_cv_prog_recode_iosegv=yes
  fi
  rm -f core*
  chmod 0777 ac_tmp_dir
  rm -f ac_tmp_dir/ac_tmp.txt
  rmdir ac_tmp_dir)
])

## GNU recode bug test
AC_DEFUN([ye_RECODE_BROKEN_UCSCRLF],
[dnl Check whether conversion to UCS*/CRLF forgets the last EOL
AC_CACHE_CHECK([whether conversion to UCS/CRLF results in odd-sized files],
  yeti_cv_prog_recode_ucscrlf,
  if test "`echo | recode l2..ucs2/crlf | wc -c | sed -e 's: ::g'`" = "5"; then
    yeti_cv_prog_recode_ucscrlf=yes
  else
    yeti_cv_prog_recode_ucscrlf=no
  fi)
])

## GNU recode bug test
AC_DEFUN([ye_RECODE_BROKEN_UTF8CORR],
[dnl Check whether conversion to UTF-8 corrupts files
AC_CACHE_CHECK([whether conversion to UTF-8 corrupts files],
  yeti_cv_prog_recode_utf8corr,
  recode l2..utf8 <$srcdir/m4/long-text.l2 | recode utf8..l2 >ac_tmp.txt
  if diff ac_tmp.txt $srcdir/m4/long-text.l2 1>&5 2>&5; then
    yeti_cv_prog_recode_utf8corr=no
  else
    yeti_cv_prog_recode_utf8corr=yes
  fi
  rm -f ac_tmp.txt)
])

## GNU recode bug test
AC_DEFUN([ye_RECODE_BROKEN_TEXL2SEGV],
[dnl Check whether recode crashes on TeX/..ISO-8859-2 conversion
AC_CACHE_CHECK([whether recode crashes on TeX/..ISO-8859-2 conversions],
  yeti_cv_prog_recode_texl2segv,
  rm -f core* crash-me-a crash-me-b
  cat $srcdir/m4/crash-me >crash-me-a
  cat $srcdir/m4/crash-me >crash-me-b
  yeti_cv_prog_recode_texl2segv=no
  { recode TeX/..ISO-8859-2 crash-me-a crash-me-b; } 2>&5 || yeti_cv_prog_recode_texl2segv=yes
  if test -n "`ls | grep '^core\(\.[0-9]\+\)\?'`"; then
    yeti_cv_prog_recode_texl2segv=yes
  fi
  rm -f core* crash-me-a crash-me-b)
])

## GNU recode bug test
AC_DEFUN([ye_RECODE_BROKEN_MACCELV],
[dnl Check whether recode MacCE map is broken for Latvian
AC_CACHE_CHECK([whether recode MacCE map is broken for Latvian],
  yeti_cv_prog_recode_maccelv,
  if test "`echo  | recode 1257/..macce/`" != ""; then
    yeti_cv_prog_recode_maccelv=yes
  else
    yeti_cv_prog_recode_maccelv=no
  fi)
])

## GNU recode bug test
AC_DEFUN([ye_RECODE_BROKEN_KOI8U],
[dnl Check whether recode KOI8-U map is broken.
AC_CACHE_CHECK([whether recode built-in KOI8-U map is broken],
  yeti_cv_prog_recode_koi8u,
  if test "`echo  | recode -x:libiconv: koi8u..iso88595`" != ""; then
    yeti_cv_prog_recode_koi8u=yes
  else
    yeti_cv_prog_recode_koi8u=no
  fi)
])

## GNU recode bug test
AC_DEFUN([ye_RECODE_BROKEN_ISO885913],
[dnl Check whether recode ISO8859-13 to Unicode map is broken.
AC_CACHE_CHECK([whether recode ISO8859-13 to Unicode map is broken],
  yeti_cv_prog_recode_iso885913,
  if test "`echo  | recode iso8859-13..ucs2 | recode ucs2..l1`" = ""; then
    yeti_cv_prog_recode_iso885913=yes
  else
    yeti_cv_prog_recode_iso885913=no
  fi)
])