Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / compile5.test
1 #! /bin/sh
2 # Copyright (C) 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 the file name translation in the `compile' script works
18 # correctly
19
20 . ./defs || Exit 1
21
22 set -e
23
24 cp "$testsrcdir/../lib/compile" .
25
26 # Use a dummy cl, since cl isn't readily available on all systems
27 cat >cl <<'END'
28 #! /bin/sh
29 echo "$@"
30 END
31
32 chmod +x ./cl
33
34 cat >>configure.in << 'END'
35 AC_CANONICAL_HOST
36 AC_CONFIG_FILES([check_host], [chmod +x check_host])
37 AC_OUTPUT
38 END
39
40 : >Makefile.am
41
42 cat >check_host.in << 'END'
43 #! /bin/sh
44 case @host_os@ in
45   mingw*)
46     ;;
47   *)
48     exit 77
49     ;;
50 esac
51 case @build_os@ in
52   mingw* | cygwin*)
53     ;;
54   *)
55     winepath -w / || exit 77
56     ;;
57 esac
58 END
59
60 $ACLOCAL
61 $AUTOCONF
62 $AUTOMAKE -a
63 ./configure
64 ./check_host
65
66 pwd=`pwd`
67
68 # POSIX mandates that the compiler accepts a space between the -I,
69 # -l and -L options and their respective arguments.  Traditionally,
70 # this should work also without a space.  Try both usages.
71 for sp in '' ' '; do
72   # Check if "compile cl" transforms absolute file names to
73   # host format (e.g /somewhere -> c:/msys/1.0/somewhere).
74
75   res=`./compile ./cl -L${sp}"$pwd" | sed -e 's/-link -LIBPATH://'`
76
77   case $res in
78     ?:[\\/]*)
79       ;;
80     *)
81       Exit 1
82       ;;
83   esac
84 done
85
86 :