diff --git a/configure.in b/configure.in index 706cebd6..95b41d48 100644 --- a/configure.in +++ b/configure.in @@ -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" diff --git a/src/Makefile.am b/src/Makefile.am index 8bd072ef..87e632ef 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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)