1#! /bin/sh 2# Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. 16 17# Check that vers*.texi files are automatically created and distributed 18# if @included into a texi source. Also check that they correctly contain 19# the @values definitions they are advertised to. 20# See also the related test 'txinfo-vtexi4.sh', which does similar checks, 21# but for version.texi only, and requires makeinfo, tex and texi2dvi. 22 23. test-init.sh 24 25# We are going to override package version in AC_INIT, so we need 26# to redefine the name of the distdir as well. 27distdir=$me-7.45.3a 28 29# This should work without tex, texinfo or makeinfo. 30TEX=false TEXI2DVI=false MAKEINFO=false 31export TEX TEXI2DVI MAKEINFO 32 33cat > configure.ac << END 34AC_INIT([$me], [7.45.3a]) 35AM_INIT_AUTOMAKE 36AC_CONFIG_FILES([Makefile]) 37AC_OUTPUT 38END 39 40cat > Makefile.am << 'END' 41info_TEXINFOS = foobar.texi quux.texi zardoz.texi 42.PHONY: echo-distfiles 43echo-distfiles: 44 @echo ' ' $(DISTFILES) ' ' 45END 46 47cat > foobar.texi << 'END' 48@setfilename foobar.info 49random text 50@include version.texi 51END 52 53cat > quux.texi << 'END' 54@setfilename quux.info 55@include version-quux.texi 56random text 57END 58 59cat > zardoz.texi << 'END' 60@setfilename zardoz.info 61some randome text 62@include vers1a_2b.texi 63more random text 64END 65 66# Required when using Texinfo. 67: > texinfo.tex 68cp "$am_scriptdir"/mdate-sh . 69 70$ACLOCAL 71$AUTOCONF 72$AUTOMAKE 73 74day='([1-9]|1[0-9]|2[0-9]|3[01])' 75month='(January|February|March|April|May|June|July|August|September|October|November|December)' 76year='20[0-9][0-9]' # Hopefully automake will be obsolete in 80 years ;-) 77date="$day $month $year" 78 79do_check () 80{ 81 # Basename of the vers*.texi file. 82 vfile=$1 83 # The $(srcdir) of the current build. 84 srcdir=$2 85 # The vers*.texi file must be created in $(srcdir). 86 $MAKE $srcdir/$vfile.texi 87 cat $srcdir/$vfile.texi 88 # EDITION and VERSION are synonyms, as per documentation. 89 grep "^@set EDITION 7\\.45\\.3a$" $srcdir/$vfile.texi 90 grep "^@set VERSION 7\\.45\\.3a$" $srcdir/$vfile.texi 91 # Check that UPDATED seems right, and that UPDATED and UPDATED-MONTH 92 # are consistent. 93 $EGREP "^@set UPDATED $date$" $srcdir/$vfile.texi 94 vmonth=$(grep '^@set UPDATED ' $srcdir/$vfile.texi | awk '{print $4, $5}') 95 grep "^@set UPDATED-MONTH $vmonth$" $srcdir/$vfile.texi 96 # Check that the vers*.texi file is distributed according 97 # to $(DISTFILES). 98 $MAKE echo-distfiles # For debugging. 99 $MAKE -s echo-distfiles | grep "[ /]$vfile\\.texi" 100} 101 102mkdir build 103cd build 104../configure 105 106do_check version .. 107do_check version-quux .. 108do_check vers1a_2b .. 109 110# The various $(srcdir)/*.info are required for the distribution 111# and they must be newer than version.texi, so that make won't try 112# to rebuild them. 113$sleep 114touch ../foobar.info 115touch ../quux.info 116touch ../zardoz.info 117# Check that the vers*.texi files are really distributed. 118$MAKE distdir 119ls -l $distdir 120diff ../version.texi $distdir/version.texi 121diff ../version-quux.texi $distdir/version-quux.texi 122diff ../version.texi $distdir/vers1a_2b.texi 123 124: 125