New exception Libvirt.Not_supported "function"
[virt-top.git] / configure.ac
1 # ocaml-libvirt
2 # Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones
3 #
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.
8 #
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.
13 #
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
17
18 dnl Process this file with autoconf to produce a configure script.
19
20 AC_INIT(ocaml-libvirt,0.4.0.0)
21
22 dnl Check for basic C environment.
23 AC_PROG_CC
24 AC_PROG_INSTALL
25 AC_PROG_CPP
26
27 AC_C_PROTOTYPES
28 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
29
30 AC_PROG_CC_C_O
31
32 dnl Check for libvirt development environment.
33 AC_ARG_WITH(libvirt,
34         AC_HELP_STRING([--with-libvirt=PATH],[Set path to installed libvirt]),
35         [if test "x$withval" != "x"; then
36            CFLAGS="$CFLAGS -I$withval/include"
37            LDFLAGS="$LDFLAGS -L$withval/lib"
38          fi
39         ])
40 AC_CHECK_LIB(virt,virConnectOpen,
41         [],
42         AC_MSG_ERROR([You must install libvirt library]))
43 AC_CHECK_HEADER([libvirt/libvirt.h],
44         [],
45         AC_MSG_ERROR([You must install libvirt development package]))
46
47 dnl Check for libvirt >= 0.2.1 (our minimum supported version).
48 dnl See: http://libvirt.org/hvsupport.html
49 AC_CHECK_FUNC(virConnectGetCapabilities,
50         [],
51         AC_MSG_ERROR([You must have libvirt >= 0.2.1]))
52
53 dnl Check for optional libvirt functions added since 0.2.1.
54 dnl See: http://libvirt.org/hvsupport.html
55 AC_CHECK_FUNCS([virConnectGetHostname virConnectGetURI virDomainBlockStats virDomainGetSchedulerParameters virDomainGetSchedulerType virDomainInterfaceStats virDomainMigrate virDomainSetSchedulerParameters virNodeGetFreeMemory virNodeGetCellsFreeMemory])
56
57 dnl We also use <libvirt/virterror.h>
58 AC_CHECK_HEADER([libvirt/virterror.h],
59         [],
60         AC_MSG_ERROR([You must install libvirt development package]))
61
62 dnl Check for optional ncurses.
63 AC_CHECK_LIB(ncurses,initscr)
64
65 dnl Check for basic OCaml environment & findlib.
66 AC_PROG_OCAML
67 AC_PROG_FINDLIB
68
69 dnl Check for required OCaml packages.
70 AC_CHECK_OCAML_PKG(unix)
71 if test "x$pkg_unix" != "xyes"; then
72    AC_MSG_ERROR([Cannot find required OCaml package 'unix'])
73 fi
74 AC_CHECK_OCAML_PKG(extlib)
75 if test "x$pkg_extlib" != "xyes"; then
76    AC_MSG_ERROR([Cannot find required OCaml package 'extlib'])
77 fi
78
79 dnl Check for optional OCaml packages.
80 AC_CHECK_OCAML_PKG(lablgtk2)
81 AC_CHECK_OCAML_PKG(curses)
82 AC_CHECK_OCAML_PKG(gettext)
83 AC_CHECK_OCAML_PKG(xml-light)
84 AC_CHECK_OCAML_PKG(csv)
85 AC_CHECK_OCAML_PKG(calendar)
86
87 AC_SUBST(pkg_lablgtk2)
88 AC_SUBST(pkg_curses)
89 AC_SUBST(pkg_gettext)
90 AC_SUBST(pkg_xml_light)
91 AC_SUBST(pkg_csv)
92 AC_SUBST(pkg_calendar)
93
94 dnl Check for optional perldoc (for building manual pages).
95 AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc)
96
97 dnl Summary.
98 echo "------------------------------------------------------------"
99 echo "Thanks for downloading" $PACKAGE_STRING
100 echo "  OCaml libvirt bindings   . yes"
101 echo "  example programs   . . . . yes"
102 echo "  mlvirsh    . . . . . . . . yes"
103 echo -n "  mlvirtmanager    . . . . . "
104 if test "x$pkg_lablgtk2" = "xyes"; then
105    echo "yes"
106 else
107    echo "no (needs optional lablgtk2)"
108 fi
109 echo -n "  virt-top     . . . . . . . "
110 if test "x$pkg_curses" = "xyes"; then
111    echo "yes"
112 else
113    echo "no (needs optional ocaml-curses)"
114 fi
115 echo -n "  virt-df      . . . . . . . "
116 if test "x$pkg_xml_light" = "xyes"; then
117    echo "yes"
118 else
119    echo "no (needs optional xml-light)"
120 fi
121 echo "------------------------------------------------------------"
122
123 dnl Produce output files.
124 AC_CONFIG_HEADERS([config.h])
125 AC_CONFIG_FILES([META
126         libvirt/libvirt_version.ml
127         Makefile
128         libvirt/Makefile
129         examples/Makefile
130         mlvirsh/Makefile
131         mlvirtmanager/Makefile
132         virt-top/Makefile
133         virt-df/Makefile
134         ])
135 AC_OUTPUT