substref.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #! /bin/sh
  2. # Copyright (C) 2001-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 for bug in variable substitution references when left hand
  17. # pattern is null.
  18. # Report from Richard Boulton.
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_SUBST([CC], [whocares])
  22. AC_OUTPUT
  23. END
  24. : > hello.c
  25. cat > Makefile.am << 'END'
  26. AUTOMAKE_OPTIONS = no-dependencies
  27. var1 = dlmain
  28. var2 = $(var1:=.)
  29. helldl_SOURCES = $(var2:=c)
  30. bin_PROGRAMS = helldl
  31. .PHONY: test
  32. test:
  33. is $(helldl_SOURCES) $(helldl_OBJECTS) == dlmain.c dlmain.$(OBJEXT)
  34. END
  35. $ACLOCAL
  36. $AUTOCONF
  37. $AUTOMAKE -a
  38. ./configure
  39. $MAKE test
  40. # This is unrelated to the rest of this test. But while we are
  41. # at it, make sure we don't use am__helldl_SOURCES_DIST here, since
  42. # it's not needed. DIST_SOURCES should contain $(helldl_SOURCES).
  43. grep am__helldl_SOURCES_DIST Makefile && exit 1
  44. grep 'DIST_SOURCES.*\$(helldl_SOURCES)' Makefile
  45. :