Hema Seetharamaiah h...@treap.net writes:
Attached is a patch that provides a new option without-tre - which can be
used to build elinks without libtre dependency.
With that patch, configure without any TRE-related option outputs here:
checking for TRE... checking for TRE in pkg-config... yes
checking for TRE header and library... yes
no
i.e. you have nested AC_MSG_CHECKING/AC_MSG_RESULT pairs, and the
final result is also incorrect. I think the simplest solution
would be just
if test $with_tre = no; then
AC_MSG_CHECKING([[for TRE]])
AC_MSG_RESULT([[not used]])
else
... put the original tests here ...
fi
Your patch also contains spaces between tabs in indentation,
and a redundant use of EL_SAVE_FLAGS.
I'm attaching a revised patch that should fix these problems.
I also renamed HAVE_TRE_REGEX_H to CONFIG_TRE because it can
now be unset even if the header and library exist all right.
I should also ask about storage of personal data and licensing
of changes but it's getting too late here.
From 3fee12ca965f3e6269800f79b054e5d26c842fb9 Mon Sep 17 00:00:00 2001
From: Kalle Olavi Niemitalo k...@iki.fi
Date: Sun, 26 Apr 2009 23:46:17 +0300
Subject: [PATCH] Add --without-tre option
elinks-lite in Debian does not depend on any libraries (except
gnutls and the usual libc and libgcc). Including this option
will allow elinks-lite to be built without libtre dependency.
Based on a patch by Hema Seetharamaiah h...@treap.net.
---
configure.in | 83 --
src/config/options.inc |2 +-
src/elinks.h |2 +-
src/viewer/text/search.c | 22 ++--
4 files changed, 64 insertions(+), 45 deletions(-)
diff --git a/configure.in b/configure.in
index 631b605..bf56d95 100644
--- a/configure.in
+++ b/configure.in
@@ -933,43 +933,62 @@ 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]])
+AC_ARG_WITH([[tre]], [[ --without-tre disable TRE regex search support]])
+if test $with_tre = no; then
+ AC_MSG_CHECKING([[for TRE]])
+ AC_MSG_RESULT([[disabled]])
+ tre_log=no (explicitly disabled)
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 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, Lzap, REG_ICASE);
- regwexec(re, LELIZAPROGRAM, 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_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, Lzap, REG_ICASE);
+ regwexec(re, LELIZAPROGRAM, 1, match, 0);],
+ [AC_MSG_RESULT([[yes]])
+ AC_DEFINE([CONFIG_TRE], [1],
+ [Define as 1 to use the TRE library for regular expression searching. This requires 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
+ # Using TRE with UTF-8 in ELinks requires that wchar_t
+ # has the same representation as unicode_val_T. See
+ # src/elinks.h for the check. It would be nice to move
+ # the check to this configure script, so that the result
+ # could be logged, but the ac_cv_sizeof_wchar_t shell
+ # variable set by AC_CHECK_SIZEOF is undocumented.
+ tre_log=TRE (if wchar_t is suitable)],
+ [AC_MSG_RESULT([[no]])
+ TRE_CFLAGS=
+ TRE_LIBS=
+ EL_RESTORE_FLAGS
+ tre_log=no])
+fi
AC_SUBST(TRE_CFLAGS)
AC_SUBST(TRE_LIBS)