test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / txinfo-vtexi4.sh
bloba3692c2f34e8513d0e0a487e63642faafb7136e6
1 #! /bin/sh
2 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Check that the version.texi file is automatically created and distributed
18 # if @included into a texi source. Also check that is correctly defined
19 # @values definitions it is advertised to.
20 # See also the related test 'txinfo-vtexi3.sh', which does similar checks,
21 # but for more vers*.texi files, and does not require makeinfo, tex and
22 # texi2dvi.
24 required='makeinfo tex texi2dvi grep-nonprint'
25 . test-init.sh
27 # We must use UTC since mdate-sh does, else the UPDATED values might
28 # differ depending on local time.
29 TZ=UTC0; export TZ
31 test $(LC_ALL=C date '+%u') -gt 0 && test $(LC_ALL=C date '+%u') -lt 8 \
32 && day=$(LC_ALL=C date '+%d') && test -n "$day" \
33 && month=$(LC_ALL=C date '+%B') && test -n "$month" \
34 && year=$(LC_ALL=C date '+%Y') && test -n "$year" \
35 || skip_ "'date' is not POSIX-compliant enough"
36 day=$(echo "$day" | sed 's/^0//')
38 cat > configure.ac << END
39 AC_INIT([$me], [123.456])
40 AM_INIT_AUTOMAKE
41 AC_CONFIG_FILES([Makefile])
42 AC_OUTPUT
43 END
45 cat > defs.am <<END
46 my_date_rx = $day $month $year
47 my_month_rx = $month $year
48 my_version_rx = 123\.456
49 END
51 cat > Makefile.am << 'END'
52 include defs.am
53 info_TEXINFOS = foo.texi
54 test-grepinfo:
55 ## Not useless uses of cat: we only tested that grep works on
56 ## non-text input when that's given from a pipe.
57 cat $(srcdir)/foo.info | grep 'GREPVERSION=$(my_version_rx)='
58 cat $(srcdir)/foo.info | grep 'GREPEDITION=$(my_version_rx)='
59 cat $(srcdir)/foo.info | grep 'GREPDATE=$(my_date_rx)='
60 cat $(srcdir)/foo.info | grep 'GREPMONTH=$(my_month_rx)='
61 test-distfiles:
62 @echo DISTFILES = $(DISTFILES)
63 echo ' ' $(DISTFILES) ' ' | grep '[ /]version.texi '
64 test-distdir: distdir
65 ls -l $(distdir)
66 diff $(srcdir)/version.texi $(distdir)/version.texi
67 .PHONY: test-grepinfo test-distfiles test-distdir
68 check-local: test-grepinfo test-distfiles test-distdir
69 END
71 cat > foo.texi << 'END'
72 \input texinfo
73 @c %**start of header
74 @setfilename foo.info
75 @settitle Zardoz
76 @c %**end of header
78 @node Top
79 @include version.texi
81 GREPVERSION=@value{VERSION}=
83 GREPEDITION=@value{EDITION}=
85 GREPDATE=@value{UPDATED}=
87 GREPMONTH=@value{UPDATED-MONTH}=
89 @bye
90 END
92 $ACLOCAL
93 $AUTOCONF
94 $AUTOMAKE -a
96 ./configure
97 $MAKE all dvi
99 # Debugging & sanity checks.
100 ls -l
101 cat version.texi
102 cat foo.info
103 test -f foo.dvi
105 $MAKE test-grepinfo
106 $MAKE test-distfiles
107 $MAKE test-distdir
108 $MAKE distcheck