1AC_DEFUN([AX_XEN_OCAML_XENSTORE_CHECK], [
2	AS_IF([test "$ocamltools" = "n"], [
3		AC_MSG_ERROR([Missing ocaml dependencies for oxenstored, try installing ocaml ocaml-compiler-libs ocaml-runtime ocaml-findlib])
4	])
5])
6
7AC_DEFUN([AX_XEN_OCAML_XENSTORE_DEFAULTS], [
8	xenstore="oxenstored"
9	xenstored=$sbindir/oxenstored
10	AS_IF([test "$ocamltools" = "n"], [
11		xenstore="xenstored"
12		xenstored=$sbindir/xenstored
13	])
14])
15
16AC_DEFUN([AX_XENSTORE_OPTIONS], [
17AS_IF([test "x$XENSTORE" = "x"], [
18AC_ARG_WITH([xenstored],
19	AS_HELP_STRING([--with-xenstored@<:@=oxenstored|xenstored@:>@],
20		[This lets you choose which xenstore daemon you want, you have
21		two options: the original xenstored written in C (xenstored)
22		or the newer and robust one written in Ocaml (oxenstored).
23		The oxenstored daemon is the default but can only
24		be used if you have ocaml library / build dependencies solved,
25		if you have not specified a preference and do not have ocaml
26		dependencies resolved we'll enable the C xenstored for you. If
27		you ask for oxenstored we'll complain until you resolve those
28		dependencies]),
29	[
30		AS_IF([test "x$withval" = "xxenstored"], [
31			xenstore=$withval
32			xenstored=$sbindir/xenstored
33		])
34		AS_IF([test "x$withval" = "xoxenstored"], [
35			xenstore=$withval
36			xenstored=$sbindir/oxenstored
37			AX_XEN_OCAML_XENSTORE_CHECK()
38		])
39		AS_IF([test "x$withval" != "xoxenstored" && test "x$withval" != "xxenstored"], [
40			AC_MSG_ERROR([Unsupported xenstored specified, supported types: oxenstored xenstored])
41		])
42	],
43	[
44		AX_XEN_OCAML_XENSTORE_DEFAULTS()
45	])
46])
47])
48
49AC_DEFUN([AX_XENSTORE_SET], [
50	XENSTORE=$xenstore
51
52	AS_IF([test "x$XENSTORED" = "x"], [
53		XENSTORED=$xenstored
54	])
55	AC_SUBST(XENSTORED)
56])
57