Hi,

I would like to propose a set of diffs to enable compilation of gcc
without requiring flex/bison. I feel that this would greatly benefit
the variety of users building gcc.

The only files which really need these are:

gcc/gengtype-lex.l
gcc/treelang/lex.l
gcc/treelang/parse.y

One more thing to note is that, in the toplevel directories: intl/
(for libintl) and libjava/ already ship with the bison-ed .y files (as
plural.c and XQueryParser.java) respectively; They are also present in
the svn repository. So I fell it wouldn't be against the rule to ship
these as part of the core-distro as well.

I wish that this same procedure is applied to the files I have mentioned above.

Things to be done:

1. flex gcc/gengtype-lex.l into gcc/gengtype-lex.c
2. flex gcc/treelang/lex.l into gcc/treelang/lex.c
3. bison gcc/treelang/parse.y into gcc/treelang/parse.h,
gcc/treelang/parse.c, gcc/treelang/parse.output (bison's output)

And finally:

4. Cleanup gcc/Makefile.in, gcc/treelang/Make-lang.in, gcc/configure.ac
5. Rerun autoconf in gcc/.

Because the version of flex/bison/autoconf on my build system may be
newer than what is used by the maintainers, I am not unable to send
patches for 1, 2, 3 and 5. I am sending the diffs for 4. If someone
can help me with the rest/in submitting a diff, Please reply to this.

I hereby request for comments/acknowledgments/suggestions;

-- 
Karthik
--- gcc/configure.ac	2007-11-08 22:09:59.000000000 +0530
+++ ../configure.ac	2007-11-26 16:31:16.000000000 +0530
@@ -865,14 +865,6 @@
 
 MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing"
 
-# How about lex?
-dnl Don't use AC_PROG_LEX; we insist on flex.
-dnl LEXLIB is not useful in gcc.
-AC_CHECK_PROGS([FLEX], flex, [$MISSING flex])
-
-# Bison?
-AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
-
 # Binutils are not build modules, unlike bison/flex/makeinfo.  So we
 # check for build == host before using them.
 
--- gcc/Makefile.in	2007-11-13 19:23:33.000000000 +0530
+++ ../Makefile.in	2007-11-26 16:36:00.000000000 +0530
@@ -209,10 +209,6 @@
 
 AWK = @AWK@
 CC = @CC@
-BISON = @BISON@
-BISONFLAGS =
-FLEX = @FLEX@
-FLEXFLAGS =
 AR = @AR@
 AR_FLAGS = rc
 NM = @NM@
@@ -933,12 +929,8 @@
 export slibdir
 
 FLAGS_TO_PASS = \
-	"BISON=$(BISON)" \
-	"BISONFLAGS=$(BISONFLAGS)" \
 	"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
 	"LDFLAGS=$(LDFLAGS)" \
-	"FLEX=$(FLEX)" \
-	"FLEXFLAGS=$(FLEXFLAGS)" \
 	"LN=$(LN)" \
 	"LN_S=$(LN_S)" \
 	"MAKEINFO=$(MAKEINFO)" \
--- gcc/Makefile.in	2007-11-13 19:23:33.000000000 +0530
+++ ../Makefile.in	2007-11-26 16:07:33.000000000 +0530
@@ -1718,8 +1718,7 @@
 
 srcextra: gcc.srcextra lang.srcextra
 
-gcc.srcextra: gengtype-lex.c
-	-cp -p $^ $(srcdir)
+gcc.srcextra: 
 
 c-incpath.o: c-incpath.c c-incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
 		intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
@@ -3251,10 +3250,6 @@
 build/gengtype$(build_exeext) : build/gengtype-lex.o build/gengtype-parse.o \
 				$(BUILD_ERRORS)
 
-# Generated source files for gengtype.
-gengtype-lex.c : gengtype-lex.l
-	-$(FLEX) $(FLEXFLAGS) -o$@ $<
-
 #
 # Remake internationalization support.
 intl.o: intl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h Makefile
--- gcc/treelang/Make-lang.in	2007-11-22 21:52:14.000000000 +0530
+++ ../../gcc-mainline-dp/gcc/treelang/Make-lang.in	2007-11-26 16:50:21.000000000 +0530
@@ -53,7 +53,7 @@
 
 # GCC_FOR_TREELANG = ./xgcc $(GCC_EXTRAS)
 
-TREE_GENERATED = lex.c parse.c parse.h parse.output
+TREE_GENERATED = 
 # We need to use something other than treelang here because the directory
 # is called treelang
 TREE_EXES = gtreelang
@@ -123,21 +123,6 @@
   $(TM_H) $(DIAGNOSTIC_H) $(TREE_H) treelang/treelang.h input.h \
   treelang/parse.h toplev.h
 
-# generated files the files from lex and yacc are put into the source
-# directory in case someone wants to build but does not have
-# lex/yacc
-
-treelang.srcextra: treelang/parse.c treelang/parse.h treelang/lex.c
-	-cp -p $^ $(srcdir)/treelang
-
-treelang/lex.c: treelang/lex.l
-	-$(FLEX) $(FLEXFLAGS) -o$@ $<
-
-treelang/parse.c treelang/parse.h treelang/parse.output: treelang/parse.y
-	-$(BISON) $(BISONFLAGS) -v --defines --output=treelang/parse.c $<
-
-# -v
-
 #
 # Build hooks:
 

Reply via email to