summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/autopoint-1
blob: 1a6be8f7df91aa6d50f28dfcee0a329741a01fb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test for sanity checks.

: ${AUTOCONF=autoconf}
${AUTOCONF} --version >/dev/null 2>/dev/null \
  || { echo "Skipping test: autoconf not found"; exit 77; }

cat <<\EOF >configure.ac
AC_PREREQ([2.60])
EOF

${AUTOCONF} >/dev/null 2>/dev/null \
  || { echo "Skipping test: autoconf version too old"; exit 77; }

rm -f configure.ac

gettext_datadir=$top_builddir/misc
export gettext_datadir

# Check if sanity checks are actually working.

# no configure.ac
$gettext_datadir/autopoint 2>&1 | grep 'Missing configure.in or configure.ac' 2>&1 >/dev/null \
    || exit 1

test ! -d intl || exit 1
test ! -d m4 || exit 1
test ! -d po || exit 1

# configure.ac without AM_GNU_GETTEXT_VERSION
cat <<\EOF >configure.ac
AC_INIT
AC_CONFIG_SRCDIR(hello.c)

AC_PROG_CC

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

$gettext_datadir/autopoint 2>&1 | grep 'Missing version' 2>&1 >/dev/null \
    || exit 1

test ! -d intl || exit 1
test ! -d m4 || exit 1
test ! -d po || exit 1

# VERSION specified through intl/VERSION file, but in wrong format
cat <<\EOF >configure.ac
AC_INIT
AC_CONFIG_SRCDIR(hello.c)

AC_PROG_CC

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

test -d intl || mkdir intl
echo bogus-version > intl/VERSION

$gettext_datadir/autopoint 2>&1 | grep 'Missing version' 2>&1 >/dev/null \
    || exit 1

test ! -d m4 || exit 1
test ! -d po || exit 1

# VERSION specified through intl/VERSION file
cat <<\EOF >configure.ac
AC_INIT
AC_CONFIG_SRCDIR(hello.c)

AC_PROG_CC

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

test -d intl || mkdir intl

echo gettext-0.15 > intl/VERSION

# For further investigation, autopoint keeps autopoint.diff in $TMPDIR
# if there is a mismatch.  Set TMPDIR not to pollute /tmp.
TMPDIR="$PWD" $gettext_datadir/autopoint 2>&1 | grep 'locally modified' 2>&1 >/dev/null || exit 1

test ! -d m4 || exit 1
test ! -d po || exit 1

echo 'GNU gettext library from gettext-0.15' > intl/VERSION

TMPDIR="$PWD" $gettext_datadir/autopoint 2>&1 || exit 1

rm -fr intl

exit 0