summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-version.h.in
blob: c259b251a30525cb2174b4eed9272171bc184ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
 * Copyright (C) 2017 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 2 of the licence or (at
 * your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library. If not, see <https://www.gnu.org/licenses/>.
 */

#pragma once

/**
 * SECTION:ostree-version
 * @short_description: ostree version checking
 *
 * ostree provides macros to check the version of the library
 * at compile-time
 */

/**
 * OSTREE_YEAR_VERSION:
 *
 * ostree year version component (e.g. 2017 if %OSTREE_VERSION is 2017.2)
 *
 * Since: 2017.4
 */
#define OSTREE_YEAR_VERSION (@YEAR_VERSION@)

/**
 * OSTREE_RELEASE_VERSION:
 *
 * ostree release version component (e.g. 2 if %OSTREE_VERSION is 2017.2)
 *
 * Since: 2017.4
 */
#define OSTREE_RELEASE_VERSION (@RELEASE_VERSION@)

/**
 * OSTREE_VERSION
 *
 * ostree version.
 *
 * Since: 2017.4
 */
#define OSTREE_VERSION (@VERSION@)

/**
 * OSTREE_VERSION_S:
 *
 * ostree version, encoded as a string, useful for printing and
 * concatenation.
 *
 * Since: 2017.4
 */
#define OSTREE_VERSION_S "@VERSION@"

#define OSTREE_ENCODE_VERSION(year,release) \
        ((year) << 16 | (release))

/**
 * OSTREE_VERSION_HEX:
 *
 * ostree version, encoded as an hexadecimal number, useful for
 * integer comparisons.
 *
 * Since: 2017.4
 */
#define OSTREE_VERSION_HEX \
        (OSTREE_ENCODE_VERSION (OSTREE_YEAR_VERSION, OSTREE_RELEASE_VERSION))

/**
 * OSTREE_CHECK_VERSION:
 * @year: required year version
 * @release: required release version
 *
 * Compile-time version checking. Evaluates to %TRUE if the version
 * of ostree is equal or greater than the required one.
 *
 * Since: 2017.4
 */
#define OSTREE_CHECK_VERSION(year,release)   \
        (OSTREE_YEAR_VERSION > (year) || \
         (OSTREE_YEAR_VERSION == (year) && OSTREE_RELEASE_VERSION >= (release)))

/**
 * OSTREE_BUILT_FEATURES:
 *
 * Whitespace separated set of features this libostree was configured with at build time.
 * Consult the source code in configure.ac (or the CLI `ostree --version`) for examples.
 *
 * Since: 2019.3
 */
#define OSTREE_BUILT_FEATURES "@OSTREE_FEATURES@"