tests: give few vala tests more significant names
[automake.git] / t / mmodely.sh
blob9147da1f2bf5fafaef88992f434246dd3a58f7be
1 #! /bin/sh
2 # Copyright (C) 2004-2012 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 <http://www.gnu.org/licenses/>.
17 # Verify that intermediate files are only built from Yacc and Lex
18 # sources in maintainer mode.
19 # From Derek R. Price.
21 required=cc
22 . ./defs || exit 1
24 cat >> configure.ac << 'END'
25 AM_MAINTAINER_MODE
26 AC_PROG_CC
27 AM_PROG_LEX
28 AC_PROG_YACC
29 AC_OUTPUT
30 END
32 cat > Makefile.am <<'END'
33 YACC = false
34 LEX = false
35 bin_PROGRAMS = zardoz
36 zardoz_SOURCES = zardoz.y joe.l
37 LDADD = @LEXLIB@
38 END
40 # The point of this test is that it is not dependent on a working lex
41 # or yacc.
42 cat > joe.c <<EOF
43 int joe (int arg)
45 return arg * 2;
47 EOF
48 # On systems which link in libraries non-lazily and whose linkers
49 # complain about unresolved symbols by default, such as Solaris, an
50 # yylex function needs to be defined to avoid an error due to an
51 # unresolved symbol.
52 cat > zardoz.c <<EOF
53 int joe (int arg);
54 int yylex (void)
56 return 0;
58 int main (int argc, char **argv)
60 return joe (argc);
62 EOF
64 # Ensure a later timestamp for our Lex & Yacc sources.
65 $sleep
66 : > joe.l
67 : > zardoz.y
69 $ACLOCAL
70 $AUTOCONF
71 $AUTOMAKE -a
73 ./configure
74 $MAKE
76 cat >myyacc.sh <<'END'
77 #! /bin/sh
78 echo "$@" >y.tab.c
79 END
80 cat >mylex.sh <<'END'
81 echo "$@" >lex.yy.c
82 END
83 chmod +x myyacc.sh mylex.sh
84 PATH=$(pwd)$PATH_SEPARATOR$PATH; export PATH
86 # "make maintainer-clean; ./configure; make" should always work,
87 # per GNU Standard.
88 $MAKE maintainer-clean
89 ./configure
90 YACC="myyacc.sh" LEX="mylex.sh" \
91 LEX_OUTPUT_ROOT='lex.yy' $MAKE -e zardoz.c joe.c
92 $FGREP zardoz.y zardoz.c
93 $FGREP joe.l joe.c