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