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

[Xen-devel] [PATCH 2/2] 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.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 configure | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/configure b/configure
index aabf098..b43fbd5 100755
--- a/configure
+++ b/configure
@@ -1983,26 +1983,12 @@ EOF
     fi
     xen=no
 
-  # Xen unstable
-  elif
-      cat > $TMPC <<EOF &&
-#undef XC_WANT_COMPAT_DEVICEMODEL_API
-#define __XEN_TOOLS__
-#include <xendevicemodel.h>
-int main(void) {
-  xendevicemodel_handle *xd;
-
-  xd = xendevicemodel_open(0, 0);
-  xendevicemodel_close(xd);
-
-  return 0;
-}
-EOF
-      compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel"
-    then
-    xen_stable_libs="$xen_stable_libs -lxendevicemodel"
-    xen_ctrl_version=40900
+  # Xen version via pkg-config (Xen 4.9.0 and newer)
+  elif $pkg_config --exists xencontrol ; then
+    xen_ctrl_version="$(printf '%d%02d%02d' \
+      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
     xen=yes
+
   elif
       cat > $TMPC <<EOF &&
 /*
@@ -2214,7 +2200,12 @@ EOF
   fi
 
   if test "$xen" = yes; then
-    if test $xen_ctrl_version -ge 40701  ; then
+    if test $xen_ctrl_version -ge 40900 ; then
+      xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab 
xenevtchn"
+      xen_pc="$xen_pc xendevicemodel"
+      xen_libs="$($pkg_config --libs $xen_pc)"
+      QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
+    elif test $xen_ctrl_version -ge 40701 ; then
       libs_softmmu="$xen_stable_libs $libs_softmmu"
     fi
     libs_softmmu="$xen_libs $libs_softmmu"
-- 
2.10.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.