2 # Copyright (C) 2010 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
23 cp "$testsrcdir/../lib/compile" .
25 # Use a dummy cl, since cl isn't readily available on all systems
44 # Check if compile library search correctly
45 opts
=`./compile ./cl foo.c -o foo -Llib -lbar -lfoo`
46 test x
"$opts" = x
"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib"
48 # Check if -static makes compile avoid bar.dll.lib
49 opts
=`./compile ./cl foo.c -o foo -Llib -static -lbar -lfoo`
50 test x
"$opts" = x
"foo.c -Fefoo lib/bar.lib $syslib/foo.lib -link -LIBPATH:lib"
55 # Check if compile finds bar.dll.lib in syslib
56 opts
=`./compile ./cl foo.c -o foo -lbar -lfoo`
57 test x
"$opts" = x
"foo.c -Fefoo $syslib/bar.dll.lib $syslib/foo.lib"
59 # Check if compile prefers -L over $LIB
60 opts
=`./compile ./cl foo.c -o foo -Llib -lbar -lfoo`
61 test x
"$opts" = x
"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib"
66 # Check if compile avoids bar.dll.lib in lib2 when -static
67 opts
=`./compile ./cl foo.c -o foo -Llib2 -static -lbar -lfoo`
68 test x
"$opts" = x
"foo.c -Fefoo $syslib/bar.lib $syslib/foo.lib -link -LIBPATH:lib2"
70 # Check if compile gets two different bar libraries when -static
71 # is added in the middle
72 opts
=`./compile ./cl foo.c -o foo -Llib2 -Llib -lbar -static -lbar`
73 test x
"$opts" = x
"foo.c -Fefoo lib2/bar.dll.lib lib/bar.lib -link -LIBPATH:lib2 -LIBPATH:lib"
75 # Check if compile gets the correct bar.dll.lib
76 opts
=`./compile ./cl foo.c -o foo -Llib -Llib2 -lbar -lfoo`
77 test x
"$opts" = x
"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib -LIBPATH:lib2"
79 # Check if compile gets the correct bar.dll.lib
80 opts
=`./compile ./cl foo.c -o foo -Llib2 -Llib -lbar -lfoo`
81 test x
"$opts" = x
"foo.c -Fefoo lib2/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib2 -LIBPATH:lib"
84 :> "sys lib2/foo.dll.lib"
86 syslib2
="`pwd`/sys lib2"
89 # Check if compile handles spaces in $LIB and that it prefers the order
90 # in a multi-component $LIB.
91 opts
=`./compile ./cl foo.c -o foo -lfoo`
92 test x
"$opts" = x
"foo.c -Fefoo $syslib2/foo.dll.lib"
94 # Check if compile handles the 2nd directory in a multi-component $LIB.
95 opts
=`./compile ./cl foo.c -o foo -static -lfoo`
96 test x
"$opts" = x
"foo.c -Fefoo $syslib/foo.lib"