remake-moved-m4-file.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 m4 files get moved among different "include
  17. # dirs" (i.e. those passed to aclocal with '-I' option).
  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 d1 -I d2 -I d3
  25. .PHONY: test
  26. test:
  27. test '$(the_answer)' -eq 42
  28. END
  29. mkdir d1 d2 d3
  30. cat > d1/macros.m4 <<'END'
  31. AC_DEFUN([MY_MACRO], [FOO])
  32. END
  33. cat > d1/foo.m4 <<'END'
  34. AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])])
  35. END
  36. $ACLOCAL -I d1
  37. $AUTOCONF
  38. $AUTOMAKE
  39. ./configure
  40. $MAKE test
  41. # Move one file.
  42. mv d1/foo.m4 d2/foo.m4
  43. using_gmake || $MAKE Makefile
  44. $MAKE test
  45. $MAKE distdir
  46. ls -l $distdir $distdir/*
  47. test -f $distdir/d2/foo.m4
  48. test ! -e $distdir/d1/foo.m4
  49. test -f $distdir/d1/macros.m4
  50. test ! -e $distdir/d2/macros.m4
  51. # Move both files at once.
  52. mv d1/macros.m4 d3/macros.m4
  53. mv d2/foo.m4 d3/foo.m4
  54. using_gmake || $MAKE Makefile
  55. $MAKE test
  56. $MAKE distdir
  57. ls -l $distdir $distdir/*
  58. test -f $distdir/d3/foo.m4
  59. test -f $distdir/d3/macros.m4
  60. test ! -e $distdir/d1/foo.m4
  61. test ! -e $distdir/d2/foo.m4
  62. test ! -e $distdir/d1/macros.m4
  63. test ! -e $distdir/d2/macros.m4
  64. :