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 `ar-lib' wraps the Microsoft Library Manager (lib) correctly.
19 am_create_testdir
=empty
20 required
=xsi-lib-shell
23 get_shell_script ar-lib
25 # Use a dummy lib, since lib isn't readily available on all systems.
28 if test x"$2" = x-LIST && test x"$3" = xfake.lib; then
30 elif test x"$2" = x-LIST && test x"$3" = xfake2.lib; then
31 printf "%s\n" "dir\\fake2.obj"
33 printf "%s\n" "lib $*"
39 # Check if ar-lib can create an archive with "cr".
40 opts
=`./ar-lib ./lib cr foo.lib foo.obj`
41 test x
"$opts" = x
"lib -NOLOGO -OUT:foo.lib foo.obj"
43 # Check if ar-lib can update an existing archive with "r".
45 opts
=`./ar-lib ./lib r foo.lib foo.obj`
46 test x
"$opts" = x
"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
48 # Check if ar-lib passes on @FILE with "r"
49 opts
=`./ar-lib ./lib r foo.lib @list`
50 test x
"$opts" = x
"lib -NOLOGO -OUT:foo.lib foo.lib @list"
52 # Check if ar-lib can delete a member from an archive with "d".
53 opts
=`./ar-lib ./lib d foo.lib foo.obj`
54 test x
"$opts" = x
"lib -NOLOGO -REMOVE:foo.obj foo.lib"
56 # Check if ar-lib can delete members in an @FILE.
57 echo foo.obj
> foolist
58 opts
=`./ar-lib ./lib d foo.lib @foolist`
59 test x
"$opts" = x
"lib -NOLOGO -REMOVE:foo.obj foo.lib"
61 # Check if ar-lib can list archive members with "t".
62 opts
=`./ar-lib ./lib t foo.lib`
63 test x
"$opts" = x
"lib -NOLOGO -LIST foo.lib"
65 # Check if ar-lib can extract archive members with "x".
67 opts
=`./ar-lib ./lib x fake.lib`
68 test x
"$opts" = x
"lib -NOLOGO -EXTRACT:fake.obj fake.lib"
70 # Check if ar-lib can extract specified archive members with "x".
71 opts
=`./ar-lib ./lib x foo.lib foo.obj`
72 test x
"$opts" = x
"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
74 # Check if ar-lib can extract members in an @FILE.
75 opts
=`./ar-lib ./lib x foo.lib @foolist`
76 test x
"$opts" = x
"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
78 # Check if ar-lib passes -lib and -LTCG through to the wrappee.
79 opts
=`./ar-lib ./lib -lib -LTCG x foo.lib foo.obj`
80 test x
"$opts" = x
"lib -lib -LTCG -NOLOGO -EXTRACT:foo.obj foo.lib"
82 # Check if ar-lib can extract backslashed members.
84 opts
=`./ar-lib ./lib x fake2.lib`
85 test x
"$opts" = x
"lib -NOLOGO -EXTRACT:dir\\fake2.obj fake2.lib"