Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / amhello-cross-compile.test
1 #! /bin/sh
2 # Copyright (C) 2011 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 # Test an example from the manual about the `amhello' package:
18 # cross-compiling a package from Linux/Unix to MinGW.
19
20 required=i586-mingw32msvc-gcc
21 . ./defs || Exit 1
22
23 set -e
24
25 cp "$testsrcdir"/../doc/amhello-1.0.tar.gz . \
26   || fatal_ "cannot get amhello tarball"
27
28 host=i586-mingw32msvc
29 build=`"$testsrcdir"/../lib/config.guess` && test -n "$build" \
30   || fatal_ "cannot guess build platform"
31 case $build in *mingw*) skip_ "build system is MinGW too";; esac
32
33 gzip -dc amhello-1.0.tar.gz | tar xf -
34 cd amhello-1.0
35
36 ./configure --build "$build" --host "$host" > stdout \
37   || { cat stdout ; Exit 1; }
38 cat stdout
39 grep '^checking for i586-mingw32msvc-strip\.\.\.' stdout
40 grep '^checking for i586-mingw32msvc-gcc\.\.\.' stdout
41 grep '^checking for suffix of executables\.\.\. \.exe *$' stdout
42 grep '^checking for suffix of object files\.\.\. o *$' stdout
43 grep '^checking whether i586-mingw32msvc-gcc accepts -g\.\.\. yes' stdout
44
45 $MAKE
46
47 cd src
48 file hello.exe > whatis
49 cat whatis
50 $EGREP 'DOS|Win' whatis
51 grep 'executable' whatis
52 grep 'ELF' whatis && Exit 1
53
54 :