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

Doug Goldstein cardoe at cardoe.com
Wed Nov 13 17:35:18 UTC 2013


On Wed, Nov 13, 2013 at 11:03 AM, Daniel P. Berrange
<berrange at redhat.com> wrote:
> 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.

Sounds good to me. I switched it and reposted. I'm suggesting adding
it to libvirt simply so that other language bindings can take
advantage of the macro as well. I'm sticking it into libvirt-python
with an ifndef wrapper as well. That patch series to come later.

-- 
Doug Goldstein




More information about the libvir-list mailing list