conflnk3.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 that AC_CONFIG_LINKS using a variable source
  17. # is not broken.
  18. . test-init.sh
  19. cat > Makefile.am << 'END'
  20. SUBDIRS = sdir
  21. .PHONY: test
  22. test: distdir
  23. test ! -r $(distdir)/sdir/dest3
  24. test ! -r $(distdir)/sdir/dest2
  25. test ! -r $(distdir)/dest3
  26. test ! -r $(distdir)/dest2
  27. test -f $(distdir)/src2
  28. ## src3 cannot be distributed, Automake knows nothing about it.
  29. test ! -r $(distdir)/sdir/src3
  30. test ! -r $(distdir)/src3
  31. END
  32. : > src
  33. : > src2
  34. mkdir sdir
  35. : > sdir/Makefile.am
  36. : > sdir/src3
  37. cat >>configure.ac << 'EOF'
  38. AC_CONFIG_FILES([sdir/Makefile])
  39. my_src_dir=sdir
  40. my_dest=dest
  41. AC_CONFIG_LINKS([sdir/dest2:src2 sdir/dest3:$my_src_dir/src3])
  42. AC_CONFIG_LINKS([$my_dest:src])
  43. # The following is a link whose source is itself a link.
  44. AC_CONFIG_LINKS([dest4:sdir/dest2])
  45. # Some package prefer to compute links.
  46. cmplink='dest5:src';
  47. AC_CONFIG_LINKS([$cmplink])
  48. AC_OUTPUT
  49. EOF
  50. $ACLOCAL
  51. $AUTOCONF
  52. $AUTOMAKE
  53. # $my_src_dir and $my_dest are variables local to configure, they should
  54. # not appear in Makefile.
  55. grep my_src_dir Makefile.in && exit 1
  56. grep my_dest Makefile.in && exit 1
  57. ./configure
  58. test -r sdir/dest2
  59. test -r sdir/dest3
  60. test -r dest
  61. test -r dest4
  62. test -r dest5
  63. $MAKE test
  64. $MAKE distclean
  65. test ! -e sdir/dest2
  66. test ! -e sdir/dest3
  67. test -r dest # Should still exist, Automake knows nothing about it.
  68. test -r dest5 # Ditto.
  69. rm -f dest dest5
  70. test ! -e dest4
  71. mkdir build
  72. cd build
  73. ../configure
  74. $MAKE test
  75. :