1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
|
# ocaml-libvirt
# 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
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
dnl Process this file with autoconf to produce a configure script.
AC_INIT(ocaml-libvirt,0.4.4.1)
dnl Check for basic C environment.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_CPP
AC_C_PROTOTYPES
test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
AC_PROG_CC_C_O
dnl Select some C flags based on the host type.
AC_CANONICAL_HOST
DEBUG="-g"
WARNINGS="-Wall -Werror"
CFLAGS_FPIC="-fPIC"
WIN32=no
case "$host" in
*-*-mingw*)
WARNINGS="$WARNINGS -Wno-unused"
CFLAGS_FPIC=""
WIN32=yes
esac
AC_SUBST(DEBUG)
AC_SUBST(WARNINGS)
AC_SUBST(CFLAGS_FPIC)
AC_SUBST(WIN32)
dnl Check for libvirt development environment.
AC_ARG_WITH(libvirt,
AC_HELP_STRING([--with-libvirt=PATH],[Set path to installed libvirt]),
[if test "x$withval" != "x"; then
CFLAGS="$CFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
])
AC_CHECK_LIB(virt,virConnectOpen,
[],
AC_MSG_ERROR([You must install libvirt library]))
AC_CHECK_HEADER([libvirt/libvirt.h],
[],
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,
[],
AC_MSG_ERROR([You must have libvirt >= 0.2.1]))
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 \
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 \
virDomainBlockPeek \
virDomainMemoryPeek \
])
# 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 basic OCaml environment & findlib.
AC_PROG_OCAML
AC_PROG_FINDLIB
if test "x$OCAMLFIND" = "x"; then
AC_MSG_ERROR([OCaml findlib is required])
fi
dnl Use ocamlfind to find the required packages ...
dnl Check for required OCaml packages.
AC_CHECK_OCAML_PKG(unix)
if test "x$pkg_unix" != "xyes"; then
AC_MSG_ERROR([Cannot find required OCaml package 'unix'])
fi
dnl Check for optional OCaml packages.
AC_CHECK_OCAML_PKG(gettext)
AC_SUBST(pkg_gettext)
dnl Check for recommended ocaml-gettext tool.
AC_CHECK_PROG(OCAML_GETTEXT,ocaml-gettext,ocaml-gettext)
dnl Check for optional NSIS (for building a Windows installer).
dnl XXX This probably doesn't work at the moment XXX
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 Write gettext modules for the programs.
dnl http://www.le-gall.net/sylvain+violaine/documentation/ocaml-gettext/html/reference-manual/ch03s04.html
for d in mlvirsh; do
f=`echo $d | tr - _`_gettext.ml
AC_MSG_NOTICE([creating $d/$f])
rm -f $d/$f
echo "(* This file is generated automatically by ./configure. *)" > $d/$f
if test "x$pkg_gettext" != "xno"; then
# Gettext module is available, so use it.
cat <<EOT >>$d/$f
module Gettext = Gettext.Program (
struct
let textdomain = "$d"
let codeset = None
let dir = None
let dependencies = [[]]
end
) (GettextStub.Native)
EOT
else
# No gettext module is available, so fake the translation functions.
cat <<EOT >>$d/$f
module Gettext = struct
external s_ : string -> string = "%identity"
external f_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format
= "%identity"
let sn_ : string -> string -> int -> string
= fun s p n -> if n = 1 then s else p
let fn_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format -> int
-> ('a -> 'b, 'c, 'd) format
= fun s p n -> if n = 1 then s else p
end
EOT
fi
done
dnl Summary.
echo "------------------------------------------------------------"
echo "Thanks for downloading" $PACKAGE_STRING
echo "------------------------------------------------------------"
dnl Produce output files.
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([META
libvirt/libvirt_version.ml
Makefile
Make.rules
po/Makefile
libvirt/Makefile
examples/Makefile
mlvirsh/Makefile
])
if test "x$MAKENSIS" != "x"; then
AC_CONFIG_FILES([wininstaller.nsis])
fi
AC_OUTPUT
|