Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / autopoint-2
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test the autopoint program, without Automake.
5
6 : ${AUTOCONF=autoconf}
7 ${AUTOCONF} --version >/dev/null 2>/dev/null \
8   || { echo "Skipping test: autoconf not found"; exit 77; }
9
10 cat <<\EOF >configure.ac
11 AC_PREREQ([2.60])
12 EOF
13
14 ${AUTOCONF} >/dev/null 2>/dev/null \
15   || { echo "Skipping test: autoconf version too old"; exit 77; }
16
17 rm -f configure.ac
18
19 gettext_datadir=$top_builddir/misc
20 export gettext_datadir
21
22 # Check for not copying libintl source.
23 cat <<EOF >configure.ac
24 AC_INIT
25 AC_CONFIG_SRCDIR(hello.c)
26 AC_CONFIG_AUX_DIR([build-aux])
27
28 AC_PROG_CC
29 AM_GNU_GETTEXT([external])
30 AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION])
31
32 AC_CONFIG_FILES([Makefile])
33 AC_CONFIG_FILES([po/Makefile.in])
34 AC_OUTPUT
35 EOF
36
37 $gettext_datadir/autopoint >/dev/null 2>autopoint.err
38 test $? = 0 || { cat autopoint.err; exit 1; }
39
40 test ! -d intl || exit 1
41 test -d m4 || exit 1
42 test -d po || exit 1
43 test -d build-aux || exit 1
44
45 test -f m4/po.m4 || exit 1
46 test -f po/Makefile.in.in || exit 1
47 test -f build-aux/config.rpath || exit 1
48
49 rm -fr m4 po
50
51 # Check for copying libintl source.
52 cat <<EOF >configure.ac
53 AC_INIT
54 AC_CONFIG_SRCDIR(hello.c)
55
56 AC_PROG_CC
57 AM_GNU_GETTEXT
58 AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION])
59
60 AC_CONFIG_FILES([Makefile])
61 AC_CONFIG_FILES([po/Makefile.in])
62 AC_OUTPUT
63 EOF
64
65 $gettext_datadir/autopoint >/dev/null 2>autopoint.err
66 test $? = 0 || { cat autopoint.err; exit 1; }
67
68 test -d intl || exit 1
69 test -d m4 || exit 1
70 test -d po || exit 1
71
72 test -f intl/VERSION || exit 1
73 test -f m4/po.m4 || exit 1
74 test -f po/Makefile.in.in || exit 1
75
76 rm -fr intl m4 po
77
78 # Check for custom macro directory.
79 cat <<EOF >configure.ac
80 AC_INIT
81 AC_CONFIG_SRCDIR(hello.c)
82
83 AC_PROG_CC
84 AM_GNU_GETTEXT([external])
85 AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION])
86
87 # first macro directory, in which po.m4, etc. belong
88 AC_CONFIG_MACRO_DIR([gettext-m4])
89
90 # second macro directory
91 AC_CONFIG_MACRO_DIR([m4])
92
93 AC_CONFIG_FILES([Makefile])
94 AC_CONFIG_FILES([po/Makefile.in])
95 AC_OUTPUT
96 EOF
97
98 $gettext_datadir/autopoint >/dev/null 2>autopoint.err
99 test $? = 0 || { cat autopoint.err; exit 1; }
100
101 test ! -d intl || exit 1
102 test ! -d m4 || exit 1
103 test -d gettext-m4 || exit 1
104 test -d po || exit 1
105
106 test -f gettext-m4/po.m4 || exit 1
107 test -f po/Makefile.in.in || exit 1
108
109 rm -fr gettext-m4 po
110
111 # Check for multiple arguments to AM_GNU_GETTEXT
112 # <https://savannah.gnu.org/bugs/?40082>
113 cat <<EOF >configure.ac
114 AC_INIT
115 AC_CONFIG_SRCDIR(hello.c)
116
117 AC_PROG_CC
118 AM_GNU_GETTEXT([external], [need-formatstring-macros])
119 AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION])
120
121 AC_CONFIG_FILES([Makefile])
122 AC_CONFIG_FILES([po/Makefile.in])
123 AC_OUTPUT
124 EOF
125
126 $gettext_datadir/autopoint >/dev/null 2>autopoint.err
127 test $? = 0 || { cat autopoint.err; exit 1; }
128
129 test ! -d intl || exit 1
130 test -d m4 || exit 1
131 test -d po || exit 1
132
133 test -f m4/po.m4 || exit 1
134 test -f po/Makefile.in.in || exit 1
135
136 rm -fr m4 po
137
138 # Check for certain built-in macros are not in effect when tracing:
139 # <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764580>
140 cat <<EOF >configure.ac
141 AC_INIT
142 AC_CONFIG_SRCDIR(hello.c)
143
144 dnl m4_shiftn internally calls m4_assert, which is disabled by autopoint
145 m4_define([_gt_recurse],
146 [m4_ifblank([\$1], , [_gt_recurse(m4_shiftn(1, \$@))])])
147 _gt_recurse([a], [b], , [c])
148
149 AC_PROG_CC
150 AM_GNU_GETTEXT([external])
151 AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION])
152
153 AC_CONFIG_FILES([Makefile])
154 AC_CONFIG_FILES([po/Makefile.in])
155 AC_OUTPUT
156 EOF
157
158 $gettext_datadir/autopoint >/dev/null 2>autopoint.err
159 test $? = 0 || { cat autopoint.err; exit 1; }
160
161 test ! -d intl || exit 1
162 test -d m4 || exit 1
163 test -d po || exit 1
164
165 test -f m4/po.m4 || exit 1
166 test -f po/Makefile.in.in || exit 1
167
168 rm -fr m4 po
169
170 # Check for AM_GNU_GETTEXT_REQUIRE_VERSION.
171 cat <<EOF >configure.ac
172 AC_INIT
173 AC_CONFIG_SRCDIR(hello.c)
174
175 AC_PROG_CC
176 AM_GNU_GETTEXT_REQUIRE_VERSION([0.19])
177 AM_GNU_GETTEXT([external])
178
179 AC_CONFIG_FILES([Makefile])
180 AC_CONFIG_FILES([po/Makefile.in])
181 AC_OUTPUT
182 EOF
183
184 $gettext_datadir/autopoint >/dev/null 2>autopoint.err
185 test $? = 0 || { cat autopoint.err; exit 1; }
186
187 test ! -d intl || exit 1
188 test -d m4 || exit 1
189 test -d po || exit 1
190
191 test -f m4/po.m4 || exit 1
192 test -f po/Makefile.in.in || exit 1
193
194 # Check for the case where both AM_GNU_GETTEXT_REQUIRE_VERSION and
195 # AM_GNU_GETTEXT_VERSION are used.
196 cat <<EOF >configure.ac
197 AC_INIT
198 AC_CONFIG_SRCDIR(hello.c)
199
200 AC_PROG_CC
201 AM_GNU_GETTEXT
202 AM_GNU_GETTEXT_REQUIRE_VERSION([0.19])
203 # This shall be ignored when AM_GNU_GETTEXT_REQUIRE_VERSION is defined
204 AM_GNU_GETTEXT_VERSION([0.19])
205
206 AC_CONFIG_MACRO_DIR([m4])
207
208 AC_CONFIG_FILES([Makefile])
209 AC_CONFIG_FILES([po/Makefile.in])
210 AC_OUTPUT
211 EOF
212
213 $gettext_datadir/autopoint >autopoint.out 2>autopoint.err
214 test $? = 0 || { cat autopoint.err; exit 1; }
215
216 grep 'using AM_GNU_GETTEXT_REQUIRE_VERSION' autopoint.out 2>&1 >/dev/null || exit 1
217
218 test -d intl || exit 1
219 test -d m4 || exit 1
220 test -d po || exit 1
221
222 cat >autopoint.ver <<EOF
223 GNU gettext library from gettext-$ARCHIVE_VERSION
224 EOF
225 : ${DIFF=diff}
226 ${DIFF} autopoint.ver intl/VERSION || exit 1
227 test -f m4/po.m4 || exit 1
228 test -f po/Makefile.in.in || exit 1