From 00f1406aa4fb4ca47bffed7a9f6ec97885ac779f Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 9 Apr 2016 22:49:49 +2100 Subject: [PATCH] [PATCH 3/4] configure: add test for default xapian backend --- 8b/8fbb9c9fb30317efac98ef11ceb94a5767890f | 131 ++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 8b/8fbb9c9fb30317efac98ef11ceb94a5767890f diff --git a/8b/8fbb9c9fb30317efac98ef11ceb94a5767890f b/8b/8fbb9c9fb30317efac98ef11ceb94a5767890f new file mode 100644 index 000000000..2806fb975 --- /dev/null +++ b/8b/8fbb9c9fb30317efac98ef11ceb94a5767890f @@ -0,0 +1,131 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 1BA4C6DE035C + for ; Fri, 8 Apr 2016 18:50:23 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.02 +X-Spam-Level: +X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.009, + SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id HHdxGtxfWsAx for ; + Fri, 8 Apr 2016 18:50:15 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id 01BC56DE02D0 + for ; Fri, 8 Apr 2016 18:50:01 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1aoi2M-00022p-U7; Fri, 08 Apr 2016 21:50:10 -0400 +Received: (nullmailer pid 6634 invoked by uid 1000); + Sat, 09 Apr 2016 01:49:55 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 3/4] configure: add test for default xapian backend +Date: Fri, 8 Apr 2016 22:49:49 -0300 +Message-Id: <1460166590-6526-4-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.8.0.rc3 +In-Reply-To: <1460166590-6526-1-git-send-email-david@tethera.net> +References: <1460166590-6526-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 09 Apr 2016 01:50:23 -0000 + +This is mainly for the test suite. We already expect the tests to be +run in the same environment as configure was run, at least to get the +name of the python interpreter. So we are not really imposing a new +restriction. +--- + configure | 26 +++++++++++++++++++++++++- + test/test-lib.sh | 11 +++++++++++ + 2 files changed, 36 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index eb6dbac..4fc31cc 100755 +--- a/configure ++++ b/configure +@@ -371,7 +371,25 @@ if [ ${have_xapian} = "1" ]; then + esac + fi + +- ++default_xapian_backend="" ++if [ ${have_xapian} = "1" ]; then ++ printf "Testing default Xapian backend... " ++ cat >_default_backend.cc < ++int main(int argc, char** argv) { ++ Xapian::WritableDatabase db("test.db",Xapian::DB_CREATE_OR_OPEN); ++} ++EOF ++ ${CXX} ${CXXLAGS} ${xapian_cxxflags} _default_backend.cc -o _default_backend ${xapian_ldflags} ++ ./_default_backend ++ if [ -f test.db/iamglass ]; then ++ default_xapian_backend=glass ++ else ++ default_xapian_backend=chert ++ fi ++ printf "${default_xapian_backend}\n"; ++ rm -rf test.db _default_backend _default_backend.cc ++fi + # we need to have a version >= 2.6.5 to avoid a crypto bug. We need + # 2.6.7 for permissive "From " header handling. + GMIME_MINVER=2.6.7 +@@ -1001,6 +1019,9 @@ LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies} + XAPIAN_CXXFLAGS = ${xapian_cxxflags} + XAPIAN_LDFLAGS = ${xapian_ldflags} + ++# Which backend will Xapian use by default? ++DEFAULT_XAPIAN_BACKEND = ${default_xapian_backend} ++ + # Flags needed to compile and link against GMime + GMIME_CFLAGS = ${gmime_cflags} + GMIME_LDFLAGS = ${gmime_ldflags} +@@ -1077,6 +1098,9 @@ cat > sh.config </dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS + rm -f y + ++# convert variable from configure to more convenient form ++case "$NOTMUCH_DEFAULT_XAPIAN_BACKEND" in ++ glass) ++ db_ending=glass ++ ;; ++ chert) ++ db_ending=DB ++ ;; ++ *) ++ error "Unknown Xapian backend $NOTMUCH_DEFAULT_XAPIAN_BACKEND" ++esac + # declare prerequisites for external binaries used in tests + test_declare_external_prereq dtach + test_declare_external_prereq emacs +-- +2.8.0.rc3 + -- 2.26.2