tests: work around strangeness in MSYS
[automake.git] / tests / compile3.test
blob800db1db1f16c7630a5f7e460e98457a6a7a789a
1 #! /bin/sh
2 # Copyright (C) 2010, 2011 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)
7 # any later version.
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' wraps the Microsoft C/C++ compiler (cl) correctly
19 am_create_testdir=empty
20 required=xsi-lib-shell
21 . ./defs || Exit 1
23 get_shell_script compile
25 # Use a dummy cl, since cl isn't readily available on all systems
26 cat >cl <<'END'
27 #! /bin/sh
28 echo "$@"
29 END
31 chmod +x ./cl
33 # Check if compile handles "-o foo", -I, -l, -L, -Xlinker -Wl,
34 opts=`LIB= ./compile ./cl foo.c -o foo -lbar -Lgazonk -Ibaz -Xlinker foobar -Wl,-foo,bar`
35 test x"$opts" = x"foo.c -Fefoo bar.lib -Ibaz -link -LIBPATH:gazonk foobar -foo bar"
37 # Check if compile handles "-o foo.obj"
38 opts=`./compile ./cl -c foo.c -o foo.obj -Ibaz`
39 test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"
41 # Check if compile handles "-o foo.o"
42 opts=`./compile ./cl -c foo.c -o foo.o -Ibaz`
43 test x"$opts" = x"-c foo.c -Fofoo.o -Ibaz"
45 # Check if compile handles "foo.cc" as C++.
46 opts=`./compile ./cl -c foo.cc -o foo.o -Ibaz`
47 test x"$opts" = x"-c -Tpfoo.cc -Fofoo.o -Ibaz"
49 # Check if compile clears the "eat" variable properly.
50 opts=`eat=1 ./compile ./cl -c foo.c -o foo.obj -Ibaz`
51 test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"