Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / compile2.test
1 #! /bin/sh
2 # Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Make sure `compile' deals correctly with w32 style paths.
18
19 . ./defs || Exit 1
20
21 set -e
22
23 cp "$testsrcdir/../lib/compile" .
24
25 cat >mycc <<'END'
26 source_seen=no
27 for arg
28 do
29   test "X$arg" = X-o && exit 1
30   test "X$arg" = "X$amtest_source" && source_seen=yes
31 done
32 if test "$source_seen" != yes; then
33   echo "$0: no source file seen" >&2
34   exit 1
35 fi
36 if test ! -f "$amtest_source"; then
37   echo "$0: $amtest_source not readable" >&2
38   exit 1
39 fi
40 if test ! -d "$amtest_lock"; then
41   echo "$0: no lockdir $amtest_lock" >&2
42   exit 1
43 fi
44 touch "$amtest_obj"
45 END
46
47 chmod +x ./mycc
48
49 # In case this test runs on a system with backslash directory separators:
50 mkdir libltdl libltdl/libltdl
51
52 # Backslashes in the input and the output name should be accepted.
53 # Since this test might run on non-w32 systems, we need to be careful not
54 # to use any backslash sequences which might be interpreted by `echo'.
55 amtest_source='libltdl\libltdl\slist.c'
56 amtest_object='libltdl\libltdl\libltdl_libltdl_la-slist.obj'
57 amtest_obj='slist.o'
58 amtest_lock='slist_o.d'
59 export amtest_source amtest_object amtest_obj amtest_lock
60
61 : > "$amtest_source"
62 ./compile ./mycc -c "$amtest_source" -o "$amtest_object"
63 test -f "$amtest_object"
64
65
66 # Absolute w32 paths should be accepted.
67 # Do not actually run this test on anything that could be w32.
68 test -d "C:\\" && Exit 77
69 case $PATH_SEPARATOR in ';'|':');; *) Exit 77;; esac
70
71 amtest_source='C:\libltdl\libltdl\slist.c'
72 amtest_object='C:\libltdl\libltdl\libltdl_libltdl_la-slist.obj'
73 amtest_obj='slist.o'
74 amtest_lock='slist_o.d'
75 export amtest_source amtest_object amtest_obj amtest_lock
76
77 : > "$amtest_source"
78 ./compile ./mycc -c "$amtest_source" -o "$amtest_object"
79 test -f "$amtest_object"
80
81 :