* [Qemu-devel] [PATCH] libtasn1: check if static library is present
@ 2015-10-02 21:46 Laurent Vivier
2015-10-02 22:49 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Vivier @ 2015-10-02 21:46 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Laurent Vivier
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
--
2.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] libtasn1: check if static library is present
2015-10-02 21:46 [Qemu-devel] [PATCH] libtasn1: check if static library is present Laurent Vivier
@ 2015-10-02 22:49 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2015-10-02 22:49 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Paolo Bonzini, QEMU Developers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-02 22:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).