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