Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / tests / nocase.at
1 # nocase.at --  test for nocase lib search  -*- Autotest -*-
2 #
3 #   Copyright (C) 2010 Free Software Foundation, Inc.
4 #   Written by Peter Rosin, 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
26 AT_SETUP([nocase library search])
27 AT_KEYWORDS([libtool])
28
29 eval `$LIBTOOL --config | $EGREP '^(want_nocaseglob|file_magic_glob)='`
30
31 AT_CHECK([test "$want_nocaseglob" != yes && ]dnl
32          [test -z "$file_magic_glob" && exit 77],
33           [1], [ignore], [ignore])
34
35 mkdir foo
36 AT_DATA([foo/Foo.c],
37 [
38 int Foo (void) { return 1; }
39 ])
40
41 mkdir bar
42 AT_DATA([bar/bar.c],
43 [
44 extern int Foo (void);
45 int bar (void) { return Foo (); }
46 ])
47
48 AT_DATA([main.c],
49 [
50 extern int bar (void);
51 int main (void) { return bar (); }
52 ])
53
54 libdir=`pwd`/inst/lib
55 mkdir inst inst/bin inst/lib
56
57 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo/Foo.lo foo/Foo.c
58 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o foo/libFoo.la foo/Foo.lo ]dnl
59          [-no-undefined -version-info 1:0:0 -rpath $libdir],
60          [], [ignore], [ignore])
61 AT_CHECK([$LIBTOOL --mode=install cp foo/libFoo.la $libdir],
62          [], [ignore], [ignore])
63 AT_CHECK([$LIBTOOL --mode=clean rm -f foo/libFoo.la],
64          [], [ignore], [ignore])
65
66 rm -f $libdir/libFoo.la
67
68 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar/bar.lo bar/bar.c
69 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o bar/libbar.la bar/bar.lo ]dnl
70          [-L$libdir -lfoo -no-undefined -version-info 1:0:0 -rpath $libdir],
71          [], [ignore], [ignore])
72 AT_CHECK([$LIBTOOL --mode=install cp bar/libbar.la $libdir],
73          [], [ignore], [ignore])
74
75 str=`$EGREP '^(old_library)=' < $libdir/libbar.la`
76 eval "$str"
77 libbar=$old_library
78 rm -f $libdir/$libbar
79
80 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.$OBJEXT main.c
81
82 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -L$libdir -lbar],
83          [], [ignore], [ignore])
84
85 AT_CLEANUP