Commit c1cdd9d5 authored by Juergen Gross's avatar Juergen Gross Committed by Stefano Stabellini
Browse files

configure: use pkg-config for obtaining xen version



Instead of trying to guess the Xen version to use by compiling various
test programs first just ask the system via pkg-config. Only if it
can't return the version fall back to the test program scheme.

If configure is being called with dedicated flags for the Xen libraries
use those instead of the pkg-config output. This will avoid breaking
an in-tree Xen build of an old Xen version while a new Xen version is
installed on the build machine: pkg-config would pick up the installed
Xen config files as the Xen tree wouldn't contain any of them.

Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarStefano Stabellini <sstabellini@kernel.org>
Tested-by: default avatarPaul Durrant <paul.durrant@citrix.com>
Reviewed-by: default avatarStefano Stabellini <sstabellini@kernel.org>
parent 14d015b6
Loading
Loading
Loading
Loading
+88 −71
Original line number Diff line number Diff line
@@ -1975,6 +1975,22 @@ fi
# xen probe

if test "$xen" != "no" ; then
  # Check whether Xen library path is specified via --extra-ldflags to avoid
  # overriding this setting with pkg-config output. If not, try pkg-config
  # to obtain all needed flags.

  if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
     $pkg_config --exists xencontrol ; then
    xen_ctrl_version="$(printf '%d%02d%02d' \
      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
    xen=yes
    xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
    xen_pc="$xen_pc xenevtchn xendevicemodel"
    QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
    libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
    LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
  else

    xen_libs="-lxenstore -lxenctrl -lxenguest"
    xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -lxenevtchn"

@@ -2233,6 +2249,7 @@ EOF
      libs_softmmu="$xen_libs $libs_softmmu"
    fi
  fi
fi

if test "$xen_pci_passthrough" != "no"; then
  if test "$xen" = "yes" && test "$linux" = "yes"; then