maint: Document how to handle assignment exemption
[automake.git] / t / compile5.sh
blobada706ba06d1954b61408126756a9ec9e5f0a442
1 #! /bin/sh
2 # Copyright (C) 2010-2017 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 the file name translation in the 'compile' script works
18 # correctly
20 . test-init.sh
22 get_shell_script compile
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
30 chmod +x ./cl
32 cat >>configure.ac << 'END'
33 AC_CANONICAL_HOST
34 AC_CONFIG_FILES([check_host], [chmod +x check_host])
35 AC_OUTPUT
36 END
38 : >Makefile.am
40 # This will be sourced, nor executed.
41 cat >check_host.in << 'END'
42 case '@host_os@' in
43 mingw*)
46 skip_ "target OS is not MinGW"
48 esac
49 case @build_os@ in
50 mingw* | cygwin*)
53 winepath -w / \
54 || skip_ "not on MinGW or Cygwin, and winepath not available"
56 esac
57 END
59 $ACLOCAL
60 $AUTOCONF
61 $AUTOMAKE -a
62 ./configure
63 . ./check_host
65 cwd=$(pwd) || fatal_ "cannot get current directory"
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