copy.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #! /bin/sh
  2. # Copyright (C) 1999-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 to make sure '-c' works. Report from Andris Pavenis.
  17. # See also the much more in-depth test 'add-missing'.
  18. . test-init.sh
  19. # We'll have to cater to systems like MSYS/MinGW where there are no
  20. # true symlinks ('ln -s' behaves like 'cp -p'); see automake bug#10441.
  21. echo dummy > foo
  22. if ln -s foo bar && test -h bar; then
  23. is_symlink () { test -h "$1"; }
  24. is_not_symlink () { test ! -h "$1"; }
  25. else
  26. is_symlink () { return 0; } # Avoid spurious failures.
  27. is_not_symlink () { return 0; }
  28. fi
  29. rm -f foo bar
  30. # First a simple test, where the auxdir is automatically determined
  31. # by automake.
  32. : > Makefile.am
  33. rm -f install-sh
  34. $ACLOCAL
  35. $AUTOMAKE -c -a
  36. ls -l # For debugging.
  37. test -f install-sh
  38. is_not_symlink install-sh
  39. # Let's do a couple of more elaborated tests, this time with the auxdir
  40. # explicitly defined in configure.ac.
  41. mkdir sub
  42. cd sub
  43. cat > configure.ac <<END
  44. AC_INIT([$me], [1.0])
  45. AC_CONFIG_AUX_DIR([auxdir])
  46. AM_INIT_AUTOMAKE
  47. AC_PROG_CC
  48. AC_CONFIG_FILES([Makefile])
  49. AC_OUTPUT
  50. END
  51. cat > Makefile.am <<END
  52. bin_PROGRAMS = foo
  53. END
  54. $ACLOCAL
  55. # 'automake -a' called without '-c' should create symlinks by default,
  56. # even when there is already a non-symlinked required auxiliary file.
  57. mkdir auxdir
  58. echo FAKE-DEPCOMP > auxdir/depcomp
  59. $AUTOMAKE -a
  60. ls -l auxdir # For debugging.
  61. test -f auxdir/install-sh
  62. is_symlink auxdir/install-sh
  63. test -f auxdir/depcomp
  64. is_not_symlink auxdir/depcomp
  65. test FAKE-DEPCOMP = "$(cat auxdir/depcomp)"
  66. # 'automake -a -c' should not create symlinks, even when there are
  67. # already symlinked required auxiliary files.
  68. rm -rf auxdir
  69. mkdir auxdir
  70. cd auxdir
  71. ln -s "$am_scriptdir/missing" "$am_scriptdir/install-sh" .
  72. cd ..
  73. $AUTOMAKE -a -c
  74. ls -l auxdir # For debugging.
  75. test -f auxdir/install-sh
  76. is_symlink auxdir/install-sh
  77. test -f auxdir/missing
  78. is_symlink auxdir/missing
  79. test -f auxdir/depcomp
  80. is_not_symlink auxdir/depcomp
  81. diff "$am_scriptdir"/depcomp auxdir/depcomp
  82. :