[PATCH 3/4] configure: add test for default xapian backend
[notmuch-archives.git] / 8b / 8fbb9c9fb30317efac98ef11ceb94a5767890f
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5  by arlo.cworth.org (Postfix) with ESMTP id 1BA4C6DE035C\r
6  for <notmuch@notmuchmail.org>; Fri,  8 Apr 2016 18:50:23 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.02\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.009,\r
12   SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id HHdxGtxfWsAx for <notmuch@notmuchmail.org>;\r
16  Fri,  8 Apr 2016 18:50:15 -0700 (PDT)\r
17 Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
18  by arlo.cworth.org (Postfix) with ESMTPS id 01BC56DE02D0\r
19  for <notmuch@notmuchmail.org>; Fri,  8 Apr 2016 18:50:01 -0700 (PDT)\r
20 Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
21  (envelope-from <bremner@tethera.net>)\r
22  id 1aoi2M-00022p-U7; Fri, 08 Apr 2016 21:50:10 -0400\r
23 Received: (nullmailer pid 6634 invoked by uid 1000);\r
24  Sat, 09 Apr 2016 01:49:55 -0000\r
25 From: David Bremner <david@tethera.net>\r
26 To: notmuch@notmuchmail.org\r
27 Subject: [PATCH 3/4] configure: add test for default xapian backend\r
28 Date: Fri,  8 Apr 2016 22:49:49 -0300\r
29 Message-Id: <1460166590-6526-4-git-send-email-david@tethera.net>\r
30 X-Mailer: git-send-email 2.8.0.rc3\r
31 In-Reply-To: <1460166590-6526-1-git-send-email-david@tethera.net>\r
32 References: <1460166590-6526-1-git-send-email-david@tethera.net>\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.20\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37  <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
39  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
44  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Sat, 09 Apr 2016 01:50:23 -0000\r
46 \r
47 This is mainly for the test suite.  We already expect the tests to be\r
48 run in the same environment as configure was run, at least to get the\r
49 name of the python interpreter. So we are not really imposing a new\r
50 restriction.\r
51 ---\r
52  configure        | 26 +++++++++++++++++++++++++-\r
53  test/test-lib.sh | 11 +++++++++++\r
54  2 files changed, 36 insertions(+), 1 deletion(-)\r
55 \r
56 diff --git a/configure b/configure\r
57 index eb6dbac..4fc31cc 100755\r
58 --- a/configure\r
59 +++ b/configure\r
60 @@ -371,7 +371,25 @@ if [ ${have_xapian} = "1" ]; then\r
61      esac\r
62  fi\r
63  \r
64 -\r
65 +default_xapian_backend=""\r
66 +if [ ${have_xapian} = "1" ]; then\r
67 +    printf "Testing default Xapian backend... "\r
68 +    cat >_default_backend.cc <<EOF\r
69 +#include <xapian.h>\r
70 +int main(int argc, char** argv) {\r
71 +   Xapian::WritableDatabase db("test.db",Xapian::DB_CREATE_OR_OPEN);\r
72 +}\r
73 +EOF\r
74 +    ${CXX} ${CXXLAGS} ${xapian_cxxflags} _default_backend.cc -o _default_backend ${xapian_ldflags}\r
75 +    ./_default_backend\r
76 +    if [ -f test.db/iamglass ]; then\r
77 +       default_xapian_backend=glass\r
78 +    else\r
79 +       default_xapian_backend=chert\r
80 +    fi\r
81 +    printf "${default_xapian_backend}\n";\r
82 +    rm -rf test.db _default_backend _default_backend.cc\r
83 +fi\r
84  # we need to have a version >= 2.6.5 to avoid a crypto bug. We need\r
85  # 2.6.7 for permissive "From " header handling.\r
86  GMIME_MINVER=2.6.7\r
87 @@ -1001,6 +1019,9 @@ LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}\r
88  XAPIAN_CXXFLAGS = ${xapian_cxxflags}\r
89  XAPIAN_LDFLAGS = ${xapian_ldflags}\r
90  \r
91 +# Which backend will Xapian use by default?\r
92 +DEFAULT_XAPIAN_BACKEND = ${default_xapian_backend}\r
93 +\r
94  # Flags needed to compile and link against GMime\r
95  GMIME_CFLAGS = ${gmime_cflags}\r
96  GMIME_LDFLAGS = ${gmime_ldflags}\r
97 @@ -1077,6 +1098,9 @@ cat > sh.config <<EOF\r
98  # Whether the Xapian version in use supports compaction\r
99  NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}\r
100  \r
101 +# Which backend will Xapian use by default?\r
102 +NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}\r
103 +\r
104  # do we have man pages?\r
105  NOTMUCH_HAVE_MAN=$((have_sphinx))\r
106  \r
107 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
108 index cc08a98..ac04b15 100644\r
109 --- a/test/test-lib.sh\r
110 +++ b/test/test-lib.sh\r
111 @@ -1327,6 +1327,17 @@ test -z "$NO_PYTHON" && test_set_prereq PYTHON\r
112  ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS\r
113  rm -f y\r
114  \r
115 +# convert variable from configure to more convenient form\r
116 +case "$NOTMUCH_DEFAULT_XAPIAN_BACKEND" in\r
117 +    glass)\r
118 +       db_ending=glass\r
119 +    ;;\r
120 +    chert)\r
121 +       db_ending=DB\r
122 +    ;;\r
123 +    *)\r
124 +       error "Unknown Xapian backend $NOTMUCH_DEFAULT_XAPIAN_BACKEND"\r
125 +esac\r
126  # declare prerequisites for external binaries used in tests\r
127  test_declare_external_prereq dtach\r
128  test_declare_external_prereq emacs\r
129 -- \r
130 2.8.0.rc3\r
131 \r