[libvirt] [PATCH] Add some automatic dependency checks for configure to enable/disable {ESX, UML, LXC, Xen-Inotify}
Daniel P. Berrange
berrange at redhat.com
Fri Jul 31 08:57:42 UTC 2009
On Thu, Jul 30, 2009 at 09:25:55PM +0200, Maximilian Wilhelm wrote:
> Hi!
>
> While building libVirt on an older Debian Etch machine, I stumbled
> across some automatic enabled drivers which stopped configure and make
> very badly due to missing header files, old libraries and stuff.
>
> So I decided to improve the automagic tests so others won't face the
> same problem again :)
ACK, this is good, everything should be automatic !
> >From e198b3ed1fcfa68465a31d75192a901fc72b2c14 Mon Sep 17 00:00:00 2001
> From: Maximilian Wilhelm <max at rfc2324.org>
> Date: Thu, 30 Jul 2009 20:18:30 +0200
> Subject: [PATCH] * configure.in: Add automatic check for libcurl and disable ESX driver if
> not present
>
> ---
> configure.in | 22 +++++++++++++---------
> 1 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/configure.in b/configure.in
> index b905b23..db559f1 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -198,7 +198,7 @@ AC_ARG_WITH([lxc],
> AC_ARG_WITH([one],
> [ --with-one add ONE support (on)],[],[with_one=check])
> AC_ARG_WITH([esx],
> -[ --with-esx add ESX support (on)],[],[with_esx=yes])
> +[ --with-esx add ESX support (on)],[],[with_esx=check])
> AC_ARG_WITH([test],
> [ --with-test add test driver support (on)],[],[with_test=yes])
> AC_ARG_WITH([remote],
> @@ -1139,7 +1139,7 @@ AC_SUBST([LIBPARTED_CFLAGS])
> AC_SUBST([LIBPARTED_LIBS])
>
> dnl
> -dnl check for libcurl
> +dnl check for libcurl (ESX)
> dnl
>
> LIBCURL_CFLAGS=""
> @@ -1147,13 +1147,17 @@ LIBCURL_LIBS=""
> LIBCURL_REQUIRED="7.18.0"
> LIBCURL_FOUND="no"
>
> -if test "$with_esx" = "yes" ; then
> - PKG_CHECK_MODULES(LIBCURL, libcurl >= $LIBCURL_REQUIRED, [LIBCURL_FOUND=yes], [LIBCURL_FOUND=no])
> -
> - if test "$LIBCURL_FOUND" = "no"; then
> - AC_MSG_CHECKING(for libcurl libraries >= $LIBCURL_REQUIRED)
> - AC_MSG_ERROR([libcurl >= $LIBCURL_REQUIRED is required for the ESX driver])
> - fi
> +if test "$with_esx" = "yes" -o "$with_esx" = "check"; then
> + PKG_CHECK_MODULES(LIBCURL, libcurl >= $LIBCURL_REQUIRED, [
> + LIBCURL_FOUND=yes
> + ], [
> + if test "$with_esx" = "check"; then
> + with_esx=no
> + AC_MSG_NOTICE([libcurl is required for ESX driver, disabling it])
> + else
> + AC_MSG_ERROR([libcurl >= $LIBCURL_REQUIRED is required for the ESX driver])
> + fi
> + ])
> fi
>
> AC_SUBST([LIBCURL_CFLAGS])
> --
> 1.5.6.5
>
> >From 6d88873f6d4bc38c338ad05fbc4491b3fcbd3c05 Mon Sep 17 00:00:00 2001
> From: Maximilian Wilhelm <max at rfc2324.org>
> Date: Thu, 30 Jul 2009 20:27:23 +0200
> Subject: [PATCH] * configure.in: Add automatic check for <sys/inotify.h> header and disable the
> UML driver if not present
>
> ---
> configure.in | 25 ++++++++++++++++++++++++-
> 1 files changed, 24 insertions(+), 1 deletions(-)
>
> diff --git a/configure.in b/configure.in
> index db559f1..008424c 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -184,7 +184,7 @@ AC_ARG_WITH([xen-inotify],
> AC_ARG_WITH([qemu],
> [ --with-qemu add QEMU/KVM support (on)],[],[with_qemu=yes])
> AC_ARG_WITH([uml],
> -[ --with-uml add UML support (on)],[],[with_uml=yes])
> +[ --with-uml add UML support (on)],[],[with_uml=check])
> AC_ARG_WITH([openvz],
> [ --with-openvz add OpenVZ support (on)],[],[with_openvz=yes])
> AC_ARG_WITH([libssh],
> @@ -780,6 +780,29 @@ AM_CONDITIONAL([HAVE_NUMACTL], [test "$with_numactl" != "no"])
> AC_SUBST([NUMACTL_CFLAGS])
> AC_SUBST([NUMACTL_LIBS])
>
> +
> +dnl
> +dnl Checks for the UML driver
> +dnl
> +
> +if test "$with_uml" = "yes" -o "$with_uml" = "check"; then
> + AC_CHECK_HEADER([sys/inotify.h], [
> + with_uml=yes
> + ], [
> + if test "$with_uml" = "check"; then
> + with_uml=no
> + AC_MSG_NOTICE([<sys/inotify.h> is required for the UML driver, disabling it])
> + else
> + AC_MSG_ERROR([The <sys/inotify.h> is required for the UML driver. Upgrade your libc6.])
> + fi
> + ])
> +fi
> +
> +
> +dnl
> +dnl libssh checks
> +dnl
> +
> if test "$with_libssh" != "yes" -a "$with_libssh" != "no"; then
> libssh_path="$with_libssh"
> elif test "$with_libssh" = "yes"; then
> --
> 1.5.6.5
>
> >From aece7bd89b9c5f90412b252ec339fac0d072f9a6 Mon Sep 17 00:00:00 2001
> From: Maximilian Wilhelm <max at rfc2324.org>
> Date: Thu, 30 Jul 2009 20:30:08 +0200
> Subject: [PATCH] Enable/disable LXC driver automatically.
>
> * configure.in: Check for <sched.h> header file and availability of the
> unshare() function within this header by performing a compile and link test.
> This function is required for the LXC driver.
> ---
> configure.in | 36 +++++++++++++++++++++++++++++++++++-
> 1 files changed, 35 insertions(+), 1 deletions(-)
>
> diff --git a/configure.in b/configure.in
> index 008424c..1a326af 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -194,7 +194,7 @@ AC_ARG_WITH([phyp],
> AC_ARG_WITH([vbox],
> [ --with-vbox add VirtualBox support (on)],[],[with_vbox=yes])
> AC_ARG_WITH([lxc],
> -[ --with-lxc add Linux Container support (on)],[],[with_lxc=yes])
> +[ --with-lxc add Linux Container support (on)],[],[with_lxc=check])
> AC_ARG_WITH([one],
> [ --with-one add ONE support (on)],[],[with_one=check])
> AC_ARG_WITH([esx],
> @@ -429,6 +429,40 @@ dnl check for kvm headers
> dnl
> AC_CHECK_HEADERS([linux/kvm.h])
>
> +dnl
> +dnl check for sufficient headers for LXC
> +dnl
> +if test "$with_lxc" = "yes" -o "$with_lxc" = "check"; then
> + AC_CHECK_HEADER([sched.h],
> + dnl Header is there, check for unshare()
> + [
> + AC_TRY_LINK([#define _GNU_SOURCE
> + #include <sched.h>], [
> + unshare (1);
> + ], [
> + with_lxc=yes
> + ], [
> + if test "$with_lxc" = "check"; then
> + with_lxc=no
> + AC_MSG_NOTICE([Function unshare() not present in <sched.h> header but required for LXC driver, disabling it])
> + else
> + AC_MSG_ERROR([Function unshare() not present in <sched.h> header, but required for LXC driver])
> + fi
> +
> + ])
> +
> + dnl Header is not there
> + ],[
> + if test "$with_lxc" = "check"; then
> + with_lxc=no
> + AC_MSG_NOTICE([Header <sched.h> not found but required for LXC driver, disabling it])
> + else
> + AC_MSG_ERROR([Header <sched.h> not found but required for LXC driver])
> + fi
> +
> + ])
> +fi
> +
> dnl OpenNebula driver Compilation setting
> dnl
>
> --
> 1.5.6.5
>
> >From 658d7e7ed06f7b1a672ff348a92e522dbb77d3be Mon Sep 17 00:00:00 2001
> From: Maximilian Wilhelm <max at rfc2324.org>
> Date: Thu, 30 Jul 2009 21:06:31 +0200
> Subject: [PATCH] Fixed check for inotify header and build Xen inotify regarding to the result
>
> * configure.in: The Xen inotify code added in commit
> 1eeceaa649c6ff92baf13a4f31edb1eb0fdb5990 uses the <sys/inotify.h> header
> but the configure script checks for <linux/inotify.h> which is a different
> file and not used within the library.
> Use the existance of <sys/inotify.h> to decide wether Xen inotify support
> should be build or not.
> ---
> configure.in | 13 +++++++++++--
> 1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/configure.in b/configure.in
> index 1a326af..1f06c60 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -180,7 +180,7 @@ dnl Allow to build without Xen, QEMU/KVM, test or remote driver
> AC_ARG_WITH([xen],
> [ --with-xen add XEN support (on)],[],[with_xen=yes])
> AC_ARG_WITH([xen-inotify],
> -[ --with-xen-inotify add XEN inotify support (on)],[],[with_xen_inotify=yes])
> +[ --with-xen-inotify add XEN inotify support (on)],[],[with_xen_inotify=check])
> AC_ARG_WITH([qemu],
> [ --with-qemu add QEMU/KVM support (on)],[],[with_qemu=yes])
> AC_ARG_WITH([uml],
> @@ -409,7 +409,16 @@ if test "$with_xen" != "yes"; then
> with_xen_inotify=no
> fi
> if test "$with_xen_inotify" != "no"; then
> - AC_CHECK_HEADER([linux/inotify.h],[],[with_xen_inotify=no])
> + AC_CHECK_HEADER([sys/inotify.h], [
> + with_xen_inotify=yes
> + ], [
> + if test "$with_xen_inotify" = "check"; then
> + with_xen_inotify=no
> + AC_MSG_NOTICE([Header file <sys/inotify.h> is required for Xen Inotify support, disabling it])
> + else
> + AC_MSG_ERROR([Header file <sys/inotify.h> is required for Xen Inotify support!])
> + fi
> + 0])
> fi
> if test "$with_xen_inotify" = "yes"; then
> AC_DEFINE_UNQUOTED([WITH_XEN_INOTIFY], 1,[whether Xen inotify sub-driver is enabled])
> --
> 1.5.6.5
>
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 :|
More information about the libvir-list
mailing list