Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / tests / duplicate_members.at
1 # duplicate_members.at -- duplicate members in archive tests  -*- Autotest -*-
2
3 #   Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
4 #   Written by Alexandre Oliva & Peter O'Gorman, 2005
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 AT_SETUP([duplicate members in archive tests])
26 AT_KEYWORDS([libtool])
27
28 # we don't want to use whole_archive_flag_spec, even if available
29 sed -e 's|^whole_archive_flag_spec=.*|whole_archive_flag_spec=|g' < $LIBTOOL > libtool
30
31 chmod +x ./libtool
32 LIBTOOL=./libtool
33
34 AT_DATA(bar.c,
35 [[extern int foo1 (), foo2 (), foo3 (), foo4 (), foo5 (), foo6 ();
36 int bar() {
37     int result = foo1 () + foo2 () + foo3 () + foo4 () + foo5 () + foo6 ();
38     return result;
39 }
40 ]])
41
42 AT_DATA(main.c,
43 [[int bar();
44 int main()
45 {
46 if (bar() == 21) return 0;
47 return 1;
48 }
49 ]])
50
51
52 for a in 1 2 3 4 5 6
53 do
54   mkdir $a
55   echo "int foo$a() {return $a;}" > $a/a.c
56 done
57
58
59 for a in 1 2 3 4 5 6
60 do
61   $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o $a/a.lo $a/a.c
62 done
63 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libc0.la 6/a.lo
64 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libconv.la ]dnl
65          [1/a.lo 2/a.lo 3/a.lo 4/a.lo 5/a.lo libc0.la], [], [ignore], [ignore])
66
67 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c
68 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbar.la ]dnl
69          [ bar.lo libconv.la -rpath /notexist], [], [ignore], [ignore])
70
71 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.lo main.c
72 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT ]dnl
73          [main.lo ./libbar.la], [], [ignore], [ignore])
74
75 LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
76
77 AT_CLEANUP