Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / autopoint-1
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test for sanity checks.
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 if sanity checks are actually working.
23
24 # no configure.ac
25 $gettext_datadir/autopoint 2>&1 | grep 'Missing configure.in or configure.ac' 2>&1 >/dev/null \
26     || exit 1
27
28 test ! -d intl || exit 1
29 test ! -d m4 || exit 1
30 test ! -d po || exit 1
31
32 # configure.ac without AM_GNU_GETTEXT_VERSION
33 cat <<\EOF >configure.ac
34 AC_INIT
35 AC_CONFIG_SRCDIR(hello.c)
36
37 AC_PROG_CC
38
39 AC_CONFIG_FILES([Makefile])
40 AC_OUTPUT
41 EOF
42
43 $gettext_datadir/autopoint 2>&1 | grep 'Missing version' 2>&1 >/dev/null \
44     || exit 1
45
46 test ! -d intl || exit 1
47 test ! -d m4 || exit 1
48 test ! -d po || exit 1
49
50 # VERSION specified through intl/VERSION file, but in wrong format
51 cat <<\EOF >configure.ac
52 AC_INIT
53 AC_CONFIG_SRCDIR(hello.c)
54
55 AC_PROG_CC
56
57 AC_CONFIG_FILES([Makefile])
58 AC_OUTPUT
59 EOF
60
61 test -d intl || mkdir intl
62 echo bogus-version > intl/VERSION
63
64 $gettext_datadir/autopoint 2>&1 | grep 'Missing version' 2>&1 >/dev/null \
65     || exit 1
66
67 test ! -d m4 || exit 1
68 test ! -d po || exit 1
69
70 # VERSION specified through intl/VERSION file
71 cat <<\EOF >configure.ac
72 AC_INIT
73 AC_CONFIG_SRCDIR(hello.c)
74
75 AC_PROG_CC
76
77 AC_CONFIG_FILES([Makefile])
78 AC_OUTPUT
79 EOF
80
81 test -d intl || mkdir intl
82
83 echo gettext-0.15 > intl/VERSION
84
85 # For further investigation, autopoint keeps autopoint.diff in $TMPDIR
86 # if there is a mismatch.  Set TMPDIR not to pollute /tmp.
87 TMPDIR="$PWD" $gettext_datadir/autopoint 2>&1 | grep 'locally modified' 2>&1 >/dev/null || exit 1
88
89 test ! -d m4 || exit 1
90 test ! -d po || exit 1
91
92 echo 'GNU gettext library from gettext-0.15' > intl/VERSION
93
94 TMPDIR="$PWD" $gettext_datadir/autopoint 2>&1 || exit 1
95
96 rm -fr intl
97
98 exit 0