qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ui/gtk: require at least GTK 2.18 and VTE 0.26


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] ui/gtk: require at least GTK 2.18 and VTE 0.26
Date: Fri, 22 Feb 2013 16:58:57 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

Am 22.02.2013 15:48, schrieb Daniel P. Berrange:
> On Fri, Feb 22, 2013 at 08:41:42AM -0600, Anthony Liguori wrote:
>> This gives us the bare amount of features we need.  We can add work arounds
>> for older versions and lower the requirement but this should be a good
>> starting point.
>>
>> Signed-off-by: Anthony Liguori <address@hidden>
>> ---
>>  configure | 45 +++++++++++++++++++++++++++++++++++++++------
>>  1 file changed, 39 insertions(+), 6 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 0dadd31..259fa7d 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1640,18 +1640,51 @@ if test "$sparse" != "no" ; then
>>    fi
>>  fi
>>  
>> +gtk_check_version()
>> +{
>> +    version="$1"
>> +    major="$2"
>> +    minor="$3"
>> +    release="$4"
>> +
>> +    a=`echo $version | cut -f1 -d.`
>> +    b=`echo $version | cut -f2 -d.`
>> +    c=`echo $version | cut -f3 -d.`
>> +
>> +    if test $a != $major; then
>> +    return 1
>> +    elif test $b -lt $minor; then
>> +    return 1
>> +    elif test $b = $minor -a $c -lt $release; then
>> +    return 1
>> +    fi
>> +
>> +    return 0
>> +}
>> +
>>  ##########################################
>>  # GTK probe
>>  
>>  if test "$gtk" != "no"; then
>>      if $pkg_config gtk+-2.0 --modversion >/dev/null 2>/dev/null && \
>>         $pkg_config vte --modversion >/dev/null 2>/dev/null; then
>> -    gtk_cflags=`$pkg_config --cflags gtk+-2.0 2>/dev/null`
>> -    gtk_libs=`$pkg_config --libs gtk+-2.0 2>/dev/null`
>> -    vte_cflags=`$pkg_config --cflags vte 2>/dev/null`
>> -    vte_libs=`$pkg_config --libs vte 2>/dev/null`
>> -    libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
>> -    gtk="yes"
>> +    gtk_version=`$pkg_config --modversion gtk+-2.0`
>> +    vte_version=`$pkg_config --modversion vte`
>> +
>> +    if gtk_check_version $gtk_version 2 18 0 &&
>> +        gtk_check_version $vte_version 0 26 0; then
>
> Isn't most of this version checking code just re-inventing what
> pkg-config can do for you already
>
>   # pkg-config --exists 'gtk+-2.0 > 2.20.0'
>   # echo $?
>   0
>   # pkg-config --exists 'gtk+-2.0 > 2.50.0'
>   # echo $?
>   1
>
> Regards,
> Daniel

Daniel is right, --exists greatly simplifies the code here
(and in most existing checks in configure).

Instead of using --exists, you can also use --atleast-version to
test for existence and for the moduleversion in a single statement:

if $pkg_config --atleast-version=2.18.0gtk+-2.0; then ...

There is also no need to redirect stdout or stderr if pkg-config
is used like that.

Regards,
StefanWeil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]