2
0

remake-deleted-m4-file.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. # Test remake rules when an m4 file gets removed and the macros it
  17. # defined get inlined into the caller. Try with both an indirect
  18. # call and a direct one. This can be seen as testing the "deleted
  19. # header file" issue w.r.t. aclocal.m4 dependencies. See also
  20. # related test 'aclocal-deleted-header.sh'.
  21. . test-init.sh
  22. cat >> configure.ac <<'END'
  23. FOO_MACRO
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am <<'END'
  27. ACLOCAL_AMFLAGS = -I m4
  28. .PHONY: test
  29. test:
  30. test '$(the_answer)' -eq 42
  31. END
  32. macro_value='the_answer=42; AC_SUBST([the_answer])'
  33. mkdir m4
  34. cat > m4/foo.m4 <<'END'
  35. AC_DEFUN([FOO_MACRO], [BAR_MACRO])
  36. END
  37. cat > m4/bar.m4 <<END
  38. AC_DEFUN([BAR_MACRO], [$macro_value])
  39. END
  40. $ACLOCAL -I m4
  41. $AUTOCONF
  42. $AUTOMAKE
  43. ./configure
  44. $MAKE test
  45. $sleep
  46. sed -e "s|BAR_MACRO|$macro_value|" m4/foo.m4 > t
  47. mv -f t m4/foo.m4
  48. rm -f m4/bar.m4
  49. using_gmake || $MAKE Makefile
  50. $MAKE test
  51. $sleep
  52. sed -e "s|FOO_MACRO|$macro_value|" configure.ac > t
  53. mv -f t configure.ac
  54. rm -f m4/foo.m4
  55. using_gmake || $MAKE Makefile
  56. $MAKE test
  57. :