diff --git a/.gitignore b/.gitignore index be24050c0f..a8ca6256c4 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/configure.ac b/configure.ac index 7ec2e19e89..d99299ec69 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/include/Makefile.am b/include/Makefile.am index 54c4d1dc80..b2f24ae815 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -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 diff --git a/include/NetworkManager.h b/include/NetworkManager.h index 1ff9111582..9e92777914 100644 --- a/include/NetworkManager.h +++ b/include/NetworkManager.h @@ -23,6 +23,8 @@ #ifndef NETWORK_MANAGER_H #define NETWORK_MANAGER_H +#include "nm-version.h" + /* * dbus services details */ diff --git a/include/nm-version.h.in b/include/nm-version.h.in new file mode 100644 index 0000000000..ee2e1080e0 --- /dev/null +++ b/include/nm-version.h.in @@ -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 */ +