1 # inherited_flags.at -- test inherited_linker_flags -*- Autotest -*-
3 # Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4 # Written by Peter O'Garman, 2005
6 # This file is part of GNU Libtool.
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.
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.
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.
26 AT_SETUP([inherited_linker_flags])
27 AT_KEYWORDS([libtool])
31 int foo() { return 1;}
36 int bar() { return 1;}
41 int baz() { return 1;}
46 int both() { return 1;}
51 int main() { return 0;}
54 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo.lo foo.c
55 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c
56 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o baz.lo baz.c
57 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o both.lo both.c
58 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.lo main.c
59 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libfoo.la foo.lo -rpath /nonexistent -no-undefined
60 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbar.la bar.lo -rpath /nonexistent -no-undefined
61 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libboth.la both.lo -rpath /nonexistent -no-undefined
64 mv libfoo.la libfoo.la.bak
65 sed -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_inlikely_existing_lib/g' < libfoo.la.bak > libfoo.la
68 mv libbar.la libbar.la.bak
69 sed -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_unlikely_existing_lib/g' < libbar.la.bak > libbar.la
72 mv libboth.la libboth.la.bak
73 sed -e "s/^inherited_linker_flags.*/inherited_linker_flags='-llt_inlikely_existing_lib -llt_unlikely_existing_lib'/g" < libboth.la.bak > libboth.la
76 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la],
77 [ignore],[stdout],[ignore])
79 # 'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'
80 # here. This fails on win32/MSVC because the generated command lines have a
81 # different syntax. So drop the first `l'.
82 AT_CHECK([$LIBTOOL --features | grep 'disable shared libraries' && (exit 77)], [1], [ignore])
83 AT_CHECK([grep 'lt_[[ui]]nlikely_existing_lib.*lt_[[ui]]nlikely_existing_lib' stdout],
84 [0],[ignore],[ignore])
85 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la],
86 [ignore],[stdout],[ignore])
87 AT_CHECK([grep 'lt_[[ui]]nlikely_existing_lib.*lt_[[ui]]nlikely_existing_lib' stdout],
88 [0],[ignore],[ignore])
90 # now check for duplicates
91 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la ./libboth.la],
92 [ignore],[stdout],[ignore])
93 AT_CHECK([grep 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout],
94 [1],[ignore],[ignore])
95 AT_CHECK([grep 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout],
96 [1],[ignore],[ignore])
97 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la ./libboth.la],
98 [ignore],[stdout],[ignore])
99 AT_CHECK([grep 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout],
100 [1],[ignore],[ignore])
101 AT_CHECK([grep 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout],
102 [1],[ignore],[ignore])
104 mv libboth.la libboth.la.bak
105 sed "s/^inherited_linker_flags.*/inherited_linker_flags='-framework Cocoa -framework ApplicationServices'/" < libboth.la.bak > libboth.la
108 AT_CHECK([$LIBTOOL -n --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -framework Cocoa -framework ApplicationServices -o libbaz.la baz.lo libboth.la -no-undefined -rpath /nonexistent],
109 [], [stdout], [ignore])
110 AT_CHECK([grep Cocoa.ltframework stdout], [1], [], [])
111 AT_CHECK([grep ' -framework Cocoa' stdout], [0], [ignore], [])