Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / tests / tagtrace.test
1 #! /bin/sh
2 # tagtrace.test - check the LT_SUPPORTED_TAGS interface
3 #
4 #   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 #
6 #   This file is part of GNU Libtool.
7 #
8 # GNU Libtool is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
12 #
13 # GNU Libtool is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Libtool; see the file COPYING.  If not, a copy
20 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
21 # or obtained by writing to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ####
24
25 . tests/defs || exit 1
26
27 : ${fnord=$srcdir/fnord$$}
28
29 $AUTOCONF --version > /dev/null 2>&1 || func_skip "This test requires GNU Autoconf"
30 if touch $fnord; then
31   rm $fnord
32 else
33   func_skip "This test requires write access to the source tree"
34 fi
35
36 ( cd "$srcdir" && $AUTOCONF --trace 'LT_SUPPORTED_TAG:$1' ) >/dev/null
37 ret=$?
38 if test $ret -eq 63 || test $ret -eq 1; then
39   func_error "This test requires the same Autoconf version"
40   func_skip  "as the one that was used to bootstrap Libtool"
41 elif test $ret -ne 0; then
42   func_fatal_error "\`$AUTOCONF --trace' exited $ret"
43 fi
44
45 # Abort as soon as something fails.
46 set -e
47
48 # Retrieve the list of tags supported by our main libtool script.
49 traced_tags=`cd "$srcdir" && $AUTOCONF --trace 'LT_SUPPORTED_TAG:$1'`
50
51 test -n "$traced_tags"
52
53 # Ensure each of them is accepted by --tag.
54 # (We do some useless operation like erasing an empty file, because
55 # we are just interested in whether --tag accepts the tag or not.)
56 for tag in $traced_tags; do
57   $LIBTOOL -n --mode=link --tag=$tag compiler -o liba.la foo.lo >output 2>&1
58   cat output
59   if grep 'ignoring unknown tag' output; then
60     exit $EXIT_FAILURE
61   else
62     :
63   fi
64 done
65
66 # Ensure the above command would have failed for unknown tags
67 $LIBTOOL -n --mode=link --tag=UnKnOwN compiler -o liba.la foo.lo >output 2>&1
68 cat output
69 grep 'ignoring unknown tag' output
70
71 rm -f output