Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / tests / localization.at
1 # localization.at -- libtool and locales                -*- Autotest -*-
2 #
3 #   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
4 #
5 #   This file is part of GNU Libtool.
6 #
7 # GNU Libtool is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of
10 # the License, or (at your option) any later version.
11 #
12 # GNU Libtool is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Libtool; see the file COPYING.  If not, a copy
19 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
20 # or obtained by writing to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 ####
23
24 AT_SETUP([localized compiler messages])
25 AT_KEYWORDS([libtool])
26
27 # Let's try German locale.  :-)
28 m4_pushdef([lt_localize],
29 [LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE])
30
31 AT_DATA([a.c],
32 [[int x[-1];
33 ]])
34 AT_DATA([b.c],
35 [[int y;
36 ]])
37
38 # First see if setting a locale is accepted at all.
39 AT_CHECK([(lt_localize $CC $CPPFLAGS $CFLAGS -c b.c) || exit 77],
40          [], [stdout], [stderr])
41
42 # Find out about expected output.
43 AT_CHECK([(lt_localize $CC $CPPFLAGS $CFLAGS -c a.c) || exit 1],
44          [1], [stdout], [stderr])
45 LT_AT_NORMALIZE_COMPILER_OUTPUT([stdout], [expected-stdout])
46 LT_AT_NORMALIZE_COMPILER_OUTPUT([stderr], [expected-stderr])
47 AT_CHECK([(lt_localize $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a.c) || exit 1],
48          [1], [stdout], [stderr])
49 LT_AT_NORMALIZE_COMPILER_OUTPUT([stdout], [libtool-stdout])
50 LT_AT_NORMALIZE_COMPILER_OUTPUT([stderr], [libtool-stderr])
51 # Avoid these errors:
52 # GNU/Linux:
53 #   /bin/sh: warning: setlocale: LC_ALL: cannot change locale (de_DE)
54 # HP-UX:
55 #   Warning! One or more of your selected locales are not available.
56 #   Please invoke the commands "locale" and "locale -a" to verify your
57 #   selections and the available locales.
58 #
59 #   Continuing processing using the "C" locale.
60 AT_CHECK([grep locale stdout stderr && exit 77], [1])
61 AT_CHECK([diff expected-stderr libtool-stderr])
62 AT_CHECK([diff expected-stdout libtool-stdout])
63
64 # check that we get our quoting right.
65 m4_define([lt_localize],
66 [[LANGUAGE='a; nosuchprogram " '\''  & $x /#+*(){}|,:`\ !%']])
67 AT_CHECK([(lt_localize $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c b.c)],
68          [0], [stdout], [stderr])
69 AT_CHECK([grep nosuchprogram stdout stderr], [1])
70
71 m4_popdef([lt_localize])
72
73 AT_CLEANUP