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 AC_CHECK_OCAML_PKG(xml-light)
74 if test "x$pkg_xml_light" != "xyes"; then
75 AC_MSG_ERROR([Cannot find required OCaml package 'xml-light'])
78 AC_CHECK_OCAML_PKG(extlib)
79 if test "x$pkg_extlib" != "xyes"; then
80 AC_MSG_ERROR([Cannot find required OCaml package 'extlib'])
83 dnl Check for optional OCaml packages.
84 AC_CHECK_OCAML_PKG(gettext)
85 AC_CHECK_OCAML_PKG(dbus)
88 AC_SUBST(pkg_lablgtk2)
92 dnl Check for optional gdk-pixbuf-mlsource (for icons).
93 AC_CHECK_PROG(HAVE_GDK_PIXBUF_MLSOURCE,gdk-pixbuf-mlsource,gdk-pixbuf-mlsource)
95 dnl Check for recommended ocaml-gettext tool.
96 AC_CHECK_PROG(OCAML_GETTEXT,ocaml-gettext,ocaml-gettext)
98 dnl Check for optional NSIS (for building a Windows installer).
99 dnl XXX This probably needs some attention XXX
101 [AS_HELP_STRING([--with-nsis],
102 [use NSIS to build a Windows installer])],
116 eval pushd "\$$1" > /dev/null
122 if test "x$with_nsis" != "xno"; then
123 AC_PATH_PROG(MAKENSIS,makensis,[],[$with_nsis:$PATH])
124 if test "x$MAKENSIS" = "x"; then
125 AC_MSG_FAILURE([--with-nsis was given, but could not find MAKENSIS.EXE])
128 # MAKENSIS is set so we will build a rule for making a Windows
129 # installer. To support this, generate wininstaller.nsis.
134 echo Checking $d for DLLs ... >&5
135 if test -f "$d/libvirt-0.dll"; then
136 LIBVIRT_DLL_PATH="$d"
138 if test -f "$d/libxdr.dll"; then
141 if test -f "$d/libxml2-2.dll"; then
142 LIBXML2_DLL_PATH="$d"
144 if test -f "$d/libgpg-error-0.dll"; then
147 if test -f "$d/libgtk-win32-2.0-0.dll"; then
154 if test "x$LIBVIRT_DLL_PATH" = "x"; then
155 AC_MSG_FAILURE([cannot find libvirt-0.dll in PATH])
157 if test "x$LIBXDR_DLL_PATH" = "x"; then
158 AC_MSG_FAILURE([cannot find libxdr.dll in PATH])
160 if test "x$LIBXML2_DLL_PATH" = "x"; then
161 AC_MSG_FAILURE([cannot find libxml2-2.dll in PATH])
163 if test "x$GNUTLS_DLL_PATH" = "x"; then
164 AC_MSG_FAILURE([cannot find GnuTLS DLLs in PATH])
166 if test "x$GTK_DLL_PATH" = "x"; then
167 AC_MSG_WARN([cannot find GTK DLLs in PATH])
170 # Change the paths to Windows paths.
171 msys_to_win_dir LIBVIRT_DLL_PATH
172 msys_to_win_dir LIBXDR_DLL_PATH
173 msys_to_win_dir LIBXML2_DLL_PATH
174 msys_to_win_dir GNUTLS_DLL_PATH
175 if test "x$GTK_DLL_PATH" != "x"; then
176 msys_to_win_dir GTK_DLL_PATH
177 msys_to_win_dir GTK_PATH
181 AC_SUBST(LIBVIRT_DLL_PATH)
182 AC_SUBST(LIBXDR_DLL_PATH)
183 AC_SUBST(LIBXML2_DLL_PATH)
184 AC_SUBST(GNUTLS_DLL_PATH)
185 AC_SUBST(GTK_DLL_PATH)
188 dnl Write gettext modules for the programs.
189 dnl http://www.le-gall.net/sylvain+violaine/documentation/ocaml-gettext/html/reference-manual/ch03s04.html
190 for d in virt-ctrl; do
191 f=`echo $d | tr - _`_gettext.ml
192 AC_MSG_NOTICE([creating $d/$f])
194 echo "(* This file is generated automatically by ./configure. *)" > $d/$f
195 if test "x$pkg_gettext" != "xno"; then
196 # Gettext module is available, so use it.
198 module Gettext = Gettext.Program (
200 let textdomain = "$d"
203 let dependencies = [[]]
205 ) (GettextStub.Native)
208 # No gettext module is available, so fake the translation functions.
210 module Gettext = struct
211 external s_ : string -> string = "%identity"
212 external f_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format
214 let sn_ : string -> string -> int -> string
215 = fun s p n -> if n = 1 then s else p
216 let fn_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format -> int
217 -> ('a -> 'b, 'c, 'd) format
218 = fun s p n -> if n = 1 then s else p
225 echo "------------------------------------------------------------"
226 echo "Thanks for downloading" $PACKAGE_STRING
227 echo "------------------------------------------------------------"
229 dnl Produce output files.
230 AC_CONFIG_HEADERS([config.h])
231 AC_CONFIG_FILES([Makefile
236 if test "x$MAKENSIS" != "x"; then
237 AC_CONFIG_FILES([wininstaller.nsis])