remake-renamed-m4-file.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 renamed.
  17. . test-init.sh
  18. cat >> configure.ac <<'END'
  19. MY_MACRO
  20. AC_OUTPUT
  21. END
  22. cat > Makefile.am <<'END'
  23. ACLOCAL_AMFLAGS = -I m4
  24. .PHONY: test
  25. test:
  26. test '$(the_answer)' -eq 42
  27. END
  28. mkdir m4
  29. cat > m4/macros.m4 <<'END'
  30. AC_DEFUN([MY_MACRO], [FOO])
  31. END
  32. cat > m4/foo.m4 <<'END'
  33. AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])])
  34. END
  35. $ACLOCAL -I m4
  36. $AUTOCONF
  37. $AUTOMAKE
  38. ./configure
  39. $MAKE test
  40. # Rename one file at the time.
  41. mv m4/foo.m4 m4/bar.m4
  42. using_gmake || $MAKE Makefile
  43. $MAKE test
  44. $MAKE distdir
  45. ls -l $distdir $distdir/*
  46. test -f $distdir/m4/bar.m4
  47. test ! -e $distdir/m4/foo.m4
  48. mv m4/macros.m4 m4/defs.m4
  49. using_gmake || $MAKE Makefile
  50. $MAKE test
  51. $MAKE distdir
  52. ls -l $distdir $distdir/*
  53. test -f $distdir/m4/defs.m4
  54. test ! -e $distdir/m4/macros.m4
  55. # Rename both files at once.
  56. mv m4/bar.m4 m4/quux.m4
  57. mv m4/defs.m4 acinclude.m4
  58. using_gmake || $MAKE Makefile
  59. $MAKE test
  60. $MAKE distdir
  61. ls -l $distdir $distdir/*
  62. test -f $distdir/m4/quux.m4
  63. test -f $distdir/acinclude.m4
  64. test ! -e $distdir/m4/foo.m4
  65. test ! -e $distdir/m4/bar.m4
  66. test ! -e $distdir/m4/macros.m4
  67. test ! -e $distdir/m4/defs.m4
  68. :