|
Packit |
79f644 |
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
Packit |
79f644 |
/*
|
|
Packit |
79f644 |
* Copyright © 2012 – 2017 Red Hat, Inc.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
79f644 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
79f644 |
* License as published by the Free Software Foundation; either
|
|
Packit |
79f644 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
79f644 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
79f644 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
79f644 |
* Lesser General Public License for more details.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* You should have received a copy of the GNU Lesser General
|
|
Packit |
79f644 |
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
79f644 |
*/
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
#include "config.h"
|
|
Packit |
79f644 |
#include "goaversion.h"
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
/**
|
|
Packit |
79f644 |
* SECTION:goaversion
|
|
Packit |
79f644 |
* @Title: Version Information
|
|
Packit |
79f644 |
* @Short_description: variables and functions to check the GOA version
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* GOA provides version information, primarily useful in configure
|
|
Packit |
79f644 |
* checks for builds that have a configure script. Applications will
|
|
Packit |
79f644 |
* not typically use the features described here.
|
|
Packit |
79f644 |
*/
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
/**
|
|
Packit |
79f644 |
* GOA_MAJOR_VERSION:
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* The major version number of the GOA daemon and library.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Like #goa_major_version, but from the headers used at
|
|
Packit |
79f644 |
* application compile time, rather than from the library
|
|
Packit |
79f644 |
* linked against at application run time.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Since: 3.8
|
|
Packit |
79f644 |
*/
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
/**
|
|
Packit |
79f644 |
* GOA_MINOR_VERSION:
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* The minor version number of the GOA daemon and library.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Like #goa_minor_version, but from the headers used at
|
|
Packit |
79f644 |
* application compile time, rather than from the library
|
|
Packit |
79f644 |
* linked against at application run time.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Since: 3.8
|
|
Packit |
79f644 |
*/
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
/**
|
|
Packit |
79f644 |
* GOA_MICRO_VERSION:
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* The micro version number of the GOA daemon and library.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Like #goa_micro_version, but from the headers used at
|
|
Packit |
79f644 |
* application compile time, rather than from the library
|
|
Packit |
79f644 |
* linked against at application run time.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Since: 3.8
|
|
Packit |
79f644 |
*/
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
/**
|
|
Packit |
79f644 |
* GOA_CHECK_VERSION:
|
|
Packit |
79f644 |
* @major: the major version to check for
|
|
Packit |
79f644 |
* @minor: the minor version to check for
|
|
Packit |
79f644 |
* @micro: the micro version to check for
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Checks the version of the GOA library that is being compiled
|
|
Packit |
79f644 |
* against.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* <example>
|
|
Packit |
79f644 |
* <title>Checking the version of the GOA library</title>
|
|
Packit |
79f644 |
* <programlisting>
|
|
Packit |
79f644 |
* if (!GOA_CHECK_VERSION (3, 8, 0))
|
|
Packit |
79f644 |
* g_error ("GOA version 3.8.0 or above is needed");
|
|
Packit |
79f644 |
* </programlisting>
|
|
Packit |
79f644 |
* </example>
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* See goa_check_version() for a runtime check.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Returns: %TRUE if the version of the GOA header files
|
|
Packit |
79f644 |
* is the same as or newer than the passed-in version.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Since: 3.8
|
|
Packit |
79f644 |
*/
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
const guint goa_major_version = GOA_MAJOR_VERSION;
|
|
Packit |
79f644 |
const guint goa_minor_version = GOA_MINOR_VERSION;
|
|
Packit |
79f644 |
const guint goa_micro_version = GOA_MICRO_VERSION;
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
/**
|
|
Packit |
79f644 |
* goa_check_version:
|
|
Packit |
79f644 |
* @required_major: the required major version.
|
|
Packit |
79f644 |
* @required_minor: the required minor version.
|
|
Packit |
79f644 |
* @required_micro: the required micro version.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Checks that the GOA library in use is compatible with the
|
|
Packit |
79f644 |
* given version. Generally you would pass in the constants
|
|
Packit |
79f644 |
* #GOA_MAJOR_VERSION, #GOA_MINOR_VERSION, #GOA_MICRO_VERSION
|
|
Packit |
79f644 |
* as the three arguments to this function; that produces
|
|
Packit |
79f644 |
* a check that the library in use is compatible with
|
|
Packit |
79f644 |
* the version of GOA the application or module was compiled
|
|
Packit |
79f644 |
* against.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Compatibility is defined by two things: first the version
|
|
Packit |
79f644 |
* of the running library is newer than the version
|
|
Packit |
79f644 |
* @required_major.@required_minor.@required_micro. Second
|
|
Packit |
79f644 |
* the running library must be binary compatible with the
|
|
Packit |
79f644 |
* version @required_major.@required_minor.@required_micro
|
|
Packit |
79f644 |
* (same major and minor version).
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Return value: %NULL if the GOA library is compatible with the
|
|
Packit |
79f644 |
* given version, or a string describing the version mismatch.
|
|
Packit |
79f644 |
* The returned string is owned by GOA and must not be modified
|
|
Packit |
79f644 |
* or freed.
|
|
Packit |
79f644 |
*
|
|
Packit |
79f644 |
* Since: 3.8
|
|
Packit |
79f644 |
*/
|
|
Packit |
79f644 |
const gchar *
|
|
Packit |
79f644 |
goa_check_version (guint required_major,
|
|
Packit |
79f644 |
guint required_minor,
|
|
Packit |
79f644 |
guint required_micro)
|
|
Packit |
79f644 |
{
|
|
Packit |
79f644 |
if (required_major > GOA_MAJOR_VERSION)
|
|
Packit |
79f644 |
return "GOA version too old (major mismatch)";
|
|
Packit |
79f644 |
if (required_major < GOA_MAJOR_VERSION)
|
|
Packit |
79f644 |
return "GOA version too new (major mismatch)";
|
|
Packit |
79f644 |
if (required_minor > GOA_MINOR_VERSION)
|
|
Packit |
79f644 |
return "GOA version too old (minor mismatch)";
|
|
Packit |
79f644 |
if (required_minor < GOA_MINOR_VERSION)
|
|
Packit |
79f644 |
return "GOA version too new (minor mismatch)";
|
|
Packit |
79f644 |
if (required_micro > GOA_MICRO_VERSION)
|
|
Packit |
79f644 |
return "GOA version too old (micro mismatch)";
|
|
Packit |
79f644 |
return NULL;
|
|
Packit |
79f644 |
}
|