[libvirt] [PATCH v6 1/6] add a configure option --with-fuse to prepare introduction of fuse support for libvirt lxc

Richard W.M. Jones rjones at redhat.com
Mon Nov 5 10:11:17 UTC 2012


On Mon, Nov 05, 2012 at 01:23:51PM +0800, Gao feng wrote:
> +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 "x$with_fuse" != "xno"; then
> +  PKG_CHECK_MODULES([FUSE], [fuse >= $FUSE_REQUIRED],
> +    [with_fuse=yes], [
> +    if test "x$with_fuse" = "xcheck" ; then
> +        with_fuse=no
> +    else
> +        AC_MSG_ERROR(
> +          [You must install fuse Library to compile libvirt])
> +    fi
> +  ])
> +  if test "x$with_fuse" = "xyes" ; then
> +    FUSE_LIBS="-lfuse"
> +    FUSE_CFLAGS="-D_FILE_OFFSET_BITS=64"
> +    AC_DEFINE_UNQUOTED([HAVE_FUSE], 1, [whether fuse is available for libvirt lxc])
> +  fi
> +fi
> +AM_CONDITIONAL([HAVE_FUSE], [test "x$with_fuse" = "xyes"])
> +AC_SUBST([FUSE_CFLAGS])
> +AC_SUBST([FUSE_LIBS])
> +

For comparison, here is how we test for fuse in libguestfs:

dnl FUSE is optional to build the FUSE module.
AC_ARG_ENABLE([fuse],
        AS_HELP_STRING([--disable-fuse], [disable FUSE (guestmount) support]),
        [],
        [enable_fuse=yes])
AS_IF([test "x$enable_fuse" != "xno"],
        [PKG_CHECK_MODULES([FUSE],[fuse],
            [AC_SUBST([FUSE_CFLAGS])
             AC_SUBST([FUSE_LIBS])
             AC_DEFINE([HAVE_FUSE],[1],[Define to 1 if you have FUSE.])
             old_LIBS="$LIBS"
             LIBS="$FUSE_LIBS $LIBS"
             AC_CHECK_FUNCS([fuse_opt_add_opt_escaped])
             LIBS="$old_LIBS"
            ],
            [enable_fuse=no
             AC_MSG_WARN([FUSE library and headers are missing, so optional FUSE module won't be built])
            ])
        ])
AM_CONDITIONAL([HAVE_FUSE],[test "x$enable_fuse" != "xno"])

[ https://github.com/libguestfs/libguestfs/blob/master/configure.ac#L744 ]

Is there any reason not to use PKG_CHECK_MODULES?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the libvir-list mailing list