2020-10-20 14:54:15 +02:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2014-07-24 08:53:33 -04:00
|
|
|
/*
|
2019-10-01 09:20:35 +02:00
|
|
|
* Copyright (C) 2011, 2015 Red Hat, Inc.
|
2014-07-24 08:53:33 -04:00
|
|
|
*/
|
|
|
|
|
|
build: extract version macros from "nm-version.h" to new header file "nm-version-macros.h"
For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus
paths of NetworkManager. It is desirable to have this header usable without
having a dependency on "glib.h", for example for a QT application. For that,
commit c0852964a890cf43cc2dcaeff41ac6edc5028f24 removed that dependancy.
For libnm-glib library, the analog to "nm-dbus-interface.h" is
"NetworkManager.h", and the same applies there. Commit
159e827a72f420048e12d318f8ba1edd3f641fc8 removed that include.
However, that broke build on PackageKit [1] which expected to get the
version macros by including "NetworkManager.h". So at least for libnm-glib,
we need to preserve old behavior so that a user including
"NetworkManager.h" gets the version macros, but not "glib.h".
Extract the version macros to a new header file "nm-version-macros.h".
This header doesn't include "glib.h" and can be included from
"NetworkManager.h". This gives as previous behavior and a glib-free
include.
For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h".
Very few users will actually need the version macros, but not using
libnm.
Users that use libnm, should just include (libnm's) "NetworkManager.h" to
get all headers.
As a special case, a user who doesn't want to use glib/libnm, but still
needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include
them both separately.
[1] https://github.com/hughsie/PackageKit/issues/85
Fixes: 4545a7fe9670ce4d7c259c11c2cc853bfae6729b
2015-09-25 16:07:50 +02:00
|
|
|
#ifndef __NM_VERSION_MACROS_H__
|
|
|
|
|
#define __NM_VERSION_MACROS_H__
|
2014-07-24 08:53:33 -04:00
|
|
|
|
build: extract version macros from "nm-version.h" to new header file "nm-version-macros.h"
For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus
paths of NetworkManager. It is desirable to have this header usable without
having a dependency on "glib.h", for example for a QT application. For that,
commit c0852964a890cf43cc2dcaeff41ac6edc5028f24 removed that dependancy.
For libnm-glib library, the analog to "nm-dbus-interface.h" is
"NetworkManager.h", and the same applies there. Commit
159e827a72f420048e12d318f8ba1edd3f641fc8 removed that include.
However, that broke build on PackageKit [1] which expected to get the
version macros by including "NetworkManager.h". So at least for libnm-glib,
we need to preserve old behavior so that a user including
"NetworkManager.h" gets the version macros, but not "glib.h".
Extract the version macros to a new header file "nm-version-macros.h".
This header doesn't include "glib.h" and can be included from
"NetworkManager.h". This gives as previous behavior and a glib-free
include.
For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h".
Very few users will actually need the version macros, but not using
libnm.
Users that use libnm, should just include (libnm's) "NetworkManager.h" to
get all headers.
As a special case, a user who doesn't want to use glib/libnm, but still
needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include
them both separately.
[1] https://github.com/hughsie/PackageKit/issues/85
Fixes: 4545a7fe9670ce4d7c259c11c2cc853bfae6729b
2015-09-25 16:07:50 +02:00
|
|
|
/* This header must not include glib or libnm. */
|
2015-09-25 15:47:55 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NM_MAJOR_VERSION:
|
|
|
|
|
*
|
|
|
|
|
* Evaluates to the major version number of NetworkManager which this source
|
|
|
|
|
* is compiled against.
|
|
|
|
|
*/
|
|
|
|
|
#define NM_MAJOR_VERSION (@NM_MAJOR_VERSION@)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NM_MINOR_VERSION:
|
|
|
|
|
*
|
|
|
|
|
* Evaluates to the minor version number of NetworkManager which this source
|
|
|
|
|
* is compiled against.
|
|
|
|
|
*/
|
|
|
|
|
#define NM_MINOR_VERSION (@NM_MINOR_VERSION@)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NM_MICRO_VERSION:
|
|
|
|
|
*
|
|
|
|
|
* Evaluates to the micro version number of NetworkManager which this source
|
|
|
|
|
* compiled against.
|
|
|
|
|
*/
|
|
|
|
|
#define NM_MICRO_VERSION (@NM_MICRO_VERSION@)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NM_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 NM_CHECK_VERSION(major,minor,micro) \
|
|
|
|
|
(NM_MAJOR_VERSION > (major) || \
|
|
|
|
|
(NM_MAJOR_VERSION == (major) && NM_MINOR_VERSION > (minor)) || \
|
|
|
|
|
(NM_MAJOR_VERSION == (major) && NM_MINOR_VERSION == (minor) && NM_MICRO_VERSION >= (micro)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define NM_ENCODE_VERSION(major,minor,micro) ((major) << 16 | (minor) << 8 | (micro))
|
|
|
|
|
|
|
|
|
|
#define NM_VERSION_0_9_8 (NM_ENCODE_VERSION (0, 9, 8))
|
|
|
|
|
#define NM_VERSION_0_9_10 (NM_ENCODE_VERSION (0, 9, 10))
|
|
|
|
|
#define NM_VERSION_1_0 (NM_ENCODE_VERSION (1, 0, 0))
|
2015-01-15 16:35:31 -05:00
|
|
|
#define NM_VERSION_1_2 (NM_ENCODE_VERSION (1, 2, 0))
|
2016-04-05 20:40:08 +02:00
|
|
|
#define NM_VERSION_1_4 (NM_ENCODE_VERSION (1, 4, 0))
|
2016-08-17 15:49:17 +02:00
|
|
|
#define NM_VERSION_1_6 (NM_ENCODE_VERSION (1, 6, 0))
|
2017-01-18 18:34:19 +01:00
|
|
|
#define NM_VERSION_1_8 (NM_ENCODE_VERSION (1, 8, 0))
|
2017-03-28 16:30:25 +02:00
|
|
|
#define NM_VERSION_1_10 (NM_ENCODE_VERSION (1, 10, 0))
|
2017-11-03 17:04:40 +01:00
|
|
|
#define NM_VERSION_1_12 (NM_ENCODE_VERSION (1, 12, 0))
|
2018-06-15 17:05:58 +02:00
|
|
|
#define NM_VERSION_1_14 (NM_ENCODE_VERSION (1, 14, 0))
|
2018-09-08 10:24:20 +02:00
|
|
|
#define NM_VERSION_1_16 (NM_ENCODE_VERSION (1, 16, 0))
|
2019-02-23 10:15:56 +01:00
|
|
|
#define NM_VERSION_1_18 (NM_ENCODE_VERSION (1, 18, 0))
|
2019-04-13 18:53:14 +02:00
|
|
|
#define NM_VERSION_1_20 (NM_ENCODE_VERSION (1, 20, 0))
|
2019-07-29 20:56:14 +02:00
|
|
|
#define NM_VERSION_1_22 (NM_ENCODE_VERSION (1, 22, 0))
|
2019-11-29 15:46:22 +01:00
|
|
|
#define NM_VERSION_1_24 (NM_ENCODE_VERSION (1, 24, 0))
|
2020-04-10 18:08:10 +02:00
|
|
|
#define NM_VERSION_1_26 (NM_ENCODE_VERSION (1, 26, 0))
|
2020-06-29 09:05:52 +02:00
|
|
|
#define NM_VERSION_1_28 (NM_ENCODE_VERSION (1, 28, 0))
|
2020-10-20 14:42:26 +02:00
|
|
|
#define NM_VERSION_1_30 (NM_ENCODE_VERSION (1, 30, 0))
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2018-01-16 16:01:49 +01:00
|
|
|
/* For releases, NM_API_VERSION is equal to NM_VERSION.
|
|
|
|
|
*
|
|
|
|
|
* For development builds, NM_API_VERSION is the next
|
|
|
|
|
* stable API after NM_VERSION. When you run a development
|
|
|
|
|
* version, you are already using the future API, even if
|
|
|
|
|
* it is not yet release. Hence, the currently used API
|
|
|
|
|
* version is the future one. */
|
|
|
|
|
#define NM_API_VERSION \
|
2018-01-16 15:57:13 +01:00
|
|
|
(((NM_MINOR_VERSION % 2) == 1) \
|
|
|
|
|
? NM_ENCODE_VERSION (NM_MAJOR_VERSION, NM_MINOR_VERSION + 1, 0 ) \
|
|
|
|
|
: NM_ENCODE_VERSION (NM_MAJOR_VERSION, NM_MINOR_VERSION , ((NM_MICRO_VERSION + 1) / 2) * 2))
|
version: combine NM_VERSION_CUR_STABLE and NM_VERSION_NEXT_STABLE
We don't need to have two version defines "CUR" and "NEXT".
The main purpose of these macros (if not their only), is to
make NM_AVAILABLE_IN_* and NM_DEPRECATED_IN_* macros work.
1) At the precise commit of a release, "CUR" and "NEXT" must be identical,
because whenever the user configures NM_VERSION_MIN_REQUIRED and
NM_VERSION_MAX_ALLOWED, then they both compare against the current
version, at which point "CUR" == "NEXT".
2) Every other commit aside the release, is a development version that leads
up the the next coming release. But as far as versioning is concerned, such
a development version should be treated like that future release. It's unstable
API and it may or may not be close to later API of the release. But
we shall treat it as that version. Hence, also in this case, we want to
set both "NM_VERSION_CUR_STABLE" and again NEXT to the future version.
This makes NM_VERSION_NEXT_STABLE redundant.
Previously, the separation between current and next version would for
example allow that NM_VERSION_CUR_STABLE is the previously release
stable API, and NM_VERSION_NEXT_STABLE is the version of the next upcoming
stable API. So, we could allow "examples" to make use of development
API, but other(?) internal code still restrict to unstable API. But it's
unclear which other code would want to avoid current development.
Also, the points 1) and 2) were badly understood. Note that for our
previousy releases, we usually didn't bump the macros at the stable
release (and if we did, we didn't set them to be the same). While using
two macros might be more powerful, it is hard to grok and easy to
forget to bump the macros a the right time. One macro shall suffice.
All this also means, that *immediately* after making a new release, we shall
bump the version number in `configure.ac` and "NM_VERSION_CUR_STABLE".
2018-01-16 15:19:12 +01:00
|
|
|
|
2018-01-16 16:01:49 +01:00
|
|
|
/* deprecated. */
|
|
|
|
|
#define NM_VERSION_CUR_STABLE NM_API_VERSION
|
|
|
|
|
|
|
|
|
|
/* deprecated. */
|
|
|
|
|
#define NM_VERSION_NEXT_STABLE NM_API_VERSION
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2016-12-20 16:51:52 +01:00
|
|
|
#define NM_VERSION NM_ENCODE_VERSION (NM_MAJOR_VERSION, NM_MINOR_VERSION, NM_MICRO_VERSION)
|
|
|
|
|
|
build: extract version macros from "nm-version.h" to new header file "nm-version-macros.h"
For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus
paths of NetworkManager. It is desirable to have this header usable without
having a dependency on "glib.h", for example for a QT application. For that,
commit c0852964a890cf43cc2dcaeff41ac6edc5028f24 removed that dependancy.
For libnm-glib library, the analog to "nm-dbus-interface.h" is
"NetworkManager.h", and the same applies there. Commit
159e827a72f420048e12d318f8ba1edd3f641fc8 removed that include.
However, that broke build on PackageKit [1] which expected to get the
version macros by including "NetworkManager.h". So at least for libnm-glib,
we need to preserve old behavior so that a user including
"NetworkManager.h" gets the version macros, but not "glib.h".
Extract the version macros to a new header file "nm-version-macros.h".
This header doesn't include "glib.h" and can be included from
"NetworkManager.h". This gives as previous behavior and a glib-free
include.
For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h".
Very few users will actually need the version macros, but not using
libnm.
Users that use libnm, should just include (libnm's) "NetworkManager.h" to
get all headers.
As a special case, a user who doesn't want to use glib/libnm, but still
needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include
them both separately.
[1] https://github.com/hughsie/PackageKit/issues/85
Fixes: 4545a7fe9670ce4d7c259c11c2cc853bfae6729b
2015-09-25 16:07:50 +02:00
|
|
|
#endif /* __NM_VERSION_MACROS_H__ */
|