Add -lm dependency for gettextlib to fix LTO build
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-po-1
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test C, C++, PO extractors.
5
6 cat <<EOF > xg-po-1.in.po
7 #: file1.c:199
8 #, fuzzy
9 msgid "extract me"
10 msgstr "some text to get fuzzy copied to result"
11
12 #: file2.cc:200
13 msgid "what about me"
14 msgstr ""
15
16 #: file3.c:10
17 #, c-format, fuzzy
18 msgid "hello"
19 msgstr "Again some text for fuzzy"
20 EOF
21
22 cat <<EOF > xg-po-1.c
23 #include <libintl.h>
24 #include <stdio.h>
25 int
26 main (int argc, char *argv[])
27 {
28   printf (dcgettext ("hello", "Hello, world."));
29   return 0;
30 }
31 EOF
32
33 cat <<EOF > xg-po-1.cc
34 #include <iostream.h>
35 #include <libintl.h>
36 #include <locale.h>
37 int
38 main (int argc, char *argv[])
39 {
40   cout << dcgettext ("hello", "Hello world!", LC_MESSAGES) << endl;
41   return 0;
42 }
43 EOF
44
45 : ${XGETTEXT=xgettext}
46 ${XGETTEXT} --omit-header -n \
47   -d xg-po-1.tmp xg-po-1.in.po xg-po-1.c xg-po-1.cc || exit 1
48 LC_ALL=C tr -d '\r' < xg-po-1.tmp.po > xg-po-1.po || exit 1
49
50 cat <<EOF > xg-po-1.ok
51 #: file1.c:199
52 #, fuzzy
53 msgid "extract me"
54 msgstr "some text to get fuzzy copied to result"
55
56 #: file2.cc:200
57 msgid "what about me"
58 msgstr ""
59
60 #: file3.c:10
61 #, fuzzy, c-format
62 msgid "hello"
63 msgstr "Again some text for fuzzy"
64
65 #: xg-po-1.c:6
66 #, c-format
67 msgid "Hello, world."
68 msgstr ""
69
70 #: xg-po-1.cc:7
71 msgid "Hello world!"
72 msgstr ""
73 EOF
74
75 : ${DIFF=diff}
76 ${DIFF} xg-po-1.ok xg-po-1.po
77 result=$?
78
79 exit $result