qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] configure: Add pkg-config handling for libgcryp


From: He Zhe
Subject: Re: [Qemu-devel] [PATCH] configure: Add pkg-config handling for libgcrypt
Date: Thu, 29 Aug 2019 17:26:49 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0


On 8/29/19 5:15 PM, Daniel P. Berrangé wrote:
> On Thu, Aug 29, 2019 at 04:53:02PM +0800, address@hidden wrote:
>> From: He Zhe <address@hidden>
>>
>> libgcrypt may also be controlled by pkg-config, this patch adds pkg-config
>> handling for libgcrypt.
> Where are you seeing pkg-config files for libgcrypt ?
>
> The upstream project has (frustratingly) been hostile to any proposal to
> add pkg-config support saying people should stick with their custom 
> libgcrypt-config tool
>
>    https://dev.gnupg.org/T2037
>
> Even if this is something added by some distro downstream, what is the
> benefit in using it, compared with libgcrypt-confg which should already
> work & is portable.

IMHO, it could be easy for people to use pkg-config as a center to control
configurations for many different packages.

This is just an addition for qemu to be able to work in both cases. It does not
remove libgcrypt-confg and can fall back to libgcrypt-confg when pkg-config does
not work.

Zhe

>
>> Signed-off-by: He Zhe <address@hidden>
>> ---
>>  configure | 48 ++++++++++++++++++++++++++++++++++++++++--------
>>  1 file changed, 40 insertions(+), 8 deletions(-)
>>
>> diff --git a/configure b/configure
>> index e44e454..0f362a7 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2875,6 +2875,30 @@ has_libgcrypt() {
>>      return 0
>>  }
>>  
>> +has_libgcrypt_pkgconfig() {
>> +    if ! has $pkg_config ; then
>> +        return 1
>> +    fi
>> +
>> +    if ! $pkg_config --list-all | grep libgcrypt > /dev/null 2>&1 ; then
>> +        return 1
>> +    fi
>> +
>> +    if test -n "$cross_prefix" ; then
>> +        host=$($pkg_config --variable=host libgcrypt)
>> +        if test "${host%-gnu}-" != "${cross_prefix%-gnu}" ; then
>> +            print_error "host($host) does not match 
>> cross_prefix($cross_prefix)"
>> +            return 1
>> +        fi
>> +    fi
>> +
>> +    if ! $pkg_config --atleast-version=1.5.0 libgcrypt ; then
>> +        print_error "libgcrypt version is $($pkg_config --modversion 
>> libgcrypt)"
>> +        return 1
>> +    fi
>> +
>> +    return 0
>> +}
>>  
>>  if test "$nettle" != "no"; then
>>      pass="no"
>> @@ -2902,7 +2926,14 @@ fi
>>  
>>  if test "$gcrypt" != "no"; then
>>      pass="no"
>> -    if has_libgcrypt; then
>> +    if has_libgcrypt_pkgconfig; then
>> +        gcrypt_cflags=$($pkg_config --cflags libgcrypt)
>> +        if test "$static" = "yes" ; then
>> +            gcrypt_libs=$($pkg_config --libs --static libgcrypt)
>> +        else
>> +            gcrypt_libs=$($pkg_config --libs libgcrypt)
>> +        fi
>> +    elif has_libgcrypt; then
>>          gcrypt_cflags=$(libgcrypt-config --cflags)
>>          gcrypt_libs=$(libgcrypt-config --libs)
>>          # Debian has removed -lgpg-error from libgcrypt-config
>> @@ -2912,15 +2943,16 @@ if test "$gcrypt" != "no"; then
>>          then
>>              gcrypt_libs="$gcrypt_libs -lgpg-error"
>>          fi
>> +    fi
>>  
>> -        # Link test to make sure the given libraries work (e.g for static).
>> -        write_c_skeleton
>> -        if compile_prog "" "$gcrypt_libs" ; then
>> -            LIBS="$gcrypt_libs $LIBS"
>> -            QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
>> -            pass="yes"
>> -        fi
>> +    # Link test to make sure the given libraries work (e.g for static).
>> +    write_c_skeleton
>> +    if compile_prog "" "$gcrypt_libs" ; then
>> +        LIBS="$gcrypt_libs $LIBS"
>> +        QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
>> +        pass="yes"
>>      fi
>> +
>>      if test "$pass" = "yes"; then
>>          gcrypt="yes"
>>          cat > $TMPC << EOF
>> -- 
>> 2.7.4
>>
> Regards,
> Daniel




reply via email to

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