# ocaml-libvirt
-# Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones
+# Copyright (C) 2007-2008 Red Hat Inc., Richard W.M. Jones
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(ocaml-libvirt,0.4.0.1)
+AC_INIT(ocaml-libvirt,0.4.1.0)
dnl Check for basic C environment.
AC_PROG_CC
[],
AC_MSG_ERROR([You must install libvirt development package]))
+dnl We also use <libvirt/virterror.h>
+AC_CHECK_HEADER([libvirt/virterror.h],
+ [],
+ AC_MSG_ERROR([You must install libvirt development package]))
+
dnl Check for libvirt >= 0.2.1 (our minimum supported version).
dnl See: http://libvirt.org/hvsupport.html
AC_CHECK_FUNC(virConnectGetCapabilities,
dnl Check for optional libvirt functions added since 0.2.1.
dnl See: http://libvirt.org/hvsupport.html
-AC_CHECK_FUNCS([virConnectGetHostname virConnectGetURI virDomainBlockStats virDomainGetSchedulerParameters virDomainGetSchedulerType virDomainInterfaceStats virDomainMigrate virDomainSetSchedulerParameters virNodeGetFreeMemory virNodeGetCellsFreeMemory])
+AC_CHECK_FUNCS([virConnectGetHostname \
+ virConnectGetURI \
+ virDomainBlockStats \
+ virDomainGetSchedulerParameters \
+ virDomainGetSchedulerType \
+ virDomainInterfaceStats \
+ virDomainMigrate \
+ virDomainSetSchedulerParameters \
+ virNodeGetFreeMemory \
+ virNodeGetCellsFreeMemory \
+ virStoragePoolGetConnect \
+ virConnectNumOfStoragePools \
+ virConnectListStoragePools \
+ virConnectNumOfDefinedStoragePools \
+ virConnectListDefinedStoragePools \
+ virStoragePoolLookupByName \
+ virStoragePoolLookupByUUID \
+ virStoragePoolLookupByUUIDString \
+ virStoragePoolLookupByVolume \
+ virStoragePoolCreateXML \
+ virStoragePoolDefineXML \
+ virStoragePoolBuild \
+ virStoragePoolUndefine \
+ virStoragePoolCreate \
+ virStoragePoolDestroy \
+ virStoragePoolDelete \
+ virStoragePoolFree \
+ virStoragePoolRefresh \
+ virStoragePoolGetName \
+ virStoragePoolGetUUID \
+ virStoragePoolGetUUIDString \
+ virStoragePoolGetInfo \
+ virStoragePoolGetXMLDesc \
+ virStoragePoolGetAutostart \
+ virStoragePoolSetAutostart \
+ virStoragePoolNumOfVolumes \
+ virStoragePoolListVolumes \
+ virStorageVolLookupByName \
+ virStorageVolLookupByKey \
+ virStorageVolLookupByPath \
+ virStorageVolGetName \
+ virStorageVolGetKey \
+ virStorageVolCreateXML \
+ virStorageVolDelete \
+ virStorageVolFree \
+ virStorageVolGetInfo \
+ virStorageVolGetXMLDesc \
+ virStorageVolGetPath \
+])
-dnl We also use <libvirt/virterror.h>
-AC_CHECK_HEADER([libvirt/virterror.h],
- [],
- AC_MSG_ERROR([You must install libvirt development package]))
+# This jobs API was never published and is due to get overhauled
+# in the near future:
+# virJobGetInfo
+# virJobGetDomain
+# virJobGetNetwork
+# virJobCancel
+# virJobFree
+# virDomainCreateLinuxJob
+# virDomainSaveJob
+# virDomainRestoreJob
+# virDomainCoreDumpJob
+# virDomainCreateJob
+# virNetworkCreateXMLJob
+# virNetworkCreateJob
+
+dnl Check for optional types added since 0.2.1.
+AC_CHECK_TYPES([virJobPtr, virStoragePoolPtr, virStorageVolPtr],,,
+ [#include <libvirt/libvirt.h>])
dnl Check for optional ncurses.
AC_CHECK_LIB(ncurses,initscr)
+dnl Check for optional GNOME icons (from gnome-icon-theme package).
+AC_ARG_WITH(icons,
+ AC_HELP_STRING([--with-icons=PATH],
+ [Set path to installed icons @<:@default=/usr/share/icons@:>@]),
+ [],[with_icons=/usr/share/icons])
+icons=""
+if test "x$with_icons" != "xno"; then
+ for size in 16 24 32 48; do
+ for f in devices/computer.png; do
+ fname="${with_icons}/gnome/${size}x${size}/${f}"
+ AC_MSG_CHECKING([checking for icon $fname])
+ if test -f "$fname"; then
+ AC_MSG_RESULT([yes])
+ icons="$size $f $fname $icons"
+ else
+ AC_MSG_RESULT([no])
+ fi
+ done
+ done
+fi
+AC_SUBST(with_icons)
+AC_SUBST(icons)
+
dnl Check for basic OCaml environment & findlib.
dnl Note that findlib is not necessary, but things will work better
dnl if it is present.
AC_CHECK_OCAML_PKG(gettext)
AC_CHECK_OCAML_PKG(xml-light)
AC_CHECK_OCAML_PKG(csv)
- AC_CHECK_OCAML_PKG(calendar)
+ AC_CHECK_OCAML_PKG(dbus)
+
+ dnl Need to check which version of calendar is installed.
+ AC_CHECK_OCAML_MODULE(calendar,pkg_calendar2,CalendarLib.Date,[+calendar])
+ if test "x$pkg_calendar2" = "xno"; then
+ AC_CHECK_OCAML_PKG(calendar)
+ fi
AC_SUBST(pkg_unix)
AC_SUBST(pkg_extlib)
AC_SUBST(pkg_gettext)
AC_SUBST(pkg_xml_light)
AC_SUBST(pkg_csv)
+ AC_SUBST(pkg_dbus)
AC_SUBST(pkg_calendar)
+ AC_SUBST(pkg_calendar2)
else
dnl Use a basic module test if there is no findlib ...
AC_CHECK_OCAML_MODULE(gettext,pkg_gettext,Gettext,[+gettext]) dnl XXX
AC_CHECK_OCAML_MODULE(xml-light,pkg_xml_light,Xml,[+xml-light])
AC_CHECK_OCAML_MODULE(csv,pkg_csv,Csv,[+csv])
+ AC_CHECK_OCAML_MODULE(dbus,pkg_dbus,DBus,[+dbus])
+ dnl XXX Version check - see above.
AC_CHECK_OCAML_MODULE(calendar,pkg_calendar,Calendar,[+calendar])
fi
dnl Which subpackages (== subdirs) will we build?
subdirs="libvirt examples mlvirsh"
if test "x$pkg_lablgtk2" != "xno"; then
- subdirs="$subdirs mlvirtmanager"
+ subdirs="$subdirs virt-ctrl"
fi
if test "x$pkg_extlib" != "xno" -a "x$pkg_curses" != "xno"; then
subdirs="$subdirs virt-top"
dnl Check for optional perldoc (for building manual pages).
AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc)
-dnl Check for optional NSIS.
+dnl Check for optional gdk-pixbuf-mlsource (for icons).
+AC_CHECK_PROG(HAVE_GDK_PIXBUF_MLSOURCE,gdk-pixbuf-mlsource,gdk-pixbuf-mlsource)
+
+dnl Check for optional NSIS (for building a Windows installer).
AC_ARG_WITH([nsis],
[AS_HELP_STRING([--with-nsis],
[use NSIS to build a Windows installer])],
[],
[with_nsis=no])
+
MAKENSIS=
+LIBVIRT_DLL_PATH=
+LIBXDR_DLL_PATH=
+LIBXML2_DLL_PATH=
+GNUTLS_DLL_PATH=
+GTK_PATH=
+GTK_DLL_PATH=
+
+[
+msys_to_win_dir () {
+ eval pushd "\$$1" > /dev/null
+ eval $1=`pwd -W`
+ popd > /dev/null
+}
+]
+
if test "x$with_nsis" != "xno"; then
AC_PATH_PROG(MAKENSIS,makensis,[],[$with_nsis:$PATH])
if test "x$MAKENSIS" = "x"; then
AC_MSG_FAILURE([--with-nsis was given, but could not find MAKENSIS.EXE])
fi
+
+ # MAKENSIS is set so we will build a rule for making a Windows
+ # installer. To support this, generate wininstaller.nsis.
+ saved_IFS=$IFS
+ IFS=$PATH_SEPARATOR
+ for d in $PATH; do
+ IFS=$saved_IFS
+ echo Checking $d for DLLs ... >&5
+ if test -f "$d/libvirt-0.dll"; then
+ LIBVIRT_DLL_PATH="$d"
+ fi
+ if test -f "$d/libxdr.dll"; then
+ LIBXDR_DLL_PATH="$d"
+ fi
+ if test -f "$d/libxml2-2.dll"; then
+ LIBXML2_DLL_PATH="$d"
+ fi
+ if test -f "$d/libgpg-error-0.dll"; then
+ GNUTLS_DLL_PATH="$d"
+ fi
+ if test -f "$d/libgtk-win32-2.0-0.dll"; then
+ GTK_DLL_PATH="$d"
+ GTK_PATH="$d/.."
+ fi
+ done
+ IFS=$saved_IFS
+
+ if test "x$LIBVIRT_DLL_PATH" = "x"; then
+ AC_MSG_FAILURE([cannot find libvirt-0.dll in PATH])
+ fi
+ if test "x$LIBXDR_DLL_PATH" = "x"; then
+ AC_MSG_FAILURE([cannot find libxdr.dll in PATH])
+ fi
+ if test "x$LIBXML2_DLL_PATH" = "x"; then
+ AC_MSG_FAILURE([cannot find libxml2-2.dll in PATH])
+ fi
+ if test "x$GNUTLS_DLL_PATH" = "x"; then
+ AC_MSG_FAILURE([cannot find GnuTLS DLLs in PATH])
+ fi
+ if test "x$GTK_DLL_PATH" = "x"; then
+ AC_MSG_WARN([cannot find GTK DLLs in PATH])
+ fi
+
+ # Change the paths to Windows paths.
+ msys_to_win_dir LIBVIRT_DLL_PATH
+ msys_to_win_dir LIBXDR_DLL_PATH
+ msys_to_win_dir LIBXML2_DLL_PATH
+ msys_to_win_dir GNUTLS_DLL_PATH
+ if test "x$GTK_DLL_PATH" != "x"; then
+ msys_to_win_dir GTK_DLL_PATH
+ msys_to_win_dir GTK_PATH
+ fi
fi
AC_SUBST(MAKENSIS)
+AC_SUBST(LIBVIRT_DLL_PATH)
+AC_SUBST(LIBXDR_DLL_PATH)
+AC_SUBST(LIBXML2_DLL_PATH)
+AC_SUBST(GNUTLS_DLL_PATH)
+AC_SUBST(GTK_DLL_PATH)
+AC_SUBST(GTK_PATH)
dnl Summary.
echo "------------------------------------------------------------"
libvirt/Makefile
examples/Makefile
mlvirsh/Makefile
- mlvirtmanager/Makefile
+ virt-ctrl/Makefile
virt-top/Makefile
virt-df/Makefile
])
+if test "x$MAKENSIS" != "x"; then
+ AC_CONFIG_FILES([wininstaller.nsis])
+fi
AC_OUTPUT