Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / gettext-7
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test that on glibc systems, gettext() in multithreaded applications works
5 # correctly if different threads operate in different locales referring to
6 # the same catalog file but with different encodings.
7
8 # This test works only on glibc and MacOS X systems.
9 : ${host_os=unknown}
10 : ${GLIBC2=no}
11 { case "$host_os" in
12     *-gnu*) test "$GLIBC2" = yes ;;
13     darwin*) true ;;
14     *) false ;;
15   esac
16 } || {
17   echo "Skipping test: not a glibc or Mac OS X system"
18   exit 77
19 }
20
21 # This test works only on systems that have a de_DE.ISO-8859-1 and
22 # de_DE.UTF-8 locale installed.
23 missing_locale=`../gettext-7-prg 1`
24 if test -n "$missing_locale"; then
25   if test -f /usr/bin/localedef; then
26     echo "Skipping test: locale ${missing_locale} not installed"
27   else
28     echo "Skipping test: locale ${missing_locale} not supported"
29   fi
30   exit 77
31 fi
32
33 test -d gt-7 || mkdir gt-7
34 test -d gt-7/de_DE || mkdir gt-7/de_DE
35 test -d gt-7/de_DE/LC_MESSAGES || mkdir gt-7/de_DE/LC_MESSAGES
36
37 : ${MSGFMT=msgfmt}
38 ${MSGFMT} -o gt-7/de_DE/LC_MESSAGES/tstthread.mo "$abs_srcdir"/gettext-7.po
39
40 ../gettext-7-prg > gt-7.out
41 case $? in
42   0) ;;
43   77)
44     echo "Skipping test: not a glibc >= 2.3 or MacOS X >= 10.5 system"
45     exit 77
46     ;;
47   *)
48     exit 1
49     ;;
50 esac
51
52 exit 0