ltmain.in: Use func_warning for all warnings
[libtool.git] / tests / duplicate_deps.at
blobf2e9f667292c636732df224388192c6a9a87f6a9
1 # duplicate_deps.at -- preserve duplicate convenience deps    -*- Autotest -*-
3 #   Copyright (C) 2006-2008, 2011-2019, 2021-2024 Free Software
4 #   Foundation, Inc.
5 #   Written by Ralf Wildenhues, 2006
7 #   This file is part of GNU Libtool.
9 # GNU Libtool is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
14 # GNU Libtool is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Libtool; see the file COPYING.  If not, a copy
21 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
22 # or obtained by writing to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 ####
26 AT_SETUP([preserve duplicate convenience deps])
27 AT_KEYWORDS([libtool])
29 # --preserve-dup-deps should work for convenience archives.
31 # Create a circular dependency of liba and libb:
32 # a1 pulls in b1, that pulls in a2.
33 cat >a1.c <<\EOF
34 extern int b1 ();
35 int a1 () { return b1 (); }
36 EOF
37 cat >a2.c <<\EOF
38 int a2 () { return 0; }
39 EOF
40 cat >b1.c <<\EOF
41 extern int a2 ();
42 int b1 () { return a2 (); }
43 EOF
44 cat >main.c <<\EOF
45 extern int a1 ();
46 int main () { return a1 (); }
47 EOF
49 for file in a1.c a2.c b1.c; do
50   $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
51 done
52 $CC $CPPFLAGS $CFLAGS -c main.c
53 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o liba.la a1.lo a2.lo
55 # This could be worked around by adding liba.la to libb.la
56 # (in that case all objects from liba would be merged into
57 # libb.a as well, possibly renamed.)
58 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libb.la b1.lo liba.la
59 AT_CHECK([$LIBTOOL --mode=link --tag=CC \
60           $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la libb.la],
61           [0], [ignore], [ignore])
62 LT_AT_EXEC_CHECK([./main])
64 # Forgo the workaround and create a true circular dependency.
65 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libb.la b1.lo
66 # Some systems find all symbols anyway; skip this test on such systems.
67 AT_CHECK([$LIBTOOL --mode=link --tag=CC \
68           $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la libb.la liba.la \
69           && exit 77],
70           [1], [ignore], [ignore])
71 # Other systems need special treatment, which currently fails.
72 AT_XFAIL_IF([:])
73 AT_CHECK([$LIBTOOL --mode=link --preserve-dup-deps --tag=CC \
74           $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la libb.la liba.la],
75           [0], [ignore], [ignore])
77 AT_CLEANUP