[libvirt] [libvirt-python 04/18] Add libvirt version check macro from libvirt upstream

Doug Goldstein cardoe at cardoe.com
Mon Nov 18 22:44:03 UTC 2013


Add LIBVIRT_CHECK_VERSION from libvirt upstream so that we can check the
version of the library we are compiling against and support a range of
libvirt versions. The macro was added to libvirt in 1.1.5 so we must
provide it if its not defined.
---
 libvirt-utils.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libvirt-utils.h b/libvirt-utils.h
index 1b26413..6f920c6 100644
--- a/libvirt-utils.h
+++ b/libvirt-utils.h
@@ -22,6 +22,16 @@
 #ifndef __LIBVIRT_UTILS_H__
 # define __LIBVIRT_UTILS_H__
 
+/**
+ * libvirt.h provides this as of version 1.1.5, but we want to be able
+ * to support older versions of libvirt so copy and paste the macro from
+ * libvirt.h
+ */
+#ifndef LIBVIR_CHECK_VERSION
+# define LIBVIR_CHECK_VERSION(major, minor, micro) \
+    ((major) * 1000000 + (minor) * 1000 + (micro) <= LIBVIR_VERSION_NUMBER)
+#endif
+
 #define STREQ(a,b) (strcmp(a,b) == 0)
 
 #ifndef MIN
-- 
1.8.3.2




More information about the libvir-list mailing list