Allow use of pre-generated ANTLR3 parsers when antlr3 is not available

This commit is contained in:
Julien BLACHE 2010-09-04 12:57:10 +02:00
parent dd6fd6ceec
commit 0137b202f0
2 changed files with 16 additions and 11 deletions

View File

@ -14,20 +14,18 @@ LT_INIT([disable-static])
AC_CHECK_PROG(ANTLR, [antlr3], [antlr3])
if test "x$ANTLR" = x; then
AC_MSG_NOTICE([antlr3 wrapper not found, checking direct java invocation])
AC_CHECK_PROG(JAVA, [java], [java])
if test "x$JAVA" = x; then
AC_MSG_FAILURE([java not found; check your java installation])
if test -d $srcdir/src/pregen; then
for f in $srcdir/src/pregen/*; do
bf=`basename $f`
ln -sf pregen/$bf $srcdir/src/$bf
done
AC_MSG_NOTICE([antlr3 wrapper not found, using pre-generated files])
else
if $JAVA org.antlr.Tool > /dev/null 2>&1; then
AC_MSG_NOTICE([Direct java invocation working, using java org.antlr.Tool to invoke antlr])
ANTLR="$JAVA org.antlr.Tool"
else
AC_MSG_FAILURE([antlr3 wrapper not found and direct java invocation failed; check your antlr3/java installation])
fi
AC_MSG_ERROR([antlr3 wrapper not found and pre-generated files not available])
fi
fi
AC_SUBST(ANTLR)
AM_CONDITIONAL(COND_ANTLR, test "x$ANTLR" != x)
CFLAGS="$CFLAGS -Wall -D_LARGEFILE_SOURCE"

View File

@ -79,7 +79,8 @@ EXTRA_DIST = \
rsp_query.c: RSPLexer.h RSPParser.h RSP2SQL.h
daap_query.c: DAAPLexer.h DAAPParser.h DAAP2SQL.h
# Support for building the parsers when ANTLR3 is available
if COND_ANTLR
SUFFIXES = .g .u
%.tokens %.c %Lexer.c %Parser.c %Lexer.h %Parser.h %.h: %.g
@ -96,4 +97,10 @@ clean-local:
rm -f $(ANTLR_PRODUCTS)
rm -f $(ANTLR_GRAMMARS:.g=.u)
else !COND_ANTLR
distclean-local:
rm -f $(ANTLR_SOURCES)
rm -f $(ANTLR_GRAMMARS:.g=.u)
endif
-include $(ANTLR_GRAMMARS:.g=.u)