[Libguestfs] [PATCH 0/3] hivex: Improve OS X support

Richard W.M. Jones rjones at redhat.com
Wed Sep 7 08:41:12 UTC 2011


On Tue, Sep 06, 2011 at 08:42:40PM -0700, Alex Nelson wrote:
> libxml2 is provided in the base OS X, though one can install a different version with MacPorts.
> 
> Do you have any recommendations on how to fix this check?  Commenting it out works well enough on OS X, it seems.

I don't like commenting out what is a good test on non-broken systems.
In particular, libxml2 uses the pkg-config system to set the correct
CFLAGS, which can be vital to correctly compiling on some systems.

We should keep the PKG_CHECK_MODULES test and only fallback if that
fails.  Something like:

  PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [], [
      AC_CHECK_LIB([xml2], [xmlNewTextWriter], [LIBXML2_LIBS="-lxml2"])
      ... also check for and set LIBXML2_CFLAGS ...
  ])
  AC_SUBST([LIBXML2_CFLAGS])
  AC_SUBST([LIBXML2_LIBS])

The pkg-config(1) man page has good documentation.

> Gillen, you seem to have the right idea in your other message, passing -liconv in hivexml_CFLAGS (also works passing in hivex_CFLAGS).  I can now compile, run, and produce a lot of Chinese with hivexml.  ...That last one was an unexpected feature, given the American image I was analyzing.
> 
> How do you test for whether you're on a system that needs that argument, though?

You have to write a configure test for it.  The autoconf documentation
covers this in detail.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list