]> granicus.if.org Git - flex/commitdiff
build: New configure option '--disable-bootstrap'.
authorExplorer09 <explorer09@gmail.com>
Sat, 26 Nov 2016 15:47:12 +0000 (23:47 +0800)
committerWill Estes <westes575@gmail.com>
Thu, 29 Dec 2016 22:26:07 +0000 (17:26 -0500)
If configure is run with '--disable-bootstrap', then stage1flex won't
be built and stage1scan.c will be generated by sed'ing scan.c.

This option is intended to workaround bootstrap bugs rather than to
fix the bootstrapping issues which are proving subtler and harder to
fix than anyone would like.

configure.ac
src/Makefile.am

index 7d742c577ef2f8d6eeedda19ffa3f6ddaad44d86..901339f904ecbc315ec3377270d08d41ccd20a15 100644 (file)
@@ -66,6 +66,15 @@ AC_ARG_ENABLE([libfl],
   [], [enable_libfl=yes])
 AM_CONDITIONAL([ENABLE_LIBFL], [test "x$enable_libfl" = xyes])
 
+# --disable-bootstrap is intended only to workaround problems with bootstrap
+# (e.g. when cross-compiling flex or when bootstrapping has bugs).
+# Ideally we should be able to bootstrap even when cross-compiling.
+AC_ARG_ENABLE([bootstrap],
+  [AS_HELP_STRING([--disable-bootstrap],
+                  [don't perform a bootstrap when building flex])],
+  [], [enable_bootstrap=yes])
+AM_CONDITIONAL([ENABLE_BOOTSTRAP], [test "x$enable_bootstrap" = xyes])
+
 AC_PATH_PROG([BISON], bison, no)
 AS_IF([test "$BISON" != no],[],
        [ AC_SUBST([BISON], [\${top_srcdir}/build-aux/missing bison])
index a4742fd97998abad9df3d468bd740918231b6d8b..3b5e362bb034edef4464162ce6c102bffa694951 100644 (file)
@@ -6,7 +6,9 @@ LIBS = @LIBS@
 m4 = @M4@
 
 bin_PROGRAMS = flex
+if ENABLE_BOOTSTRAP
 noinst_PROGRAMS = stage1flex
+endif
 
 if ENABLE_LIBFL
 lib_LTLIBRARIES = libfl.la
@@ -82,16 +84,21 @@ skel.c: flex.skl mkskel.sh flexint.h tables_shared.h tables_shared.c
          $(SHELL) $(srcdir)/mkskel.sh > $@.tmp
        mv $@.tmp $@
 
+if ENABLE_BOOTSTRAP
 stage1scan.c: scan.l stage1flex$(EXEEXT)
        ./stage1flex$(EXEEXT) $(AM_LFLAGS) $(LFLAGS) -o $@ $<
+else
+stage1scan.c: scan.c
+       sed 's|^\(#line .*\)"'`printf %s $< | sed 's|[][\\\\.*]|\\\\&|g'`'"|\1"$@"|g' $< > $@
+endif
 
 # make needs to be told to make parse.h so that parallelized runs will
 # not fail.
 
-main.c : parse.h
-scan.c : parse.h
-stage1scan.c : parse.h
-yylex.c : parse.h
+main.c: parse.h
+yylex.c: parse.h
+stage1flex-scan.$(OBJEXT): parse.h
+flex-stage1scan.$(OBJEXT): parse.h
 
 # Run GNU indent on sources. Don't run this unless all the sources compile cleanly.
 #