include: add NM_CHECK_VERSION define

This commit is contained in:
Dan Williams 2011-03-02 17:16:27 -06:00
parent 28e6523b8d
commit 1a590cce13
5 changed files with 92 additions and 3 deletions

2
.gitignore vendored
View file

@ -32,6 +32,8 @@ man/*.[185]
po/*.gmo
po/.intltool-merge-cache
include/nm-version.h
docs/libnm-glib/*.stamp
docs/libnm-glib/html/
docs/libnm-glib/tmpl/

View file

@ -1,6 +1,15 @@
AC_PREREQ(2.52)
AC_INIT(NetworkManager, 0.8.992, dcbw@redhat.com, NetworkManager)
dnl The NM version number
m4_define([nm_major_version], [0])
m4_define([nm_minor_version], [8])
m4_define([nm_micro_version], [992])
m4_define([nm_version],
[nm_major_version.nm_minor_version.nm_micro_version])
AC_INIT([NetworkManager], [nm_version],
[http://bugzilla.gnome.org/enter_bug.gci?product=NetworkManager],
[NetworkManager])
AM_INIT_AUTOMAKE([1.9 subdir-objects tar-ustar no-dist-gzip dist-bzip2])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
AM_MAINTAINER_MODE
@ -28,6 +37,16 @@ else
fi
AC_SUBST(DISABLE_DEPRECATED)
dnl Version stuff
NM_MAJOR_VERSION=nm_major_version
NM_MINOR_VERSION=nm_minor_version
NM_MICRO_VERSION=nm_micro_version
NM_VERSION=nm_version
AC_SUBST(NM_MAJOR_VERSION)
AC_SUBST(NM_MINOR_VERSION)
AC_SUBST(NM_MICRO_VERSION)
AC_SUBST(NM_VERSION)
dnl
dnl Required headers
dnl
@ -537,6 +556,7 @@ esac
AC_CONFIG_FILES([
Makefile
include/Makefile
include/nm-version.h
src/Makefile
src/tests/Makefile
marshallers/Makefile

View file

@ -4,11 +4,13 @@ EXTRA_DIST = \
wireless-helper.h \
nm-dbus-glib-types.h \
nm-glib-compat.h \
nm-test-helpers.h
nm-test-helpers.h \
nm-version.h.in
NetworkManagerincludedir=$(includedir)/NetworkManager
NetworkManagerinclude_HEADERS = \
NetworkManager.h \
NetworkManagerVPN.h
NetworkManagerVPN.h \
nm-version.h

View file

@ -23,6 +23,8 @@
#ifndef NETWORK_MANAGER_H
#define NETWORK_MANAGER_H
#include "nm-version.h"
/*
* dbus services details
*/

63
include/nm-version.h.in Normal file
View file

@ -0,0 +1,63 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* 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 Red Hat, Inc.
*/
#ifndef NM_VERSION_H
#define NM_VERSION_H
/**
* 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)))
#endif /* NM_VERSION_H */