qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Laurent Vivier <laurent@vivier.eu>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] libtasn1: check if static library is present
Date: Fri, 2 Oct 2015 23:49:01 +0100	[thread overview]
Message-ID: <CAFEAcA8FnVoud4cDNuk-0UhE56x7YdR06QK3VDHYQkfa9Xx9aw@mail.gmail.com> (raw)
In-Reply-To: <1443822412-29479-1-git-send-email-laurent@vivier.eu>

On 2 October 2015 at 22:46, Laurent Vivier <laurent@vivier.eu> wrote:
> Some distros [1] don't ship systematically static libraries,
> and pkg-config doesn't give us the information.
>
> This is the case for libtasn1, so add a check in configure
> to see if linker is able to find the library.
>
> [1] https://fedoraproject.org/wiki/Archive:PackagingDrafts/StaticLibraryPolicy
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  configure | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index f14454e..99d4269 100755
> --- a/configure
> +++ b/configure
> @@ -2284,9 +2284,20 @@ fi
>  tasn1=yes
>  if $pkg_config --exists "libtasn1"; then
>      tasn1_cflags=`$pkg_config --cflags libtasn1`
> -    tasn1_libs=`$pkg_config --libs libtasn1`
> -    test_cflags="$test_cflags $tasn1_cflags"
> -    test_libs="$test_libs $tasn1_libs"
> +    if test "$static" = "yes" ; then
> +        # some distros (fedora) don't ship all static libraries
> +        tasn1_libs=`$pkg_config --static --libs libtasn1`
> +        if compile_prog "$tasn1_cflags" "$tasn1_libs" ; then
> +            test_cflags="$test_cflags $tasn1_cflags"
> +            test_libs="$test_libs $tasn1_libs"
> +        else
> +            tasn1=no
> +        fi
> +    else
> +        tasn1_libs=`$pkg_config --libs libtasn1`
> +        test_cflags="$test_cflags $tasn1_cflags"
> +        test_libs="$test_libs $tasn1_libs"
> +    fi
>  else
>      tasn1=no
>  fi

If $static is 'yes' then calling $pkg_config already
passes the --static flag (see $QEMU_PKG_CONFIG_FLAGS).
You probably just want to always do the compile_prog,
rather than special-casing $static=yes.

See also the gnutls_works function which is doing a
similar "ask pkg_config, but sanity check that it compiles"
job.

(We could maybe abstract the idea out into a
'pkg_exists_and_works thing' function, but I'd be
happy to wait til we have 3 uses before doing that.)

PS: this is a bug in Fedora, which is shipping bogus
pkg-config info for the static case.

thanks
-- PMM

      reply	other threads:[~2015-10-02 22:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 21:46 [Qemu-devel] [PATCH] libtasn1: check if static library is present Laurent Vivier
2015-10-02 22:49 ` Peter Maydell [this message]

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=CAFEAcA8FnVoud4cDNuk-0UhE56x7YdR06QK3VDHYQkfa9Xx9aw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).