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-mem,0.2.7)
25 dnl Check for an ANSI C compiler.
29 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
32 AC_CHECK_FUNCS([memmem])
34 dnl Do we have pahole (from acme's "dwarves" library)?
35 AC_PATH_PROG(PAHOLE,pahole)
37 dnl Check for basic OCaml environment & findlib.
41 if test "x$OCAMLFIND" = "x"; then
42 AC_MSG_ERROR([OCaml findlib is required])
45 dnl Use ocamlfind to find the required packages ...
47 dnl Check for required OCaml packages.
48 AC_CHECK_OCAML_PKG(unix)
49 if test "x$pkg_unix" != "xyes"; then
50 AC_MSG_ERROR([Cannot find required OCaml package 'unix'])
53 AC_CHECK_OCAML_PKG(extlib)
54 if test "x$pkg_extlib" != "xyes"; then
55 AC_MSG_ERROR([Cannot find required OCaml package 'extlib'])
58 AC_CHECK_OCAML_PKG(libvirt)
59 if test "x$pkg_libvirt" != "xyes"; then
60 AC_MSG_ERROR([Cannot find required OCaml package 'libvirt'])
63 AC_CHECK_OCAML_PKG(xml-light)
64 if test "x$pkg_xml_light" != "xyes"; then
65 AC_MSG_ERROR([Cannot find required OCaml package 'xml-light'])
68 AC_CHECK_OCAML_PKG(bitstring)
69 if test "x$pkg_bitstring" != "xyes"; then
70 AC_MSG_ERROR([Cannot find required OCaml package 'bitstring'])
73 dnl Check for optional OCaml packages.
74 AC_CHECK_OCAML_PKG(gettext)
75 AC_CHECK_OCAML_PKG(csv)
76 AC_CHECK_OCAML_PKG(xmlrpc-light)
81 AC_SUBST(pkg_xml_light)
82 AC_SUBST(pkg_bitstring)
85 AC_SUBST(pkg_xmlrpc_light)
87 dnl Check for optional perldoc (for building manual pages).
88 AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc)
90 dnl Check for recommended ocaml-gettext tool.
91 AC_CHECK_PROG(OCAML_GETTEXT,ocaml-gettext,ocaml-gettext)
93 dnl Write gettext modules for the programs.
94 dnl http://www.le-gall.net/sylvain+violaine/documentation/ocaml-gettext/html/reference-manual/ch03s04.html
96 f=`echo $d | tr - _`_gettext.ml
97 AC_MSG_NOTICE([creating lib/$f])
99 echo "(* This file is generated automatically by ./configure. *)" > lib/$f
100 if test "x$pkg_gettext" != "xno"; then
101 # Gettext module is available, so use it.
103 module Gettext = Gettext.Program (
105 let textdomain = "$d"
108 let dependencies = [[]]
110 ) (GettextStub.Native)
113 # No gettext module is available, so fake the translation functions.
115 module Gettext = struct
116 external s_ : string -> string = "%identity"
117 external f_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format
119 let sn_ : string -> string -> int -> string
120 = fun s p n -> if n = 1 then s else p
121 let fn_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format -> int
122 -> ('a -> 'b, 'c, 'd) format
123 = fun s p n -> if n = 1 then s else p
129 dnl Enable type annotation files (always, there's no penalty for doing
130 dnl this). Use C-c C-t in emacs to print the type of an expression.
131 OCAMLCFLAGS="-dtypes -g"
134 dnl Enable profiling support for native code.
135 AC_ARG_ENABLE([profiling],
136 [AS_HELP_STRING([--enable-profiling],
137 [enable profiling for native code])],
138 [OCAMLOPTFLAGS="$OCAMLOPTFLAGS -p"])
140 AC_SUBST(OCAMLCFLAGS)
141 AC_SUBST(OCAMLOPTFLAGS)
144 echo "------------------------------------------------------------"
145 echo "Thanks for downloading" $PACKAGE_STRING
146 echo "------------------------------------------------------------"
148 dnl Produce output files.
149 AC_CONFIG_HEADERS([config.h])
150 AC_CONFIG_FILES([Makefile
153 lib/virt_mem_version.ml
159 extract/fedora-koji/Makefile