[Libvir] Please check my autoconf libvirt.m4
jim at meyering.net
Wed May 23 18:34:01 UTC 2007
"Richard W.M. Jones" <rjones at redhat.com> wrote:
> Attached is an autoconf snippet which allows you to check that the
> libvirt library is installed (not necessarily development headers
> though) and check the version number.
> If any autoconf experts (hello, Mark) would like to check it makes
> sense, that'd be great.
In general, the autoconf "way" is to perform feature tests, rather than
version-number comparison tests. The problem with the latter is that
the invoking code can end up looking really obtuse, much like portable
pre-autoconf #ifdef spaghetti C did.
Also, if there's a way to do the test solely at compile- or link-time,
that'd be good, since a run-test causes trouble when cross-compiling.
With a library like libvirt, you might want to provide autoconf tests
that detect "version X.Y or newer" by checking for some public symbol
that was introduced in version X.Y, or maybe by a compile-check for a
changed signature in a published header.
If you really need the version of the library itself and can't rely on
pkg-config (not everyone has that, and it's not always spelled that
way), then you might consider making libvirt publish a symbol like
__libvirt_version_X_Y_Z. Then an autoconf macro could find the version
number with just a few link tests. Of course, that won't help for
versions that predate the addition of the first __libvirt_version_X_Y_Z
More information about the libvir-list