From d8cdec468bb7efad768d25872147533312cffe91 Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Sun, 1 Jul 2012 12:23:00 -0400 Subject: improvements to the ragel and colm config-time checks Fixed the test of build_parsers that allows the ragel/colm check to function. Was checking for "true" when it should be a check for "yes". Added --with-* options for specifying where the packages are installed to. --- colm/Makefile.am | 6 ++--- configure.in | 67 +++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/colm/Makefile.am b/colm/Makefile.am index 19bb3dc1..c4a3504a 100644 --- a/colm/Makefile.am +++ b/colm/Makefile.am @@ -75,15 +75,15 @@ version.h: Makefile if BUILD_PARSERS lmparse.h: lmparse.kh - kelbt -o $@ $< + $(KELBT) -o $@ $< lmparse.cc: lmparse.kl lmparse.kh - kelbt -o $@ $< + $(KELBT) -o $@ $< lmscan.cc: lmparse.h lmscan.cc: lmscan.rl - ragel -G2 -o $@ $< + $(RAGEL) -G2 -o $@ $< endif diff --git a/configure.in b/configure.in index a5fcc823..59bf09f1 100644 --- a/configure.in +++ b/configure.in @@ -28,9 +28,9 @@ AC_CONFIG_HEADER([colm/config.h colm/defs.h]) dnl Choose defaults for the build_parsers and build_manual vars. If the dist dnl file is present in the root then default to no, otherwise go for it. -AC_CHECK_FILES( $srcdir/DIST, - [ . $srcdir/DIST; ], - [ build_parsers=yes; build_manual=yes; ] ) +AC_CHECK_FILES( [$srcdir/DIST], + [. $srcdir/DIST;], + [build_parsers=yes; build_manual=yes; ] ) dnl Set to true if the build system should generate parsers from ragel and kelbt dnl sources. Set to false if generated files are included and not to be built @@ -79,25 +79,56 @@ AC_ARG_ENABLE(debug, # AC_ARG_ENABLE(log-match, "turns on match logging", AC_DEFINE(COLM_LOG_MATCH)) # AC_ARG_ENABLE(log-compile, "turns on compile logging", AC_DEFINE(COLM_LOG_COMPILE)) -if test $build_parsers = true; then +if test "x$build_parsers" = "xyes"; then dnl Check for Ragel -AC_CHECK_PROG(RAGEL, ragel, ragel) -if test -z "$RAGEL"; then - echo - echo "error: ragel is required to build the parsers" - echo - exit 1 -fi +AC_ARG_WITH(ragel, + [AC_HELP_STRING([--with-ragel], [location of ragel install])], + [ + # with value specified + RAGEL="$withval/bin/ragel" + AC_CHECK_FILES( + [$RAGEL], + [], + [AC_ERROR([ragel is required to build this package])] + ) + ], + [ + AC_CHECK_PROG(RAGEL, ragel, ragel) + if test -z "$RAGEL"; then + echo + echo "error: ragel is required to build the parsers" + echo + exit 1 + fi + ] +) dnl Check for Kelbt -AC_CHECK_PROG(KELBT, kelbt, kelbt) -if test -z "$KELBT"; then - echo - echo "error: kelbt is required to build the parsers" - echo - exit 1 -fi +AC_ARG_WITH(kelbt, + [AC_HELP_STRING([--with-kelbt], [location of kelbt install])], + [ + # with value specified + KELBT="$withval/bin/kelbt" + AC_CHECK_FILES( + [$RAGEL], + [], + [AC_ERROR([kelbt is required to build this package])] + ) + ], + [ + AC_CHECK_PROG(KELBT, kelbt, kelbt) + if test -z "$KELBT"; then + echo + echo "error: kelbt is required to build the parsers" + echo + exit 1 + fi + ] +) + +AC_SUBST(RAGEL) +AC_SUBST(KELBT) fi # build_parsers -- cgit v1.2.1