tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / compile5.sh
1 #! /bin/sh
2 # Copyright (C) 2010-2013 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 . test-init.sh
21
22 get_shell_script compile
23
24 # Use a dummy cl, since cl isn't readily available on all systems
25 cat >cl <<'END'
26 #! /bin/sh
27 echo "$@"
28 END
29
30 chmod +x ./cl
31
32 cat >>configure.ac << 'END'
33 AC_CANONICAL_HOST
34 AC_CONFIG_FILES([check_host], [chmod +x check_host])
35 AC_OUTPUT
36 END
37
38 : >Makefile.am
39
40 # This will be sourced, nor executed.
41 cat >check_host.in << 'END'
42 case '@host_os@' in
43   mingw*)
44     ;;
45   *)
46     skip_ "target OS is not MinGW"
47     ;;
48 esac
49 case @build_os@ in
50   mingw* | cygwin*)
51     ;;
52   *)
53     winepath -w / \
54       || skip_ "not on MinGW or Cygwin, and winepath not available"
55     ;;
56 esac
57 END
58
59 $ACLOCAL
60 $AUTOCONF
61 $AUTOMAKE -a
62 ./configure
63 . ./check_host
64
65 cwd=$(pwd) || fatal_ "cannot get current directory"
66
67 # POSIX mandates that the compiler accepts a space between the -I,
68 # -l and -L options and their respective arguments.  Traditionally,
69 # this should work also without a space.  Try both usages.
70 for sp in '' ' '; do
71   # Check if "compile cl" transforms absolute file names to
72   # host format (e.g /somewhere -> c:/msys/1.0/somewhere).
73   res=$(./compile ./cl -L${sp}"$cwd" | sed -e 's/-link -LIBPATH://')
74   case $res in
75     ?:[\\/]*) ;;
76     *) exit 1 ;;
77   esac
78 done
79
80 :