2 # Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 dnl Process this file with autoconf to produce a configure script.
20 AC_INIT(ocaml-libvirt,0.4.0.1)
22 dnl Check for basic C environment.
28 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
32 dnl Select some C flags based on the host type.
36 WARNINGS="-Wall -Werror"
41 WARNINGS="$WARNINGS -Wno-unused"
50 dnl Check for libvirt development environment.
52 AC_HELP_STRING([--with-libvirt=PATH],[Set path to installed libvirt]),
53 [if test "x$withval" != "x"; then
54 CFLAGS="$CFLAGS -I$withval/include"
55 LDFLAGS="$LDFLAGS -L$withval/lib"
58 AC_CHECK_LIB(virt,virConnectOpen,
60 AC_MSG_ERROR([You must install libvirt library]))
61 AC_CHECK_HEADER([libvirt/libvirt.h],
63 AC_MSG_ERROR([You must install libvirt development package]))
65 dnl Check for libvirt >= 0.2.1 (our minimum supported version).
66 dnl See: http://libvirt.org/hvsupport.html
67 AC_CHECK_FUNC(virConnectGetCapabilities,
69 AC_MSG_ERROR([You must have libvirt >= 0.2.1]))
71 dnl Check for optional libvirt functions added since 0.2.1.
72 dnl See: http://libvirt.org/hvsupport.html
73 AC_CHECK_FUNCS([virConnectGetHostname virConnectGetURI virDomainBlockStats virDomainGetSchedulerParameters virDomainGetSchedulerType virDomainInterfaceStats virDomainMigrate virDomainSetSchedulerParameters virNodeGetFreeMemory virNodeGetCellsFreeMemory])
75 dnl We also use <libvirt/virterror.h>
76 AC_CHECK_HEADER([libvirt/virterror.h],
78 AC_MSG_ERROR([You must install libvirt development package]))
80 dnl Check for optional ncurses.
81 AC_CHECK_LIB(ncurses,initscr)
83 dnl Check for basic OCaml environment & findlib.
84 dnl Note that findlib is not necessary, but things will work better
89 if test "x$OCAMLFIND" != "x"; then
90 dnl Use ocamlfind to find the required packages ...
92 dnl Check for required OCaml packages.
93 AC_CHECK_OCAML_PKG(unix)
94 if test "x$pkg_unix" != "xyes"; then
95 AC_MSG_ERROR([Cannot find required OCaml package 'unix'])
98 dnl Check for optional OCaml packages.
99 AC_CHECK_OCAML_PKG(extlib)
100 AC_CHECK_OCAML_PKG(lablgtk2)
101 AC_CHECK_OCAML_PKG(curses)
102 AC_CHECK_OCAML_PKG(gettext)
103 AC_CHECK_OCAML_PKG(xml-light)
104 AC_CHECK_OCAML_PKG(csv)
105 AC_CHECK_OCAML_PKG(calendar)
109 AC_SUBST(pkg_lablgtk2)
111 AC_SUBST(pkg_gettext)
112 AC_SUBST(pkg_xml_light)
114 AC_SUBST(pkg_calendar)
116 dnl Use a basic module test if there is no findlib ...
118 dnl Check for required OCaml modules.
119 AC_CHECK_OCAML_MODULE(unix,pkg_unix,Unix,[.])
120 if test "x$pkg_unix" = "xno"; then
121 AC_MSG_ERROR([Cannot find required OCaml package 'unix'])
124 dnl Check for optional OCaml modules.
125 AC_CHECK_OCAML_MODULE(extlib,pkg_extlib,ExtString,[+extlib])
126 AC_CHECK_OCAML_MODULE(lablgtk2,pkg_lablgtk2,GMain,[+lablgtk2])
127 AC_CHECK_OCAML_MODULE(curses,pkg_curses,Curses,[+curses])
128 AC_CHECK_OCAML_MODULE(gettext,pkg_gettext,Gettext,[+gettext]) dnl XXX
129 AC_CHECK_OCAML_MODULE(xml-light,pkg_xml_light,Xml,[+xml-light])
130 AC_CHECK_OCAML_MODULE(csv,pkg_csv,Csv,[+csv])
131 AC_CHECK_OCAML_MODULE(calendar,pkg_calendar,Calendar,[+calendar])
134 dnl Which subpackages (== subdirs) will we build?
135 subdirs="libvirt examples mlvirsh"
136 if test "x$pkg_lablgtk2" != "xno"; then
137 subdirs="$subdirs mlvirtmanager"
139 if test "x$pkg_extlib" != "xno" -a "x$pkg_curses" != "xno"; then
140 subdirs="$subdirs virt-top"
142 if test "x$pkg_extlib" != "xno" -a "x$pkg_xml_light" != "xno"; then
143 subdirs="$subdirs virt-df"
147 dnl Check for optional perldoc (for building manual pages).
148 AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc)
150 dnl Check for optional NSIS.
152 [AS_HELP_STRING([--with-nsis],
153 [use NSIS to build a Windows installer])],
157 if test "x$with_nsis" != "xno"; then
158 AC_PATH_PROG(MAKENSIS,makensis,[],[$with_nsis:$PATH])
159 if test "x$MAKENSIS" = "x"; then
160 AC_MSG_FAILURE([--with-nsis was given, but could not find MAKENSIS.EXE])
166 echo "------------------------------------------------------------"
167 echo "Thanks for downloading" $PACKAGE_STRING
168 echo " subpackages to build : $subdirs"
169 echo "------------------------------------------------------------"
171 dnl Produce output files.
172 AC_CONFIG_HEADERS([config.h])
173 AC_CONFIG_FILES([META
174 libvirt/libvirt_version.ml
180 mlvirtmanager/Makefile