qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: zhe.he@windriver.com
Cc: pbonzini@redhat.com, thuth@redhat.com, philmd@redhat.com,
	laurent@vivier.eu, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] configure: Add pkg-config handling for libgcrypt
Date: Thu, 29 Aug 2019 10:15:05 +0100	[thread overview]
Message-ID: <20190829091505.GB17141@redhat.com> (raw)
In-Reply-To: <1567068782-371028-1-git-send-email-zhe.he@windriver.com>

On Thu, Aug 29, 2019 at 04:53:02PM +0800, zhe.he@windriver.com wrote:
> From: He Zhe <zhe.he@windriver.com>
> 
> 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.

> 
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
>  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
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


  reply	other threads:[~2019-08-29  9:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29  8:53 [Qemu-devel] [PATCH] configure: Add pkg-config handling for libgcrypt zhe.he
2019-08-29  9:15 ` Daniel P. Berrangé [this message]
2019-08-29  9:26   ` He Zhe
2019-08-29  9:36     ` Daniel P. Berrangé
2022-01-07 11:43   ` Andrea Bolognani
2022-01-07 11:55     ` Thomas Huth
2022-01-07 12:06       ` Daniel P. Berrangé
2022-01-07 13:39         ` Andrea Bolognani
  -- strict thread matches above, loose matches on Subject: below --
2019-08-29  8:51 zhe.he

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190829091505.GB17141@redhat.com \
    --to=berrange@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=zhe.he@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).