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