From ac955305855a329c7716dc54325927c421fe4319 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Thu, 31 Mar 2011 17:33:12 +0200 Subject: [PATCH] Check for gperf, add support to the build system --- configure.in | 6 ++++++ src/Makefile.am | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/configure.in b/configure.in index 02f3fae4..0bd6068a 100644 --- a/configure.in +++ b/configure.in @@ -12,6 +12,12 @@ AC_PROG_CC AM_PROG_CC_C_O LT_INIT([disable-static]) +AC_CHECK_PROG(GPERF, [gperf], [gperf]) +if test "x$GPERF" = x; then + AC_MSG_ERROR([GNU gperf not found, please install it]) +fi +AC_SUBST(GPERF) + AC_CHECK_PROG(ANTLR, [antlr3], [antlr3]) if test "x$ANTLR" = x; then if test -d $srcdir/src/pregen; then diff --git a/src/Makefile.am b/src/Makefile.am index c989ba64..10a626d2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,6 +21,10 @@ if COND_OSS4 OSS4SRC=laudio_oss4.c endif +GPERF_FILES = + +GPERF_PRODUCTS = + ANTLR_GRAMMARS = \ RSP.g RSP2SQL.g \ DAAP.g DAAP2SQL.g @@ -82,15 +86,33 @@ forked_daapd_SOURCES = main.c \ nodist_forked_daapd_SOURCES = \ $(ANTLR_SOURCES) +BUILT_SOURCES = \ + $(GPERF_PRODUCTS) + EXTRA_DIST = \ $(ANTLR_GRAMMARS) \ scan-mpc.c \ scan-flac.c +CLEANFILES = \ + $(GPERF_PRODUCTS) + # Let's help the dependencies a little. rsp_query.c: RSPLexer.h RSPParser.h RSP2SQL.h daap_query.c: DAAPLexer.h DAAPParser.h DAAP2SQL.h +# gperf construction rules +%_hash.c: %.gperf + if $(GPERF) $< > $@.tmp; then \ + mv $@.tmp $@; \ + elif $(GPERF) --version >/dev/null 2>&1; then \ + rm $@.tmp; \ + exit 1; \ + else \ + rm $@.tmp; \ + touch $@; \ + fi + # Support for building the parsers when ANTLR3 is available if COND_ANTLR SUFFIXES = .g .u