From 4c95dd86a79900094356e8634d7211fd32abf896 Mon Sep 17 00:00:00 2001 From: Hema Seetharamaiah Date: Sun, 26 Apr 2009 16:43:01 +0530 Subject: [PATCH] Add --without-tre option elinks-lite in Debian does not depend on any libraries (except gnutls). Including this option will allow elinks-lite to be built without libtre dependency. --- configure.in | 82 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/configure.in b/configure.in index 81f39ec2..47910a30 100644 --- a/configure.in +++ b/configure.in @@ -926,42 +926,56 @@ fi # Check for TRE library # =================================================================== -AC_MSG_CHECKING([[for TRE in pkg-config]]) -if pkg-config tre; then - TRE_CFLAGS=`pkg-config --cflags tre` - TRE_LIBS=`pkg-config --libs tre` - AC_MSG_RESULT([[yes]]) -else - # - # "libtre-dev: /usr/lib/pkgconfig/tre.pc missing" - # so we look for the library even if pkg-config doesn't know about it. - TRE_CFLAGS= - TRE_LIBS=-ltre - AC_MSG_RESULT([[no, but let's try defaults]]) -fi +disable_tre="" +AC_ARG_WITH(tre, [ --without-tre disable TRE regex search support], + [if test "$with_tre" = no; then disable_tre=yes; fi]) + +AC_MSG_CHECKING([for TRE]) -AC_MSG_CHECKING([[for TRE header and library]]) EL_SAVE_FLAGS -CFLAGS="$TRE_CFLAGS $CFLAGS" -LIBS="$TRE_LIBS $LIBS" -AC_TRY_LINK([#include ], - [regex_t re; - regmatch_t match[1]; - regwcomp(&re, L"zap", REG_ICASE); - regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);], - [AC_MSG_RESULT([[yes]]) - AC_DEFINE([HAVE_TRE_REGEX_H], [1], - [Define to 1 if you have the header file.]) - # TRE_CFLAGS will be used only where needed. - # TRE_LIBS will be kept in LIBS and used everywhere. - EL_RESTORE_FLAGS - LIBS="$TRE_LIBS $LIBS"], - [AC_MSG_RESULT([[no]]) - TRE_CFLAGS= - TRE_LIBS= - EL_RESTORE_FLAGS]) -AC_SUBST(TRE_CFLAGS) -AC_SUBST(TRE_LIBS) +cf_result="no" + +if test "$disable_tre" = yes; then + cf_result="not used" +else + AC_MSG_CHECKING([[for TRE in pkg-config]]) + if pkg-config tre; then + TRE_CFLAGS=`pkg-config --cflags tre` + TRE_LIBS=`pkg-config --libs tre` + AC_MSG_RESULT([[yes]]) + else + # + # "libtre-dev: /usr/lib/pkgconfig/tre.pc missing" + # so we look for the library even if pkg-config doesn't know about it. + TRE_CFLAGS= + TRE_LIBS=-ltre + AC_MSG_RESULT([[no, but let's try defaults]]) + fi + + AC_MSG_CHECKING([[for TRE header and library]]) + EL_SAVE_FLAGS + CFLAGS="$TRE_CFLAGS $CFLAGS" + LIBS="$TRE_LIBS $LIBS" + AC_TRY_LINK([#include ], + [regex_t re; + regmatch_t match[1]; + regwcomp(&re, L"zap", REG_ICASE); + regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);], + [AC_MSG_RESULT([[yes]]) + AC_DEFINE([HAVE_TRE_REGEX_H], [1], + [Define to 1 if you have the header file.]) + # TRE_CFLAGS will be used only where needed. + # TRE_LIBS will be kept in LIBS and used everywhere. + EL_RESTORE_FLAGS + LIBS="$TRE_LIBS $LIBS"], + [AC_MSG_RESULT([[no]]) + TRE_CFLAGS= + TRE_LIBS= + EL_RESTORE_FLAGS]) + AC_SUBST(TRE_CFLAGS) + AC_SUBST(TRE_LIBS) +fi +AC_MSG_RESULT($cf_result) AC_CHECK_SIZEOF([wchar_t], [4], [[#include ]])