dist-missing-m4.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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-included-m4.sh'.
  21. . test-init.sh
  22. cat >> configure.ac <<'END'
  23. m4_pattern_forbid([^MY_])
  24. MY_FOOBAR || exit 1
  25. MY_ZARDOZ || exit 1
  26. AC_OUTPUT
  27. END
  28. mkdir m4
  29. echo 'AC_DEFUN([MY_FOOBAR], [:])' > m4/foobar.m4
  30. echo 'AC_DEFUN([MY_ZARDOZ], [:])' > m4/zardoz.m4
  31. echo 'ACLOCAL_AMFLAGS = -I m4' > Makefile.am
  32. $ACLOCAL -I m4
  33. $AUTOCONF
  34. $AUTOMAKE
  35. ./configure
  36. # A faulty distribution tarball, with a required '.m4' file missing.
  37. # Building from it should fail, both for in-tree and VPATH builds.
  38. ocwd=$(pwd) || fatal_ "cannot get current working directory"
  39. for vpath in false :; do
  40. $MAKE distdir
  41. test -f $distdir/m4/zardoz.m4 # Sanity check.
  42. rm -f $distdir/m4/zardoz.m4
  43. if $vpath; then
  44. # We can't just build in a subdirectory of $distdir, otherwise
  45. # we'll hit automake bug#10111.
  46. mkdir vpath-distcheck
  47. cd vpath-distcheck
  48. ../$distdir/configure
  49. else
  50. cd $distdir
  51. ./configure
  52. fi
  53. run_make -e FAIL -M
  54. # This error will come from autoconf, not make, so we can be stricter
  55. # in our grepping of it.
  56. grep 'possibly undefined .*MY_ZARDOZ' output
  57. grep 'MY_FOOBAR' output && exit 1 # No spurious error, please.
  58. cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
  59. done
  60. :