libltdl belongs to System/Libraries
[platform/upstream/libtool.git] / tests / runpath-in-lalib.at
1 # runpath-in-lalib.at --                         -*- Autotest -*-
2
3 #   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
4 #   Written by Ralf Wildenhues, 2007
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([Runpath in libtool library files])
26 AT_KEYWORDS([libtool])
27
28 AT_DATA([a.c],
29 [[int a () { return 0; }
30 ]])
31 AT_DATA([b.c],
32 [[extern int a ();
33 int b () { return a (); }
34 ]])
35 AT_DATA([m.c],
36 [[extern int b ();
37 int main () { return b (); }
38 ]])
39
40 instdir=`pwd`/inst
41 libdir=$instdir/lib
42 bindir=$instdir/bin
43 addrunpath=`pwd`/foobar
44
45 mkdir $instdir $libdir $bindir
46
47 for file in a.c b.c; do
48   $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
49 done
50 $CC $CPPFLAGS $CFLAGS -c m.c
51 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir -R$addrunpath],
52          [], [ignore], [ignore])
53 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo -rpath $libdir liba.la],
54          [], [ignore], [ignore])
55 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT m.$OBJEXT libb.la],
56          [], [ignore], [ignore])
57 AT_CHECK([$LIBTOOL --mode=install cp liba.la $libdir/liba.la], [], [ignore], [ignore])
58 AT_CHECK([$LIBTOOL --mode=install cp libb.la $libdir/libb.la], [], [ignore], [ignore])
59 AT_CHECK([$LIBTOOL --mode=install cp m$EXEEXT $bindir/m$EXEEXT], [], [ignore], [ignore])
60
61 AT_CHECK([grep /foobar $libdir/liba.la], [], [ignore])
62 AT_CHECK([grep /foobar $libdir/libb.la], [], [ignore])
63
64 # TODO: check that m gets -R, too.
65
66 AT_CLEANUP