remake-include-aclocal.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #! /bin/sh
  2. # Copyright (C) 2010-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 remake rules for m4 files included (also recursively) by
  17. # aclocal.m4. Keep in sync with sister tests:
  18. # - remake-include-configure.sh
  19. # - remake-include-makefile.sh
  20. . test-init.sh
  21. magic1=::MagicStringOne::
  22. magic2=__MagicStringTwo__
  23. magic3=%%MagicStringThree%%
  24. if using_gmake; then
  25. remake="$MAKE nil"
  26. else
  27. remake="$MAKE Makefile"
  28. fi
  29. cat >> configure.ac <<END
  30. AC_CONFIG_MACRO_DIR([m4])
  31. FINGERPRINT='my_fingerprint'
  32. AC_SUBST([FINGERPRINT])
  33. AC_OUTPUT
  34. END
  35. cat > Makefile.am <<'END'
  36. .PHONY: nil
  37. nil:
  38. ## Used by "make distcheck" later.
  39. check-local:
  40. test -f $(top_srcdir)/m4/foo.m4
  41. test ! -r $(top_srcdir)/m4/bar.m4
  42. test x'$(FINGERPRINT)' = x'DummyValue'
  43. END
  44. mkdir m4
  45. echo 'AC_DEFUN([my_fingerprint], [BadBadBad])' > m4/foo.m4
  46. $ACLOCAL
  47. $AUTOCONF
  48. $AUTOMAKE
  49. for vpath in : false; do
  50. if $vpath; then
  51. mkdir build
  52. cd build
  53. top_srcdir=..
  54. else
  55. top_srcdir=.
  56. fi
  57. $top_srcdir/configure
  58. $MAKE # Should be a no-op.
  59. $sleep
  60. echo "AC_DEFUN([my_fingerprint], [$magic1])" > $top_srcdir/m4/foo.m4
  61. $remake
  62. $FGREP FINGERPRINT Makefile # For debugging.
  63. $FGREP $magic1 Makefile
  64. $sleep
  65. echo "AC_DEFUN([my_fingerprint], [$magic2])" > $top_srcdir/m4/foo.m4
  66. $remake
  67. $FGREP FINGERPRINT Makefile # For debugging.
  68. $FGREP $magic1 Makefile && exit 1
  69. $FGREP $magic2 Makefile
  70. $sleep
  71. echo "m4_include([m4/bar.m4])" > $top_srcdir/m4/foo.m4
  72. echo "AC_DEFUN([my_fingerprint], [$magic3])" > $top_srcdir/m4/bar.m4
  73. $remake
  74. $FGREP FINGERPRINT Makefile # For debugging.
  75. $FGREP $magic1 Makefile && exit 1
  76. $FGREP $magic2 Makefile && exit 1
  77. $FGREP $magic3 Makefile
  78. $sleep
  79. echo "AC_DEFUN([my_fingerprint], [$magic1])" > $top_srcdir/m4/bar.m4
  80. $remake
  81. $FGREP $magic2 Makefile && exit 1
  82. $FGREP $magic3 Makefile && exit 1
  83. $FGREP $magic1 Makefile
  84. $sleep
  85. echo "AC_DEFUN([my_fingerprint], [DummyValue])" > $top_srcdir/m4/foo.m4
  86. echo "AC_DEFUN([AM_UNUSED], [NoSuchMacro])" > $top_srcdir/m4/bar.m4
  87. using_gmake || $remake
  88. $MAKE distcheck
  89. $FGREP $magic1 Makefile && exit 1 # Sanity check.
  90. $FGREP $magic2 Makefile && exit 1 # Likewise.
  91. $FGREP $magic3 Makefile && exit 1 # Likewise.
  92. $MAKE distclean
  93. cd $top_srcdir
  94. done
  95. :