remake-renamed-m4-macro.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 the name of an m4 macro change. Try both with
  17. # and without indirection.
  18. . test-init.sh
  19. cat >> configure.ac <<'END'
  20. MY_MACRO
  21. AC_OUTPUT
  22. END
  23. cat > Makefile.am <<'END'
  24. ACLOCAL_AMFLAGS = -I m4
  25. .PHONY: test
  26. test:
  27. test '$(the_answer)' -eq 42
  28. END
  29. mkdir m4
  30. cat > m4/macros.m4 <<'END'
  31. AC_DEFUN([MY_MACRO], [FOO_1])
  32. END
  33. cat > m4/foo.m4 <<'END'
  34. AC_DEFUN([FOO_1], [the_answer=42
  35. AC_SUBST([the_answer])])
  36. END
  37. $ACLOCAL -I m4
  38. $AUTOCONF
  39. $AUTOMAKE
  40. ./configure
  41. $MAKE test
  42. $sleep
  43. for x in macros foo; do
  44. sed -e 's/FOO_1/FOO_2/' m4/$x.m4 > t
  45. mv -f t m4/$x.m4
  46. done
  47. using_gmake || $MAKE Makefile
  48. $MAKE test
  49. $sleep
  50. for f in m4/macros.m4 configure.ac; do
  51. sed -e 's/MY_MACRO/YOUR_MACRO/' $f > t
  52. mv -f t $f
  53. done
  54. using_gmake || $MAKE Makefile
  55. $MAKE test
  56. :