--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id BEEF2429E5A\r
+ for <notmuch@notmuchmail.org>; Wed, 6 Nov 2013 11:01:54 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 971tZOADL14V for <notmuch@notmuchmail.org>;\r
+ Wed, 6 Nov 2013 11:01:47 -0800 (PST)\r
+Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
+ [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 0C62A429E53 for <notmuch@notmuchmail.org>; Wed, 6 Nov 2013 11:01:46 -0800\r
+ (PST)\r
+Received: by mail-ee0-f53.google.com with SMTP id e51so2781551eek.12\r
+ for <notmuch@notmuchmail.org>; Wed, 06 Nov 2013 11:01:45 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id;\r
+ bh=WeA/q4IO17MWeV098NP4+fVNyYmizvN1vtdbwFUwrxI=;\r
+ b=H+dJhEIVD9naL/k5+XlrKQyp7SPevqIL7KTB/35Sq6nkl+1//BfXIm+s0TOsYa/mIN\r
+ 5sNqoV66prIngq2jq9xSnyKlt60CrZkxkANjW3LvJl1mOxO0L+cF06UEeReA4UkJKmdn\r
+ e7WKEmuHFCLOTkmWrThvWgDQuN724uk6YGElDT01ZoNpmK0MvNUBQV9XShn2odejNumZ\r
+ s4mu02zVOs83YE2yiWd8dR04R0DWqqTdJxvvdw5n710cAjsP1f5de5YgL6WMU+Vc/ar1\r
+ bbCfrieP5+eugWv6j5kAARaEN8vFZOE+lyuBagRbzJ00zQIsJpPuN0yai7XpEYtVXqiu\r
+ zeIQ==\r
+X-Gm-Message-State:\r
+ ALoCoQnf4uALkFl2SJX/EhK2KkjT6srgqvQaao7SYNarFN85qqVVOniUPFDxv231UjT8ax4ZiGtN\r
+X-Received: by 10.14.1.130 with SMTP id 2mr5460498eed.24.1383764504484;\r
+ Wed, 06 Nov 2013 11:01:44 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+ [88.195.111.91])\r
+ by mx.google.com with ESMTPSA id 8sm45841004eem.15.2013.11.06.11.01.42\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Wed, 06 Nov 2013 11:01:43 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] lib: add library version check macro\r
+Date: Wed, 6 Nov 2013 21:01:41 +0200\r
+Message-Id: <1383764501-18973-1-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 06 Nov 2013 19:01:54 -0000\r
+\r
+There have been some plans for making build incompatible changes to\r
+the library API. This is inconvenient, but it is much more so without\r
+a way to easily conditional build against multiple versions of\r
+notmuch.\r
+\r
+The macro has been lifted from glib.\r
+---\r
+ lib/notmuch.h | 24 ++++++++++++++++++++++++\r
+ 1 file changed, 24 insertions(+)\r
+\r
+diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+index 9dab555..d109a2c 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -41,6 +41,30 @@ NOTMUCH_BEGIN_DECLS\r
+ #define TRUE 1\r
+ #endif\r
+ \r
++#define NOTMUCH_MAJOR_VERSION 0\r
++#define NOTMUCH_MINOR_VERSION 17\r
++#define NOTMUCH_MICRO_VERSION 0\r
++\r
++/*\r
++ * Check the version of the notmuch library being compiled against.\r
++ *\r
++ * Return true if the library being compiled against is of the\r
++ * specified version or above. For example:\r
++ *\r
++ * #if NOTMUCH_CHECK_VERSION(0, 18, 0)\r
++ * (code requiring notmuch 0.18 or above)\r
++ * #endif\r
++ *\r
++ * NOTMUCH_CHECK_VERSION has been defined since version 0.17.0; you\r
++ * can use #if !defined(NOTMUCH_CHECK_VERSION) to check for versions\r
++ * prior to that.\r
++ */\r
++#define NOTMUCH_CHECK_VERSION (major, minor, micro) \\r
++ (NOTMUCH_MAJOR_VERSION > (major) || \\r
++ (NOTMUCH_MAJOR_VERSION == (major) && NOTMUCH_MINOR_VERSION > (minor)) || \\r
++ (NOTMUCH_MAJOR_VERSION == (major) && NOTMUCH_MINOR_VERSION == (minor) && \\r
++ NOTMUCH_MICRO_VERSION >= (micro)))\r
++\r
+ typedef int notmuch_bool_t;\r
+ \r
+ /* Status codes used for the return values of most functions.\r
+-- \r
+1.8.4.rc3\r
+\r