Commit 198a909b authored by Daniel Salzman's avatar Daniel Salzman

configure: remove Ragel detection

Previous logic was too complicated and confusing. Currently, there are
just two pregenerated source files which are selected on the basis of
the --disable-fastparser configure option.

Pregenerated files can be updated using scripts/update-parser.sh script.
parent fab123c2
......@@ -2,7 +2,6 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = libtap src tests samples doc man patches
AM_DISTCHECK_CONFIGURE_FLAGS = \
--without-ragel \
--disable-code-coverage
code_coverage_quiet = --quiet
......
......@@ -64,36 +64,11 @@ AS_IF([test "x$YACC_BISON" != "xbison"],
[AC_MSG_ERROR([GNU bison needed for reentrant parsers, set the \$YACC variable before running configure])])
AC_PROG_INSTALL
# Check for Ragel
AC_ARG_WITH([ragel],
AC_HELP_STRING([--with-ragel=path], [Path to Ragel binary. [default=auto]]),
[with_ragel=$withval],
[with_ragel=auto])
AS_CASE([$with_ragel],
[yes|auto], [AC_PATH_PROG([RAGEL], [ragel], [false])],
[no], [RAGEL=false],
[*], [RAGEL=$with_ragel],
)
AM_CONDITIONAL([HAVE_RAGEL], test "$RAGEL" != "false")
# Set FSM type for Ragel
# Set zone parser type
AC_ARG_ENABLE([fastparser],
AS_HELP_STRING([--disable-fastparser], [Don't use faster zone parser]),
[],
[enable_fastparser=yes])
AS_CASE([$enable_fastparser],
[no], [AC_SUBST([FSM_TYPE], [-T0])],
[yes], [AC_SUBST([FSM_TYPE], [-G2])],
[*], [
AS_IF([test "$RAGEL" = "false"],
[AC_MSG_ERROR([Ragel is needed to generate different parsers])])
AC_SUBST([FSM_TYPE], [$enable_fastparser])
])
AM_CONDITIONAL([G2_PARSER], test "$enable_fastparser" = "yes")
AM_CONDITIONAL([T0_PARSER], test "$enable_fastparser" = "no")
AS_HELP_STRING([--disable-fastparser], [Use slower zone parser]),
[], [enable_fastparser=yes])
AM_CONDITIONAL([FAST_PARSER], [test "$enable_fastparser" = yes])
# Systemd integration
AC_ARG_ENABLE([systemd],
......@@ -398,9 +373,9 @@ echo "
CFlags: ${CFLAGS} ${CPPFLAGS}
LDFlags: ${LDFLAGS}
Libs: ${LIBS}
Ragel: ${RAGEL} ${FSM_TYPE}
Fast zone parser: ${enable_fastparser}
Utils with IDN: ${libidn}
Use systemd notifications: ${enable_systemd}
Systemd notifications: ${enable_systemd}
Code coverage: ${enable_code_coverage}
Continue with 'make' command"
#!/bin/bash
IN="./scanner.rl"
OUT="./scanner.c"
pushd ../src/zscanner/
ragel -T0 -s -o ./scanner.c ./scanner.rl
sed '/#line/d' ./scanner.c > ./scanner.c.t0
ragel -T0 -s -o $OUT $IN
sed '/#line/d' $OUT > $OUT.t0
rm $OUT
ragel -G2 -s -o ./scanner.c ./scanner.rl
sed '/#line/d' ./scanner.c > ./scanner.c.g2
ragel -G2 -s -o $OUT $IN
sed '/#line/d' $OUT > $OUT.g2
rm $OUT
popd
......@@ -14,27 +14,15 @@ EXTRA_DIST = \
BUILT_SOURCES = scanner.c
CLEANFILES = scanner.c
if HAVE_RAGEL
scanner.c: scanner.rl scanner_body.rl
$(RAGEL) $(FSM_TYPE) -o $@ $(srcdir)/scanner.rl
else
if G2_PARSER
if FAST_PARSER
scanner.c: scanner.c.g2
cp $(srcdir)/$@.g2 $@
endif
if T0_PARSER
@echo "NOTE: Compilation of scanner.c can take several minutes!"
else
scanner.c: scanner.c.t0
cp $(srcdir)/$@.t0 $@
endif
endif #HAVE_RAGEL
if G2_PARSER
@echo "NOTE: Compilation of scanner.c can take several minutes!"
endif
libzscanner_la_SOURCES = \
zscanner.h \
scanner.h \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment