dnl Some macros to test for the existance and features of libvirt. dnl By Richard W.M. Jones dnl AC_LIBVIRT dnl Test for libvirt library, and fail if not present. dnl Sets LIBVIRT_VERSION to the version (1000000*major + 1000*minor dnl + release), for example 2002 for version 0.2.2. AC_DEFUN([AC_LIBVIRT],[ AC_CHECK_LIB(virt, virGetVersion, [], [ AC_MSG_ERROR([libvirt not installed]) ]) dnl Get the version number by calling virGetVersion. AC_MSG_CHECKING([for encoded libvirt version]) AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ #include #include #include /* Don't require libvirt-devel. */ extern int virGetVersion (unsigned long *, const char *, unsigned long *); ]],[[ FILE *fp; unsigned long ver; if (virGetVersion (&ver, NULL, NULL) == 0 && (fp = fopen ("ac_libvirt_version", "w")) != NULL) { fprintf (fp, "%lu", ver); fclose (fp); exit (0); } else exit (1); ]]) ],[ LIBVIRT_VERSION=`cat ac_libvirt_version` rm -f ac_libvirt_version AC_MSG_RESULT([$LIBVIRT_VERSION]) ],[ AC_MSG_ERROR([cannot determine version of libvirt]) ],[ AC_MSG_WARN([cannot determine version of libvirt because cross-compiling]) LIBVIRT_VERSION=0 ]) AC_SUBST(LIBVIRT_VERSION) ])