1/*
2 * Copyright (C) 2009 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
3 * File inspired by champlain-version.h.in which is
4 * Authored By Matthew Allum  <mallum@openedhand.com>
5 * Copyright (C) 2006 OpenedHand
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 */
21
22#ifndef __CHAMPLAIN_VERSION_H__
23#define __CHAMPLAIN_VERSION_H__
24
25/**
26 * SECTION:champlain-version
27 * @short_description: Versioning utility macros
28 *
29 * Champlain offers a set of macros for checking the version of the library
30 * an application was linked to.
31 */
32
33/**
34 * CHAMPLAIN_MAJOR_VERSION:
35 *
36 * The major version of libchamplain (1, if %CHAMPLAIN_VERSION is 1.2.3)
37 */
38#define CHAMPLAIN_MAJOR_VERSION   (@CHAMPLAIN_MAJOR_VERSION@)
39
40/**
41 * CHAMPLAIN_MINOR_VERSION:
42 *
43 * The minor version of libchamplain (2, if %CHAMPLAIN_VERSION is 1.2.3)
44 */
45#define CHAMPLAIN_MINOR_VERSION   (@CHAMPLAIN_MINOR_VERSION@)
46
47/**
48 * CHAMPLAIN_MICRO_VERSION:
49 *
50 * The micro version of libchamplain (3, if %CHAMPLAIN_VERSION is 1.2.3)
51 */
52#define CHAMPLAIN_MICRO_VERSION   (@CHAMPLAIN_MICRO_VERSION@)
53
54/**
55 * CHAMPLAIN_VERSION:
56 *
57 * The full version of libchamplain, like 1.2.3
58 */
59#define CHAMPLAIN_VERSION         @CHAMPLAIN_VERSION@
60
61/**
62 * CHAMPLAIN_VERSION_S:
63 *
64 * The full version of libchamplain, in string form (suited for
65 * string concatenation)
66 */
67#define CHAMPLAIN_VERSION_S       "@CHAMPLAIN_VERSION@"
68
69/**
70 * CHAMPLAIN_VERSION_HEX:
71 *
72 * Numerically encoded version of libchamplain, like 0x010203
73 */
74#define CHAMPLAIN_VERSION_HEX     ((CHAMPLAIN_MAJOR_VERSION << 24) | \
75                                 (CHAMPLAIN_MINOR_VERSION << 16) | \
76                                 (CHAMPLAIN_MICRO_VERSION << 8))
77
78/**
79 * CHAMPLAIN_CHECK_VERSION:
80 * @major: major version, like 1 in 1.2.3
81 * @minor: minor version, like 2 in 1.2.3
82 * @micro: micro version, like 3 in 1.2.3
83 *
84 * Evaluates to %TRUE if the version of libchamplain is greater or equal
85 * than @major, @minor and @micro
86 */
87#define CHAMPLAIN_CHECK_VERSION(major,minor,micro) \
88        (CHAMPLAIN_MAJOR_VERSION > (major) || \
89         (CHAMPLAIN_MAJOR_VERSION == (major) && CHAMPLAIN_MINOR_VERSION > (minor)) || \
90         (CHAMPLAIN_MAJOR_VERSION == (major) && CHAMPLAIN_MINOR_VERSION == (minor) && CHAMPLAIN_MICRO_VERSION >= (micro)))
91
92#endif /* __CHAMPLAIN_VERSION_H__ */
93