[Spice-devel,spice-common] spice-deps: Make LZ4 check depending on function

Submitted by Uri Lublin on Nov. 24, 2016, 1:14 p.m.

Details

Message ID 5bb1b294-2eda-655d-f0eb-6c2b144f2278@redhat.com
State New
Headers show
Series "spice-deps: Make LZ4 check depending on function" ( rev: 2 ) in Spice

Not browsing as part of any series.

Commit Message

Uri Lublin Nov. 24, 2016, 1:14 p.m.
On 11/24/2016 01:07 PM, Pavel Grunt wrote:
> On Thu, 2016-11-24 at 05:18 -0500, Frediano Ziglio wrote:
>>> LZ4 changed versioning scheme from r131 to v1.7.3 making our
>>> configure
>>> fail with (1.7.3 < 129).
>>>
>>> Switch from version checking to checking that the necessary
>>> function
>>> is available.
>>> ---
>>>  m4/spice-deps.m4 | 6 ++++--
>>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
>>> index adedec4..43a7d4a 100644
>>> --- a/m4/spice-deps.m4
>>> +++ b/m4/spice-deps.m4
>>> @@ -185,12 +185,14 @@ AC_DEFUN([SPICE_CHECK_LZ4], [
>>>
>>>      have_lz4="no"
>>>      if test "x$enable_lz4" != "xno"; then
>>> -      PKG_CHECK_MODULES([LZ4], [liblz4 >= 129], [have_lz4="yes"],
>>> [have_lz4="no"])
>>> +      PKG_CHECK_MODULES([LZ4], [liblz4], [
>>> +          AC_SEARCH_LIBS([LZ4_compress_default], [lz4],
>>> [have_lz4="yes"],
>>> [have_lz4="no"])],
>>> +          [have_lz4="no"])
>>>
>>
>> have_lz4 by default is defined no so you could remove the assignment
>> to "no", but that's not a problem.
>
> ok
>
>>
>> Using AC_SEARCH_LIBS and [lz4] as library you are assuming you can
>> link lz4 library with -llz4 (more or less) but this can be a problem
>> if you are using MingW or another cross compiler that needs other
>> options. Maybe this is hidden by the fact that we just require a
>> library path and is already included by another library.
>> Did you try to cross compile the client for Windows?
>
> lz4 is not available for mingw so I haven't tried it

The magic of autoconf should work when compiling with mingw too.

To test it I add the following to virt-viewer.git/configure.ac
and run (autoreconf and) ./configure and mingw32-configure.
For both cases I get AAA: yes

---
  AS_IF([test "x$with_spice_gtk" != "xno" && test "x$with_spice_gtk" != 
"xyes"],
        [PKG_CHECK_EXISTS([spice-client-gtk-3.0 >= $SPICE_GTK_REQUIRED
                           spice-client-glib-2.0 >= $SPICE_GTK_REQUIRED
@@ -277,3 +279,5 @@ AC_MSG_NOTICE([     LIBVIRT: $LIBVIRT_CFLAGS 
$LIBVIRT_LIBS])
  AC_MSG_NOTICE([])
  AC_MSG_NOTICE([       OVIRT: $OVIRT_CFLAGS $OVIRT_LIBS])
  AC_MSG_NOTICE([])
+AC_MSG_NOTICE([       AAA: $have_aaa])
+AC_MSG_NOTICE([])

---

Uri.

Patch hide | download patch | download mbox

diff --git a/configure.ac b/configure.ac
index 81cb576..75b0a8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,6 +156,8 @@  AM_CONDITIONAL([HAVE_GTK_VNC], [test 
"x$with_gtk_vnc" = "xyes"])
  AC_ARG_WITH([spice-gtk],
      AS_HELP_STRING([--without-spice-gtk], [Ignore presence of 
spice-gtk and disable it]))

+AC_SEARCH_LIBS([spice_gtk_session_copy_to_guest], 
[spice-client-gtk-3.0], [have_aaa="yes"], [have_aaa="no"])
+