All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree.
@ 2015-04-16 15:56 George Dunlap
  2015-04-16 15:56 ` [PATCH RFC v2 1/3] tools: Remove in-tree blktap2 George Dunlap
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: George Dunlap @ 2015-04-16 15:56 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, Ian Campbell, Wen Congyang, George Dunlap,
	Jonathan Ludlam, Ian Jackson, Yang Hongyang, Dave Scott

For some time, the blktap2 in-tree has bitrotted.  Many years ago the
XenServer team at Citrix forked the code into a separate repository;
several attempts have been made to upstream those changes back into
Xen, to no avail.

The blktap code at the moment is the only source of performant vhd
format integration.  It's additionally in use by projects like the
COLO project.

This patch series removes the in-tree blktap2 code and enables xen to
detect and build against the XenServer blktap tree.  I've gotten
agreement from the XenServer team to act as an upstream -- to accept
patches fixing bugs, to help track down errors, and to attempt to help
fix build breakages introduced by development.

At the moment this patch is against the "blktap2" branch of
XenServer's blktap.git.  (This has been sometimes known as "blktap
2.5".)  This branch is maintianed in order to provide a buildroot for
OpenStack, and has also been used by the CentOS xen packages for
several years now.

The series consists of three patches:

1/3 Remove the blktap2 tree and temporarily disable it in config

2/3 Port libxl to use the upstream blktap2.

3/3 Detect blktap2 and enable it by default if detected.

The first patch is pretty massive and mostly not very interesting;
I'll be sending a modified patch with the interesting bits.  The full
patch series can be found here:

git://xenbits.xen.org/people/gdunlap/xen.git  out/blktap25/rfc-v2

This series has some niggles (noted in the patches themselves), and so
it not yet ready to apply as-is.

One of the big ones is that the blktap headers are borked: you can't
actually include them from where they get installed.  This is
something I'm going to try to address upstream.

 -George Dunlap

CC: Ian Campbell <ian.campbell@citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Dave Scott <Dave.Scott@eu.citrix.com>
CC: Jonathan Ludlam <Jonathan.Ludlam@eu.citrix.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
CC: Yang Hongyang <yanghy@cn.fujitsu.com>

George Dunlap (3):
  tools: Remove in-tree blktap2
  libxl: Port libxl_blktap2.c to blktap2.5 API.
  tools/configure: Detect out-of-tree blktap2 and use by default if
    available

 tools/Makefile                             |    1 -
 tools/Rules.mk                             |   10 +-
[tools/blktap2 tree removed]
 tools/config.h.in                          |    4 +-
 tools/configure                            | 2125 ++++++++++--------
 tools/configure.ac                         |   30 +-
 tools/libxl/libxl.c                        |    6 +-
 tools/libxl/libxl_blktap2.c                |   58 +-
 tools/libxl/libxl_dm.c                     |    3 +-
 tools/libxl/libxl_internal.h               |    3 +-
 135 files changed, 1221 insertions(+), 41148 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH RFC v2 1/3] tools: Remove in-tree blktap2
  2015-04-16 15:56 [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree George Dunlap
@ 2015-04-16 15:56 ` George Dunlap
  2015-04-16 16:45   ` Ian Jackson
  2015-04-16 15:56 ` [PATCH RFC v2 2/3] libxl: Port libxl_blktap2.c to blktap2.5 API George Dunlap
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: George Dunlap @ 2015-04-16 15:56 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, Ian Campbell, Wen Congyang, George Dunlap,
	Jonathan Ludlam, Ian Jackson, Yang Hongyang, Dave Scott

Remove and temporarily disable the in-tree blktap2 while we pivot to
using an external blktap2 library.

The reason for removing first is to be able to port libxl_blktap2.c to
the upstream blktap2.5 API (which is incompatible with the in-tree
bltkap) in a separate patch to the code linking the external blktap2
tree.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

---
This patch modifies tools/configure.ac; autogen.sh should be re-run.

CC: Ian Campbell <ian.campbell@citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Dave Scott <Dave.Scott@eu.citrix.com>
CC: Jonathan Ludlam <Jonathan.Ludlam@eu.citrix.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
CC: Yang Hongyang <yanghy@cn.fujitsu.com>
---
 tools/Makefile                             |    1 -
[tools/blktap2/* deleted]
 tools/config.h.in                          |    3 -
 tools/configure                            |   26 +-
 tools/configure.ac                         |   12 +-
 130 files changed, 9 insertions(+), 40162 deletions(-)
 delete mode 100644 tools/blktap2/[*]

diff --git a/tools/Makefile b/tools/Makefile
index 966354a..2003365 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -16,7 +16,6 @@ SUBDIRS-y += console
 SUBDIRS-y += xenmon
 SUBDIRS-y += xenstat
 SUBDIRS-$(CONFIG_Linux) += memshr 
-SUBDIRS-$(CONFIG_BLKTAP2) += blktap2
 SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
 SUBDIRS-y += libfsimage
 SUBDIRS-$(CONFIG_Linux) += libvchan
diff --git a/tools/blktap2/Makefile b/tools/blktap2/Makefile
deleted file mode 100644
index 94200dc..0000000
diff --git a/tools/config.h.in b/tools/config.h.in
index 2a0ae48..251f6c1 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -1,8 +1,5 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* Blktap2 enabled */
-#undef HAVE_BLKTAP2
-
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
diff --git a/tools/configure b/tools/configure
index a752acd..cc8caf6 100755
--- a/tools/configure
+++ b/tools/configure
@@ -3222,7 +3222,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3268,7 +3268,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3292,7 +3292,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3337,7 +3337,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3361,7 +3361,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -4043,24 +4043,12 @@ if test "${enable_blktap2+set}" = set; then :
   enableval=$enable_blktap2;
 else
 
-    case "$host_os" in
-        linux*)
-           enable_blktap2="yes";;
-        *) enable_blktap2="no";;
-    esac
-
+    enable_blktap2="no"
 fi
 
 if test "x$enable_blktap2" = "xyes"; then :
 
-
-$as_echo "#define HAVE_BLKTAP2 1" >>confdefs.h
-
-    blktap2=y
-else
-
-    blktap2=n
-
+    as_fn_error $? "blktap2 support temporarily unavailable" "$LINENO" 5
 fi
 
 
diff --git a/tools/configure.ac b/tools/configure.ac
index d31c2f3..ae2946f 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -118,17 +118,9 @@ dnl Enable blktap2 on Linux only.
 AC_ARG_ENABLE([blktap2],
     AS_HELP_STRING([--enable-blktap2],
                    [Enable blktap2, (DEFAULT is on for Linux, otherwise off)]),,[
-    case "$host_os" in
-        linux*)
-           enable_blktap2="yes";;
-        *) enable_blktap2="no";;
-    esac
-])
+    enable_blktap2="no"])
 AS_IF([test "x$enable_blktap2" = "xyes"], [
-AC_DEFINE([HAVE_BLKTAP2], [1], [Blktap2 enabled])
-    blktap2=y],[
-    blktap2=n
-])
+    AC_MSG_ERROR([blktap2 support temporarily unavailable])])
 AC_SUBST(blktap2)
 
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH RFC v2 2/3] libxl: Port libxl_blktap2.c to blktap2.5 API.
  2015-04-16 15:56 [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree George Dunlap
  2015-04-16 15:56 ` [PATCH RFC v2 1/3] tools: Remove in-tree blktap2 George Dunlap
@ 2015-04-16 15:56 ` George Dunlap
  2015-04-16 16:45   ` Ian Jackson
  2015-04-16 15:56 ` [PATCH RFC v2 3/3] tools/configure: Detect out-of-tree blktap2 and use by default if available George Dunlap
  2015-04-16 15:57 ` [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree George Dunlap
  3 siblings, 1 reply; 7+ messages in thread
From: George Dunlap @ 2015-04-16 15:56 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, Ian Campbell, Wen Congyang, George Dunlap,
	Jonathan Ludlam, Ian Jackson, Yang Hongyang, Dave Scott

This is code is in preparation for building against an external blktap
tree.

tap_ctl_find() has gone away, so in some cases we use
tap_ctl_find_minor(), and in other cases we use a
locally-reimplemented version of tap_ctl_find().

tap_ctl_create() has an extra three parameters, including a flags
parameter which can be used to designate a disk image as read-only.
Pass the readwrite disk flag here so we can now open backends on
read-only storage.

tap_ctl_destroy() now has two extra arguments as well; add sensible
default values.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

---

CC: Ian Campbell <ian.campbell@citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Dave Scott <Dave.Scott@eu.citrix.com>
CC: Jonathan Ludlam <Jonathan.Ludlam@eu.citrix.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
CC: Yang Hongyang <yanghy@cn.fujitsu.com>
---
 tools/libxl/libxl.c          |  6 +++--
 tools/libxl/libxl_blktap2.c  | 58 ++++++++++++++++++++++++++++++++++++--------
 tools/libxl/libxl_dm.c       |  3 ++-
 tools/libxl/libxl_internal.h |  3 ++-
 4 files changed, 56 insertions(+), 14 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index debb20c..54a9fb7 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2484,7 +2484,8 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
             case LIBXL_DISK_BACKEND_TAP:
                 if (dev == NULL) {
                     dev = libxl__blktap_devpath(gc, disk->pdev_path,
-                                                disk->format);
+                                                disk->format,
+                                                disk->readwrite);
                     if (!dev) {
                         LOG(ERROR, "failed to get blktap devpath for %p\n",
                             disk->pdev_path);
@@ -3078,7 +3079,8 @@ void libxl__device_disk_local_initiate_attach(libxl__egc *egc,
                 break;
             case LIBXL_DISK_FORMAT_VHD:
                 dev = libxl__blktap_devpath(gc, disk->pdev_path,
-                                            disk->format);
+                                            disk->format,
+                                            disk->readwrite);
                 break;
             case LIBXL_DISK_FORMAT_QCOW:
             case LIBXL_DISK_FORMAT_QCOW2:
diff --git a/tools/libxl/libxl_blktap2.c b/tools/libxl/libxl_blktap2.c
index 2053403..24939d7 100644
--- a/tools/libxl/libxl_blktap2.c
+++ b/tools/libxl/libxl_blktap2.c
@@ -23,26 +23,62 @@ int libxl__blktap_enabled(libxl__gc *gc)
     return !tap_ctl_check(&msg);
 }
 
+static int tap_ctl_find(const char *type, const char *disk, tap_list_t *tap) 
+{
+    int err;
+    struct list_head list = LIST_HEAD_INIT(list);
+    tap_list_t *entry;
+
+    err = tap_ctl_list(&list);
+    if (err)
+        return err;
+
+    err = ERROR_FAIL;
+
+    tap_list_for_each_entry(entry, &list) {
+        if (type && (!entry->type || strcmp(entry->type, type)))
+            continue;
+        
+        if (disk && (!entry->path || strcmp(entry->path, disk)))
+            continue;
+        
+        tap->minor = entry->minor;
+        tap->pid = entry->pid;
+        err = 0;
+        break;
+    }
+    tap_ctl_list_free(&list);
+    
+    return err;
+}
+
 char *libxl__blktap_devpath(libxl__gc *gc,
                             const char *disk,
-                            libxl_disk_format format)
+                            libxl_disk_format format,
+                            int readwrite)
 {
     const char *type;
     char *params, *devname = NULL;
-    tap_list_t tap;
     int err;
+    int minor;
+    int flags;
 
     type = libxl__device_disk_string_of_format(format);
-    err = tap_ctl_find(type, disk, &tap);
-    if (err == 0) {
-        devname = libxl__sprintf(gc, "/dev/xen/blktap-2/tapdev%d", tap.minor);
+
+    minor = tap_ctl_find_minor(type, disk);
+    if (minor >= 0) {
+        devname = libxl__sprintf(gc, "/dev/xen/blktap-2/tapdev%d", minor);
         if (devname)
             return devname;
     }
 
     params = libxl__sprintf(gc, "%s:%s", type, disk);
-    err = tap_ctl_create(params, &devname);
+    fprintf(stderr, "DEBUG %s %d %s\n", __func__, __LINE__, params);
+    flags = readwrite ? 0 : TAPDISK_MESSAGE_FLAG_RDONLY;
+
+    err = tap_ctl_create(params, &devname, flags, -1, 0, 0);
     if (!err) {
+        fprintf(stderr, "DEBUG %s %d %s\n", __func__, __LINE__, devname);
         libxl__ptr_add(gc, devname);
         return devname;
     }
@@ -55,7 +91,8 @@ int libxl__device_destroy_tapdisk(libxl__gc *gc, const char *params)
 {
     char *type, *disk;
     int err;
-    tap_list_t tap;
+    struct list_head list = LIST_HEAD_INIT(list);
+    tap_list_t tap = { .minor=-1, .pid=-1 };
 
     type = libxl__strdup(gc, params);
 
@@ -65,19 +102,20 @@ int libxl__device_destroy_tapdisk(libxl__gc *gc, const char *params)
         return ERROR_INVAL;
     }
 
+    fprintf(stderr, "DEBUG %s %d type=%s disk=%s\n",__func__,__LINE__,type,disk);
     *disk++ = '\0';
 
     err = tap_ctl_find(type, disk, &tap);
-    if (err < 0) {
+    if (err) {
         /* returns -errno */
         LOGEV(ERROR, -err, "Unable to find type %s disk %s", type, disk);
         return ERROR_FAIL;
     }
 
-    err = tap_ctl_destroy(tap.id, tap.minor);
+    err = tap_ctl_destroy(tap.pid, tap.minor, 1, NULL);
     if (err < 0) {
         LOGEV(ERROR, -err, "Failed to destroy tap device id %d minor %d",
-              tap.id, tap.minor);
+              tap.pid, tap.minor);
         return ERROR_FAIL;
     }
 
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 30c1578..d13ef9e 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -835,7 +835,8 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                 if (disks[i].backend == LIBXL_DISK_BACKEND_TAP) {
                     format = qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
                     pdev_path = libxl__blktap_devpath(gc, disks[i].pdev_path,
-                                                      disks[i].format);
+                                                      disks[i].format,
+                                                      disks[i].readwrite);
                 } else {
                     pdev_path = disks[i].pdev_path;
                 }
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 10d1252..46968f1 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1574,7 +1574,8 @@ _hidden int libxl__blktap_enabled(libxl__gc *gc);
  */
 _hidden char *libxl__blktap_devpath(libxl__gc *gc,
                                     const char *disk,
-                                    libxl_disk_format format);
+                                    libxl_disk_format format,
+                                    int readwrite);
 
 /* libxl__device_destroy_tapdisk:
  *   Destroys any tapdisk process associated with the backend represented
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH RFC v2 3/3] tools/configure: Detect out-of-tree blktap2 and use by default if available
  2015-04-16 15:56 [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree George Dunlap
  2015-04-16 15:56 ` [PATCH RFC v2 1/3] tools: Remove in-tree blktap2 George Dunlap
  2015-04-16 15:56 ` [PATCH RFC v2 2/3] libxl: Port libxl_blktap2.c to blktap2.5 API George Dunlap
@ 2015-04-16 15:56 ` George Dunlap
  2015-04-16 15:57 ` [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree George Dunlap
  3 siblings, 0 replies; 7+ messages in thread
From: George Dunlap @ 2015-04-16 15:56 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, Ian Campbell, Wen Congyang, George Dunlap,
	Jonathan Ludlam, Ian Jackson, Yang Hongyang, Dave Scott

Set the {CFLAGS,LDLIBS,SHLIBS}_libblktapctl conditionally so that if
someone is building blkttap out-of-tree but not installing it in the
build environment, they can specify the path thus:

CFLAGS="-I$INST_DIR/$PREFIX/include/blktap -I$INST_DIR/$PREFIX/include/vhd" \
LDFLAGS="-L$INST_DIR/$PREFIX/lib -Wl,-rpath-link=$INST_DIR/$PREFIX/lib" \
./configure --prefix=$PREFIX --with-system-qemu=/usr/bin/qemu-system-i386

CFLAGS_libblktapctl="-I$INST_DIR/$PREFIX/include/blktap -I$INST_DIR/$PREFIX/include/vhd" \
LDLIBS_libblktapctl="-L$INST_DIR/$PREFIX/lib -lblktapctl" \
SHLIB_libblktapctl="-Wl,-rpath-link=$INST_DIR/$PREFIX/lib" \
make

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
---
NOTES:

1. blktap doesn't have any proper versioning, so these checks may
need to be made more complete to make sure we have a compatible
version of the library.

2. The blktap header files at the moment are borked wrt paths.  "make
install" will separate them into /usr/include/blktap and
/usr/include/vhd; but in the header files themselves they include one
another by using #include "filename.h".  This means that using them
after install doesn't work unless you add -I/usr/include/blktap and
-I/usr/include/vhd.

Rules.mk at the moment handles this by including both paths in
CFLAGS_libblktapctl; but for configure to correctly detect it, at the
moment it means passing an extra CFLAGS, like this:

CFLAGS="-I/usr/include/blktap -I/usr/include/vhd" ./configure

I'll try to sort out #2 before getting this committed.

This patch modifies tools/configure.ac; autogen.sh should be re-run.

CC: Ian Campbell <ian.campbell@citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Dave Scott <Dave.Scott@eu.citrix.com>
CC: Jonathan Ludlam <Jonathan.Ludlam@eu.citrix.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
CC: Yang Hongyang <yanghy@cn.fujitsu.com>
---
 tools/Rules.mk     |   10 +-
 tools/config.h.in  |    7 +-
 tools/configure    | 2013 ++++++++++++++++++++++++++++------------------------
 tools/configure.ac |   32 +-
 4 files changed, 1123 insertions(+), 939 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 3c29d07..f3687d8 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -14,7 +14,6 @@ XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
 XEN_XENLIGHT       = $(XEN_ROOT)/tools/libxl
 XEN_XENSTORE       = $(XEN_ROOT)/tools/xenstore
 XEN_LIBXENSTAT     = $(XEN_ROOT)/tools/xenstat/libxenstat/src
-XEN_BLKTAP2        = $(XEN_ROOT)/tools/blktap2
 XEN_LIBVCHAN       = $(XEN_ROOT)/tools/libvchan
 
 CFLAGS_xeninclude = -I$(XEN_INCLUDE)
@@ -63,10 +62,13 @@ endif
 
 LIBXL_BLKTAP ?= $(CONFIG_BLKTAP2)
 
+# If you build blktap out-of-tree but don't install it in your
+# buildroot, set these environment variables to let the build system
+# know where to find the headers and libraries.
 ifeq ($(LIBXL_BLKTAP),y)
-CFLAGS_libblktapctl = -I$(XEN_BLKTAP2)/control -I$(XEN_BLKTAP2)/include $(CFLAGS_xeninclude)
-LDLIBS_libblktapctl = -L$(XEN_BLKTAP2)/control -lblktapctl
-SHLIB_libblktapctl  = -Wl,-rpath-link=$(XEN_BLKTAP2)/control
+CFLAGS_libblktapctl ?= -I$(INCLUDEDIR)/blktap -I$(INCLUDEDIR)/vhd $(CFLAGS_xeninclude)
+LDLIBS_libblktapctl ?= -lblktapctl
+SHLIB_libblktapctl  ?= -Wl,-rpath-link=$(LIBDIR)
 else
 CFLAGS_libblktapctl =
 LDLIBS_libblktapctl =
diff --git a/tools/config.h.in b/tools/config.h.in
index 251f6c1..9b3764f 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -1,10 +1,13 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Blktap2 enabled */
+#undef HAVE_BLKTAP2
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
-/* Define to 1 if you have the `aio' library (-laio). */
-#undef HAVE_LIBAIO
+/* Define to 1 if you have the `blktapctl' library (-lblktapctl). */
+#undef HAVE_LIBBLKTAPCTL
 
 /* Define to 1 if you have the `crypto' library (-lcrypto). */
 #undef HAVE_LIBCRYPTO
diff --git a/tools/configure b/tools/configure
index cc8caf6..e67ec8e 100755
--- a/tools/configure
+++ b/tools/configure
@@ -639,7 +639,6 @@ PTHREAD_LDFLAGS
 PTHREAD_CFLAGS
 libgcrypt
 EXTFS_LIBS
-system_aio
 zlib
 FETCHER
 FTP
@@ -653,9 +652,6 @@ PKG_CONFIG_PATH
 PKG_CONFIG
 CURSES_LIBS
 PY_NOOPT_CFLAGS
-EGREP
-GREP
-CPP
 pyconfig
 PYTHONPATH
 CHECKPOLICY
@@ -702,6 +698,9 @@ qemu_xen
 rombios
 qemu_traditional
 blktap2
+EGREP
+GREP
+CPP
 LINUX_BACKEND_MODULES
 debug
 seabios
@@ -814,6 +813,7 @@ CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
+CPP
 PREPEND_INCLUDES
 PREPEND_LIB
 APPEND_INCLUDES
@@ -830,7 +830,6 @@ AS86
 LD86
 BCC
 IASL
-CPP
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
@@ -1527,6 +1526,7 @@ Some influential environment variables:
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
   PREPEND_INCLUDES
               List of include folders to prepend to CFLAGS (without -I)
   PREPEND_LIB List of library folders to prepend to LDFLAGS (without -L)
@@ -1545,7 +1545,6 @@ Some influential environment variables:
   LD86        Path to ld86 tool
   BCC         Path to bcc tool
   IASL        Path to iasl tool
-  CPP         C preprocessor
   PKG_CONFIG  path to pkg-config utility
   PKG_CONFIG_PATH
               directories to add to pkg-config's search path
@@ -4038,110 +4037,723 @@ fi
 LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 
 
-# Check whether --enable-blktap2 was given.
-if test "${enable_blktap2+set}" = set; then :
-  enableval=$enable_blktap2;
-else
-
-    enable_blktap2="no"
-fi
-
-if test "x$enable_blktap2" = "xyes"; then :
-
-    as_fn_error $? "blktap2 support temporarily unavailable" "$LINENO" 5
+# Check for blktap2
+blktap2_present="yes"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
 fi
-
-
-
-# Check whether --enable-qemu-traditional was given.
-if test "${enable_qemu_traditional+set}" = set; then :
-  enableval=$enable_qemu_traditional;
+if test -z "$CPP"; then
+  if ${ac_cv_prog_CPP+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
 
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-
+else
+  # Broken: fails on valid input.
+continue
 fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-if test "x$enable_qemu_traditional" = "xyes"; then :
-
-
-$as_echo "#define HAVE_QEMU_TRADITIONAL 1" >>confdefs.h
-
-    qemu_traditional=y
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
 else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-    qemu_traditional=n
-
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
 fi
 
+    done
+    ac_cv_prog_CPP=$CPP
 
-# Check whether --enable-rombios was given.
-if test "${enable_rombios+set}" = set; then :
-  enableval=$enable_rombios;
+fi
+  CPP=$ac_cv_prog_CPP
 else
-
-    if test "x$enable_qemu_traditional" = "xyes"; then :
-
-        enable_rombios="yes"
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
 
 else
-
-        enable_rombios="no"
-
+  # Broken: fails on valid input.
+continue
 fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
 fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-if test "x$enable_rombios" = "xyes"; then :
-
-
-$as_echo "#define HAVE_ROMBIOS 1" >>confdefs.h
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
 
-    rombios=y
 else
-
-    rombios=n
-
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-# Check whether --with-system-qemu was given.
-if test "${with_system_qemu+set}" = set; then :
-  withval=$with_system_qemu;
-    case $withval in
-    yes) qemu_xen=n ; qemu_xen_path=qemu ;;
-    no)  qemu_xen=y ; qemu_xen_path= ;;
-    *)   qemu_xen=n ; qemu_xen_path=$withval ;;
-    esac
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
 
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           qemu_xen=y;;
-        arm*|aarch64)
-           qemu_xen=y;;
-        *) qemu_xen=n;;
-    esac
-
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
 fi
 
-if test "x$qemu_xen" = "xn"; then :
-
-
-cat >>confdefs.h <<_ACEOF
-#define QEMU_XEN_PATH "$qemu_xen_path"
-_ACEOF
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "blktap/tap-ctl.h" "ac_cv_header_blktap_tap_ctl_h" "$ac_includes_default"
+if test "x$ac_cv_header_blktap_tap_ctl_h" = xyes; then :
+
+else
+  blktap2_present="no"
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tap_ctl_list in -lblktapctl" >&5
+$as_echo_n "checking for tap_ctl_list in -lblktapctl... " >&6; }
+if ${ac_cv_lib_blktapctl_tap_ctl_list+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lblktapctl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char tap_ctl_list ();
+int
+main ()
+{
+return tap_ctl_list ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_blktapctl_tap_ctl_list=yes
+else
+  ac_cv_lib_blktapctl_tap_ctl_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blktapctl_tap_ctl_list" >&5
+$as_echo "$ac_cv_lib_blktapctl_tap_ctl_list" >&6; }
+if test "x$ac_cv_lib_blktapctl_tap_ctl_list" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBBLKTAPCTL 1
+_ACEOF
+
+  LIBS="-lblktapctl $LIBS"
+
+else
+  blktap2_present="no"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tap_ctl_find_minor in -lblktapctl" >&5
+$as_echo_n "checking for tap_ctl_find_minor in -lblktapctl... " >&6; }
+if ${ac_cv_lib_blktapctl_tap_ctl_find_minor+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lblktapctl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char tap_ctl_find_minor ();
+int
+main ()
+{
+return tap_ctl_find_minor ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_blktapctl_tap_ctl_find_minor=yes
+else
+  ac_cv_lib_blktapctl_tap_ctl_find_minor=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blktapctl_tap_ctl_find_minor" >&5
+$as_echo "$ac_cv_lib_blktapctl_tap_ctl_find_minor" >&6; }
+if test "x$ac_cv_lib_blktapctl_tap_ctl_find_minor" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBBLKTAPCTL 1
+_ACEOF
+
+  LIBS="-lblktapctl $LIBS"
+
+else
+  blktap2_present="no"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tap_ctl_create in -lblktapctl" >&5
+$as_echo_n "checking for tap_ctl_create in -lblktapctl... " >&6; }
+if ${ac_cv_lib_blktapctl_tap_ctl_create+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lblktapctl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char tap_ctl_create ();
+int
+main ()
+{
+return tap_ctl_create ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_blktapctl_tap_ctl_create=yes
+else
+  ac_cv_lib_blktapctl_tap_ctl_create=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blktapctl_tap_ctl_create" >&5
+$as_echo "$ac_cv_lib_blktapctl_tap_ctl_create" >&6; }
+if test "x$ac_cv_lib_blktapctl_tap_ctl_create" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBBLKTAPCTL 1
+_ACEOF
+
+  LIBS="-lblktapctl $LIBS"
+
+else
+  blktap2_present="no"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tap_ctl_destroy in -lblktapctl" >&5
+$as_echo_n "checking for tap_ctl_destroy in -lblktapctl... " >&6; }
+if ${ac_cv_lib_blktapctl_tap_ctl_destroy+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lblktapctl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char tap_ctl_destroy ();
+int
+main ()
+{
+return tap_ctl_destroy ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_blktapctl_tap_ctl_destroy=yes
+else
+  ac_cv_lib_blktapctl_tap_ctl_destroy=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blktapctl_tap_ctl_destroy" >&5
+$as_echo "$ac_cv_lib_blktapctl_tap_ctl_destroy" >&6; }
+if test "x$ac_cv_lib_blktapctl_tap_ctl_destroy" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBBLKTAPCTL 1
+_ACEOF
+
+  LIBS="-lblktapctl $LIBS"
+
+else
+  blktap2_present="no"
+fi
+
+
+# Check whether --enable-blktap2 was given.
+if test "${enable_blktap2+set}" = set; then :
+  enableval=$enable_blktap2; if test "$enable_blktap2" = "yes"; then :
+  if test "$blktap2_present" = "no"; then :
+  as_fn_error $? "blktap2 enabled, but cannot find blktap2" "$LINENO" 5
+fi
+fi
+else
+
+    case "$blktap2_present" in
+        yes)
+            enable_blktap2="yes";;
+        no)
+            enable_blktap2="no";;
+    esac
+
+fi
+
+if test "x$enable_blktap2" = "xyes"; then :
+
+
+$as_echo "#define HAVE_BLKTAP2 1" >>confdefs.h
+
+    blktap2=y
+else
+
+    blktap2=n
+
+fi
+
+
+
+# Check whether --enable-qemu-traditional was given.
+if test "${enable_qemu_traditional+set}" = set; then :
+  enableval=$enable_qemu_traditional;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+    case "$host_os" in
+        freebsd*)
+           enable_qemu_traditional="no";;
+    esac
+
+
+fi
+
+if test "x$enable_qemu_traditional" = "xyes"; then :
+
+
+$as_echo "#define HAVE_QEMU_TRADITIONAL 1" >>confdefs.h
+
+    qemu_traditional=y
+else
+
+    qemu_traditional=n
+
+fi
+
+
+# Check whether --enable-rombios was given.
+if test "${enable_rombios+set}" = set; then :
+  enableval=$enable_rombios;
+else
+
+    if test "x$enable_qemu_traditional" = "xyes"; then :
+
+        enable_rombios="yes"
+
+else
+
+        enable_rombios="no"
+
+fi
+
+fi
+
+if test "x$enable_rombios" = "xyes"; then :
+
+
+$as_echo "#define HAVE_ROMBIOS 1" >>confdefs.h
+
+    rombios=y
+else
+
+    rombios=n
+
+fi
+
+
+
+# Check whether --with-system-qemu was given.
+if test "${with_system_qemu+set}" = set; then :
+  withval=$with_system_qemu;
+    case $withval in
+    yes) qemu_xen=n ; qemu_xen_path=qemu ;;
+    no)  qemu_xen=y ; qemu_xen_path= ;;
+    *)   qemu_xen=n ; qemu_xen_path=$withval ;;
+    esac
+
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           qemu_xen=y;;
+        arm*|aarch64)
+           qemu_xen=y;;
+        *) qemu_xen=n;;
+    esac
+
+fi
+
+if test "x$qemu_xen" = "xn"; then :
+
+
+cat >>confdefs.h <<_ACEOF
+#define QEMU_XEN_PATH "$qemu_xen_path"
+_ACEOF
 
 
 fi
@@ -5860,209 +6472,20 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-
-
-fi
-if test -z "$ac_cv_prog_OCAMLDOC"; then
-  ac_ct_OCAMLDOC=$OCAMLDOC
-  # Extract the first word of "ocamldoc", so it can be a program name with args.
-set dummy ocamldoc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OCAMLDOC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_OCAMLDOC"; then
-  ac_cv_prog_ac_ct_OCAMLDOC="$ac_ct_OCAMLDOC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OCAMLDOC="ocamldoc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OCAMLDOC=$ac_cv_prog_ac_ct_OCAMLDOC
-if test -n "$ac_ct_OCAMLDOC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDOC" >&5
-$as_echo "$ac_ct_OCAMLDOC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_OCAMLDOC" = x; then
-    OCAMLDOC="no"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OCAMLDOC=$ac_ct_OCAMLDOC
-  fi
-else
-  OCAMLDOC="$ac_cv_prog_OCAMLDOC"
-fi
-
-
-  # checking for ocamlbuild
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ocamlbuild", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ocamlbuild; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OCAMLBUILD+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OCAMLBUILD"; then
-  ac_cv_prog_OCAMLBUILD="$OCAMLBUILD" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_OCAMLBUILD="${ac_tool_prefix}ocamlbuild"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-OCAMLBUILD=$ac_cv_prog_OCAMLBUILD
-if test -n "$OCAMLBUILD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLBUILD" >&5
-$as_echo "$OCAMLBUILD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OCAMLBUILD"; then
-  ac_ct_OCAMLBUILD=$OCAMLBUILD
-  # Extract the first word of "ocamlbuild", so it can be a program name with args.
-set dummy ocamlbuild; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OCAMLBUILD+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_OCAMLBUILD"; then
-  ac_cv_prog_ac_ct_OCAMLBUILD="$ac_ct_OCAMLBUILD" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OCAMLBUILD="ocamlbuild"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OCAMLBUILD=$ac_cv_prog_ac_ct_OCAMLBUILD
-if test -n "$ac_ct_OCAMLBUILD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLBUILD" >&5
-$as_echo "$ac_ct_OCAMLBUILD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_OCAMLBUILD" = x; then
-    OCAMLBUILD="no"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OCAMLBUILD=$ac_ct_OCAMLBUILD
-  fi
-else
-  OCAMLBUILD="$ac_cv_prog_OCAMLBUILD"
-fi
-
-
-
-  # checking for ocamlfind
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ocamlfind", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ocamlfind; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OCAMLFIND+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OCAMLFIND"; then
-  ac_cv_prog_OCAMLFIND="$OCAMLFIND" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_OCAMLFIND="${ac_tool_prefix}ocamlfind"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-OCAMLFIND=$ac_cv_prog_OCAMLFIND
-if test -n "$OCAMLFIND"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLFIND" >&5
-$as_echo "$OCAMLFIND" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OCAMLFIND"; then
-  ac_ct_OCAMLFIND=$OCAMLFIND
-  # Extract the first word of "ocamlfind", so it can be a program name with args.
-set dummy ocamlfind; ac_word=$2
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLDOC"; then
+  ac_ct_OCAMLDOC=$OCAMLDOC
+  # Extract the first word of "ocamldoc", so it can be a program name with args.
+set dummy ocamldoc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OCAMLFIND+:} false; then :
+if ${ac_cv_prog_ac_ct_OCAMLDOC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_OCAMLFIND"; then
-  ac_cv_prog_ac_ct_OCAMLFIND="$ac_ct_OCAMLFIND" # Let the user override the test.
+  if test -n "$ac_ct_OCAMLDOC"; then
+  ac_cv_prog_ac_ct_OCAMLDOC="$ac_ct_OCAMLDOC" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -6071,7 +6494,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OCAMLFIND="ocamlfind"
+    ac_cv_prog_ac_ct_OCAMLDOC="ocamldoc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6081,17 +6504,17 @@ IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_OCAMLFIND=$ac_cv_prog_ac_ct_OCAMLFIND
-if test -n "$ac_ct_OCAMLFIND"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLFIND" >&5
-$as_echo "$ac_ct_OCAMLFIND" >&6; }
+ac_ct_OCAMLDOC=$ac_cv_prog_ac_ct_OCAMLDOC
+if test -n "$ac_ct_OCAMLDOC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDOC" >&5
+$as_echo "$ac_ct_OCAMLDOC" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_OCAMLFIND" = x; then
-    OCAMLFIND="no"
+  if test "x$ac_ct_OCAMLDOC" = x; then
+    OCAMLDOC="no"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
@@ -6099,26 +6522,24 @@ yes:)
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    OCAMLFIND=$ac_ct_OCAMLFIND
+    OCAMLDOC=$ac_ct_OCAMLDOC
   fi
 else
-  OCAMLFIND="$ac_cv_prog_OCAMLFIND"
+  OCAMLDOC="$ac_cv_prog_OCAMLDOC"
 fi
 
 
-
-
-for ac_prog in gawk mawk nawk awk
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
+  # checking for ocamlbuild
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlbuild", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlbuild; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
+if ${ac_cv_prog_OCAMLBUILD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+  if test -n "$OCAMLBUILD"; then
+  ac_cv_prog_OCAMLBUILD="$OCAMLBUILD" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -6127,7 +6548,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_AWK="$ac_prog"
+    ac_cv_prog_OCAMLBUILD="${ac_tool_prefix}ocamlbuild"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6137,159 +6558,83 @@ IFS=$as_save_IFS
 
 fi
 fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
+OCAMLBUILD=$ac_cv_prog_OCAMLBUILD
+if test -n "$OCAMLBUILD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLBUILD" >&5
+$as_echo "$OCAMLBUILD" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-  test -n "$AWK" && break
-done
-
-if test "x$ocamltools" = "xy"; then :
-
-    if test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"; then :
-
-        if test "x$enable_ocamltools" = "xyes"; then :
-
-            as_fn_error $? "Ocaml tools enabled, but unable to find Ocaml" "$LINENO" 5
 fi
-        ocamltools="n"
-
+if test -z "$ac_cv_prog_OCAMLBUILD"; then
+  ac_ct_OCAMLBUILD=$OCAMLBUILD
+  # Extract the first word of "ocamlbuild", so it can be a program name with args.
+set dummy ocamlbuild; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLBUILD+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-
-
-
-
-  # Used to indicate true or false condition
-  ax_compare_version=false
-
-  # Convert the two version strings to be compared into a format that
-  # allows a simple string comparison.  The end result is that a version
-  # string of the form 1.12.5-r617 will be converted to the form
-  # 0001001200050617.  In other words, each number is zero padded to four
-  # digits, and non digits are removed.
-
-  ax_compare_version_A=`echo "$OCAMLVERSION" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
-                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
-                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
-                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
-                     -e 's/[^0-9]//g'`
-
-
-  ax_compare_version_B=`echo "3.09.3" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
-                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
-                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
-                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
-                     -e 's/[^0-9]//g'`
-
-
-    ax_compare_version=`echo "x$ax_compare_version_A
-x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/false/;s/x${ax_compare_version_B}/true/;1q"`
-
-
-
-    if test "$ax_compare_version" = "true" ; then
-
-            if test "x$enable_ocamltools" = "xyes"; then :
-
-                as_fn_error $? "Your version of OCaml: $OCAMLVERSION is not supported" "$LINENO" 5
-fi
-            ocamltools="n"
-
-      fi
-
-
-fi
-
-fi
-
-
-
-
-
-
-
-
-
-
-if test "x$XENSTORE" = "x"; then :
-
-
-# Check whether --with-xenstored was given.
-if test "${with_xenstored+set}" = set; then :
-  withval=$with_xenstored;
-		if test "x$withval" = "xxenstored"; then :
-
-			xenstore=$withval
-			xenstored=$sbindir/xenstored
-
-fi
-		if test "x$withval" = "xoxenstored"; then :
-
-			xenstore=$withval
-			xenstored=$sbindir/oxenstored
-
-	if test "$ocamltools" = "n"; then :
-
-		as_fn_error $? "Missing ocaml dependencies for oxenstored, try installing ocaml ocaml-compiler-libs ocaml-runtime ocaml-findlib" "$LINENO" 5
-
-fi
-
-
-fi
-		if test "x$withval" != "xoxenstored" && test "x$withval" != "xxenstored"; then :
-
-			as_fn_error $? "Unsupported xenstored specified, supported types: oxenstored xenstored" "$LINENO" 5
-
-fi
-
+  if test -n "$ac_ct_OCAMLBUILD"; then
+  ac_cv_prog_ac_ct_OCAMLBUILD="$ac_ct_OCAMLBUILD" # Let the user override the test.
 else
-
-
-	xenstore="oxenstored"
-	xenstored=$sbindir/oxenstored
-	if test "$ocamltools" = "n"; then :
-
-		xenstore="xenstored"
-		xenstored=$sbindir/xenstored
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLBUILD="ocamlbuild"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
 fi
-
-
 fi
-
-
+ac_ct_OCAMLBUILD=$ac_cv_prog_ac_ct_OCAMLBUILD
+if test -n "$ac_ct_OCAMLBUILD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLBUILD" >&5
+$as_echo "$ac_ct_OCAMLBUILD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-
-	XENSTORE=$xenstore
-
-	if test "x$XENSTORED" = "x"; then :
-
-		XENSTORED=$xenstored
-
+  if test "x$ac_ct_OCAMLBUILD" = x; then
+    OCAMLBUILD="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLBUILD=$ac_ct_OCAMLBUILD
+  fi
+else
+  OCAMLBUILD="$ac_cv_prog_OCAMLBUILD"
 fi
 
 
 
-if test "x$xsmpolicy" = "xy"; then :
-
-      # check for a checkpolicy binary with support for -t xen
+  # checking for ocamlfind
   if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}checkpolicy", so it can be a program name with args.
-set dummy ${ac_tool_prefix}checkpolicy; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}ocamlfind", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlfind; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CHECKPOLICY+:} false; then :
+if ${ac_cv_prog_OCAMLFIND+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$CHECKPOLICY"; then
-  ac_cv_prog_CHECKPOLICY="$CHECKPOLICY" # Let the user override the test.
+  if test -n "$OCAMLFIND"; then
+  ac_cv_prog_OCAMLFIND="$OCAMLFIND" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -6298,7 +6643,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CHECKPOLICY="${ac_tool_prefix}checkpolicy"
+    ac_cv_prog_OCAMLFIND="${ac_tool_prefix}ocamlfind"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6308,10 +6653,10 @@ IFS=$as_save_IFS
 
 fi
 fi
-CHECKPOLICY=$ac_cv_prog_CHECKPOLICY
-if test -n "$CHECKPOLICY"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHECKPOLICY" >&5
-$as_echo "$CHECKPOLICY" >&6; }
+OCAMLFIND=$ac_cv_prog_OCAMLFIND
+if test -n "$OCAMLFIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLFIND" >&5
+$as_echo "$OCAMLFIND" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -6319,17 +6664,17 @@ fi
 
 
 fi
-if test -z "$ac_cv_prog_CHECKPOLICY"; then
-  ac_ct_CHECKPOLICY=$CHECKPOLICY
-  # Extract the first word of "checkpolicy", so it can be a program name with args.
-set dummy checkpolicy; ac_word=$2
+if test -z "$ac_cv_prog_OCAMLFIND"; then
+  ac_ct_OCAMLFIND=$OCAMLFIND
+  # Extract the first word of "ocamlfind", so it can be a program name with args.
+set dummy ocamlfind; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CHECKPOLICY+:} false; then :
+if ${ac_cv_prog_ac_ct_OCAMLFIND+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_CHECKPOLICY"; then
-  ac_cv_prog_ac_ct_CHECKPOLICY="$ac_ct_CHECKPOLICY" # Let the user override the test.
+  if test -n "$ac_ct_OCAMLFIND"; then
+  ac_cv_prog_ac_ct_OCAMLFIND="$ac_ct_OCAMLFIND" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -6338,7 +6683,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CHECKPOLICY="checkpolicy"
+    ac_cv_prog_ac_ct_OCAMLFIND="ocamlfind"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6348,17 +6693,17 @@ IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_CHECKPOLICY=$ac_cv_prog_ac_ct_CHECKPOLICY
-if test -n "$ac_ct_CHECKPOLICY"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CHECKPOLICY" >&5
-$as_echo "$ac_ct_CHECKPOLICY" >&6; }
+ac_ct_OCAMLFIND=$ac_cv_prog_ac_ct_OCAMLFIND
+if test -n "$ac_ct_OCAMLFIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLFIND" >&5
+$as_echo "$ac_ct_OCAMLFIND" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_CHECKPOLICY" = x; then
-    CHECKPOLICY="no"
+  if test "x$ac_ct_OCAMLFIND" = x; then
+    OCAMLFIND="no"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
@@ -6366,51 +6711,35 @@ yes:)
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    CHECKPOLICY=$ac_ct_CHECKPOLICY
+    OCAMLFIND=$ac_ct_OCAMLFIND
   fi
 else
-  CHECKPOLICY="$ac_cv_prog_CHECKPOLICY"
+  OCAMLFIND="$ac_cv_prog_OCAMLFIND"
 fi
 
 
-  if test "$CHECKPOLICY" != "no"; then
-     CHECKPOLICYHELP=`$CHECKPOLICY -h | grep xen`
-     if test "$CHECKPOLICYHELP" = ""; then
-        CHECKPOLICY=no
-     fi
-  fi
-
-    if test "x$CHECKPOLICY" = "xno"; then :
-
-        if test "x$enable_xsmpolicy" = "xyes"; then :
-
-            as_fn_error $? "XSM policy compilation enabled, but unable to find checkpolicy" "$LINENO" 5
-fi
-        xsmpolicy="n"
 
-fi
 
-fi
-# Extract the first word of "bash", so it can be a program name with args.
-set dummy bash; ac_word=$2
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_BASH+:} false; then :
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $BASH in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_BASH="$BASH" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_BASH="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_prog_AWK="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6418,490 +6747,376 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_BASH" && ac_cv_path_BASH="no"
-  ;;
-esac
 fi
-BASH=$ac_cv_path_BASH
-if test -n "$BASH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH" >&5
-$as_echo "$BASH" >&6; }
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-if test x"${BASH}" = x"no"
-then
-    as_fn_error $? "Unable to find bash, please install bash" "$LINENO" 5
-fi
-if echo "$PYTHON" | grep -q "^/"; then :
+  test -n "$AWK" && break
+done
 
-    PYTHONPATH=$PYTHON
-    PYTHON=`basename $PYTHONPATH`
+if test "x$ocamltools" = "xy"; then :
 
-elif test -z "$PYTHON"; then :
-  PYTHON="python"
-else
-  as_fn_error $? "PYTHON specified, but is not an absolute path" "$LINENO" 5
-fi
-# Extract the first word of "$PYTHON", so it can be a program name with args.
-set dummy $PYTHON; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PYTHONPATH+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PYTHONPATH in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PYTHONPATH="$PYTHONPATH" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_PYTHONPATH="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+    if test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"; then :
 
-  test -z "$ac_cv_path_PYTHONPATH" && ac_cv_path_PYTHONPATH="no"
-  ;;
-esac
+        if test "x$enable_ocamltools" = "xyes"; then :
+
+            as_fn_error $? "Ocaml tools enabled, but unable to find Ocaml" "$LINENO" 5
 fi
-PYTHONPATH=$ac_cv_path_PYTHONPATH
-if test -n "$PYTHONPATH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHONPATH" >&5
-$as_echo "$PYTHONPATH" >&6; }
+        ocamltools="n"
+
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
-if test x"${PYTHONPATH}" = x"no"
-then
-    as_fn_error $? "Unable to find $PYTHON, please install $PYTHON" "$LINENO" 5
+
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+
+  ax_compare_version_A=`echo "$OCAMLVERSION" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+  ax_compare_version_B=`echo "3.09.3" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+    ax_compare_version=`echo "x$ax_compare_version_A
+x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/false/;s/x${ax_compare_version_B}/true/;1q"`
+
+
+
+    if test "$ax_compare_version" = "true" ; then
+
+            if test "x$enable_ocamltools" = "xyes"; then :
+
+                as_fn_error $? "Your version of OCaml: $OCAMLVERSION is not supported" "$LINENO" 5
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python version >= 2.3 " >&5
-$as_echo_n "checking for python version >= 2.3 ... " >&6; }
-`$PYTHON -c 'import sys; sys.exit(eval("sys.version_info < (2, 3)"))'`
-if test "$?" != "0"
-then
-    python_version=`$PYTHON -V 2>&1`
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-    as_fn_error $? "$python_version is too old, minimum required version is 2.3" "$LINENO" 5
-else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+            ocamltools="n"
+
+      fi
+
+
 fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
 fi
-if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
 
-else
-  # Broken: fails on valid input.
-continue
+
+
+
+
+
+
+
+
+
+if test "x$XENSTORE" = "x"; then :
+
+
+# Check whether --with-xenstored was given.
+if test "${with_xenstored+set}" = set; then :
+  withval=$with_xenstored;
+		if test "x$withval" = "xxenstored"; then :
+
+			xenstore=$withval
+			xenstored=$sbindir/xenstored
+
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+		if test "x$withval" = "xoxenstored"; then :
+
+			xenstore=$withval
+			xenstored=$sbindir/oxenstored
+
+	if test "$ocamltools" = "n"; then :
+
+		as_fn_error $? "Missing ocaml dependencies for oxenstored, try installing ocaml ocaml-compiler-libs ocaml-runtime ocaml-findlib" "$LINENO" 5
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-  break
+
 fi
+		if test "x$withval" != "xoxenstored" && test "x$withval" != "xxenstored"; then :
 
-    done
-    ac_cv_prog_CPP=$CPP
+			as_fn_error $? "Unsupported xenstored specified, supported types: oxenstored xenstored" "$LINENO" 5
 
 fi
-  CPP=$ac_cv_prog_CPP
+
 else
-  ac_cv_prog_CPP=$CPP
+
+
+	xenstore="oxenstored"
+	xenstored=$sbindir/oxenstored
+	if test "$ocamltools" = "n"; then :
+
+		xenstore="xenstored"
+		xenstored=$sbindir/xenstored
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
 
-else
-  # Broken: fails on valid input.
-continue
+
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
+
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
 
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+	XENSTORE=$xenstore
+
+	if test "x$XENSTORED" = "x"; then :
+
+		XENSTORED=$xenstored
+
 fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
+if test "x$xsmpolicy" = "xy"; then :
+
+      # check for a checkpolicy binary with support for -t xen
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}checkpolicy", so it can be a program name with args.
+set dummy ${ac_tool_prefix}checkpolicy; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CHECKPOLICY+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+  if test -n "$CHECKPOLICY"; then
+  ac_cv_prog_CHECKPOLICY="$CHECKPOLICY" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-    for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CHECKPOLICY="${ac_tool_prefix}checkpolicy"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
   done
 IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
+fi
+CHECKPOLICY=$ac_cv_prog_CHECKPOLICY
+if test -n "$CHECKPOLICY"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHECKPOLICY" >&5
+$as_echo "$CHECKPOLICY" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
+fi
+if test -z "$ac_cv_prog_CHECKPOLICY"; then
+  ac_ct_CHECKPOLICY=$CHECKPOLICY
+  # Extract the first word of "checkpolicy", so it can be a program name with args.
+set dummy checkpolicy; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CHECKPOLICY+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  ac_path_EGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+  if test -n "$ac_ct_CHECKPOLICY"; then
+  ac_cv_prog_ac_ct_CHECKPOLICY="$ac_ct_CHECKPOLICY" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-    for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_EGREP_found && break 3
-    done
-  done
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CHECKPOLICY="checkpolicy"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
   done
 IFS=$as_save_IFS
-  if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+
+fi
+fi
+ac_ct_CHECKPOLICY=$ac_cv_prog_ac_ct_CHECKPOLICY
+if test -n "$ac_ct_CHECKPOLICY"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CHECKPOLICY" >&5
+$as_echo "$ac_ct_CHECKPOLICY" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CHECKPOLICY" = x; then
+    CHECKPOLICY="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CHECKPOLICY=$ac_ct_CHECKPOLICY
   fi
 else
-  ac_cv_path_EGREP=$EGREP
+  CHECKPOLICY="$ac_cv_prog_CHECKPOLICY"
 fi
 
-   fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
 
+  if test "$CHECKPOLICY" != "no"; then
+     CHECKPOLICYHELP=`$CHECKPOLICY -h | grep xen`
+     if test "$CHECKPOLICYHELP" = ""; then
+        CHECKPOLICY=no
+     fi
+  fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
+    if test "x$CHECKPOLICY" = "xno"; then :
 
-int
-main ()
-{
+        if test "x$enable_xsmpolicy" = "xyes"; then :
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  ac_cv_header_stdc=no
+            as_fn_error $? "XSM policy compilation enabled, but unable to find checkpolicy" "$LINENO" 5
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
+        xsmpolicy="n"
 
-else
-  ac_cv_header_stdc=no
 fi
-rm -f conftest*
 
 fi
+# Extract the first word of "bash", so it can be a program name with args.
+set dummy bash; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BASH+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BASH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BASH="$BASH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BASH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
-
+  test -z "$ac_cv_path_BASH" && ac_cv_path_BASH="no"
+  ;;
+esac
+fi
+BASH=$ac_cv_path_BASH
+if test -n "$BASH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH" >&5
+$as_echo "$BASH" >&6; }
 else
-  ac_cv_header_stdc=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-rm -f conftest*
 
-fi
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
+if test x"${BASH}" = x"no"
+then
+    as_fn_error $? "Unable to find bash, please install bash" "$LINENO" 5
+fi
+if echo "$PYTHON" | grep -q "^/"; then :
 
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
+    PYTHONPATH=$PYTHON
+    PYTHON=`basename $PYTHONPATH`
 
+elif test -z "$PYTHON"; then :
+  PYTHON="python"
 else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+  as_fn_error $? "PYTHON specified, but is not an absolute path" "$LINENO" 5
 fi
+# Extract the first word of "$PYTHON", so it can be a program name with args.
+set dummy $PYTHON; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PYTHONPATH+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PYTHONPATH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PYTHONPATH="$PYTHONPATH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PYTHONPATH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
+  test -z "$ac_cv_path_PYTHONPATH" && ac_cv_path_PYTHONPATH="no"
+  ;;
+esac
 fi
+PYTHONPATH=$ac_cv_path_PYTHONPATH
+if test -n "$PYTHONPATH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHONPATH" >&5
+$as_echo "$PYTHONPATH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
 
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
+if test x"${PYTHONPATH}" = x"no"
+then
+    as_fn_error $? "Unable to find $PYTHON, please install $PYTHON" "$LINENO" 5
 fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python version >= 2.3 " >&5
+$as_echo_n "checking for python version >= 2.3 ... " >&6; }
+`$PYTHON -c 'import sys; sys.exit(eval("sys.version_info < (2, 3)"))'`
+if test "$?" != "0"
+then
+    python_version=`$PYTHON -V 2>&1`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    as_fn_error $? "$python_version is too old, minimum required version is 2.3" "$LINENO" 5
+else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 fi
 
-done
-
-
 if test "$cross_compiling" != yes; then :
 
 
@@ -8042,58 +8257,6 @@ fi
 
 
 
-if test "x$enable_blktap2" = "xyes"]; then :
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for io_setup in -laio" >&5
-$as_echo_n "checking for io_setup in -laio... " >&6; }
-if ${ac_cv_lib_aio_io_setup+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-laio  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char io_setup ();
-int
-main ()
-{
-return io_setup ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_aio_io_setup=yes
-else
-  ac_cv_lib_aio_io_setup=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_aio_io_setup" >&5
-$as_echo "$ac_cv_lib_aio_io_setup" >&6; }
-if test "x$ac_cv_lib_aio_io_setup" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBAIO 1
-_ACEOF
-
-  LIBS="-laio $LIBS"
-
-else
-  as_fn_error $? "Could not find libaio" "$LINENO" 5
-fi
-
-
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5 in -lcrypto" >&5
 $as_echo_n "checking for MD5 in -lcrypto... " >&6; }
 if ${ac_cv_lib_crypto_MD5+:} false; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index ae2946f..ecf1508 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -114,13 +114,33 @@ esac])
 LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 AC_SUBST(LINUX_BACKEND_MODULES)
 
-dnl Enable blktap2 on Linux only.
+# Check for blktap2
+blktap2_present="yes"
+AC_CHECK_HEADER([tap-ctl.h],,[blktap2_present="no"])
+AC_CHECK_LIB([blktapctl], [tap_ctl_list],,[blktap2_present="no"])
+AC_CHECK_LIB([blktapctl], [tap_ctl_find_minor],,[blktap2_present="no"])
+AC_CHECK_LIB([blktapctl], [tap_ctl_create],,[blktap2_present="no"])
+AC_CHECK_LIB([blktapctl], [tap_ctl_destroy],,[blktap2_present="no"])
+
 AC_ARG_ENABLE([blktap2],
     AS_HELP_STRING([--enable-blktap2],
-                   [Enable blktap2, (DEFAULT is on for Linux, otherwise off)]),,[
-    enable_blktap2="no"])
+                   [Enable blktap2, (DEFAULT is on for Linux, otherwise off)]),
+    [AS_IF([test "$enable_blktap2" = "yes"],
+        [AS_IF([test "$blktap2_present" = "no"],
+	    [AC_MSG_ERROR([blktap2 enabled, but cannot find blktap2])])])],
+    [
+    case "$blktap2_present" in
+        yes)
+            enable_blktap2="yes";;
+        no)
+            enable_blktap2="no";;
+    esac
+    ])
 AS_IF([test "x$enable_blktap2" = "xyes"], [
-    AC_MSG_ERROR([blktap2 support temporarily unavailable])])
+AC_DEFINE([HAVE_BLKTAP2], [1], [Blktap2 enabled])
+    blktap2=y],[
+    blktap2=n
+])
 AC_SUBST(blktap2)
 
 
@@ -327,10 +347,6 @@ AC_CHECK_HEADER([lzo/lzo1x.h], [
 AC_CHECK_LIB([lzo2], [lzo1x_decompress], [zlib="$zlib -DHAVE_LZO1X -llzo2"])
 ])
 AC_SUBST(zlib)
-AS_IF(test "x$enable_blktap2" = "xyes"], [
-AC_CHECK_LIB([aio], [io_setup], [], [AC_MSG_ERROR([Could not find libaio])])
-])
-AC_SUBST(system_aio)
 AC_CHECK_LIB([crypto], [MD5], [], [AC_MSG_ERROR([Could not find libcrypto])])
 AX_CHECK_EXTFS
 AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"])
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree.
  2015-04-16 15:56 [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree George Dunlap
                   ` (2 preceding siblings ...)
  2015-04-16 15:56 ` [PATCH RFC v2 3/3] tools/configure: Detect out-of-tree blktap2 and use by default if available George Dunlap
@ 2015-04-16 15:57 ` George Dunlap
  3 siblings, 0 replies; 7+ messages in thread
From: George Dunlap @ 2015-04-16 15:57 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, Ian Campbell, Wen Congyang, Jonathan Ludlam, Ian Jackson,
	Yang Hongyang, Dave Scott

On 04/16/2015 04:56 PM, George Dunlap wrote:
> For some time, the blktap2 in-tree has bitrotted.  Many years ago the
> XenServer team at Citrix forked the code into a separate repository;
> several attempts have been made to upstream those changes back into
> Xen, to no avail.
> 
> The blktap code at the moment is the only source of performant vhd
> format integration.  It's additionally in use by projects like the
> COLO project.
> 
> This patch series removes the in-tree blktap2 code and enables xen to
> detect and build against the XenServer blktap tree.  I've gotten
> agreement from the XenServer team to act as an upstream -- to accept
> patches fixing bugs, to help track down errors, and to attempt to help
> fix build breakages introduced by development.
> 
> At the moment this patch is against the "blktap2" branch of
> XenServer's blktap.git.  (This has been sometimes known as "blktap
> 2.5".)  This branch is maintianed in order to provide a buildroot for
> OpenStack, and has also been used by the CentOS xen packages for
> several years now.
> 
> The series consists of three patches:
> 
> 1/3 Remove the blktap2 tree and temporarily disable it in config
> 
> 2/3 Port libxl to use the upstream blktap2.
> 
> 3/3 Detect blktap2 and enable it by default if detected.
> 
> The first patch is pretty massive and mostly not very interesting;
> I'll be sending a modified patch with the interesting bits.  The full
> patch series can be found here:
> 
> git://xenbits.xen.org/people/gdunlap/xen.git  out/blktap25/rfc-v2
> 
> This series has some niggles (noted in the patches themselves), and so
> it not yet ready to apply as-is.
> 
> One of the big ones is that the blktap headers are borked: you can't
> actually include them from where they get installed.  This is
> something I'm going to try to address upstream.

I forgot to add,

Difference vs v1: build as an external library, rather than cloning and
building it internally.

 -George

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RFC v2 2/3] libxl: Port libxl_blktap2.c to blktap2.5 API.
  2015-04-16 15:56 ` [PATCH RFC v2 2/3] libxl: Port libxl_blktap2.c to blktap2.5 API George Dunlap
@ 2015-04-16 16:45   ` Ian Jackson
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Jackson @ 2015-04-16 16:45 UTC (permalink / raw)
  To: George Dunlap
  Cc: Wei Liu, Dave Scott, Wen Congyang, Jonathan Ludlam, xen-devel,
	Yang Hongyang, Ian Campbell

George Dunlap writes ("[PATCH RFC v2 2/3] libxl: Port libxl_blktap2.c to blktap2.5 API."):
> This is code is in preparation for building against an external blktap
> tree.

(NB I'm not really familiar with the tapdisk API.  I guess we'll want
an ack from some blktap2.5 person ?)


> +static int tap_ctl_find(const char *type, const char *disk, tap_list_t *tap) 
> +{

What does this function return ?

> +    int err;
> +    struct list_head list = LIST_HEAD_INIT(list);
> +    tap_list_t *entry;
> +
> +    err = tap_ctl_list(&list);
> +    if (err)
> +        return err;
> +
> +    err = ERROR_FAIL;
...

But later,

>      err = tap_ctl_find(type, disk, &tap);
> -    if (err < 0) {
> +    if (err) {
>          /* returns -errno */


Also if it fails to find an entry it simply returns ERROR_FAIL without
logging anything, which seems unhelpfully opaque.


>  char *libxl__blktap_devpath(libxl__gc *gc,
>                              const char *disk,
> -                            libxl_disk_format format)
> +                            libxl_disk_format format,
> +                            int readwrite)
...
> +    fprintf(stderr, "DEBUG %s %d %s\n", __func__, __LINE__, params);

Mistakenly left in ?


> @@ -55,7 +91,8 @@ int libxl__device_destroy_tapdisk(libxl__gc *gc, const char *params)
>  {
>      char *type, *disk;
>      int err;
> -    tap_list_t tap;
> +    struct list_head list = LIST_HEAD_INIT(list);

Where is this variable `list' used ?


Thanks,
Ian.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RFC v2 1/3] tools: Remove in-tree blktap2
  2015-04-16 15:56 ` [PATCH RFC v2 1/3] tools: Remove in-tree blktap2 George Dunlap
@ 2015-04-16 16:45   ` Ian Jackson
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Jackson @ 2015-04-16 16:45 UTC (permalink / raw)
  To: George Dunlap
  Cc: Wei Liu, Dave Scott, Wen Congyang, Jonathan Ludlam, xen-devel,
	Yang Hongyang, Ian Campbell

George Dunlap writes ("[PATCH RFC v2 1/3] tools: Remove in-tree blktap2"):
> Remove and temporarily disable the in-tree blktap2 while we pivot to
> using an external blktap2 library.
> 
> The reason for removing first is to be able to port libxl_blktap2.c to
> the upstream blktap2.5 API (which is incompatible with the in-tree
> bltkap) in a separate patch to the code linking the external blktap2
> tree.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-04-16 16:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-16 15:56 [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree George Dunlap
2015-04-16 15:56 ` [PATCH RFC v2 1/3] tools: Remove in-tree blktap2 George Dunlap
2015-04-16 16:45   ` Ian Jackson
2015-04-16 15:56 ` [PATCH RFC v2 2/3] libxl: Port libxl_blktap2.c to blktap2.5 API George Dunlap
2015-04-16 16:45   ` Ian Jackson
2015-04-16 15:56 ` [PATCH RFC v2 3/3] tools/configure: Detect out-of-tree blktap2 and use by default if available George Dunlap
2015-04-16 15:57 ` [PATCH RFC v2 0/3] tools: Allow building XenServer's blktap 2.5 as an external tree George Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.