Update MANIFEST
[ocaml-libvirt.git] / configure.ac
1 # ocaml-libvirt
2 # Copyright (C) 2007-2015 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.6.1.4)
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 Select some C flags based on the host type.
33 AC_CANONICAL_HOST
34
35 DEBUG="-g"
36 WARNINGS="-Wall -Werror"
37 CFLAGS_FPIC="-fPIC"
38 WIN32=no
39 case "$host" in
40   *-*-mingw*)
41     WARNINGS="$WARNINGS -Wno-unused"
42     CFLAGS_FPIC=""
43     WIN32=yes
44 esac
45 AC_SUBST(DEBUG)
46 AC_SUBST(WARNINGS)
47 AC_SUBST(CFLAGS_FPIC)
48 AC_SUBST(WIN32)
49
50 dnl Check for perl (required).
51 AC_CHECK_PROG([PERL],[perl],[perl],[no])
52 if test "x$PERL" = "xno"; then
53     AC_MSG_ERROR([Perl must be installed to build])
54 fi
55
56 dnl Check for libvirt development environment.
57 AC_ARG_WITH(libvirt,
58         AC_HELP_STRING([--with-libvirt=PATH],[Set path to installed libvirt]),
59         [if test "x$withval" != "x"; then
60            CFLAGS="$CFLAGS -I$withval/include"
61            LDFLAGS="$LDFLAGS -L$withval/lib"
62          fi
63         ])
64 AC_CHECK_LIB(virt,virConnectOpen,
65         [],
66         AC_MSG_ERROR([You must install libvirt library]))
67 AC_CHECK_HEADER([libvirt/libvirt.h],
68         [],
69         AC_MSG_ERROR([You must install libvirt development package]))
70
71 dnl We also use <libvirt/virterror.h>
72 AC_CHECK_HEADER([libvirt/virterror.h],
73         [],
74         AC_MSG_ERROR([You must install libvirt development package]))
75
76 dnl Check for basic OCaml environment & findlib.
77 AC_PROG_OCAML
78 AC_PROG_FINDLIB
79
80 if test "x$OCAMLFIND" = "x"; then
81     AC_MSG_ERROR([OCaml findlib is required])
82 fi
83
84 dnl Use ocamlfind to find the required packages ...
85
86 dnl Check for required OCaml packages.
87 AC_CHECK_OCAML_PKG(unix)
88 if test "x$pkg_unix" != "xyes"; then
89     AC_MSG_ERROR([Cannot find required OCaml package 'unix'])
90 fi
91
92 dnl Summary.
93 echo "------------------------------------------------------------"
94 echo "Thanks for downloading" $PACKAGE_STRING
95 echo "------------------------------------------------------------"
96
97 dnl Produce output files.
98 AC_CONFIG_HEADERS([config.h])
99 AC_CONFIG_FILES([META
100         libvirt/libvirt_version.ml
101         Makefile
102         Make.rules
103         libvirt/Makefile
104         examples/Makefile
105         ])
106 AC_OUTPUT