[libvirt] [PATCH] Macro for testing the version you are compiling with

Daniel P. Berrange berrange at redhat.com
Wed Nov 13 17:03:19 UTC 2013


On Wed, Nov 13, 2013 at 10:59:14AM -0600, Doug Goldstein wrote:
> Added a macro similar to the Linux kernel's KERNEL_VERSION so that you
> can simply do something like:
> 
>  #if LIBVIR_VERSION(1,1,3) <= LIBVIR_VERSION_NUMBER
>    /* Call function here that appeared in 1.1.3 and newer */
>    virSomeNewFunction();
>  #endif
> ---
>  include/libvirt/libvirt.h.in | 10 ++++++++++
>  1 file changed, 10 insertions(+)

I think it'd be better to have something like GLib's macro

https://developer.gnome.org/glib/stable/glib-Version-Information.html#GLIB-CHECK-VERSION:CAPS

eg

   #if LIBVIRT_CHECK_VERSION(1,1,3)
     ...some code...
   #endif


Of course this won't help the python binding - we'll need to actually
provide that macro in the python binding so it can work with all old
historic versions of libvirt.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list