1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test the autopoint program, with Automake.
5
6: ${AUTOCONF=autoconf}
7${AUTOCONF} --version >/dev/null 2>/dev/null \
8  || { echo "Skipping test: autoconf not found"; Exit 77; }
9
10cat <<\EOF >configure.ac
11AC_PREREQ([2.60])
12EOF
13
14${AUTOCONF} >/dev/null 2>/dev/null \
15  || { echo "Skipping test: autoconf version too old"; Exit 77; }
16
17rm -f configure.ac
18
19: ${AUTOMAKE=automake}
20${AUTOMAKE} --version >/dev/null 2>/dev/null \
21  || { echo "Skipping test: automake not found"; Exit 77; }
22
23cat <<\EOF >configure.ac
24AC_PREREQ([2.60])
25AC_INIT([foo], [0.0], [bug-gnu-gettext@gnu.org])
26AM_INIT_AUTOMAKE([1.11 foreign])
27AC_CONFIG_FILES([Makefile])
28AC_OUTPUT
29EOF
30
31: ${ACLOCAL=aclocal}
32${ACLOCAL} >/dev/null 2>autopoint.err
33test $? = 0 || { cat autopoint.err; Exit 1; }
34
35: > Makefile.am
36
37${AUTOMAKE} --add-missing >/dev/null 2>/dev/null \
38  || { echo "Skipping test: automake version too old"; Exit 77; }
39
40rm -f configure.ac Makefile.am
41
42: ${MAKE=make}
43${MAKE} --version >/dev/null 2>/dev/null \
44  || { echo "Skipping test: make not found"; Exit 77; }
45
46gettext_datadir=$top_builddir/misc
47export gettext_datadir
48
49cat <<EOF >configure.ac
50AC_INIT([hello], [0.0.0], [bug-gnu-gettext@gnu.org])
51AM_INIT_AUTOMAKE([foreign])
52LT_INIT
53
54AC_CONFIG_MACRO_DIR([m4])
55
56AC_PROG_CC
57AM_GNU_GETTEXT([external])
58AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION])
59
60AC_CONFIG_HEADERS([config.h])
61AC_CONFIG_FILES([Makefile])
62AC_CONFIG_FILES([po/Makefile.in])
63AC_OUTPUT
64EOF
65
66cat <<\EOF >Makefile.am
67# Example for use of GNU gettext.
68# This file is in the public domain.
69#
70# Makefile configuration - processed by automake.
71
72# The list of subdirectories containing Makefiles.
73SUBDIRS = po
74
75# The list of programs that are built.
76bin_PROGRAMS = hello
77
78# The source files of the 'hello' program.
79hello_SOURCES = hello.c gettext.h
80
81# Define a C macro LOCALEDIR indicating where catalogs will be installed.
82DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
83
84# Make sure the gettext.h include file is found.
85AM_CPPFLAGS = -I. -I$(srcdir)
86
87# Link time dependencies.
88LDADD = @LTLIBINTL@
89EOF
90
91cp -p "$abs_top_srcdir"/gnulib-lib/gettext.h .
92cp -p "$abs_top_srcdir"/examples/hello-c/hello.c .
93
94$gettext_datadir/autopoint -f >/dev/null 2>autopoint.err
95test $? = 0 || { cat autopoint.err; Exit 1; }
96
97test ! -d intl || Exit 1
98test -d m4 || Exit 1
99test -d po || Exit 1
100
101test -f m4/po.m4 || Exit 1
102test -f po/Makefile.in.in || Exit 1
103
104cp -p po/Makevars.template po/Makevars
105echo hello.c > po/POTFILES.in
106
107${ACLOCAL} -I m4 >/dev/null 2>autopoint.err
108test $? = 0 || { cat autopoint.err; Exit 1; }
109
110: ${AUTOHEADER=autoheader}
111${AUTOHEADER} >/dev/null 2>autopoint.err
112test $? = 0 || { cat autopoint.err; Exit 1; }
113
114${AUTOCONF} >/dev/null 2>autopoint.err
115test $? = 0 || { cat autopoint.err; Exit 1; }
116
117# If ltmain.sh is not present, some installations of Automake fail with an
118# error "configure.ac:3: error: required file './ltmain.sh' not found".
119touch ltmain.sh
120
121${AUTOMAKE} -a -c >/dev/null 2>autopoint.err
122test $? = 0 || { cat autopoint.err; Exit 1; }
123
124# Check that it all compiles.
125: ${CONFIG_SHELL=${SHELL-/bin/sh}}
126${CONFIG_SHELL} ./configure >/dev/null 2>autpoint.err
127test $? = 0 || { cat autopoint.err; Exit 1; }
128
129${MAKE} >/dev/null 2>autopoint.err
130test $? = 0 || { cat autopoint.err; Exit 1; }
131
132${MAKE} dist >/dev/null 2>autopoint.err
133test $? = 0 || { cat autopoint.err; Exit 1; }
134
135Exit 0
136