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: Juergen Gross <jgross@suse.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Tested-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Juergen Gross 2017-03-27 09:42:45 +02:00 committed by Stefano Stabellini
parent 14d015b6fc
commit c1cdd9d5be
1 changed files with 86 additions and 69 deletions

17
configure vendored
View File

@ -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