distlinks.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. # Check that distributed symlinks in the source tree will be expanded
  17. # as regular files in $(distdir).
  18. . test-init.sh
  19. echo text > file
  20. ln -s file lnk || skip_ "cannot create symlinks to files"
  21. mkdir A
  22. mkdir B
  23. echo aaa > A/aaa
  24. cd B
  25. ln -s ../A/aaa bbb
  26. cd ..
  27. echo FooBarBaz > foo
  28. ln -s foo bar1
  29. ln -s bar1 bar2
  30. ln -s bar2 bar3
  31. ln -s "$(pwd)/foo" quux
  32. cat >> configure.ac << 'END'
  33. AC_OUTPUT
  34. END
  35. echo "me = $me" > Makefile.am # For better failure messages.
  36. cat >> Makefile.am << 'END'
  37. EXTRA_DIST = lnk B/bbb bar1 bar2 bar3 quux
  38. .PHONY: test
  39. test: distdir
  40. ls -l $(distdir) $(distdir)/B
  41. fail() { echo "$(me): $$*" >&2; e=1; }; \
  42. e=0; \
  43. set file lnk A/aaa B/bbb foo quux foo bar1 foo bar2 foo bar3; \
  44. while test $$# -ge 2; do \
  45. file=$$1; shift; link=$(distdir)/$$1; shift; \
  46. test -f $$link || fail "$$link is not a regular file"; \
  47. test ! -h $$link || fail "$$link is a symlink"; \
  48. diff $$file $$link || fail "$$link differs from $$file"; \
  49. done; \
  50. exit $$e;
  51. END
  52. ls -l . A B
  53. $ACLOCAL
  54. $AUTOCONF
  55. $AUTOMAKE
  56. ./configure
  57. $MAKE test
  58. :