libqmi-glib,api: provide version info

This commit is contained in:
Aleksander Morgado 2013-06-13 11:53:43 +02:00
parent eaa6bcd2a1
commit 306a3c9d01
7 changed files with 105 additions and 1 deletions

1
.gitignore vendored
View File

@ -35,6 +35,7 @@ libqmi-glib/.deps
libqmi-glib/Makefile
libqmi-glib/Makefile.in
libqmi-glib/libqmi-glib.la
libqmi-glib/qmi-version.h
libqmi-glib/generated/.libs
libqmi-glib/generated/.deps

View File

@ -1,7 +1,14 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([libqmi], [1.5.0], [libqmi-devel@lists.freedesktop.org])
dnl The QMI version number
m4_define([qmi_major_version], [1])
m4_define([qmi_minor_version], [5])
m4_define([qmi_micro_version], [0])
m4_define([qmi_version],
[qmi_major_version.qmi_minor_version.qmi_micro_version])
AC_INIT([libqmi], [qmi_version], [libqmi-devel@lists.freedesktop.org])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
@ -26,6 +33,16 @@ LT_INIT
dnl Specific warnings to always use
LIBQMI_COMPILER_WARNINGS
dnl Version stuff
QMI_MAJOR_VERSION=qmi_major_version
QMI_MINOR_VERSION=qmi_minor_version
QMI_MICRO_VERSION=qmi_micro_version
QMI_VERSION=qmi_version
AC_SUBST(QMI_MAJOR_VERSION)
AC_SUBST(QMI_MINOR_VERSION)
AC_SUBST(QMI_MICRO_VERSION)
AC_SUBST(QMI_VERSION)
dnl General dependencies for libqmi-glib
PKG_CHECK_MODULES(LIBQMI_GLIB,
glib-2.0 >= 2.32
@ -68,6 +85,7 @@ AC_CONFIG_FILES([Makefile
build-aux/templates/Makefile
build-aux/qmi-codegen/Makefile
libqmi-glib/Makefile
libqmi-glib/qmi-version.h
libqmi-glib/generated/Makefile
libqmi-glib/test/Makefile
cli/Makefile

View File

@ -1,3 +1,12 @@
<SECTION>
<FILE>qmi-version</FILE>
<TITLE>Version checks</TITLE>
QMI_MAJOR_VERSION
QMI_MICRO_VERSION
QMI_MINOR_VERSION
QMI_CHECK_VERSION
</SECTION>
<SECTION>
<FILE>qmi-client</FILE>
<TITLE>QmiClient</TITLE>

View File

@ -39,6 +39,7 @@
<chapter>
<title>Core</title>
<xi:include href="xml/qmi-version.xml"/>
<xi:include href="xml/qmi-message.xml"/>
<xi:include href="xml/qmi-device.xml"/>
<xi:include href="xml/qmi-client.xml"/>

View File

@ -15,6 +15,7 @@ libqmi_glib_la_CPPFLAGS = \
libqmi_glib_la_SOURCES = \
libqmi-glib.h \
qmi-version.h \
qmi-errors.h \
qmi-enums-wds.h qmi-enums-wds.c \
qmi-enums-dms.h qmi-flags64-dms.h \
@ -34,6 +35,7 @@ libqmi_glib_la_LIBADD = \
includedir = @includedir@/libqmi-glib
include_HEADERS = \
libqmi-glib.h \
qmi-version.h \
qmi-errors.h \
qmi-enums.h \
qmi-enums-private.h \
@ -46,3 +48,6 @@ include_HEADERS = \
qmi-message.h \
qmi-device.h \
qmi-client.h
EXTRA_DIST = \
qmi-version.h.in

View File

@ -28,6 +28,7 @@
/* libqmi-glib headers */
#include "qmi-version.h"
#include "qmi-device.h"
#include "qmi-client.h"
#include "qmi-message.h"

View File

@ -0,0 +1,69 @@
/* -*- 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) 2013 Lanedo GmbH
*/
#ifndef _QMI_VERSION_H_
#define _QMI_VERSION_H_
/**
* SECTION:qmi-version
* @short_description: Version information in the API.
*
* This section defines types that are used to identify the libqmi-glib version.
**/
/**
* QMI_MAJOR_VERSION:
*
* Evaluates to the major version number of libqmi-glib which this source
* is compiled against.
*/
#define QMI_MAJOR_VERSION (@QMI_MAJOR_VERSION@)
/**
* QMI_MINOR_VERSION:
*
* Evaluates to the minor version number of libqmi-glib which this source
* is compiled against.
*/
#define QMI_MINOR_VERSION (@QMI_MINOR_VERSION@)
/**
* QMI_MICRO_VERSION:
*
* Evaluates to the micro version number of libqmi-glib which this source
* compiled against.
*/
#define QMI_MICRO_VERSION (@QMI_MICRO_VERSION@)
/**
* QMI_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 libqmi-glib header files
* is the same as or newer than the passed-in version.
*/
#define QMI_CHECK_VERSION(major,minor,micro) \
(QMI_MAJOR_VERSION > (major) || \
(QMI_MAJOR_VERSION == (major) && QMI_MINOR_VERSION > (minor)) || \
(QMI_MAJOR_VERSION == (major) && QMI_MINOR_VERSION == (minor) && QMI_MICRO_VERSION >= (micro)))
#endif /* _QMI_VERSION_H_ */