This ensures that ./configure will work fine if xen development packages
are not around, rather than fail. When passing ./configure --with-xen, the
lack of xen development packages become fatal.
---
configure.in | 60 ++++++++++++++++++++++++++++++++-------------------------
1 files changed, 34 insertions(+), 26 deletions(-)
diff --git a/configure.in b/configure.in
index b03b8e3..18b5429 100644
--- a/configure.in
+++ b/configure.in
@@ -195,7 +195,7 @@ fi
dnl Allow to build without Xen, QEMU/KVM, test or remote driver
AC_ARG_WITH([xen],
- AS_HELP_STRING([--with-xen], [add XEN support
@<:@default=yes@:>@]),[],[with_xen=yes])
+ AS_HELP_STRING([--with-xen], [add XEN support
@<:@default=auto@:>@]),[],[with_xen=check])
AC_ARG_WITH([xen-inotify],
AS_HELP_STRING([--with-xen-inotify], [add XEN inotify support
@<:@default=yes@:>@]),[],[with_xen_inotify=check])
AC_ARG_WITH([qemu],
@@ -324,6 +324,8 @@ if test "$with_libvirtd" = "yes" ; then
fi
AM_CONDITIONAL([WITH_LIBVIRTD], [test "$with_libvirtd" = "yes"])
+old_LIBS="$LIBS"
+old_CFLAGS="$CFLAGS"
XEN_LIBS=""
XEN_CFLAGS=""
dnl search for the Xen store library
@@ -333,52 +335,58 @@ if test "$with_xen" != "no" ; then
XEN_LIBS="-L$with_xen/lib64 -L$with_xen/lib"
fi
fail=0
- old_LIBS="$LIBS"
- old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $XEN_CFLAGS"
LIBS="$LIBS $XEN_LIBS"
AC_CHECK_LIB([xenstore], [xs_read], [
with_xen=yes
XEN_LIBS="$XEN_LIBS -lxenstore"
],[
- if test "$with_xen" = "check" ; then
- with_xen=no
- else
- with_xen=no
+ if test "$with_xen" = "yes"; then
fail=1
fi
+ with_xen=no
])
+fi
- test $fail = 1 &&
- AC_MSG_ERROR([You must install the Xen development package to compile Xen driver
with -lxenstore])
-
+if test "$with_xen" != "no" ; then
AC_CHECK_HEADERS([xen/xen.h xen/version.h xen/dom0_ops.h],,[
- AC_MSG_ERROR([Cannot find standard Xen headers. Is xen-devel installed?])
+ if test "$with_xen" = "yes"; then
+ fail=1
+ fi
+ with_xen=no
],
[#include <stdio.h>
#include <stdint.h>
])
+fi
+if test "$with_xen" != "no" ; then
dnl Search for the location of <xen/{linux,sys}/privcmd.h>.
- AC_CHECK_HEADERS([xen/sys/privcmd.h],,[
- AC_CHECK_HEADERS([xen/linux/privcmd.h],,[
- AC_MSG_ERROR([Cannot find header file <xen/linux/privcmd.h> or
<xen/sys/privcmd.h>. Is xen-devel installed?])
- ],
-[#include <stdio.h>
-#include <stdint.h>
-#include <xen/xen.h>
-])
- ],
-[#include <stdio.h>
-#include <stdint.h>
-#include <xen/xen.h>
-])
- LIBS="$old_LIBS"
- CFLAGS="$old_CFLAGS"
+ found=
+ AC_CHECK_HEADERS([xen/sys/privcmd.h xen/linux/privcmd.h], [found=yes; break;], [],
+ [#include <stdio.h>
+ #include <stdint.h>
+ #include <xen/xen.h>
+ ])
+ if test "x$found" != "xyes"; then
+ if test "$with_xen" = "yes"; then
+ fail=1
+ fi
+ with_xen=no
+ fi
fi
+
+LIBS="$old_LIBS"
+CFLAGS="$old_CFLAGS"
+
+if test $fail = 1; then
+ AC_MSG_ERROR([You must install the Xen development package to compile Xen driver with
-lxenstore])
+fi
+
if test "$with_xen" = "yes"; then
AC_DEFINE_UNQUOTED([WITH_XEN], 1, [whether Xen driver is enabled])
fi
+
AM_CONDITIONAL([WITH_XEN], [test "$with_xen" = "yes"])
AC_SUBST([XEN_CFLAGS])
AC_SUBST([XEN_LIBS])
--
1.6.6