amhello-cross-compile.sh 1.7 KB

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