dist-missing-included-m4.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #! /bin/sh
  2. # Copyright (C) 2011-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. # The stub rules emitted to work around the "deleted header problem"
  17. # for '.m4' files shouldn't prevent "make" from diagnosing a missing
  18. # required '.m4' file from a distribution tarball.
  19. # See discussion about automake bug#9768.
  20. # See also sister test 'dist-missing-m4.sh'.
  21. . test-init.sh
  22. cat >> configure.ac <<'END'
  23. m4_include([foobar.m4])
  24. m4_include([zardoz.m4])
  25. AC_OUTPUT
  26. END
  27. : > foobar.m4
  28. : > zardoz.m4
  29. : > Makefile.am
  30. $ACLOCAL
  31. $AUTOCONF
  32. $AUTOMAKE
  33. ./configure
  34. # A faulty distribution tarball, with a required '.m4' file missing.
  35. # Building from it should fail, both for in-tree and VPATH builds.
  36. ocwd=$(pwd) || fatal_ "cannot get current working directory"
  37. for vpath in false :; do
  38. $MAKE distdir
  39. test -f $distdir/zardoz.m4 # Sanity check.
  40. rm -f $distdir/zardoz.m4
  41. if $vpath; then
  42. # We can't just build in a subdirectory of $distdir, otherwise
  43. # we'll hit automake bug#10111.
  44. mkdir vpath-distcheck
  45. cd vpath-distcheck
  46. ../$distdir/configure
  47. else
  48. cd $distdir
  49. ./configure
  50. fi
  51. run_make -e FAIL -M
  52. # This error will come from automake, not make, so we can be stricter
  53. # in our grepping of it.
  54. grep 'zardoz\.m4.*does not exist' output
  55. grep 'foobar\.m4' output && exit 1 # No spurious error, please.
  56. cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
  57. done
  58. :