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