+2002-02-25 Alexandre Duret-Lutz <duret_g@epita.fr>
+
+ * automake.in (scan_one_autoconf_file): Declare
+ LEX_OUTPUT_ROOT and LEXLIB as configure variables when
+ AM_PROG_LEX or AC_PROG_LEX are seen. This allows to ...
+ * lib/am/lex.am: ... remove the LEX_OUTPUT_ROOT and LEXLIB
+ definitions. Search %SOURCE% in $(srcdir). Use s||| instead
+ of s/// in the sed invocation, to support filenames containing
+ slashes.
+ * lib/am/yacc.am: Search %SOURCE% in $(srcdir). Use s||| too.
+ * tests/lex5.test, tests/yacc8.test: New files.
+ * tests/Makefile.am (TESTS): Add them.
+
2002-02-23 Per Bothner <per@bothner.com>
* m4/depout.m4 (_AM_OUTPUT_DEPENDENCY_COMMANDS): Set `dirpart' to
* aclocal and automake are also installed with the version number
appended, and some of the install directory names have changed.
This lets you have multiple versions installed simultaneously.
+* Support for parsers and lexers in subdirectories.
\f
New in 1.5:
* Support for `configure.ac'.
if (/AM_PROG_LEX/)
{
$configure_vars{'LEX'} = $here;
+ $configure_vars{'LEX_OUTPUT_ROOT'} = $here;
+ $configure_vars{'LEXLIB'} = $here;
$seen_prog_lex = $here;
}
if (/AC_PROG_LEX/ && $filename =~ /configure\.(ac|in)$/)
{
$configure_vars{'LEX'} = $here;
+ $configure_vars{'LEX_OUTPUT_ROOT'} = $here;
+ $configure_vars{'LEXLIB'} = $here;
$seen_prog_lex = $here;
file_warning ($here,
"automake requires `AM_PROG_LEX', not `AC_PROG_LEX'");
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
-## FIXME: These two are to be removed once we trace Autoconf, since
-## they are AC_SUBST'ed.
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LEXLIB = @LEXLIB@
-
?GENERIC?%EXT%%DERIVED-EXT%:
?!GENERIC?%OBJ%: %SOURCE%
if %?MORE-THAN-ONE%
- $(SHELL) $(YLWRAP) %SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE%
+ $(SHELL) $(YLWRAP) `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE%
else !%?MORE-THAN-ONE%
- %COMPILE% %SOURCE%
+ %COMPILE% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
## Edit out `#line' or `#' directives.
- sed '/^#/ s/$(LEX_OUTPUT_ROOT)\.c/%OBJ%/' $(LEX_OUTPUT_ROOT).c >%OBJ%
+ sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|%OBJ%|' $(LEX_OUTPUT_ROOT).c >%OBJ%
rm -f $(LEX_OUTPUT_ROOT).c
endif !%?MORE-THAN-ONE%
?GENERIC?%EXT%%DERIVED-EXT%:
?!GENERIC?%OBJ%: %SOURCE%
if %?MORE-THAN-ONE%
- $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h y.output %BASE%.output -- %COMPILE%
+ $(SHELL) $(YLWRAP) `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h y.output %BASE%.output -- %COMPILE%
else !%?MORE-THAN-ONE%
- %COMPILE% %SOURCE%
+ %COMPILE% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%
## Edit out `#line' or `#' directives.
- sed '/^#/ s/y\.tab\.c/%OBJ%/' y.tab.c >%OBJ%
+ sed '/^#/ s|y\.tab\.c|%OBJ%|' y.tab.c >%OBJ%
rm -f y.tab.c
## Edit out Bison multiple inclusion guards. It may be BISON_Y_TAB_H,
## or Y_TAB_H depending upon the version, that's why the regexp is
-@set UPDATED 19 February 2002
+@set UPDATED 21 February 2002
@set UPDATED-MONTH February 2002
@set EDITION 1.5e
@set VERSION 1.5e
lex2.test \
lex3.test \
lex4.test \
+lex5.test \
libobj.test \
libobj2.test \
libobj3.test \
yacc5.test \
yacc6.test \
yacc7.test \
+yacc8.test \
yaccpp.test \
yaccvpath.test
lex2.test \
lex3.test \
lex4.test \
+lex5.test \
libobj.test \
libobj2.test \
libobj3.test \
yacc5.test \
yacc6.test \
yacc7.test \
+yacc8.test \
yaccpp.test \
yaccvpath.test
--- /dev/null
+#! /bin/sh
+
+# Test for subdir lexers.
+
+required='gcc make gzip'
+. $srcdir/defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_AUX_DIR([.])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = foreign subdir-objects
+LDADD = @LEXLIB@
+
+bin_PROGRAMS = foo/foo
+foo_foo_SOURCES = foo/foo.l
+END
+
+mkdir foo
+
+cat > foo/foo.l << 'END'
+%%
+"END" return EOF;
+.
+%%
+int
+main ()
+{
+ while (yylex () != EOF)
+ ;
+
+ return 0;
+}
+END
+
+set -e
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir sub
+cd sub
+../configure
+$MAKE foo/foo.o
+
+test -f foo/foo.c
+test -f foo/foo.o
+
+# Now, adds another lexer to test ylwrap.
+
+cd ..
+cp foo/foo.l foo/foo2.l
+cat >> Makefile.am << 'END'
+EXTRA_foo_foo_SOURCES = foo/foo2.l
+END
+
+$AUTOMAKE -a
+test -f ./ylwrap
+
+cd sub
+make foo/foo2.o
+test -f foo/foo2.c
+test -f foo/foo2.o
+
+exit 0
--- /dev/null
+#! /bin/sh
+
+# Test for subdir parsers.
+
+required="gcc bison"
+
+. $srcdir/defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_AUX_DIR([.])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = foo/foo
+foo_foo_SOURCES = foo/parse.y
+END
+
+mkdir foo
+
+cat > foo/parse.y << 'END'
+%{
+int yylex () {return 0;}
+void yyerror (char *s) {}
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+# We are not checking Autoconf, so we pick $YACC for it.
+YACC="bison -y"
+export YACC
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir sub
+cd sub
+
+../configure
+$MAKE foo/parse.o
+test -f foo/parse.c
+test -f foo/parse.o
+
+# Now, adds another parser to test ylwrap.
+
+cd ..
+cp foo/parse.y foo/parse2.y
+cat >> Makefile.am << 'END'
+EXTRA_foo_foo_SOURCES = foo/parse2.y
+END
+
+$AUTOMAKE -a
+test -f ./ylwrap
+
+cd sub
+make foo/parse2.o
+test -f foo/parse2.c
+test -f foo/parse2.o
+
+exit 0
-@set UPDATED 19 February 2002
+@set UPDATED 21 February 2002
@set UPDATED-MONTH February 2002
@set EDITION 1.5e
@set VERSION 1.5e