Skip to content

Commit

Permalink
build: New configure option '--disable-bootstrap'.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Explorer09 authored and westes committed Dec 29, 2016
1 parent 6964073 commit adddfba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
9 changes: 9 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
15 changes: 11 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
#
Expand Down

0 comments on commit adddfba

Please sign in to comment.