Set version to 0.3.3.0 to match libvirt numbering.
[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.3.3.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])
56
57 dnl Check for optional ncurses.
58 AC_CHECK_LIB(ncurses,initscr)
59
60 dnl Check for basic OCaml environment & findlib.
61 AC_PROG_OCAML
62 AC_PROG_FINDLIB
63
64 dnl Check for required OCaml packages.
65 AC_CHECK_OCAML_PKG(unix)
66 if test "x$pkg_unix" != "xyes"; then
67    AC_MSG_ERROR([Cannot find required OCaml package 'unix'])
68 fi
69 AC_CHECK_OCAML_PKG(extlib)
70 if test "x$pkg_extlib" != "xyes"; then
71    AC_MSG_ERROR([Cannot find required OCaml package 'extlib'])
72 fi
73
74 dnl Check for optional OCaml packages.
75 AC_CHECK_OCAML_PKG(lablgtk2)
76 AC_CHECK_OCAML_PKG(curses)
77 AC_CHECK_OCAML_PKG(gettext)
78 AC_CHECK_OCAML_PKG(xml-light)
79 AC_CHECK_OCAML_PKG(csv)
80
81 AC_SUBST(pkg_lablgtk2)
82 AC_SUBST(pkg_curses)
83 AC_SUBST(pkg_gettext)
84 AC_SUBST(pkg_xml_light)
85 AC_SUBST(pkg_csv)
86
87 dnl Check for optional perldoc (for building manual pages).
88 AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc)
89
90 dnl Summary.
91 echo "------------------------------------------------------------"
92 echo "Thanks for downloading" $PACKAGE_STRING
93 echo "  OCaml libvirt bindings   . yes"
94 echo "  example programs   . . . . yes"
95 echo "  mlvirsh    . . . . . . . . yes"
96 echo -n "  mlvirtmanager    . . . . . "
97 if test "x$pkg_lablgtk2" = "xyes"; then
98    echo "yes"
99 else
100    echo "no (needs optional lablgtk2)"
101 fi
102 echo -n "  virt-top     . . . . . . . "
103 if test "x$pkg_curses" = "xyes"; then
104    echo "yes"
105 else
106    echo "no (needs optional ocaml-curses)"
107 fi
108 echo -n "  virt-df      . . . . . . . "
109 if test "x$pkg_xml_light" = "xyes"; then
110    echo "yes"
111 else
112    echo "no (needs optional xml-light)"
113 fi
114 echo "------------------------------------------------------------"
115
116 dnl Produce output files.
117 AC_CONFIG_HEADERS([config.h])
118 AC_CONFIG_FILES([META
119         libvirt/libvirt_version.ml
120         Makefile
121         libvirt/Makefile
122         examples/Makefile
123         mlvirsh/Makefile
124         mlvirtmanager/Makefile
125         virt-top/Makefile
126         virt-df/Makefile
127         ])
128 AC_OUTPUT