"Richard W.M. Jones" <[EMAIL PROTECTED]> 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.

Hi Rich,

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
symbol.

Jim

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to