于 2012年07月11日 17:24, Daniel P. Berrange 写道:
On Wed, Jul 11, 2012 at 03:58:19PM +0800, Gao feng wrote:
> add a configure option --with-fuse to prepare introduction
> of fuse support for libvirt lxc.
>
> Signed-off-by: Gao feng <gaofeng(a)cn.fujitsu.com>
> ---
> configure.ac | 45 +++++++++++++++++++++++++++++++++++++++++++++
> libvirt.spec.in | 9 +++++++++
> 2 files changed, 54 insertions(+), 0 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index d45f4f1..d5cf45f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1694,7 +1694,47 @@ AM_CONDITIONAL([HAVE_CAPNG], [test "$with_capng" !=
"no"])
> AC_SUBST([CAPNG_CFLAGS])
> AC_SUBST([CAPNG_LIBS])
>
> +dnl libfuse
> +AC_ARG_WITH([fuse],
> + AC_HELP_STRING([--with-fuse], [use libfuse to proivde fuse filesystem support
for libvirt lxc]),
> + [],
> + [with_fuse=check])
>
> +dnl
> +dnl This check looks for 'fuse'
> +dnl
> +FUSE_CFLAGS=
> +FUSE_LIBS=
> +if test "$with_fuse" != "no"; then
> + old_cflags="$CFLAGS"
> + old_libs="$LIBS"
> + old_cppflags="$CPPFLAGS"
> + CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
> + if test "$with_fuse" = "check"; then
> + AC_CHECK_HEADER([fuse.h], [], [with_fuse=no])
> + AC_CHECK_LIB([fuse], [fuse_main], [], [with_fuse=no])
> + if test "$with_fuse" != "no"; then
> + with_fuse="yes"
> + fi
> + else
> + fail=0
> + AC_CHECK_HEADER([fuse.h], [], [fail=1])
> + AC_CHECK_LIB([fuse], [fuse_main], [], [fail=1])
> + test $fail = 1 &&
> + AC_MSG_ERROR([You must install the fuse >= 2.9.0 development package
in order to compile and run libvirt])
> + fi
> + CFLAGS="$old_cflags"
> + LIBS="$old_libs"
> + CPPFLAGS="$old_cppflags"
> +fi
> +if test "$with_fuse" = "yes"; then
> + FUSE_LIBS="-lfuse"
> + FUSE_CFLAGS="-D_FILE_OFFSET_BITS=64"
> + AC_DEFINE_UNQUOTED([HAVE_FUSE], 1, [Whether fuse is available for privilege
reduction])
> +fi
> +AM_CONDITIONAL([HAVE_FUSE], [test "$with_fuse" != "no"])
> +AC_SUBST([FUSE_CFLAGS])
> +AC_SUBST([FUSE_LIBS])
FUSE includes a pkg-config file, so you can remove almost all of this
code here and just use PKG_CONFIG_CHECK
I see,I will change this in next version.
Thanks!