distcheck-pr18286.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #! /bin/sh
  2. # Copyright (C) 2014-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. # Ensure "make distcheck" detects all missing files, without getting
  17. # confused by the fact that they exists in the "original" source tree
  18. # from which "make distcheck" is run. See automake bug#18286.
  19. . test-init.sh
  20. echo AC_OUTPUT >> configure.ac
  21. cat > Makefile.am <<'END'
  22. $(srcdir)/test_data.am: $(srcdir)/test_data.txt $(srcdir)/gen-testdata.sh
  23. cd $(srcdir) && $(SHELL) gen-testdata.sh <test_data.txt >test_data.am
  24. include $(srcdir)/test_data.am
  25. check-local:
  26. is $(testdata) == foo bar
  27. END
  28. cat > test_data.txt <<'END'
  29. foo
  30. bar
  31. END
  32. cat > gen-testdata.sh <<'END'
  33. #!/bin/sh
  34. printf 'testdata = \\\n'
  35. sed 's/$/ \\/'
  36. echo '$(empty_string)'
  37. END
  38. chmod a+x gen-testdata.sh
  39. $sleep
  40. ./gen-testdata.sh <test_data.txt >test_data.am
  41. $ACLOCAL
  42. $AUTOCONF
  43. $AUTOMAKE -a
  44. ./configure
  45. $MAKE check
  46. # Oops, we failed to distribute some required files!
  47. run_make -e FAIL -M distcheck
  48. $FGREP '../../test_data.txt' output
  49. # But if we distribute them, everything will be OK.
  50. echo 'EXTRA_DIST = test_data.txt gen-testdata.sh' >> Makefile.am
  51. using_gmake || $MAKE Makefile
  52. $MAKE distcheck
  53. :