summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/autopoint-3
blob: 8ea619be8848626c6bdced4d860267d1ddd1a3d7 (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test the autopoint program, with Automake.

required_gettext_version=0.18.3

: ${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

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

cat <<\EOF >configure.ac
AC_PREREQ([2.60])
AC_INIT([foo], [0.0], [bug-gnu-gettext@gnu.org])
AM_INIT_AUTOMAKE([1.11 foreign])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

: ${ACLOCAL=aclocal}
${ACLOCAL} >/dev/null 2>/dev/null || exit 1

: > Makefile.am

${AUTOMAKE} --add-missing >/dev/null 2>/dev/null \
  || { echo "Skipping test: automake version too old"; exit 77; }

rm -f configure.ac Makefile.am

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

gettext_datadir=$top_builddir/misc
export gettext_datadir

cat <<EOF >configure.ac
AC_CONFIG_MACRO_DIR([m4])

AC_INIT([hello], [0.0.0], [bug-gnu-gettext@gnu.org])
AM_INIT_AUTOMAKE([foreign])

AC_PROG_CC
AM_GNU_GETTEXT
AM_GNU_GETTEXT_VERSION([$required_gettext_version])

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([intl/Makefile])
AC_CONFIG_FILES([po/Makefile.in])
AC_OUTPUT
EOF

cat <<\EOF >Makefile.am
# Example for use of GNU gettext.
# This file is in the public domain.
#
# Makefile configuration - processed by automake.

# The list of subdirectories containing Makefiles.
SUBDIRS = intl po

# The list of programs that are built.
bin_PROGRAMS = hello

# The source files of the 'hello' program.
hello_SOURCES = hello.c gettext.h

# Define a C macro LOCALEDIR indicating where catalogs will be installed.
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@

# Make sure the gettext.h include file is found.
AM_CPPFLAGS = -I. -I$(srcdir)

# Link time dependencies.
LDADD = @LIBINTL@
EOF

cp -p "$abs_top_srcdir"/gnulib-lib/gettext.h .
cp -p "$abs_top_srcdir"/examples/hello-c/hello.c .

$gettext_datadir/autopoint -f >/dev/null 2>/dev/null || exit 1

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

test -f m4/po.m4 || exit 1
test -f po/Makefile.in.in || exit 1

cp -p po/Makevars.template po/Makevars
echo hello.c > po/POTFILES.in

${ACLOCAL} -I m4 >/dev/null 2>/dev/null || exit 1
: ${AUTOHEADER=autoheader}
${AUTOHEADER} >/dev/null 2>/dev/null || exit 1
${AUTOCONF} >/dev/null 2>/dev/null || exit 1
${AUTOMAKE} -a -c >/dev/null 2>/dev/null || exit 1

# Check if libintl compiles.
: ${CONFIG_SHELL=${SHELL-/bin/sh}}
${CONFIG_SHELL} ./configure --with-included-gettext >/dev/null 2>/dev/null \
    || exit 1

${MAKE} >/dev/null 2>/dev/null || exit 1

exit 0