txinfo-include.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #! /bin/sh
  2. # Copyright (C) 2012-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. # Texinfo input files using @include directives. Check both in-tree
  17. # and VPATH builds, and both top-level and subdir input.
  18. required='makeinfo tex texi2dvi'
  19. . test-init.sh
  20. echo AC_OUTPUT >> configure.ac
  21. cat > Makefile.am << 'END'
  22. info_TEXINFOS = main.texi sub/more.texi
  23. main_TEXINFOS = one.texi two.texi three.texi
  24. sub_more_TEXINFOS = sub/desc.texi sub/hist.texi
  25. END
  26. cat > main.texi << 'END'
  27. \input texinfo
  28. @setfilename main.info
  29. @settitle main
  30. @ifnottex
  31. @node Top
  32. @top GNU dummy.
  33. @menu
  34. * one:: Chapter one
  35. * two:: Chapter two
  36. * three:: Chapter three
  37. @end menu
  38. @end ifnottex
  39. @include one.texi
  40. @include two.texi
  41. @include three.texi
  42. @bye
  43. END
  44. cat > one.texi << 'END'
  45. @node one
  46. @chapter Chapter one
  47. Foo bar, baz.
  48. END
  49. cat > two.texi << 'END'
  50. @node two
  51. @chapter Chapter two
  52. Blah Blah Blah.
  53. END
  54. cat > three.texi << 'END'
  55. @node three
  56. @chapter Chapter two
  57. GNU's Not Unix.
  58. END
  59. mkdir sub
  60. cat > sub/more.texi << 'END'
  61. \input texinfo
  62. @setfilename more.info
  63. @settitle main
  64. @ifnottex
  65. @node Top
  66. @top GNU more.
  67. @menu
  68. * desc:: Description of this program
  69. * hist:: History of this program
  70. @end menu
  71. @end ifnottex
  72. @include desc.texi
  73. @include hist.texi
  74. @bye
  75. END
  76. cat > sub/desc.texi << 'END'
  77. @node desc
  78. @chapter Description of this program
  79. It does something, really.
  80. END
  81. cat > sub/hist.texi << 'END'
  82. @node hist
  83. @chapter History of this program
  84. It was written somehow.
  85. END
  86. cat > exp << 'END'
  87. ./main.info
  88. ./sub/more.info
  89. END
  90. check_info_contents ()
  91. {
  92. srcdir=${1-.}
  93. $FGREP "Foo bar, baz." $srcdir/main.info
  94. $FGREP "Blah Blah Blah." $srcdir/main.info
  95. $FGREP "GNU's Not Unix." $srcdir/main.info
  96. $FGREP 'It does something, really.' $srcdir/sub/more.info
  97. $FGREP 'It was written somehow.' $srcdir/sub/more.info
  98. }
  99. get_info_names ()
  100. {
  101. find ${1-.} -type f -name '*.info' | LC_ALL=C sort > got
  102. }
  103. check_expected ()
  104. {
  105. cat exp
  106. cat got
  107. diff exp got
  108. }
  109. $ACLOCAL
  110. $AUTOMAKE --add-missing
  111. $AUTOCONF
  112. ./configure
  113. $MAKE info
  114. get_info_names
  115. check_expected
  116. check_info_contents
  117. $MAKE dvi
  118. test -f main.dvi
  119. test -f sub/more.dvi
  120. $MAKE maintainer-clean
  121. test ! -f main.dvi
  122. test ! -f sub/more.dvi
  123. test ! -f main.info
  124. test ! -f sub/more.info
  125. mkdir build
  126. cd build
  127. ../configure
  128. $MAKE all dvi
  129. get_info_names ..
  130. sed 's|^\./|../|' ../exp > exp
  131. check_expected
  132. test -f main.dvi
  133. test -f sub/more.dvi
  134. check_info_contents ..
  135. $MAKE distcheck
  136. :