Hello,

I use elinks-lite in Debian and I noticed that it brings in a libtre
dependency since 0.12-pre3-2 Prior to this the only dependency was
libgnutls.

Attached is a patch that provides a new option without-tre - which can be
used to build elinks without libtre dependency.

Regards,
Hema.
>From c7e2d3607900c6b4807adaf21863e3ee18201c11 Mon Sep 17 00:00:00 2001
From: Hema Seetharamaiah <h...@treap.net>
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 files changed, 48 insertions(+), 34 deletions(-)

diff --git a/configure.in b/configure.in
index 6917532..5dc43ef 100644
--- a/configure.in
+++ b/configure.in
@@ -936,42 +936,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
-	# <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513055>
-	# "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 <tre/regex.h>],
-	    [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 <tre/regex.h> 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
+		# <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513055>
+		# "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 <tre/regex.h>],
+	    	[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 <tre/regex.h> 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 <wchar.h>]])
 
-- 
1.6.2.4
_______________________________________________
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

Reply via email to