conflnk4.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #! /bin/sh
  2. # Copyright (C) 2003-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 links to _identical files_ created by AC_CONFIG_LINKS get
  17. # removed with 'make distclean' only if doing a VPATH build.
  18. . test-init.sh
  19. mkdir nonmk-subdir sdir sdir/mk-subdir
  20. : > src
  21. : > sdir/Makefile.am
  22. : > sdir/src2
  23. : > nonmk-subdir/src3
  24. : > sdir/mk-subdir/src4
  25. cat >> Makefile.am <<'EOF'
  26. SUBDIRS = sdir
  27. .PHONY: test
  28. test: distdir
  29. test -f $(distdir)/src
  30. test -f $(distdir)/sdir/src2
  31. test -f $(distdir)/nonmk-subdir/src3
  32. test -f $(distdir)/sdir/mk-subdir/src4
  33. EOF
  34. cat >>configure.ac << 'EOF'
  35. AC_CONFIG_FILES([sdir/Makefile])
  36. AC_CONFIG_LINKS([src:src])
  37. AC_CONFIG_LINKS([sdir/src2:sdir/src2])
  38. AC_CONFIG_LINKS([nonmk-subdir/src3:nonmk-subdir/src3])
  39. AC_CONFIG_LINKS([sdir/mk-subdir/src4:sdir/mk-subdir/src4])
  40. AC_OUTPUT
  41. EOF
  42. $ACLOCAL
  43. $AUTOMAKE
  44. $AUTOCONF
  45. mkdir build
  46. cd build
  47. ../configure
  48. $MAKE test
  49. # Make sure nothing is deleted by 'make clean'
  50. $MAKE clean
  51. test -f ../src
  52. test -f ../sdir/src2
  53. test -f ../nonmk-subdir/src3
  54. test -f ../sdir/mk-subdir/src4
  55. # Make sure the links are deleted by 'make distclean' and the original files
  56. # are not.
  57. $MAKE distclean
  58. test -f ../src
  59. test -f ../sdir/src2
  60. test -f ../nonmk-subdir/src3
  61. test -f ../sdir/mk-subdir/src4
  62. test -r src && exit 1
  63. test -r sdir/src2 && exit 1
  64. test -r nonmk-subdir/src3 && exit 1
  65. test -r sdir/mk-subdir/src4 && exit 1
  66. cd ..
  67. ./configure
  68. $MAKE test
  69. # Make sure nothing is deleted by 'make distclean'
  70. $MAKE distclean
  71. test -f src
  72. test -f sdir/src2
  73. test -f nonmk-subdir/src3
  74. test -f sdir/mk-subdir/src4
  75. :