goa: Add missing linker flag (for real).
[platform/upstream/evolution-data-server.git] / libedataserver / eds-version.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU Lesser General Public
7  * License as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #include "eds-version.h"
21
22 const guint eds_major_version = EDS_MAJOR_VERSION;
23 const guint eds_minor_version = EDS_MINOR_VERSION;
24 const guint eds_micro_version = EDS_MICRO_VERSION;
25
26 /**
27  * eds_check_version:
28  * @required_major: the required major version
29  * @required_minor: the required minor version
30  * @required_micro: the required micro version
31  *
32  * Checks that the Evolution-Data-Server library in use is compatible with
33  * the given version.  Generally you would pass in the constants
34  * #EDS_MAJOR_VERSION, #EDS_MINOR_VERSION, #EDS_MICRO_VERSION as the three
35  * arguments to this function.  That produces a check that the library in
36  * use is compatible with the version of Evolution-Data-Server the
37  * application or module was compiled against.
38  *
39  * Returns: %NULL if the Evolution-Data-Server library is compatible with
40  * the given version, or a string describing the version mismatch.  The
41  * returned string is owned by libedataserver and must not be modified or
42  * freed.
43  *
44  * Since: 2.24
45  **/
46 const gchar *
47 eds_check_version (guint required_major,
48                    guint required_minor,
49                    guint required_micro)
50 {
51         gint eds_effective_micro = 100 * EDS_MINOR_VERSION + EDS_MICRO_VERSION;
52         gint required_effective_micro = 100 * required_minor + required_micro;
53
54         if (required_major > EDS_MAJOR_VERSION)
55                 return "EDS version too old (major mismatch)";
56         if (required_major < EDS_MAJOR_VERSION)
57                 return "EDS version too new (major mismatch)";
58         if (required_effective_micro > eds_effective_micro)
59                 return "EDS version too old (micro mismatch)";
60
61         return NULL;
62 }