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

Re: [libvirt] [PATCH 2/2] Change detection of xen so that it's actually automatic rather than forced.



On Sun, Jan 17, 2010 at 03:48:46PM +0100, Diego Elio Petten? wrote:
> 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 447d57e..8cbbfe5 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
>         ])
> +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])
> --

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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