* automake.in (scan_one_autoconf_file): Declare
authorAlexandre Duret-Lutz <adl@gnu.org>
Mon, 25 Feb 2002 11:00:35 +0000 (11:00 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Mon, 25 Feb 2002 11:00:35 +0000 (11:00 +0000)
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.

ChangeLog
NEWS
automake.in
lib/am/lex.am
lib/am/yacc.am
stamp-vti
tests/Makefile.am
tests/Makefile.in
tests/lex5.test [new file with mode: 0755]
tests/yacc8.test [new file with mode: 0755]
version.texi

index 84e36a5..6d351eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+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
diff --git a/NEWS b/NEWS
index bb29e0c..becc0c7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@ New in 1.5d:
 * 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'.
index 5bb3d92..69666a5 100755 (executable)
@@ -4922,11 +4922,15 @@ sub scan_one_autoconf_file
        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'");
index e78fb89..24d9d44 100644 (file)
 ## 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%
index 563ba3e..02d7580 100644 (file)
 ?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
index 5479783..d0f6402 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 19 February 2002
+@set UPDATED 21 February 2002
 @set UPDATED-MONTH February 2002
 @set EDITION 1.5e
 @set VERSION 1.5e
index 4aa24b2..37143e7 100644 (file)
@@ -184,6 +184,7 @@ lex.test \
 lex2.test \
 lex3.test \
 lex4.test \
+lex5.test \
 libobj.test \
 libobj2.test \
 libobj3.test \
@@ -355,6 +356,7 @@ yacc4.test \
 yacc5.test \
 yacc6.test \
 yacc7.test \
+yacc8.test \
 yaccpp.test \
 yaccvpath.test
 
index 9d2a15a..22d5e99 100644 (file)
@@ -259,6 +259,7 @@ lex.test \
 lex2.test \
 lex3.test \
 lex4.test \
+lex5.test \
 libobj.test \
 libobj2.test \
 libobj3.test \
@@ -430,6 +431,7 @@ yacc4.test \
 yacc5.test \
 yacc6.test \
 yacc7.test \
+yacc8.test \
 yaccpp.test \
 yaccvpath.test
 
diff --git a/tests/lex5.test b/tests/lex5.test
new file mode 100755 (executable)
index 0000000..62410ef
--- /dev/null
@@ -0,0 +1,73 @@
+#! /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
diff --git a/tests/yacc8.test b/tests/yacc8.test
new file mode 100755 (executable)
index 0000000..f3bb06f
--- /dev/null
@@ -0,0 +1,68 @@
+#! /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
index 5479783..d0f6402 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 19 February 2002
+@set UPDATED 21 February 2002
 @set UPDATED-MONTH February 2002
 @set EDITION 1.5e
 @set VERSION 1.5e