[libgdata] Add version check preprocessor macros
- From: Holger Berndt <hb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] Add version check preprocessor macros
- Date: Tue, 27 Sep 2011 22:10:02 +0000 (UTC)
commit e1ab283e0a347bea06398953f9ad6eeba4e891c5
Author: Holger Berndt <hb gnome org>
Date: Sun Sep 25 02:24:03 2011 +0200
Add version check preprocessor macros
https://bugzilla.gnome.org/show_bug.cgi?id=660038
Makefile.am | 6 ++-
configure.ac | 1 +
docs/reference/gdata-docs.xml | 1 +
docs/reference/gdata-sections.txt | 9 ++++
gdata/gdata-version.h.in | 80 +++++++++++++++++++++++++++++++++++++
gdata/gdata.h | 1 +
6 files changed, 96 insertions(+), 2 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 23b986c..42e2dc8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,7 +180,8 @@ private_headers = \
gdatainclude_HEADERS = \
$(gdata_headers) \
gdata/gdata-enums.h \
- gdata/gdata-types.h
+ gdata/gdata-types.h \
+ gdata/gdata-version.h
gdataatomincludedir = $(gdataincludedir)/atom
gdataatominclude_HEADERS = \
@@ -609,7 +610,8 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libgdata.pc
CLEANFILES += $(pkgconfig_DATA)
-EXTRA_DIST += libgdata.pc.in
+EXTRA_DIST += libgdata.pc.in \
+ gdata/gdata-version.h.in
# ChangeLog
ChangeLog: $(srcdir)/ChangeLog
diff --git a/configure.ac b/configure.ac
index 61aa30d..152f616 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,6 +139,7 @@ GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
AC_CONFIG_FILES([
Makefile
libgdata.pc
+gdata/gdata-version.h
gdata/tests/Makefile
po/Makefile.in
docs/Makefile
diff --git a/docs/reference/gdata-docs.xml b/docs/reference/gdata-docs.xml
index 41e0157..fff7dba 100644
--- a/docs/reference/gdata-docs.xml
+++ b/docs/reference/gdata-docs.xml
@@ -25,6 +25,7 @@
<title>Core API</title>
<chapter>
<title>Core API</title>
+ <xi:include href="xml/gdata-version.xml"/>
<xi:include href="xml/gdata-service.xml"/>
<xi:include href="xml/gdata-query.xml"/>
<xi:include href="xml/gdata-feed.xml"/>
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 2da91d1..80b378d 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -1,4 +1,13 @@
<SECTION>
+<FILE>gdata-version</FILE>
+<TITLE>Version Information</TITLE>
+GDATA_MAJOR_VERSION
+GDATA_MINOR_VERSION
+GDATA_MICRO_VERSION
+GDATA_CHECK_VERSION
+</SECTION>
+
+<SECTION>
<FILE>gdata-service</FILE>
<TITLE>GDataService</TITLE>
GDataService
diff --git a/gdata/gdata-version.h.in b/gdata/gdata-version.h.in
new file mode 100644
index 0000000..90c0282
--- /dev/null
+++ b/gdata/gdata-version.h.in
@@ -0,0 +1,80 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * GData Client
+ * Copyright (C) Holger Berndt 2011 <hb gnome org>
+ *
+ * GData Client 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.1 of the License, or (at your option) any later version.
+ *
+ * GData Client 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 GData Client. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * SECTION:gdata-version
+ * @Short_description: Macros to check the libgdata version
+ * @Title: Version Information
+ *
+ * libgdata provides compile-time version information.
+ *
+ * Since: 0.11.0
+ */
+
+#ifndef GDATA_VERSION_H
+#define GDATA_VERSION_H
+
+/**
+ * GDATA_MAJOR_VERSION:
+ *
+ * Evaluates to the major version of the GData headers at compile time.
+ * (e.g. in libgdata version 1.2.3 this is 1).
+ *
+ * Since: 0.11.0
+ */
+#define GDATA_MAJOR_VERSION (@GDATA_VERSION_MAJOR@)
+
+/**
+ * GDATA_MINOR_VERSION:
+ *
+ * Evaluates to the minor version of the GData headers at compile time.
+ * (e.g. in libgdata version 1.2.3 this is 2).
+ *
+ * Since: 0.11.0
+ */
+#define GDATA_MINOR_VERSION (@GDATA_VERSION_MINOR@)
+
+/**
+ * GDATA_MICRO_VERSION:
+ *
+ * Evaluates to the micro version of the GData headers at compile time.
+ * (e.g. in libgdata version 1.2.3 this is 3).
+ *
+ * Since: 0.11.0
+ */
+#define GDATA_MICRO_VERSION (@GDATA_VERSION_MICRO@)
+
+/**
+ * GDATA_CHECK_VERSION:
+ * @major: major version (e.g. 1 for version 1.2.3)
+ * @minor: minor version (e.g. 2 for version 1.2.3)
+ * @micro: micro version (e.g. 3 for version 1.2.3)
+ *
+ * Evaluates to %TRUE if the version of the GData header files
+ * is the same as or newer than the passed-in version.
+ *
+ * Since: 0.11.0
+ */
+#define GDATA_CHECK_VERSION(major,minor,micro) \
+ (GDATA_MAJOR_VERSION > (major) || \
+ (GDATA_MAJOR_VERSION == (major) && GDATA_MINOR_VERSION > (minor)) || \
+ (GDATA_MAJOR_VERSION == (major) && GDATA_MINOR_VERSION == (minor) && \
+ GDATA_MICRO_VERSION >= (micro)))
+
+#endif /* !GDATA_VERSION_H */
diff --git a/gdata/gdata.h b/gdata/gdata.h
index 35316f0..441e226 100644
--- a/gdata/gdata.h
+++ b/gdata/gdata.h
@@ -41,6 +41,7 @@
#include <gdata/gdata-oauth1-authorizer.h>
#include <gdata/gdata-commentable.h>
#include <gdata/gdata-comment.h>
+#include <gdata/gdata-version.h>
/* Namespaces */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]