diff --git a/configure.in b/configure.in index 447d57e3f5..8cbbfe5ce9 100644 --- a/configure.in +++ b/configure.in @@ -205,7 +205,7 @@ fi dnl Allow to build without Xen, QEMU/KVM, test or remote driver AC_ARG_WITH([xen], - AC_HELP_STRING([--with-xen], [add XEN support @<:@default=yes@:>@]),[],[with_xen=yes]) + AC_HELP_STRING([--with-xen], [add XEN support @<:@default=check@:>@]),[],[with_xen=check]) AC_ARG_WITH([xen-inotify], AC_HELP_STRING([--with-xen-inotify], [add XEN inotify support @<:@default=check@:>@]),[],[with_xen_inotify=check]) AC_ARG_WITH([qemu], @@ -334,6 +334,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 @@ -343,52 +345,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 ]) - - test $fail = 1 && - AC_MSG_ERROR([You must install the Xen development package to compile Xen driver with -lxenstore]) - - 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?]) - ], -[#include -#include -]) - - dnl Search for the location of . - AC_CHECK_HEADERS([xen/sys/privcmd.h],,[ - AC_CHECK_HEADERS([xen/linux/privcmd.h],,[ - AC_MSG_ERROR([Cannot find header file or . Is xen-devel installed?]) - ], -[#include -#include -#include -]) - ], -[#include -#include -#include -]) - LIBS="$old_LIBS" - CFLAGS="$old_CFLAGS" fi + +if test "$with_xen" != "no" ; then + AC_CHECK_HEADERS([xen/xen.h xen/version.h xen/dom0_ops.h],,[ + if test "$with_xen" = "yes"; then + fail=1 + fi + with_xen=no + ], +[#include +#include +]) +fi + +if test "$with_xen" != "no" ; then + dnl Search for the location of . + found= + AC_CHECK_HEADERS([xen/sys/privcmd.h xen/linux/privcmd.h], [found=yes; break;], [], + [#include + #include + #include + ]) + 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])