c918662f33cd30413a07b505f93665cb57ea3424
[platform/upstream/automake.git] / tests / gettext.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 2006  Free Software Foundation, Inc.
3 #
4 # This file is part of GNU Automake.
5 #
6 # GNU Automake is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10 #
11 # GNU Automake is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Automake; see the file COPYING.  If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
20
21 # Check gettext support.
22
23 required='gettext'
24 . ./defs || exit 1
25
26 set -e
27
28 cat >>configure.in <<END
29 AM_GNU_GETTEXT
30 AM_GNU_GETTEXT_VERSION([0.14.3])
31 AC_OUTPUT
32 END
33
34 : >Makefile.am
35 mkdir po intl
36
37 # config.rpath is required by versions >= 0.14.3.  We try to verify
38 # this requirement, but only when we find we have a working and recent
39 # gettext installation.
40
41 # If aclocal fails here, it may be that gettext is too old to
42 # provide AM_GNU_GETTEXT_VERSION.
43 if $ACLOCAL; then
44
45   # autopoint will fail if it's from an older version.
46   # If gettext is too old to provide autopoint, this will
47   # fail as well, so we're safe here.
48   if autopoint -n; then
49     AUTOMAKE_fails --add-missing
50     grep 'required.*config.rpath' stderr
51   fi
52 fi
53
54 : >config.rpath
55 sed '/AM_GNU_GETTEXT_VERSION/d' configure.in >configure.int
56 mv -f configure.int configure.in
57
58 $ACLOCAL
59
60 # po/ and intl/ are required
61
62 AUTOMAKE_fails --add-missing
63 grep 'AM_GNU_GETTEXT.*SUBDIRS' stderr
64
65 echo 'SUBDIRS = po' >Makefile.am
66 AUTOMAKE_fails --add-missing
67 grep 'AM_GNU_GETTEXT.*intl' stderr
68
69 echo 'SUBDIRS = intl' >Makefile.am
70 AUTOMAKE_fails --add-missing
71 grep 'AM_GNU_GETTEXT.*po' stderr
72
73 # Ok.
74
75 echo 'SUBDIRS = po intl' >Makefile.am
76 $AUTOMAKE --add-missing
77
78 # Make sure distcheck runs ./configure --with-included-gettext
79 grep 'with-included-gettext' Makefile.in
80
81 # `SUBDIRS = po intl' isn't required if po/ doesn't exist.
82 # PR/381.
83
84 rmdir po
85 mkdir sub
86 echo 'SUBDIRS = sub' >Makefile.am
87 $AUTOMAKE
88
89 # Still, SUBDIRS must be defined.
90
91 : >Makefile.am
92 AUTOMAKE_fails --add-missing
93 grep 'AM_GNU_GETTEXT.*SUBDIRS' stderr