summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hartwig <mandyke@gmail.com>2012-06-30 00:16:04 +0800
committerDaniel Hartwig <mandyke@gmail.com>2012-06-30 00:16:04 +0800
commit211e6c5e661e727f325a9b55a60a0426a678ccae (patch)
tree24e042d4b30721b551a48c5f7af0ff1704ae6be1
parente0ec5877d33d00876983b80c18f4269373baf79a (diff)
downloadaptitude-211e6c5e661e727f325a9b55a60a0426a678ccae.tar.gz
Drop support for ancient libept features; make libept use really optional
The tree included several checks for various ways that libept previously did things. These old code paths have been dropped along with the checks for them. configure now also supports --disable-ept to build without using the ept library.
-rw-r--r--configure.ac363
-rw-r--r--src/generic/apt/matching/match.cc23
-rw-r--r--src/generic/apt/tags.cc24
-rw-r--r--src/generic/apt/tags.h8
4 files changed, 125 insertions, 293 deletions
diff --git a/configure.ac b/configure.ac
index 4f599a33..e4deb6d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,244 +51,6 @@ AC_CHECK_LIB(pthread, main,
HAVE_LIBPTHREAD=1
, [AC_MSG_ERROR([Can't find the POSIX thread libraries])])
-PKG_CHECK_MODULES(ept, libept, [], [AC_MSG_ERROR([Can't find the ept library -- please install libept-dev])])
-AC_DEFINE([HAVE_EPT], [], [Backwards compatibility symbol; must always be defined.])
-
-############################ CHECKS FOR EPT ############################
-
-OLD_CXXFLAGS="$CXXFLAGS"
-
-CXXFLAGS="$CXXFLAGS $ept_CFLAGS"
-
-dnl Newer versions of libept use strings instead of various old ept
-dnl data structures. Test for each one individually.
-DEBTAGS_OK=0
-
-AC_MSG_CHECKING([whether ept::debtags::Tag exists])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/debtags/tag.h>
-
-int main(int argc, char **argv)
-{
- ept::debtags::Tag t;
-
- return 0;
-}])],
- [
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_EPT_DEBTAGS_TAG], [], [Define if ept::debtags::Tag exists.])
- DEBTAGS_OK=1
- ],
- [AC_MSG_RESULT(no)])
-
-AC_MSG_CHECKING([whether ept::debtags::Facet exists])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/debtags/tag.h>
-
-int main(int argc, char **argv)
-{
- ept::debtags::Facet f;
-
- return 0;
-}])],
- [
- AC_DEFINE([HAVE_EPT_DEBTAGS_FACET], [], [Define if ept::debtags::Facet exists])
- AC_MSG_RESULT([yes])
- ],
- [AC_MSG_RESULT([no])])
-
-AC_MSG_CHECKING([whether ept::debtags::getTagsOfItem returns a set of strings.])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/debtags/debtags.h>
-
-int main(int argc, char **argv)
-{
- // This would always crash, but we only care if it type-checks.
- ept::debtags::Debtags DB;
- std::set<std::string> result = DB.getTagsOfItem("foo");
-
- return 0;
-}
-])],
- [
- AC_MSG_RESULT(yes)
- AC_DEFINE([EPT_DEBTAGS_GETTAGSOFITEM_RETURNS_STRINGS], [], [Define if ept::debtags::Debtags::getTagsOfItem returns a set of strings])
- DEBTAGS_OK=1
- ],
- [
- AC_MSG_RESULT(no)
- ])
-
-if test x$DEBTAGS_OK = x0
-then
- AC_MSG_FAILURE([Can't figure out how to access the ept debtags database.])
-fi
-
-TEXTSEARCH_OK=0
-
-dnl Newer versions of ept got rid of the whole textsearch header and
-dnl instead just include the Xapian database directly. See which
-dnl version we're dealing with.
-AC_MSG_CHECKING([whether ept::textsearch exists])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/textsearch/textsearch.h>
-
-int main(int argc, char **argv)
-{
- ept::textsearch::TextSearch db;
-
- db.docidByName("foo");
-
- return 0;
-}])],
- [
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_EPT_TEXTSEARCH], [], [Define if ept::textsearch exists])
- TEXTSEARCH_OK=1
- ],
- [
- AC_MSG_RESULT(no)
- ])
-
-dnl Now look in the new location:
-AC_MSG_CHECKING([whether ept/axi exists])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/axi/axi.h>
-
-int main(int argc, char **argv)
-{
- Xapian::Database db(ept::axi::path_db());
-
- return 0;
-}])],
- [
- AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_EPT_AXI], [], [Define if ept/axi/axi.h can provide docids.])
- TEXTSEARCH_OK=1
- ],
- [AC_MSG_RESULT([no])])
-
-if test x$TEXTSEARCH_OK = x0
-then
- AC_MSG_FAILURE([Can't figure out how to access the ept Xapian database.])
-fi
-
-AC_MSG_CHECKING([whether ept::debtags::Vocabulary::tagData exists and returns ept::debtags::voc::TagData *])
-
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/debtags/vocabulary.h>
-
-int main(int argc, char **argv)
-{
- ept::debtags::Vocabulary vocabulary;
- const ept::debtags::voc::TagData *td = vocabulary.tagData("foo");
-
- // Use td so the compiler doesn't complain:
- return td == NULL ? 1 : 0;
-}])],
- [
- AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_EPT_DEBTAGS_VOCABULARY_TAG_DATA], [], [Define if the ept debtags vocabulary object exists and supports tagData()])
- ],
- [AC_MSG_RESULT([no])])
-
-
-AC_MSG_CHECKING([whether ept::debtags::Vocabulary::facetData exists and returns ept::debtags::voc::FacetData *])
-
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/debtags/vocabulary.h>
-
-int main(int argc, char **argv)
-{
- ept::debtags::Vocabulary vocabulary;
- const ept::debtags::voc::FacetData *fd = vocabulary.facetData("foo");
-
- // Use fd so the compiler doesn't complain:
- return fd == NULL ? 1 : 0;
-}])],
- [
- AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_EPT_DEBTAGS_VOCABULARY_FACET_DATA], [], [Define if the ept debtags vocabulary object exists and supports facetData()])
- ],
- [AC_MSG_RESULT([no])])
-
-AC_MSG_CHECKING([whether ept::debtags::Tag::fullname() exists])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/debtags/tag.h>
-
-int main(int argc, char **argv)
-{
- ept::debtags::Tag t;
-
- std::string s = t.fullname();
-
- return 0;
-}])],
- [
- AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_EPT_DEBTAGS_TAG_FULLNAME], [], [Define if ept::debtags::Tag exists and has a fullname() method])
- ],
- [AC_MSG_RESULT([no])])
-
-
-AC_MSG_CHECKING([whether ept::debtags::Facet exists and supports name()])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/debtags/tag.h>
-
-int main(int argc, char **argv)
-{
- ept::debtags::Facet f;
-
- const std::string name = f.name();
-
- return 0;
-}])],
- [
- AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_EPT_DEBTAGS_FACET_NAME], [], [Define if ept::debtags::Facet exists and supports description retrieval.])
- ],
- [AC_MSG_RESULT([no])])
-
-
-AC_MSG_CHECKING([whether ept::debtags::Facet exists and supports description retrieval])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/debtags/tag.h>
-
-int main(int argc, char **argv)
-{
- ept::debtags::Facet f;
-
- const std::string longDesc = f.longDescription();
- const std::string shortDesc = f.shortDescription();
-
- return 0;
-}])],
- [
- AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_EPT_DEBTAGS_FACET_DESCRIPTION], [], [Define if ept::debtags::Facet exists and supports description retrieval.])
- ],
- [AC_MSG_RESULT([no])])
-
-AC_MSG_CHECKING([whether ept::debtags::Tag exists and supports description retrieval])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <ept/debtags/tag.h>
-
-int main(int argc, char **argv)
-{
- ept::debtags::Tag t;
-
- const std::string longDesc = t.longDescription();
- const std::string shortDesc = t.shortDescription();
-
- return 0;
-}])],
- [
- AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_EPT_DEBTAGS_TAG_DESCRIPTION], [], [Define if ept::debtags::Tag exists and supports description retrieval.])
- ],
- [AC_MSG_RESULT([no])])
-
-CXXFLAGS="$OLD_CXXFLAGS"
########################################################################
@@ -543,6 +305,131 @@ PKG_CHECK_MODULES(SQLITE3, sqlite3)
AM_CONDITIONAL([BUILD_LOCAL_GMOCK], [test x$BUILD_LOCAL_GMOCK = x1])
+########################################################################
+
+WANT_HAVE_EPT=1
+AC_ARG_ENABLE(ept,
+ AS_HELP_STRING(--disable-ept, [disable use of ept library]),
+ [if test x$enableval = xno
+ then
+ WANT_HAVE_EPT=0
+ fi])
+
+HAVE_EPT=0
+AS_IF(
+ [test x$WANT_HAVE_EPT = x1 && test "x$enable_aptitude" != xno],
+ [HAVE_EPT=1
+ PKG_CHECK_MODULES([ept], [libept], [],
+ [AC_MSG_ERROR([Can't find the ept library -- please install libept-dev])])
+
+ OLD_CXXFLAGS="$CXXFLAGS"
+
+ CXXFLAGS="$CXXFLAGS $ept_CFLAGS"
+
+ DEBTAGS_OK=0
+
+ AC_MSG_CHECKING([whether ept::debtags::getTagsOfItem returns a set of strings.])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include <ept/debtags/debtags.h>
+
+int main(int argc, char **argv)
+{
+ // This would always crash, but we only care if it type-checks.
+ ept::debtags::Debtags DB;
+ std::set<std::string> result = DB.getTagsOfItem("foo");
+
+ return 0;
+}])],
+ [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([EPT_DEBTAGS_GETTAGSOFITEM_RETURNS_STRINGS], [],
+ [Define if ept::debtags::Debtags::getTagsOfItem returns a set of strings])
+ DEBTAGS_OK=1
+ ],
+ [
+ AC_MSG_RESULT(no)
+ ])
+
+ if test x$DEBTAGS_OK = x0
+ then
+ AC_MSG_FAILURE([Can't figure out how to access the ept debtags database.])
+ fi
+
+ TEXTSEARCH_OK=0
+
+ AC_MSG_CHECKING([whether ept/axi exists])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include <ept/axi/axi.h>
+
+int main(int argc, char **argv)
+{
+ Xapian::Database db(ept::axi::path_db());
+
+ return 0;
+}])],
+ [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_EPT_AXI], [], [Define if ept/axi/axi.h can provide docids.])
+ TEXTSEARCH_OK=1
+ ],
+ [AC_MSG_RESULT([no])])
+
+ if test x$TEXTSEARCH_OK = x0
+ then
+ AC_MSG_FAILURE([Can't figure out how to access the ept Xapian database.])
+ fi
+
+ AC_MSG_CHECKING([whether ept::debtags::Vocabulary::tagData exists and returns ept::debtags::voc::TagData *])
+
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include <ept/debtags/vocabulary.h>
+
+int main(int argc, char **argv)
+{
+ ept::debtags::Vocabulary vocabulary;
+ const ept::debtags::voc::TagData *td = vocabulary.tagData("foo");
+
+ // Use td so the compiler doesn't complain:
+ return td == NULL ? 1 : 0;
+}])],
+ [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_EPT_DEBTAGS_VOCABULARY_TAG_DATA], [], [Define if the ept debtags vocabulary object exists and supports tagData()])
+ ],
+ [AC_MSG_RESULT([no])])
+
+ AC_MSG_CHECKING([whether ept::debtags::Vocabulary::facetData exists and returns ept::debtags::voc::FacetData *])
+
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include <ept/debtags/vocabulary.h>
+
+int main(int argc, char **argv)
+{
+ ept::debtags::Vocabulary vocabulary;
+ const ept::debtags::voc::FacetData *fd = vocabulary.facetData("foo");
+
+ // Use fd so the compiler doesn't complain:
+ return fd == NULL ? 1 : 0;
+}])],
+ [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_EPT_DEBTAGS_VOCABULARY_FACET_DATA], [], [Define if the ept debtags vocabulary object exists and supports facetData()])
+ ],
+ [AC_MSG_RESULT([no])])
+
+ CXXFLAGS="$OLD_CXXFLAGS"
+ ],
+
+ [test "x$enable_aptitude" != xno],
+ [AC_MSG_NOTICE([The ept library is not being used; use --enable-ept to enable it.])])
+
+if test x$HAVE_EPT = x1
+then
+ AC_DEFINE([HAVE_EPT], [], [Define if the ept library is to be used.])
+fi
+
+########################################################################
+
WANT_HAVE_GTK=0
AC_ARG_ENABLE(gtk,
AS_HELP_STRING(--enable-gtk, [compile the GTK+ frontend]),
diff --git a/src/generic/apt/matching/match.cc b/src/generic/apt/matching/match.cc
index 20545294..8d42fc28 100644
--- a/src/generic/apt/matching/match.cc
+++ b/src/generic/apt/matching/match.cc
@@ -35,15 +35,11 @@
#include <cwidget/generic/util/transcode.h>
-#ifdef HAVE_EPT_TEXTSEARCH
-#include <ept/textsearch/textsearch.h>
-#else
#ifdef HAVE_EPT_AXI
#include <ept/axi/axi.h>
#else
#error "Don't know how to use the debtags Xapian database."
#endif
-#endif
#include <xapian/enquire.h>
@@ -65,21 +61,6 @@ namespace aptitude
{
namespace
{
-#ifdef HAVE_EPT_TEXTSEARCH
- typedef ept::textsearch::TextSearch debtags_db;
-
- const Xapian::docid get_docid_by_name(const debtags_db &db,
- const char *name)
- {
- return db.docidByName(name);
- }
-
- const Xapian::Database &get_xapian_db(const debtags_db &db)
- {
- return db.db();
- }
-#endif
-
#ifdef HAVE_EPT_AXI
typedef Xapian::Database debtags_db;
@@ -407,15 +388,11 @@ namespace aptitude
{
try
{
-#ifdef HAVE_EPT_TEXTSEARCH
- db.reset(new ept::textsearch::TextSearch);
-#else
#ifdef HAVE_EPT_AXI
db.reset(new Xapian::Database(ept::axi::path_db()));
#else
#error "Can't figure out how to create the debtags database."
#endif
-#endif
}
catch(...)
{
diff --git a/src/generic/apt/tags.cc b/src/generic/apt/tags.cc
index e41dea46..0e906e98 100644
--- a/src/generic/apt/tags.cc
+++ b/src/generic/apt/tags.cc
@@ -412,17 +412,6 @@ namespace aptitude
return std::string(name, split_pos + 2);
}
-#ifdef HAVE_EPT_DEBTAGS_FACET_DESCRIPTION
- std::string get_facet_long_description(const tag &t)
- {
- return t.facet().longDescription();
- }
-
- std::string get_facet_short_description(const tag &t)
- {
- return t.facet().shortDescription();
- }
-#else
#ifdef HAVE_EPT_DEBTAGS_VOCABULARY_FACET_DATA
std::string get_facet_long_description(const tag &t)
{
@@ -456,19 +445,7 @@ namespace aptitude
#else
#error "Don't know how to retrieve facet descriptions."
#endif
-#endif
-#ifdef HAVE_EPT_DEBTAGS_TAG_DESCRIPTION
- std::string get_tag_long_description(const tag &t)
- {
- return t.longDescription();
- }
-
- std::string get_tag_short_description(const tag &t)
- {
- return t.shortDescription();
- }
-#else
#ifdef HAVE_EPT_DEBTAGS_VOCABULARY_TAG_DATA
std::string get_tag_long_description(const tag &t)
{
@@ -502,7 +479,6 @@ namespace aptitude
#else
#error "Don't know how to retrieve tag descriptions."
#endif
-#endif
}
}
diff --git a/src/generic/apt/tags.h b/src/generic/apt/tags.h
index d4d5171c..6ec61a14 100644
--- a/src/generic/apt/tags.h
+++ b/src/generic/apt/tags.h
@@ -233,13 +233,6 @@ namespace aptitude
{
namespace apt
{
-#ifdef HAVE_EPT_DEBTAGS_TAG
- typedef ept::debtags::Tag tag;
- inline std::string get_fullname(const tag &t)
- {
- return t.fullname();
- }
-#else
#ifdef EPT_DEBTAGS_GETTAGSOFITEM_RETURNS_STRINGS
typedef std::string tag;
inline std::string get_fullname(const std::string &t)
@@ -251,7 +244,6 @@ namespace aptitude
// configure checks can't recognize.
#error "Don't know how to represent a debtags tag."
#endif
-#endif
const std::set<tag> get_tags(const pkgCache::PkgIterator &pkg);