Commit 30c88a28 authored by Romain Beauxis's avatar Romain Beauxis

Imported Upstream version 0.2.2

parent 5a7ce62e
0.2.2 (26-06-2011)
=====
* Cleaned up daemonization code,
added optional change of user,
should be useful when running
as root.
0.2.1 (18-09-2010)
=====
* Fixed requires, s/thread/threads/
......
......@@ -3,7 +3,7 @@
SRC=src
PROGNAME=ocaml-dtools
DISTFILES = bootstrap CHANGES configure configure.ac \
COPYING Makefile README \
COPYING Makefile README m4/*.m4 \
src/OCamlMakefile src/*Makefile.in src/META.in src/*.ml src/*.mli \
doc/html
......
#!/bin/sh
aclocal -I m4
autoconf
This source diff could not be displayed because it is too large. You can view the blob instead.
AC_INIT(ocaml-dtools, 0.2.1, savonet-users@lists.sourceforge.net)
AC_INIT(ocaml-dtools, 0.2.2, savonet-users@lists.sourceforge.net)
VERSION=$PACKAGE_VERSION
AC_MSG_RESULT(configuring $PACKAGE_STRING)
REQUIRES="str unix threads"
OCAMLFIND_LDCONF=""
AC_ARG_ENABLE([ldconf], AC_HELP_STRING([--disable-ldconf],[don't modify the dynamic loader configuration file (default is enable)]),[ac_enable_ldconf=$enableval],[ac_enable_ldconf=$enableval],[ac_enable_ldconf=yes])
if test "$ac_enable_ldconf" = no ; then
AC_MSG_RESULT(disabling modification of ld.conf)
OCAMLFIND_LDCONF=dummy
fi
# Check for Ocaml compilers
# we first look for ocamlc in the path; if not present, we fail
AC_CHECK_PROG(OCAMLC,ocamlc,`which ocamlc`,no)
if test "$OCAMLC" = no ; then
AC_MSG_ERROR(Cannot find ocamlc.)
fi
# we look for the directory of ocamlc in $OCAMLC
OCAMLBIN=`dirname $OCAMLC`
# we extract Ocaml version number and library path
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
echo "ocaml version is $OCAMLVERSION"
OCAMLLIB=`$OCAMLC -v | tail -n 1 | cut -f 4 -d " "`
echo "ocaml library path is $OCAMLLIB"
# then we look for ocamlopt; if not present, we issue a warning
# if the version is not the same, we also discard it
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
AC_PATH_PROG(OCAMLOPT,ocamlopt,no)
OCAMLBEST=byte
if test "$OCAMLOPT" = no ; then
AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.)
else
AC_MSG_CHECKING(ocamlopt version)
TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT(differs from ocamlc; ocamlopt discarded.)
OCAMLOPT=no
else
AC_MSG_RESULT(ok)
OCAMLBEST=native
fi
fi
# checking for ocamlc.opt
AC_PATH_PROG(OCAMLCDOTOPT,ocamlc.opt,no)
if test "$OCAMLCDOTOPT" != no ; then
AC_MSG_CHECKING(ocamlc.opt version)
TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT(differs from ocamlc; ocamlc.opt discarded.)
else
AC_MSG_RESULT(ok)
OCAMLC=$OCAMLCDOTOPT
fi
fi
# checking for ocamlopt.opt
if test "$OCAMLOPT" != no ; then
AC_PATH_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,no)
if test "$OCAMLOPTDOTOPT" != no ; then
AC_MSG_CHECKING(ocamlc.opt version)
TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVER" != "$OCAMLVERSION" ; then
AC_MSG_RESULT(differs from ocamlc; ocamlopt.opt discarded.)
else
AC_MSG_RESULT(ok)
OCAMLOPT=$OCAMLOPTDOTOPT
fi
fi
fi
# ocamldep, ocamllex and ocamlyacc should also be present in the path
AC_PATH_PROG(OCAMLDEP,ocamldep,no)
if test "$OCAMLDEP" = no ; then
AC_MSG_ERROR(Cannot find ocamldep.)
fi
AC_PATH_PROG(OCAMLLEX,ocamllex,no)
if test "$OCAMLLEX" = no ; then
AC_MSG_ERROR(Cannot find ocamllex.)
fi
AC_PATH_PROG(OCAMLYACC,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
AC_MSG_ERROR(Cannot find ocamlyacc.)
fi
AC_PATH_PROG(OCAMLDOC,ocamldoc,no)
AC_ARG_ENABLE([debugging],
AC_HELP_STRING(
[--enable-debugging],
[compile with debugging information (backtrace printing in particular)]))
if test "x$enable_debugging" = "xyes" ; then
OCAMLFLAGS="$OCAMLFLAGS -g"
fi
AC_PATH_PROG(OCAMLMKTOP,ocamlmktop,no)
if test "$OCAMLMKTOP" = no ; then
AC_MSG_ERROR(Cannot find ocamlmktop.)
fi
CAMLLIBPATH=`$OCAMLC -where`
if test "$OCAMLOPT" = no ; then
BEST=byte
else
BEST="byte native"
fi
# other progs
AC_PATH_PROG(OCAMLFIND,ocamlfind,no)
if test "$OCAMLFIND" = no ; then
AC_MSG_ERROR(Cannot find ocamlfind.)
fi
#AC_PATH_PROG(OCAMLCP,ocamlcp,no)
#if test "$OCAMLCP" = no ; then
# AC_MSG_ERROR(Cannot find ocamlcp.)
#fi
AC_PATH_PROG(LATEX,latex,no)
#if test "$LATEX" = no ; then
# AC_MSG_ERROR(Cannot find LaTeX.)
#fi
AC_PATH_PROG(DVIPS,dvips,no)
#if test "$DVIPS" = no ; then
# AC_MSG_ERROR(Cannot find dvips.)
#fi
AC_PATH_PROG(PS2PDF,ps2pdf,no)
#if test "$PS2PDF" = no ; then
# AC_MSG_ERROR(Cannot find ps2pdf.)
#fi
AC_CHECK_OCAML_COMPILERS()
REQUIRES="str unix threads"
#
# Syslog
#
......@@ -152,45 +17,20 @@ AC_ARG_ENABLE([syslog],
AC_HELP_STRING([--disable-syslog],["don't use ocaml-syslog"]))
if test "x$enable_syslog" != "xno" ; then
AC_MSG_CHECKING(for ocaml-syslog)
if ! $OCAMLFIND query syslog > /dev/null 2>&1 ; then
SYSLOG_FILES=""
AC_MSG_RESULT(not found)
else
SYSLOG_FILES="dtools_syslog.ml"
AC_MSG_RESULT(ok)
REQUIRES="$REQUIRES syslog"
INC="$INC `$OCAMLFIND query syslog`"
fi
AC_CHECK_OCAML_BINDING([syslog])
fi
if test "$W_SYSLOG" != ""; then
SYSLOG_FILES="dtools_syslog.ml"
REQUIRES="$REQUIRES syslog"
INC="$INC `$OCAMLFIND query syslog`"
fi
# substitutions to perform
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLFLAGS)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLBEST)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLLIB)
AC_SUBST(OCAMLBIN)
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLMKTOP) # TODO
AC_SUBST(OCAMLFIND) # TODO
AC_SUBST(OCAMLFIND_LDCONF)
AC_SUBST(OCAMLCP) # TODO
AC_SUBST(CAMLLIBPATH)
AC_SUBST(BEST)
AC_SUBST(REQUIRES)
AC_SUBST(SYSLOG_FILES)
AC_SUBST(INC)
AC_SUBST(LATEX) # TODO
AC_SUBST(DVIPS) # TODO
AC_SUBST(DVIPS) # TODO
AC_SUBST(PS2PDF) # TODO
# Finally create the Makefile and samples
AC_CONFIG_FILES([src/Makefile],[chmod a-w src/Makefile])
AC_CONFIG_FILES([src/META])
......
......@@ -20,17 +20,17 @@
<br>
<pre><span class="keyword">module</span> Conf: <code class="code">sig</code> <a href="Dtools.Conf.html">..</a> <code class="code">end</code></pre>Configuration management module.<br>
<hr width="100%">
<pre><span class="keyword">type</span> <a name="TYPElink"></a><code class="type"></code>link = <code class="type">string</code> </pre>
<pre><span id="TYPElink"><span class="keyword">type</span> <code class="type"></code>link</span> = <code class="type">string</code> </pre>
<div class="info">
Type for links between keys<br>
</div>
<pre><span class="keyword">type</span> <a name="TYPEpath"></a><code class="type"></code>path = <code class="type"><a href="Dtools.Conf.html#TYPElink">link</a> list</code> </pre>
<pre><span id="TYPEpath"><span class="keyword">type</span> <code class="type"></code>path</span> = <code class="type"><a href="Dtools.Conf.html#TYPElink">link</a> list</code> </pre>
<div class="info">
Type for paths between keys<br>
</div>
<pre><span class="keyword">type</span> <a name="TYPEut"></a><code class="type"></code>ut = <code class="type">< comments : string list; descr : string; kind : string option;<br> path : <a href="Dtools.Conf.html#TYPEpath">path</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a>;<br> plug : <a href="Dtools.Conf.html#TYPElink">link</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a> -> unit;<br> routes : <a href="Dtools.Conf.html#TYPEut">ut</a> -> <a href="Dtools.Conf.html#TYPEpath">path</a> list;<br> subs : <a href="Dtools.Conf.html#TYPElink">link</a> list; ut : <a href="Dtools.Conf.html#TYPEut">ut</a> ></code> </pre>
<pre><span id="TYPEut"><span class="keyword">type</span> <code class="type"></code>ut</span> = <code class="type">< comments : string list; descr : string; kind : string option;<br> path : <a href="Dtools.Conf.html#TYPEpath">path</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a>;<br> plug : <a href="Dtools.Conf.html#TYPElink">link</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a> -> unit;<br> routes : <a href="Dtools.Conf.html#TYPEut">ut</a> -> <a href="Dtools.Conf.html#TYPEpath">path</a> list;<br> subs : <a href="Dtools.Conf.html#TYPElink">link</a> list; ut : <a href="Dtools.Conf.html#TYPEut">ut</a> ></code> </pre>
<br>
Type for untyped keys (or keys with unknown type)<ul>
......@@ -43,7 +43,7 @@ Type for untyped keys (or keys with unknown type)<ul>
<li><code class="code">routes</code>: a way to find paths to an other key</li>
</ul>
<br>
<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type">'a</code> t = <code class="type">< comments : string list; descr : string; get : 'a; get_d : 'a option;<br> kind : string option; path : <a href="Dtools.Conf.html#TYPEpath">path</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a>;<br> plug : <a href="Dtools.Conf.html#TYPElink">link</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a> -> unit;<br> routes : <a href="Dtools.Conf.html#TYPEut">ut</a> -> <a href="Dtools.Conf.html#TYPEpath">path</a> list; set : 'a -> unit;<br> set_d : 'a option -> unit; subs : <a href="Dtools.Conf.html#TYPElink">link</a> list;<br> ut : <a href="Dtools.Conf.html#TYPEut">ut</a> ></code> </pre>
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> = <code class="type">< comments : string list; descr : string; get : 'a; get_d : 'a option;<br> kind : string option; path : <a href="Dtools.Conf.html#TYPEpath">path</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a>;<br> plug : <a href="Dtools.Conf.html#TYPElink">link</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a> -> unit;<br> routes : <a href="Dtools.Conf.html#TYPEut">ut</a> -> <a href="Dtools.Conf.html#TYPEpath">path</a> list; set : 'a -> unit;<br> set_d : 'a option -> unit; subs : <a href="Dtools.Conf.html#TYPElink">link</a> list;<br> ut : <a href="Dtools.Conf.html#TYPEut">ut</a> ></code> </pre>
<br>
Type for 'a keys<ul>
......@@ -54,83 +54,83 @@ Type for 'a keys<ul>
<li><code class="code">get</code>: retrieve the resulting key value</li>
</ul>
<br>
<pre><span class="keyword">type</span> <a name="TYPElinks"></a><code class="type"></code>links = <code class="type">(<a href="Dtools.Conf.html#TYPElink">link</a> * <a href="Dtools.Conf.html#TYPEut">ut</a>) list</code> </pre>
<pre><span id="TYPElinks"><span class="keyword">type</span> <code class="type"></code>links</span> = <code class="type">(<a href="Dtools.Conf.html#TYPElink">link</a> * <a href="Dtools.Conf.html#TYPEut">ut</a>) list</code> </pre>
<div class="info">
A set of connections to others keys<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONUndefined"></a>Undefined <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a></code></pre>
<pre><span id="EXCEPTIONUndefined"><span class="keyword">exception</span> Undefined</span> <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a></code></pre>
<div class="info">
Raised on access to an undefined key (without default value)<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONInvalid"></a>Invalid <span class="keyword">of</span> <code class="type">string</code></pre>
<pre><span id="EXCEPTIONInvalid"><span class="keyword">exception</span> Invalid</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info">
Raised when an invalid link has been specified<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONUnbound"></a>Unbound <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> * string</code></pre>
<pre><span id="EXCEPTIONUnbound"><span class="keyword">exception</span> Unbound</span> <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> * string</code></pre>
<div class="info">
Raised when a specified link does not exist<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONBound"></a>Bound <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> * string</code></pre>
<pre><span id="EXCEPTIONBound"><span class="keyword">exception</span> Bound</span> <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> * string</code></pre>
<div class="info">
Raised when a specified link already exist<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONMismatch"></a>Mismatch <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a></code></pre>
<pre><span id="EXCEPTIONMismatch"><span class="keyword">exception</span> Mismatch</span> <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a></code></pre>
<div class="info">
Raised on access to a key with a mismatching type<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONCyclic"></a>Cyclic <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> * <a href="Dtools.Conf.html#TYPEut">ut</a></code></pre>
<pre><span id="EXCEPTIONCyclic"><span class="keyword">exception</span> Cyclic</span> <span class="keyword">of</span> <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> * <a href="Dtools.Conf.html#TYPEut">ut</a></code></pre>
<div class="info">
Raised on cyclic plug<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONWrong_Conf"></a>Wrong_Conf <span class="keyword">of</span> <code class="type">string * string</code></pre>
<pre><span id="EXCEPTIONWrong_Conf"><span class="keyword">exception</span> Wrong_Conf</span> <span class="keyword">of</span> <code class="type">string * string</code></pre>
<div class="info">
Raised when bad configuration assignations are encountered<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONFile_Wrong_Conf"></a>File_Wrong_Conf <span class="keyword">of</span> <code class="type">string * int * string</code></pre>
<pre><span id="EXCEPTIONFile_Wrong_Conf"><span class="keyword">exception</span> File_Wrong_Conf</span> <span class="keyword">of</span> <code class="type">string * int * string</code></pre>
<div class="info">
Raised when bad configuration assignations are encountered
inside configuration files<br>
</div>
<pre><span class="keyword">type</span> <a name="TYPEbuilder"></a><code class="type">'a</code> builder = <code class="type">?d:'a -><br> ?p:(<a href="Dtools.Conf.html#TYPEut">ut</a> -> unit) -><br> ?l:<a href="Dtools.Conf.html#TYPElinks">links</a> -> ?comments:string list -> string -> 'a <a href="Dtools.Conf.html#TYPEt">t</a></code> </pre>
<pre><span id="TYPEbuilder"><span class="keyword">type</span> <code class="type">'a</code> builder</span> = <code class="type">?d:'a -><br> ?p:(<a href="Dtools.Conf.html#TYPEut">ut</a> -> unit) -><br> ?l:<a href="Dtools.Conf.html#TYPElinks">links</a> -> ?comments:string list -> string -> 'a <a href="Dtools.Conf.html#TYPEt">t</a></code> </pre>
<div class="info">
Receipt to build a 'a key<br>
</div>
<pre><span class="keyword">val</span> <a name="VALunit"></a>unit : <code class="type">unit <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span class="keyword">val</span> <a name="VALint"></a>int : <code class="type">int <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span class="keyword">val</span> <a name="VALfloat"></a>float : <code class="type">float <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span class="keyword">val</span> <a name="VALbool"></a>bool : <code class="type">bool <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span class="keyword">val</span> <a name="VALstring"></a>string : <code class="type">string <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span class="keyword">val</span> <a name="VALlist"></a>list : <code class="type">string list <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><div class="info">
<pre><span id="VALunit"><span class="keyword">val</span> unit</span> : <code class="type">unit <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span id="VALint"><span class="keyword">val</span> int</span> : <code class="type">int <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span id="VALfloat"><span class="keyword">val</span> float</span> : <code class="type">float <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span id="VALbool"><span class="keyword">val</span> bool</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span id="VALstring"><span class="keyword">val</span> string</span> : <code class="type">string <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><pre><span id="VALlist"><span class="keyword">val</span> list</span> : <code class="type">string list <a href="Dtools.Conf.html#TYPEbuilder">builder</a></code></pre><div class="info">
Some key builders<br>
</div>
<pre><span class="keyword">val</span> <a name="VALvoid"></a>void : <code class="type">?p:(<a href="Dtools.Conf.html#TYPEut">ut</a> -> unit) -><br> ?l:<a href="Dtools.Conf.html#TYPElinks">links</a> -> ?comments:string list -> string -> <a href="Dtools.Conf.html#TYPEut">ut</a></code></pre><div class="info">
<pre><span id="VALvoid"><span class="keyword">val</span> void</span> : <code class="type">?p:(<a href="Dtools.Conf.html#TYPEut">ut</a> -> unit) -><br> ?l:<a href="Dtools.Conf.html#TYPElinks">links</a> -> ?comments:string list -> string -> <a href="Dtools.Conf.html#TYPEut">ut</a></code></pre><div class="info">
A structural key builder<br>
</div>
<pre><span class="keyword">val</span> <a name="VALas_unit"></a>as_unit : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> unit <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALas_int"></a>as_int : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> int <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALas_float"></a>as_float : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> float <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALas_bool"></a>as_bool : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> bool <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALas_string"></a>as_string : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> string <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALas_list"></a>as_list : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> string list <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><div class="info">
<pre><span id="VALas_unit"><span class="keyword">val</span> as_unit</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> unit <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span id="VALas_int"><span class="keyword">val</span> as_int</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> int <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span id="VALas_float"><span class="keyword">val</span> as_float</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> float <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span id="VALas_bool"><span class="keyword">val</span> as_bool</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> bool <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span id="VALas_string"><span class="keyword">val</span> as_string</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> string <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><pre><span id="VALas_list"><span class="keyword">val</span> as_list</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> string list <a href="Dtools.Conf.html#TYPEt">t</a></code></pre><div class="info">
Casts to specificaly typed keys.
Raises <code class="code">Mismatch</code> on mismatching cast.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALpath_of_string"></a>path_of_string : <code class="type">string -> <a href="Dtools.Conf.html#TYPEpath">path</a></code></pre><div class="info">
<pre><span id="VALpath_of_string"><span class="keyword">val</span> path_of_string</span> : <code class="type">string -> <a href="Dtools.Conf.html#TYPEpath">path</a></code></pre><div class="info">
Convert a dot separated string to a path<br>
</div>
<pre><span class="keyword">val</span> <a name="VALstring_of_path"></a>string_of_path : <code class="type"><a href="Dtools.Conf.html#TYPEpath">path</a> -> string</code></pre><div class="info">
<pre><span id="VALstring_of_path"><span class="keyword">val</span> string_of_path</span> : <code class="type"><a href="Dtools.Conf.html#TYPEpath">path</a> -> string</code></pre><div class="info">
Convert a path to a dot separated string<br>
</div>
<pre><span class="keyword">val</span> <a name="VALdescr"></a>descr : <code class="type">?prefix:<a href="Dtools.Conf.html#TYPEpath">path</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a> -> string</code></pre><div class="info">
<pre><span id="VALdescr"><span class="keyword">val</span> descr</span> : <code class="type">?prefix:<a href="Dtools.Conf.html#TYPEpath">path</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a> -> string</code></pre><div class="info">
Generate a description table of a (sub)key<br>
</div>
<pre><span class="keyword">val</span> <a name="VALdump"></a>dump : <code class="type">?prefix:<a href="Dtools.Conf.html#TYPEpath">path</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a> -> string</code></pre><div class="info">
<pre><span id="VALdump"><span class="keyword">val</span> dump</span> : <code class="type">?prefix:<a href="Dtools.Conf.html#TYPEpath">path</a> -> <a href="Dtools.Conf.html#TYPEut">ut</a> -> string</code></pre><div class="info">
Dump the configuration table for a (sub)key<br>
</div>
<pre><span class="keyword">val</span> <a name="VALconf_set"></a>conf_set : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> string -> unit</code></pre><div class="info">
<pre><span id="VALconf_set"><span class="keyword">val</span> conf_set</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> string -> unit</code></pre><div class="info">
Add a value to the configuration keys, according to the given
correctly formated string: "type key :value"
Raises <code class="code">Wrong_Conf</code> in badly formated cases.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALconf_file"></a>conf_file : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> string -> unit</code></pre><div class="info">
<pre><span id="VALconf_file"><span class="keyword">val</span> conf_file</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> string -> unit</code></pre><div class="info">
Read configuration values from the file associated with the given
filename.
Raises <code class="code">File_Wrong_Conf</code> with filename line and and error message
in case of a bad configuration file.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALargs"></a>args : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> (string list * Arg.spec * string) list</code></pre><div class="info">
<pre><span id="VALargs"><span class="keyword">val</span> args</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">ut</a> -> (string list * Arg.spec * string) list</code></pre><div class="info">
A set of command line options to be used with the Arg module.<br>
</div>
</body></html>
\ No newline at end of file
......@@ -24,15 +24,15 @@
Allow to define procedures that must be executed at start up, and
procedures that are to be executed at exit to have a clean quit.<br>
<hr width="100%">
<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre>
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> </pre>
<pre><span class="keyword">val</span> <a name="VALstart"></a>start : <code class="type"><a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
<pre><span id="VALstart"><span class="keyword">val</span> start</span> : <code class="type"><a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
Root start atom<br>
</div>
<pre><span class="keyword">val</span> <a name="VALstop"></a>stop : <code class="type"><a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
<pre><span id="VALstop"><span class="keyword">val</span> stop</span> : <code class="type"><a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
Root stop atom<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmake"></a>make : <code class="type">?name:string -><br> ?depends:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?triggers:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?after:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?before:<a href="Dtools.Init.html#TYPEt">t</a> list -> (unit -> unit) -> <a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
<pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type">?name:string -><br> ?depends:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?triggers:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?after:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?before:<a href="Dtools.Init.html#TYPEt">t</a> list -> (unit -> unit) -> <a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
Define a init atom associated with the given <code class="code">(unit -&gt; unit)</code>
procedure, which eventualy depends on others atoms (these atoms
will be executed before the one currently defined) an triggers
......@@ -40,16 +40,16 @@ Define a init atom associated with the given <code class="code">(unit -&gt; unit
defined). <code class="code">after</code> and <code class="code">before</code> allow to register the currently
defined atom in the depend and triggers lists of other atoms.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALat_start"></a>at_start : <code class="type">?name:string -><br> ?depends:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?triggers:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?after:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?before:<a href="Dtools.Init.html#TYPEt">t</a> list -> (unit -> unit) -> <a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
<pre><span id="VALat_start"><span class="keyword">val</span> at_start</span> : <code class="type">?name:string -><br> ?depends:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?triggers:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?after:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?before:<a href="Dtools.Init.html#TYPEt">t</a> list -> (unit -> unit) -> <a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
Same as <code class="code">make</code> plus a shortcut for "after Init.start".<br>
</div>
<pre><span class="keyword">val</span> <a name="VALat_stop"></a>at_stop : <code class="type">?name:string -><br> ?depends:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?triggers:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?after:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?before:<a href="Dtools.Init.html#TYPEt">t</a> list -> (unit -> unit) -> <a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
<pre><span id="VALat_stop"><span class="keyword">val</span> at_stop</span> : <code class="type">?name:string -><br> ?depends:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?triggers:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?after:<a href="Dtools.Init.html#TYPEt">t</a> list -><br> ?before:<a href="Dtools.Init.html#TYPEt">t</a> list -> (unit -> unit) -> <a href="Dtools.Init.html#TYPEt">t</a></code></pre><div class="info">
Same as <code class="code">make</code> plus a shortcut for "before Init.stop".<br>
</div>
<pre><span class="keyword">val</span> <a name="VALexec"></a>exec : <code class="type"><a href="Dtools.Init.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<pre><span id="VALexec"><span class="keyword">val</span> exec</span> : <code class="type"><a href="Dtools.Init.html#TYPEt">t</a> -> unit</code></pre><div class="info">
Launch the execution of a given init atom.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALinit"></a>init : <code class="type">?prohibit_root:bool -> (unit -> unit) -> unit</code></pre><div class="info">
<pre><span id="VALinit"><span class="keyword">val</span> init</span> : <code class="type">?prohibit_root:bool -> (unit -> unit) -> unit</code></pre><div class="info">
This fuction must be used to launch the main procedure of the
program. It first execute the registered start atoms, then call
the main procedure, then execute the registered stop atoms.
......@@ -59,9 +59,9 @@ This fuction must be used to launch the main procedure of the
When invoqued with <code class="code">~prohibit_root:true</code>, it checks for root access
rights (euid, egid) and exit in this case.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONStartError"></a>StartError <span class="keyword">of</span> <code class="type">exn</code></pre>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONStopError"></a>StopError <span class="keyword">of</span> <code class="type">exn</code></pre>
<pre><span class="keyword">val</span> <a name="VALconf"></a>conf : <code class="type"><a href="Dtools.Conf.html#TYPEut">Dtools.Conf.ut</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_daemon"></a>conf_daemon : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_daemon_pidfile"></a>conf_daemon_pidfile : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_daemon_pidfile_path"></a>conf_daemon_pidfile_path : <code class="type">string <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_concurrent"></a>conf_concurrent : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_trace"></a>conf_trace : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_catch_exn"></a>conf_catch_exn : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALargs"></a>args : <code class="type">(string list * Arg.spec * string) list</code></pre><div class="info">
<pre><span id="EXCEPTIONStartError"><span class="keyword">exception</span> StartError</span> <span class="keyword">of</span> <code class="type">exn</code></pre>
<pre><span id="EXCEPTIONStopError"><span class="keyword">exception</span> StopError</span> <span class="keyword">of</span> <code class="type">exn</code></pre>
<pre><span id="VALconf"><span class="keyword">val</span> conf</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">Dtools.Conf.ut</a></code></pre><pre><span id="VALconf_daemon"><span class="keyword">val</span> conf_daemon</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_daemon_pidfile"><span class="keyword">val</span> conf_daemon_pidfile</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_daemon_pidfile_path"><span class="keyword">val</span> conf_daemon_pidfile_path</span> : <code class="type">string <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_concurrent"><span class="keyword">val</span> conf_concurrent</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_trace"><span class="keyword">val</span> conf_trace</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_catch_exn"><span class="keyword">val</span> conf_catch_exn</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALargs"><span class="keyword">val</span> args</span> : <code class="type">(string list * Arg.spec * string) list</code></pre><div class="info">
A set of command line options to be used with the Arg module.<br>
</div>
</body></html>
\ No newline at end of file
......@@ -19,12 +19,12 @@
<center><h1>Module <a href="type_Dtools.Log.html">Dtools.Log</a></h1></center>
<br>
<pre><span class="keyword">module</span> Log: <code class="code">sig</code> <a href="Dtools.Log.html">..</a> <code class="code">end</code></pre><hr width="100%">
<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t = <code class="type">< active : int -> bool;<br> f : 'a. int -> ('a, unit, string, unit) Pervasives.format4 -> 'a ></code> </pre>
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> = <code class="type">< active : int -> bool;<br> f : 'a. int -> ('a, unit, string, unit) Pervasives.format4 -> 'a ></code> </pre>
<div class="info">
Type for loggers.<br>
</div>
<br><code><span class="keyword">type</span> <a name="TYPEcustom_log"></a><code class="type"></code>custom_log = {</code><table class="typetable">
<br><code><span id="TYPEcustom_log"><span class="keyword">type</span> <code class="type"></code>custom_log</span> = {</code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
......@@ -42,22 +42,22 @@ Type for loggers.<br>
}
<pre><span class="keyword">val</span> <a name="VALadd_custom_log"></a>add_custom_log : <code class="type">string -> <a href="Dtools.Log.html#TYPEcustom_log">custom_log</a> -> unit</code></pre><div class="info">
<pre><span id="VALadd_custom_log"><span class="keyword">val</span> add_custom_log</span> : <code class="type">string -> <a href="Dtools.Log.html#TYPEcustom_log">custom_log</a> -> unit</code></pre><div class="info">
Add a custom logging functions.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALrm_custom_log"></a>rm_custom_log : <code class="type">string -> unit</code></pre><div class="info">
<pre><span id="VALrm_custom_log"><span class="keyword">val</span> rm_custom_log</span> : <code class="type">string -> unit</code></pre><div class="info">
Remove a custom logging functions.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmake"></a>make : <code class="type"><a href="Dtools.Conf.html#TYPEpath">Dtools.Conf.path</a> -> <a href="Dtools.Log.html#TYPEt">t</a></code></pre><div class="info">
<pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type"><a href="Dtools.Conf.html#TYPEpath">Dtools.Conf.path</a> -> <a href="Dtools.Log.html#TYPEt">t</a></code></pre><div class="info">
Make a logger labeled according to the given path.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALstart"></a>start : <code class="type"><a href="Dtools.Init.html#TYPEt">Dtools.Init.t</a></code></pre><div class="info">
<pre><span id="VALstart"><span class="keyword">val</span> start</span> : <code class="type"><a href="Dtools.Init.html#TYPEt">Dtools.Init.t</a></code></pre><div class="info">
An atom that starts the logging.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALstop"></a>stop : <code class="type"><a href="Dtools.Init.html#TYPEt">Dtools.Init.t</a></code></pre><div class="info">
<pre><span id="VALstop"><span class="keyword">val</span> stop</span> : <code class="type"><a href="Dtools.Init.html#TYPEt">Dtools.Init.t</a></code></pre><div class="info">
An atom that stops the logging.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALconf"></a>conf : <code class="type"><a href="Dtools.Conf.html#TYPEut">Dtools.Conf.ut</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_level"></a>conf_level : <code class="type">int <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_unix_timestamps"></a>conf_unix_timestamps : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_stdout"></a>conf_stdout : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_file"></a>conf_file : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_file_path"></a>conf_file_path : <code class="type">string <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_file_append"></a>conf_file_append : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALconf_file_perms"></a>conf_file_perms : <code class="type">int <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span class="keyword">val</span> <a name="VALargs"></a>args : <code class="type">(string list * Arg.spec * string) list</code></pre><div class="info">
<pre><span id="VALconf"><span class="keyword">val</span> conf</span> : <code class="type"><a href="Dtools.Conf.html#TYPEut">Dtools.Conf.ut</a></code></pre><pre><span id="VALconf_level"><span class="keyword">val</span> conf_level</span> : <code class="type">int <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_unix_timestamps"><span class="keyword">val</span> conf_unix_timestamps</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_stdout"><span class="keyword">val</span> conf_stdout</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_file"><span class="keyword">val</span> conf_file</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_file_path"><span class="keyword">val</span> conf_file_path</span> : <code class="type">string <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_file_append"><span class="keyword">val</span> conf_file_append</span> : <code class="type">bool <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALconf_file_perms"><span class="keyword">val</span> conf_file_perms</span> : <code class="type">int <a href="Dtools.Conf.html#TYPEt">Dtools.Conf.t</a></code></pre><pre><span id="VALargs"><span class="keyword">val</span> args</span> : <code class="type">(string list * Arg.spec * string) list</code></pre><div class="info">
A set of command line options to be used with the Arg module.<br>
</div>
</body></html>
\ No newline at end of file
......@@ -30,4 +30,5 @@ body { background-color : White }
tr { background-color : White }
td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;}
pre { margin-bottom: 4px }
div.sig_block {margin-left: 2em}
\ No newline at end of file
div.sig_block {margin-left: 2em}
*:target { background: yellow; }
\ No newline at end of file
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
#
# DESCRIPTION
#
# This macro compares two version strings. Due to the various number of
# minor-version numbers that can exist, and the fact that string
# comparisons are not compatible with numeric comparisons, this is not
# necessarily trivial to do in a autoconf script. This macro makes doing
# these comparisons easy.
#
# The six basic comparisons are available, as well as checking equality
# limited to a certain number of minor-version levels.
#
# The operator OP determines what type of comparison to do, and can be one
# of:
#
# eq - equal (test A == B)
# ne - not equal (test A != B)
# le - less than or equal (test A <= B)
# ge - greater than or equal (test A >= B)
# lt - less than (test A < B)
# gt - greater than (test A > B)
#
# Additionally, the eq and ne operator can have a number after it to limit
# the test to that number of minor versions.
#
# eq0 - equal up to the length of the shorter version
# ne0 - not equal up to the length of the shorter version
# eqN - equal up to N sub-version levels
# neN - not equal up to N sub-version levels
#
# When the condition is true, shell commands ACTION-IF-TRUE are run,
# otherwise shell commands ACTION-IF-FALSE are run. The environment
# variable 'ax_compare_version' is always set to either 'true' or 'false'
# as well.
#
# Examples:
#
# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
#
# would both be true.
#
# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
#
# would both be false.
#
# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
#
# would be true because it is only comparing two minor versions.
#
# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
#
# would be true because it is only comparing the lesser number of minor
# versions of the two values.
#
# Note: The characters that separate the version numbers do not matter. An
# empty string is the same as version 0. OP is evaluated by autoconf, not
# configure, so must be a string, not a variable.
#
# The author would like to acknowledge Guido Draheim whose advice about
# the m4_case and m4_ifvaln functions make this macro only include the
# portions necessary to perform the specific comparison specified by the
# OP argument in the final configure script.
#
# LICENSE
#
# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 11
dnl #########################################################################
AC_DEFUN([AX_COMPARE_VERSION], [
AC_REQUIRE([AC_PROG_AWK])
# Used to indicate true or false condition
ax_compare_version=false
# Convert the two version strings to be compared into a format that
# allows a simple string comparison. The end result is that a version
# string of the form 1.12.5-r617 will be converted to the form
# 0001001200050617. In other words, each number is zero padded to four
# digits, and non digits are removed.
AS_VAR_PUSHDEF([A],[ax_compare_version_A])
A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
AS_VAR_PUSHDEF([B],[ax_compare_version_B])
B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
dnl # then the first line is used to determine if the condition is true.
dnl # The sed right after the echo is to remove any indented white space.
m4_case(m4_tolower($2),
[lt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[gt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[le],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],
[ge],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],[
dnl Split the operator from the subversion count if present.
m4_bmatch(m4_substr($2,2),
[0],[
# A count of zero means use the length of the shorter version.
# Determine the number of characters in A and B.
ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
# Set A to no more than B's length and B to no more than A's length.
A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
],
[[0-9]+],[
# A count greater than zero means use only that many subversions
A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
],
[.+],[
AC_WARNING(
[illegal OP numeric parameter: $2])
],[])
# Pad zeros at end of numbers to make same length.
ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
B="$B`echo $A | sed 's/./0/g'`"
A="$ax_compare_version_tmp_A"
# Check for equality or inequality as necessary.
m4_case(m4_tolower(m4_substr($2,0,2)),
[eq],[
test "x$A" = "x$B" && ax_compare_version=true
],
[ne],[
test "x$A" != "x$B" && ax_compare_version=true
],[
AC_WARNING([illegal OP parameter: $2])
])
])
AS_VAR_POPDEF([A])dnl
AS_VAR_POPDEF([B])dnl
dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
if test "$ax_compare_version" = "true" ; then
m4_ifvaln([$4],[$4],[:])dnl
m4_ifvaln([$5],[else $5])dnl
fi
]) dnl AX_COMPARE_VERSION