remake-include-configure.sh 2.7 KB

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