aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-12-12 12:02:20 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-01-19 21:48:59 +0100
commit53f84f7cbafcb177406f8f7bcc890e626e72ca63 (patch)
tree37d5cbd337eb3fed871e04c20e904165dbef8d87 /configure
parent242f22f2ef7aeb14c36e54d7d44d3fd4e51a5d06 (diff)
downloadvis-53f84f7cbafcb177406f8f7bcc890e626e72ca63.tar.gz
vis-53f84f7cbafcb177406f8f7bcc890e626e72ca63.tar.xz
text-regex: add regex backend based on libtre
While memory consumption should be improved, backward searches will still be slow, because they are implemented in terms of repeated forward searches. It needs to be investigated whether the underlying automaton can have its transitions reversed and essentially run backwards, as is the case in sam.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure52
1 files changed, 52 insertions, 0 deletions
diff --git a/configure b/configure
index dc8f278..fe85ccf 100755
--- a/configure
+++ b/configure
@@ -25,6 +25,7 @@ Fine tuning of the installation directories:
Optional features:
--enable-lua build with Lua support [auto]
--enable-lpeg build with support for statically linking to LPeg [auto]
+ --enable-tre build with TRE regex support [auto]
--enable-selinux build with SELinux support [auto]
--enable-acl build with POSIX ACL support [auto]
@@ -115,6 +116,7 @@ MANDIR='$(PREFIX)/share/man'
lua=auto
lpeg=auto
+tre=auto
selinux=auto
acl=auto
@@ -133,6 +135,8 @@ case "$arg" in
--disable-lua|--enable-lua=no) lua=no ;;
--enable-lpeg|--enable-lpeg=yes) lpeg=yes ;;
--disable-lpeg|--enable-lpeg=no) lpeg=no ;;
+--enable-tre|--enable-tre=yes) tre=yes ;;
+--disable-tre|--enable-tre=no) tre=no ;;
--enable-selinux|--enable-selinux=yes) selinux=yes ;;
--disable-selinux|--enable-selinux=no) selinux=no ;;
--enable-acl|--enable-acl=yes) acl=yes ;;
@@ -353,6 +357,50 @@ else
fail "$0: cannot find libtermkey"
fi
+CONFIG_TRE=0
+REGEX_SRC=text-regex.c
+
+if test "$tre" != "no" ; then
+
+ printf "checking for libtre... "
+
+cat > "$tmpc" <<EOF
+#include <tre/tre.h>
+
+int main() {
+ regex_t preg;
+ tre_str_source *source = NULL;
+ regmatch_t pmatch[1];
+ tre_regcomp(&preg, "\0", REG_EXTENDED);
+ tre_reguexec(&preg, source, 1, pmatch, 0);
+ tre_regfree(&preg);
+ return 0;
+}
+EOF
+
+ if test "$have_pkgconfig" = "yes" ; then
+ CFLAGS_TRE=$(pkg-config --cflags tre 2>/dev/null)
+ LDFLAGS_TRE=$(pkg-config --libs tre 2>/dev/null)
+ fi
+
+ if test -z "$LDFLAGS_TRE"; then
+ CFLAGS_TRE=""
+ LDFLAGS_TRE="-ltre"
+ fi
+
+ if $CC $CFLAGS $CFLAGS_TRE "$tmpc" \
+ $LDFLAGS $LDFLAGS_TRE -o "$tmpo" >/dev/null 2>&1; then
+ CONFIG_TRE=1
+ REGEX_SRC=text-regex-tre.c
+ printf "%s\n" "yes"
+ else
+ printf "%s\n" "no"
+ CFLAGS_TRE=""
+ LDFLAGS_TRE=""
+ test "$tre" = "yes" && fail "$0: cannot find libtre"
+ fi
+fi
+
CONFIG_LUA=0
# enabling builtin lpeg requires lua support
@@ -537,6 +585,10 @@ CFLAGS_CURSES = $CFLAGS_CURSES
LDFLAGS_CURSES = $LDFLAGS_CURSES
CFLAGS_TERMKEY = $CFLAGS_TERMKEY
LDFLAGS_TERMKEY = $LDFLAGS_TERMKEY
+REGEX_SRC = $REGEX_SRC
+CONFIG_TRE = $CONFIG_TRE
+CFLAGS_TRE = $CFLAGS_TRE
+LDFLAGS_TRE = $LDFLAGS_TRE
CONFIG_LUA = $CONFIG_LUA
CFLAGS_LUA = $CFLAGS_LUA
LDFLAGS_LUA = $LDFLAGS_LUA