于 2012年11月05日 20:14, Richard W.M. Jones 写道:
On Mon, Nov 05, 2012 at 08:10:26PM +0800, Gao feng wrote:
> 于 2012年11月05日 18:30, Daniel P. Berrange 写道:
>> On Mon, Nov 05, 2012 at 10:11:17AM +0000, Richard W.M. Jones wrote:
>>> 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"
>>
>> As per Rich's comments, these 2 lines are bogus. The PKG_CHECK_MODULES
>> macro should already be setting FUSE_LIBS and FUSE_CFLAGS to the
>> correct values defined in the pkg-config file for FUSE.
>>
>>>> + 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?
>>
>
> Is this ok? I'm not familiar with this :(
>
> 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
> AS_IF([test "x$with_fuse" != "xno"],
> [PKG_CHECK_MODULES([FUSE], [fuse >= $FUSE_REQUIRED],
> [with_fuse=yes
> AC_SUBST([FUSE_CFLAGS])
> AC_SUBST([FUSE_LIBS])
> AC_DEFINE([HAVE_FUSE], [1], [whether fuse is available for libvirt lxc])
> ],
> [with_fuse=no
> AC_MSG_ERROR([You must install fuse Library to compile libvirt])
> ])
> ])
> AM_CONDITIONAL([HAVE_FUSE], [test "x$with_fuse" = "xyes"])
It looks OK, but you need to try all four combinations: with and
without fuse-devel installed, and --with-fuse and --without-fuse.
As written, --with-fuse=check and --with-fuse=yes both do the same
thing (check for FUSE), which is probably OK but may not be what you
meant to write.