compile5.sh 1.9 KB

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