subdir-add-pr46.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #! /bin/sh
  2. # Copyright (C) 2001-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 to make sure that adding a new directory works.
  17. # This test runs 'make' from the top-level directory, the sister
  18. # test 'subdir-add2-pr46.sh' do it from a subdirectory.
  19. # PR automake/46
  20. . test-init.sh
  21. cat >> configure.ac << 'END'
  22. AC_OUTPUT
  23. END
  24. : > Makefile.am
  25. $ACLOCAL
  26. $AUTOCONF
  27. $AUTOMAKE
  28. ./configure
  29. $MAKE
  30. # Now add new directories.
  31. # First we add a new directory by modifying configure.ac directly.
  32. # We update configure.ac *before* updating sub/Makefile.am; the sister
  33. # test 'subdir-add2-pr46.sh' does it in the other way: it updates
  34. # confiles.m4 (which is m4_included by configure.ac there) after
  35. # Makefile.am.
  36. # Modified configure dependencies must be newer than config.status.
  37. $sleep
  38. sed <configure.ac >configure.tmp -e '/^AC_OUTPUT$/i\
  39. AC_CONFIG_FILES([maude/Makefile])\
  40. m4_include([confile.m4])\
  41. ' # Last newline required by older OpenBSD sed.
  42. mv -f configure.tmp configure.ac
  43. cat configure.ac # For debugging.
  44. : > confile.m4
  45. mkdir maude
  46. cat > maude/Makefile.am << 'END'
  47. include_HEADERS = foo.h
  48. END
  49. : > maude/foo.h
  50. echo 'SUBDIRS = maude' >> Makefile.am
  51. # We want a simple rebuild to create maude/Makefile automatically.
  52. $MAKE
  53. grep '^SUBDIRS = *maude *$' Makefile.in
  54. grep '^SUBDIRS = *maude *$' Makefile
  55. test -f maude/Makefile
  56. # Then we add a new directory by modifying a file included (through
  57. # 'm4_include') by configure.ac.
  58. mkdir maude2
  59. # Modified configure dependencies must be newer than config.status.
  60. $sleep
  61. cat >> confile.m4 << 'END'
  62. AC_CONFIG_FILES([maude2/Makefile])
  63. AC_SUBST([GREPME])
  64. END
  65. : > maude2/Makefile.am
  66. echo 'SUBDIRS += maude2' >> Makefile.am
  67. # We want a simple rebuild to create maude2/Makefile and update
  68. # all other Makefiles automatically.
  69. $MAKE
  70. grep '^SUBDIRS =.* maude2' Makefile.in
  71. grep '^SUBDIRS =.* maude2' Makefile
  72. for ext in '.in' ''; do
  73. for d in . maude maude2; do
  74. grep '^GREPME =' $d/Makefile$ext
  75. done
  76. done
  77. :