1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test that bind_textdomain_codeset() works.
5
6test -d in-3-1 || mkdir in-3-1
7test -d in-3-1/fr || mkdir in-3-1/fr
8test -d in-3-1/fr/LC_MESSAGES || mkdir in-3-1/fr/LC_MESSAGES
9
10: ${MSGFMT=msgfmt}
11${MSGFMT} -o in-3-1/fr/LC_MESSAGES/tstprog.mo "$wabs_srcdir"/intl-2-1.po
12
13test -d in-3-2 || mkdir in-3-2
14test -d in-3-2/fr || mkdir in-3-2/fr
15test -d in-3-2/fr/LC_MESSAGES || mkdir in-3-2/fr/LC_MESSAGES
16
17: ${MSGFMT=msgfmt}
18${MSGFMT} -o in-3-2/fr/LC_MESSAGES/tstprog.mo "$wabs_srcdir"/intl-2-2.po
19
20: ${DIFF=diff}
21cat <<EOF > in-3-1.ok
22K�se
23EOF
24cat <<EOF > in-3-2.ok
25Käse
26EOF
27
28: ${LOCALE_FR=fr_FR}
29: ${LOCALE_FR_UTF8=fr_FR.UTF-8}
30if test $LOCALE_FR != none; then
31  prepare_locale_ in-3-1/fr in-3-1/$LOCALE_FR
32  prepare_locale_ in-3-2/fr in-3-2/$LOCALE_FR
33  ../intl-3-prg in-3-1 $LOCALE_FR ISO-8859-1 > in-3.tmp || Exit 1
34  LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1
35  ${DIFF} in-3-1.ok in-3.out || Exit 1
36  ../intl-3-prg in-3-2 $LOCALE_FR ISO-8859-1 > in-3.tmp || Exit 1
37  LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1
38  ${DIFF} in-3-1.ok in-3.out || Exit 1
39  ../intl-3-prg in-3-1 $LOCALE_FR UTF-8 > in-3.tmp || Exit 1
40  LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1
41  ${DIFF} in-3-2.ok in-3.out || Exit 1
42  ../intl-3-prg in-3-2 $LOCALE_FR UTF-8 > in-3.tmp || Exit 1
43  LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1
44  ${DIFF} in-3-2.ok in-3.out || Exit 1
45fi
46if test $LOCALE_FR_UTF8 != none; then
47  prepare_locale_ in-3-1/fr in-3-1/$LOCALE_FR_UTF8
48  prepare_locale_ in-3-2/fr in-3-2/$LOCALE_FR_UTF8
49  ../intl-3-prg in-3-1 $LOCALE_FR_UTF8 ISO-8859-1 > in-3.tmp || Exit 1
50  LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1
51  ${DIFF} in-3-1.ok in-3.out || Exit 1
52  ../intl-3-prg in-3-2 $LOCALE_FR_UTF8 ISO-8859-1 > in-3.tmp || Exit 1
53  LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1
54  ${DIFF} in-3-1.ok in-3.out || Exit 1
55  ../intl-3-prg in-3-1 $LOCALE_FR_UTF8 UTF-8 > in-3.tmp || Exit 1
56  LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1
57  ${DIFF} in-3-2.ok in-3.out || Exit 1
58  ../intl-3-prg in-3-2 $LOCALE_FR_UTF8 UTF-8 > in-3.tmp || Exit 1
59  LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1
60  ${DIFF} in-3-2.ok in-3.out || Exit 1
61fi
62if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
63  if test -f /usr/bin/localedef; then
64    echo "Skipping test: no french locale is installed"
65  else
66    echo "Skipping test: no french locale is supported"
67  fi
68  Exit 77
69fi
70
71Exit 0
72