compile2.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #! /bin/sh
  2. # Copyright (C) 2009-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 'compile' deals correctly with Windows-style paths.
  17. am_create_testdir=empty
  18. . test-init.sh
  19. get_shell_script compile
  20. cat >mycc <<'END'
  21. source_seen=no
  22. for arg
  23. do
  24. test "X$arg" = X-o && exit 1
  25. test "X$arg" = "X$amtest_source" && source_seen=yes
  26. done
  27. if test "$source_seen" != yes; then
  28. echo "$0: no source file seen" >&2
  29. exit 1
  30. fi
  31. if test ! -f "$amtest_source"; then
  32. echo "$0: $amtest_source not readable" >&2
  33. exit 1
  34. fi
  35. if test ! -d "$amtest_lock"; then
  36. echo "$0: no lockdir $amtest_lock" >&2
  37. exit 1
  38. fi
  39. touch "$amtest_obj"
  40. END
  41. chmod +x ./mycc
  42. # In case this test runs on a system with backslash directory separators:
  43. mkdir libltdl libltdl/libltdl
  44. # Backslashes in the input and the output name should be accepted.
  45. # Since this test might run on non-w32 systems, we need to be careful not
  46. # to use any backslash sequences which might be interpreted by 'echo'.
  47. amtest_source='libltdl\libltdl\slist.c'
  48. amtest_object='libltdl\libltdl\libltdl_libltdl_la-slist.obj'
  49. amtest_obj='slist.o'
  50. amtest_lock='slist_o.d'
  51. export amtest_source amtest_object amtest_obj amtest_lock
  52. : > "$amtest_source"
  53. ./compile ./mycc -c "$amtest_source" -o "$amtest_object"
  54. test -f "$amtest_object"
  55. # Absolute Windows paths should be accepted.
  56. # Do not actually run this test on anything that could be Windows.
  57. if test -d 'C:\'; then
  58. skip_ "this test shouldn't run on a Windows-like system"
  59. fi
  60. case $PATH_SEPARATOR in
  61. ';'|':');;
  62. *) skip_ "unrecognized PATH separator '$PATH_SEPARATOR'"
  63. esac
  64. amtest_source='C:\libltdl\libltdl\slist.c'
  65. amtest_object='C:\libltdl\libltdl\libltdl_libltdl_la-slist.obj'
  66. amtest_obj='slist.o'
  67. amtest_lock='slist_o.d'
  68. export amtest_source amtest_object amtest_obj amtest_lock
  69. : > "$amtest_source"
  70. ./compile ./mycc -c "$amtest_source" -o "$amtest_object"
  71. test -f "$amtest_object"
  72. :