2 # Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Make sure 'compile' searches libraries correctly
19 am_create_testdir=empty
20 required=xsi-lib-shell
23 get_shell_script compile
25 # Use a dummy cl, since cl isn't readily available on all systems
33 # POSIX mandates that the compiler accepts a space between the -I,
34 # -l and -L options and their respective arguments. Traditionally,
35 # this should work also without a space. Try both usages.
37 rm -rf lib lib2 syslib "sys lib2"
50 # Check if compile library search correctly
51 opts=`./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo`
52 test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib"
54 # Check if -static makes compile avoid bar.dll.lib
55 opts=`./compile ./cl foo.c -o foo -L${sp}lib -static -l${sp}bar -l${sp}foo`
56 test x"$opts" = x"foo.c -Fefoo lib/bar.lib $syslib/foo.lib -link -LIBPATH:lib"
61 # Check if compile finds bar.dll.lib in syslib
62 opts=`./compile ./cl foo.c -o foo -l${sp}bar -l${sp}foo`
63 test x"$opts" = x"foo.c -Fefoo $syslib/bar.dll.lib $syslib/foo.lib"
65 # Check if compile prefers -L over $LIB
66 opts=`./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo`
67 test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib"
72 # Check if compile avoids bar.dll.lib in lib2 when -static
73 opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -static -l${sp}bar -l${sp}foo`
74 test x"$opts" = x"foo.c -Fefoo $syslib/bar.lib $syslib/foo.lib -link -LIBPATH:lib2"
76 # Check if compile gets two different bar libraries when -static
77 # is added in the middle
78 opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar -static -l${sp}bar`
79 test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib lib/bar.lib -link -LIBPATH:lib2 -LIBPATH:lib"
81 # Check if compile gets the correct bar.dll.lib
82 opts=`./compile ./cl foo.c -o foo -L${sp}lib -L${sp}lib2 -l${sp}bar -l${sp}foo`
83 test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib -LIBPATH:lib2"
85 # Check if compile gets the correct bar.dll.lib
86 opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar -l${sp}foo`
87 test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib2 -LIBPATH:lib"
90 :> "sys lib2/foo.dll.lib"
92 syslib2="`pwd`/sys lib2"
95 # Check if compile handles spaces in $LIB and that it prefers the order
96 # in a multi-component $LIB.
97 opts=`./compile ./cl foo.c -o foo -l${sp}foo`
98 test x"$opts" = x"foo.c -Fefoo $syslib2/foo.dll.lib"
100 # Check if compile handles the 2nd directory in a multi-component $LIB.
101 opts=`./compile ./cl foo.c -o foo -static -l${sp}foo`
102 test x"$opts" = x"foo.c -Fefoo $syslib/foo.lib"