qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 4/6] configure: Link test before auto-enabling the l


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] [PATCH 4/6] configure: Link test before auto-enabling the libusbredir library
Date: Fri, 14 Jun 2019 09:24:30 +0200

Similarly to commit a73e82ef912, test the library links correctly
before considering it as usable.

This fixes using ./configure --static on Ubuntu 18.04:

  $ make subdir-aarch64-softmmu
  [...]
    LINK    aarch64-softmmu/qemu-system-aarch64
  /usr/bin/ld: cannot find -lusbredirparser
  collect2: error: ld returned 1 exit status
  Makefile:204: recipe for target 'qemu-system-aarch64' failed
  make[1]: *** [qemu-system-aarch64] Error 1

  $ fgrep redir config-host.mak
  USB_REDIR_LIBS=-lusbredirparser

  $ lsb_release -cri
  Distributor ID: Ubuntu
  Release:        18.04
  Codename:       bionic

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 configure | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index e2511df1e3..4eed33e1b1 100755
--- a/configure
+++ b/configure
@@ -4926,9 +4926,23 @@ fi
 # check for usbredirparser for usb network redirection support
 if test "$usb_redir" != "no" ; then
     if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
-        usb_redir="yes"
         usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
-        usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
+        if test "$static" = "yes"; then
+            usb_redir_libs=$($pkg_config --libs --static libusbredirparser-0.5)
+        else
+            usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
+        fi
+        # Packaging for the static libraries is not always correct.
+        # At least ubuntu 18.04 ships only shared libraries.
+        write_c_skeleton
+        if ! compile_prog "$usb_redir_cflags" "$usb_redir_libs" ; then
+            if test "$usb_redir" = "yes" ; then
+              error_exit "usbredir check failed."
+            fi
+            usb_redir="no"
+        else
+            usb_redir="yes"
+        fi
     else
         if test "$usb_redir" = "yes"; then
             feature_not_found "usb-redir" "Install usbredir devel"
-- 
2.20.1




reply via email to

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