summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2009-07-03 10:41:32 +0100
committerRichard Hughes <richard@hughsie.com>2009-07-03 10:41:32 +0100
commit77c767edf47a1528bbcc14cf9341708e6c748948 (patch)
tree2640b3690cf00be5388efd77961cb5507b7e3a79
parentcb702d07363823fe497d2401e62e7111c9d77ffa (diff)
Add a DKP_CHECK_VERSION macro which we can use in client tools
-rw-r--r--configure.ac4
-rw-r--r--devkit-power-gobject/.gitignore1
-rw-r--r--devkit-power-gobject/Makefile.am5
-rw-r--r--devkit-power-gobject/devicekit-power.h1
-rw-r--r--devkit-power-gobject/dkp-version.h.in39
5 files changed, 50 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7faacaa..f06b4e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,6 +9,9 @@ AM_MAINTAINER_MODE
# enable nice build output on automake1.11
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+# use this in dkp-version.h
+AC_SUBST(VERSION)
+
# libtool versioning - this applies to devkit-power-gobject
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
@@ -187,6 +190,7 @@ doc/man/Makefile
doc/dbus/Makefile
policy/Makefile
devkit-power-gobject/Makefile
+devkit-power-gobject/dkp-version.h
po/Makefile.in
])
diff --git a/devkit-power-gobject/.gitignore b/devkit-power-gobject/.gitignore
index e9199c5..2455079 100644
--- a/devkit-power-gobject/.gitignore
+++ b/devkit-power-gobject/.gitignore
@@ -8,4 +8,5 @@
*.gcov
*.gcda
*.gcno
+dkp-version.h
diff --git a/devkit-power-gobject/Makefile.am b/devkit-power-gobject/Makefile.am
index 1aebc3c..588ebce 100644
--- a/devkit-power-gobject/Makefile.am
+++ b/devkit-power-gobject/Makefile.am
@@ -14,6 +14,7 @@ lib_LTLIBRARIES = \
libdevkit_power_includedir = $(includedir)/DeviceKit-power/devkit-power-gobject
libdevkit_power_include_HEADERS = \
devicekit-power.h \
+ dkp-version.h \
dkp-client.h \
dkp-device.h \
dkp-wakeups.h \
@@ -25,6 +26,7 @@ libdevkit_power_include_HEADERS = \
libdevkit_power_gobject_la_SOURCES = \
devicekit-power.h \
+ dkp-version.h \
dkp-client.c \
dkp-client.h \
dkp-device.c \
@@ -53,6 +55,9 @@ libdevkit_power_gobject_la_LDFLAGS = \
-no-undefined \
-export-symbols-regex '^dkp_.*'
+EXTRA_DIST = \
+ dkp-version.h.in
+
clean-local:
rm -f *~
diff --git a/devkit-power-gobject/devicekit-power.h b/devkit-power-gobject/devicekit-power.h
index 85f1af9..6d173a9 100644
--- a/devkit-power-gobject/devicekit-power.h
+++ b/devkit-power-gobject/devicekit-power.h
@@ -28,6 +28,7 @@
#define __DEVICEKIT_POWER_H_INSIDE__
+#include <devkit-power-gobject/dkp-version.h>
#include <devkit-power-gobject/dkp-client.h>
#include <devkit-power-gobject/dkp-device.h>
#include <devkit-power-gobject/dkp-enum.h>
diff --git a/devkit-power-gobject/dkp-version.h.in b/devkit-power-gobject/dkp-version.h.in
new file mode 100644
index 0000000..3f61935
--- /dev/null
+++ b/devkit-power-gobject/dkp-version.h.in
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Richard Hughes <richard@hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#if !defined (__DEVICEKIT_POWER_H_INSIDE__) && !defined (DKP_COMPILATION)
+#error "Only <devicekit-power.h> can be included directly."
+#endif
+
+#ifndef __DKP_VERSION_H
+#define __DKP_VERSION_H
+
+/* compile time version
+ */
+#define DKP_COMPILE_VERSION (@VERSION@)
+
+/* check whether a the version is above the compile time version.
+ */
+#define DKP_CHECK_VERSION(ver) \
+ (DKP_COMPILE_VERSION > (ver) || \
+ (DKP_COMPILE_VERSION == (ver)))
+
+#endif /* __DKP_VERSION_H */