summaryrefslogtreecommitdiff
path: root/src/libnma/nma-version.h.in
blob: 15a240d7f2b1d793b58ad61f4c4977eeff2b2ef3 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* NetworkManager Applet -- allow user control over networking
 *
 * This library 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 License, 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, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA.
 *
 * Copyright (C) 2011-2017 Red Hat, Inc.
 */

#ifndef NMA_VERSION_H
#define NMA_VERSION_H

#include <glib.h>

/**
 * NMA_MAJOR_VERSION:
 *
 * Evaluates to the major version number of NetworkManager which this source
 * is compiled against.
 */
#define NMA_MAJOR_VERSION (@NMA_MAJOR_VERSION@)

/**
 * NMA_MINOR_VERSION:
 *
 * Evaluates to the minor version number of NetworkManager which this source
 * is compiled against.
 */
#define NMA_MINOR_VERSION (@NMA_MINOR_VERSION@)

/**
 * NMA_MICRO_VERSION:
 *
 * Evaluates to the micro version number of NetworkManager which this source
 * compiled against.
 */
#define NMA_MICRO_VERSION (@NMA_MICRO_VERSION@)

/**
 * NMA_CHECK_VERSION:
 * @major: major version (e.g. 1 for version 1.2.5)
 * @minor: minor version (e.g. 2 for version 1.2.5)
 * @micro: micro version (e.g. 5 for version 1.2.5)
 *
 * Returns: %TRUE if the version of the NetworkManager header files
 * is the same as or newer than the passed-in version.
 */
#define NMA_CHECK_VERSION(major,minor,micro)                         \
    (NMA_MAJOR_VERSION > (major) ||                                  \
     (NMA_MAJOR_VERSION == (major) && NMA_MINOR_VERSION > (minor)) || \
     (NMA_MAJOR_VERSION == (major) && NMA_MINOR_VERSION == (minor) && NMA_MICRO_VERSION >= (micro)))

#define NMA_ENCODE_VERSION(major,minor,micro) ((major) << 16 | (minor) << 8 | (micro))

#define NMA_VERSION_1_2    (NMA_ENCODE_VERSION (1, 2, 0))
#define NMA_VERSION_1_4    (NMA_ENCODE_VERSION (1, 4, 0))
#define NMA_VERSION_1_8    (NMA_ENCODE_VERSION (1, 8, 0))
#define NMA_VERSION_1_8_2  (NMA_ENCODE_VERSION (1, 8, 2))
#define NMA_VERSION_1_8_4  (NMA_ENCODE_VERSION (1, 8, 4))
#define NMA_VERSION_1_8_6  (NMA_ENCODE_VERSION (1, 8, 6))
#define NMA_VERSION_1_8_8  (NMA_ENCODE_VERSION (1, 8, 8))
#define NMA_VERSION_1_8_10 (NMA_ENCODE_VERSION (1, 8, 10))
#define NMA_VERSION_1_8_12 (NMA_ENCODE_VERSION (1, 8, 12))
#define NMA_VERSION_1_8_14 (NMA_ENCODE_VERSION (1, 8, 14))
#define NMA_VERSION_1_8_16 (NMA_ENCODE_VERSION (1, 8, 16))

#define NMA_VERSION_CUR_STABLE  NMA_VERSION_1_8_14
#define NMA_VERSION_NEXT_STABLE NMA_VERSION_1_8_16

#define NMA_VERSION NMA_ENCODE_VERSION (NMA_MAJOR_VERSION, NMA_MINOR_VERSION, NMA_MICRO_VERSION)

/* Deprecation / Availability macros */

#if !defined (NMA_VERSION_MIN_REQUIRED) || (NMA_VERSION_MIN_REQUIRED == 0)
# undef NMA_VERSION_MIN_REQUIRED
# define NMA_VERSION_MIN_REQUIRED (NMA_VERSION_CUR_STABLE)
#endif

#if !defined (NMA_VERSION_MAX_ALLOWED) || (NMA_VERSION_MAX_ALLOWED == 0)
# undef NMA_VERSION_MAX_ALLOWED
# define NMA_VERSION_MAX_ALLOWED (NMA_VERSION_NEXT_STABLE)
#endif

/* sanity checks */
#if NMA_VERSION_MIN_REQUIRED > NMA_VERSION_NEXT_STABLE
#error "NMA_VERSION_MIN_REQUIRED must be <= NMA_VERSION_NEXT_STABLE"
#endif
#if NMA_VERSION_MAX_ALLOWED < NMA_VERSION_MIN_REQUIRED
#error "NMA_VERSION_MAX_ALLOWED must be >= NMA_VERSION_MIN_REQUIRED"
#endif
#if NMA_VERSION_MIN_REQUIRED < NMA_VERSION_1_2
#error "NMA_VERSION_MIN_REQUIRED must be >= NMA_VERSION_1_2"
#endif

#if NMA_VERSION_MIN_REQUIRED >= NMA_VERSION_1_2
# define NMA_DEPRECATED_IN_1_2           G_DEPRECATED
# define NMA_DEPRECATED_IN_1_2_FOR(f)    G_DEPRECATED_FOR(f)
#else
# define NMA_DEPRECATED_IN_1_2
# define NMA_DEPRECATED_IN_1_2_FOR(f)
#endif

#if NMA_VERSION_MIN_REQUIRED >= NMA_VERSION_1_8
# define NMA_DEPRECATED_IN_1_8           G_DEPRECATED
# define NMA_DEPRECATED_IN_1_8_FOR(f)    G_DEPRECATED_FOR(f)
#else
# define NMA_DEPRECATED_IN_1_8
# define NMA_DEPRECATED_IN_1_8_FOR(f)
#endif

#if NMA_VERSION_MAX_ALLOWED < NMA_VERSION_1_8
# define NMA_AVAILABLE_IN_1_8            G_UNAVAILABLE(1,8)
#else
# define NMA_AVAILABLE_IN_1_8
#endif

#if NMA_VERSION_MAX_ALLOWED < NMA_VERSION_1_8_16
# define NMA_AVAILABLE_IN_1_8_16         G_UNAVAILABLE(1,8.16)
#else
# define NMA_AVAILABLE_IN_1_8_16
#endif

#endif  /* NMA_VERSION_H */