2 # Copyright (C) 2007-2008 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(virt-ctrl,1.0.0)
24 dnl Check for optional GNOME icons (from gnome-icon-theme package).
26 AC_HELP_STRING([--with-icons=PATH],
27 [Set path to installed icons @<:@default=/usr/share/icons@:>@]),
28 [],[with_icons=/usr/share/icons])
30 if test "x$with_icons" != "xno"; then
31 for size in 16 24 32 48; do
32 for f in devices/computer.png; do
33 fname="${with_icons}/gnome/${size}x${size}/${f}"
34 AC_MSG_CHECKING([checking for icon $fname])
35 if test -f "$fname"; then
37 icons="$size $f $fname $icons"
47 dnl Check for basic OCaml environment & findlib.
51 if test "x$OCAMLFIND" = "x"; then
52 AC_MSG_ERROR([OCaml findlib is required])
55 dnl Use ocamlfind to find the required packages ...
57 dnl Check for required OCaml packages.
58 AC_CHECK_OCAML_PKG(unix)
59 if test "x$pkg_unix" != "xyes"; then
60 AC_MSG_ERROR([Cannot find required OCaml package 'unix'])
63 AC_CHECK_OCAML_PKG(libvirt)
64 if test "x$pkg_libvirt" != "xyes"; then
65 AC_MSG_ERROR([Cannot find required OCaml package 'libvirt'])
68 AC_CHECK_OCAML_PKG(lablgtk2)
69 if test "x$pkg_lablgtk2" != "xyes"; then
70 AC_MSG_ERROR([Cannot find required OCaml package 'lablgtk2'])
73 dnl Check for optional OCaml packages.
74 AC_CHECK_OCAML_PKG(gettext)
75 AC_CHECK_OCAML_PKG(dbus)
78 AC_SUBST(pkg_lablgtk2)
82 dnl Check for optional gdk-pixbuf-mlsource (for icons).
83 AC_CHECK_PROG(HAVE_GDK_PIXBUF_MLSOURCE,gdk-pixbuf-mlsource,gdk-pixbuf-mlsource)
85 dnl Check for recommended ocaml-gettext tool.
86 AC_CHECK_PROG(OCAML_GETTEXT,ocaml-gettext,ocaml-gettext)
88 dnl Check for optional NSIS (for building a Windows installer).
89 dnl XXX This probably needs some attention XXX
91 [AS_HELP_STRING([--with-nsis],
92 [use NSIS to build a Windows installer])],
106 eval pushd "\$$1" > /dev/null
112 if test "x$with_nsis" != "xno"; then
113 AC_PATH_PROG(MAKENSIS,makensis,[],[$with_nsis:$PATH])
114 if test "x$MAKENSIS" = "x"; then
115 AC_MSG_FAILURE([--with-nsis was given, but could not find MAKENSIS.EXE])
118 # MAKENSIS is set so we will build a rule for making a Windows
119 # installer. To support this, generate wininstaller.nsis.
124 echo Checking $d for DLLs ... >&5
125 if test -f "$d/libvirt-0.dll"; then
126 LIBVIRT_DLL_PATH="$d"
128 if test -f "$d/libxdr.dll"; then
131 if test -f "$d/libxml2-2.dll"; then
132 LIBXML2_DLL_PATH="$d"
134 if test -f "$d/libgpg-error-0.dll"; then
137 if test -f "$d/libgtk-win32-2.0-0.dll"; then
144 if test "x$LIBVIRT_DLL_PATH" = "x"; then
145 AC_MSG_FAILURE([cannot find libvirt-0.dll in PATH])
147 if test "x$LIBXDR_DLL_PATH" = "x"; then
148 AC_MSG_FAILURE([cannot find libxdr.dll in PATH])
150 if test "x$LIBXML2_DLL_PATH" = "x"; then
151 AC_MSG_FAILURE([cannot find libxml2-2.dll in PATH])
153 if test "x$GNUTLS_DLL_PATH" = "x"; then
154 AC_MSG_FAILURE([cannot find GnuTLS DLLs in PATH])
156 if test "x$GTK_DLL_PATH" = "x"; then
157 AC_MSG_WARN([cannot find GTK DLLs in PATH])
160 # Change the paths to Windows paths.
161 msys_to_win_dir LIBVIRT_DLL_PATH
162 msys_to_win_dir LIBXDR_DLL_PATH
163 msys_to_win_dir LIBXML2_DLL_PATH
164 msys_to_win_dir GNUTLS_DLL_PATH
165 if test "x$GTK_DLL_PATH" != "x"; then
166 msys_to_win_dir GTK_DLL_PATH
167 msys_to_win_dir GTK_PATH
171 AC_SUBST(LIBVIRT_DLL_PATH)
172 AC_SUBST(LIBXDR_DLL_PATH)
173 AC_SUBST(LIBXML2_DLL_PATH)
174 AC_SUBST(GNUTLS_DLL_PATH)
175 AC_SUBST(GTK_DLL_PATH)
178 dnl Write gettext modules for the programs.
179 dnl http://www.le-gall.net/sylvain+violaine/documentation/ocaml-gettext/html/reference-manual/ch03s04.html
180 for d in virt-ctrl; do
181 f=`echo $d | tr - _`_gettext.ml
182 AC_MSG_NOTICE([creating $d/$f])
184 echo "(* This file is generated automatically by ./configure. *)" > $d/$f
185 if test "x$pkg_gettext" != "xno"; then
186 # Gettext module is available, so use it.
188 module Gettext = Gettext.Program (
190 let textdomain = "$d"
193 let dependencies = [[]]
195 ) (GettextStub.Native)
198 # No gettext module is available, so fake the translation functions.
200 module Gettext = struct
201 external s_ : string -> string = "%identity"
202 external f_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format
204 let sn_ : string -> string -> int -> string
205 = fun s p n -> if n = 1 then s else p
206 let fn_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format -> int
207 -> ('a -> 'b, 'c, 'd) format
208 = fun s p n -> if n = 1 then s else p
215 echo "------------------------------------------------------------"
216 echo "Thanks for downloading" $PACKAGE_STRING
217 echo "------------------------------------------------------------"
219 dnl Produce output files.
220 AC_CONFIG_HEADERS([config.h])
221 AC_CONFIG_FILES([Makefile
226 if test "x$MAKENSIS" != "x"; then
227 AC_CONFIG_FILES([wininstaller.nsis])