[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v4 12/15] autoconf: xen: peg the xenstored preference onto the top level config



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx>

This lets us easily look what xenstored we have on the build system
and use it with autoconf for file generation. Although you can now
specify your preference to disable ocaml tools the we can only make
a general build flag available if coming from the parent configure.ac

You can only use:

./configure --with-xenstored=cxenstored
./configure --with-xenstored=oxenstored

And by default oxenstored will be used, but only if you have ocaml
dependencies. Enabling cxenstored will then disable ocamltools. This lets
us simplify the legacy init script a bit but it should help us simplify
our systemd service files even more.

Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Keir Fraser <keir@xxxxxxx>
Cc: Tim Deegan <tim@xxxxxxx>
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxx>
---
 config/Toplevel.mk.in                 |  3 ++
 config/xen-environment-header.in      |  3 ++
 config/xen-environment-scripts.in     |  3 ++
 configure.ac                          |  1 +
 m4/expand_config.m4                   | 61 +++++++++++++++++++++++++++++++++++
 stubdom/configure.ac                  |  1 +
 tools/configure.ac                    | 11 +++++++
 tools/hotplug/Linux/init.d/xencommons |  6 ----
 8 files changed, 83 insertions(+), 6 deletions(-)

diff --git a/config/Toplevel.mk.in b/config/Toplevel.mk.in
index fc2754c..bea9d96 100644
--- a/config/Toplevel.mk.in
+++ b/config/Toplevel.mk.in
@@ -23,3 +23,6 @@ XENFIRMWAREDIR           := @XENFIRMWAREDIR@
 
 XEN_CONFIG_DIR           := @XEN_CONFIG_DIR@
 XEN_SCRIPT_DIR           := @XEN_SCRIPT_DIR@
+
+XENSTORED                := @XENSTORED@
+XENSTORE                 := @XENSTORE@
diff --git a/config/xen-environment-header.in b/config/xen-environment-header.in
index 7dd7a53..3ee8e32 100644
--- a/config/xen-environment-header.in
+++ b/config/xen-environment-header.in
@@ -11,3 +11,6 @@
 #define XEN_LOCK_DIR "@XEN_LOCK_DIR@"
 #define XEN_RUN_DIR "@XEN_RUN_DIR@"
 #define XEN_PAGING_DIR "@XEN_PAGING_DIR@"
+
+#define XENSTORED @XENSTORED@
+#define XENSTORE @XENSTORE@
diff --git a/config/xen-environment-scripts.in 
b/config/xen-environment-scripts.in
index 9623231..a17e0e9 100644
--- a/config/xen-environment-scripts.in
+++ b/config/xen-environment-scripts.in
@@ -13,3 +13,6 @@ XEN_LOG_DIR="@XEN_LOG_DIR@"
 XEN_LIB_STORED="@XEN_LIB_STORED@"
 XEN_RUN_DIR="@XEN_RUN_DIR@"
 XEN_PAGING_DIR="@XEN_PAGING_DIR@"
+
+XENSTORED="@XENSTORED@"
+XENSTORE="@XENSTORE@"
diff --git a/configure.ac b/configure.ac
index 3f26a39..f5faa4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,7 @@ AC_CANONICAL_HOST
 m4_include([m4/features.m4])
 m4_include([m4/subsystem.m4])
 m4_include([m4/expand_config.m4])
+m4_include([m4/ocaml.m4])
 
 AX_XEN_EXPAND_CONFIG()
 
diff --git a/m4/expand_config.m4 b/m4/expand_config.m4
index 717fcd1..40d9707 100644
--- a/m4/expand_config.m4
+++ b/m4/expand_config.m4
@@ -58,4 +58,65 @@ AC_SUBST(XEN_RUN_DIR)
 
 XEN_PAGING_DIR=/var/lib/xen/xenpaging
 AC_SUBST(XEN_PAGING_DIR)
+
+AC_DEFUN([AX_XEN_OCAML_XENSTORE_CHECK], [
+       AC_PROG_OCAML
+       AC_PROG_FINDLIB
+       AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
+               AC_MSG_ERROR([Missing ocaml dependencies for oxenstored, try 
installing ocaml ocaml-compiler-libs ocaml-runtime ocaml-findlib])
+       ])
+])
+
+AC_DEFUN([AX_XEN_OCAML_XENSTORE_DEFAULTS], [
+       xenstore="oxenstored"
+       xenstored=$SBINDIR/oxenstored
+       AC_PROG_OCAML
+       AC_PROG_FINDLIB
+       AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
+               xenstore="cxenstored"
+               xenstored=$SBINDIR/xenstored
+       ])
+])
+
+AS_IF([test "x$XENSTORE" = "x"], [
+AC_ARG_WITH([xenstored],
+       AS_HELP_STRING([--with-xenstored@<:@=cxenstored|cxenstored@:>@],
+               [This lets you choose which xenstore daemon you want, you have
+               two options: the original xenstored written in C (cxenstored)
+               or the newer and robust one written in Ocaml (oxenstored).
+               The oxenstored daemon is the default but will but can only
+               be used if you have ocaml library / build dependencies solved,
+               if you have not specified a preference and do not have ocaml
+               dependencies resolved we'll enable the C xenstored for you. If
+               you ask for oxenstored we'll complain until you resolve those
+               dependencies]),
+       [
+               AS_IF([test "x$withval" = "xcxenstored"], [
+                       xenstore="cxenstored"
+                       xenstored=$SBINDIR/xenstored
+               ])
+               AS_IF([test "x$withval" = "xoxenstored"], [
+                       xenstore="oxenstored"
+                       xenstored=$SBINDIR/oxenstored
+                       AX_XEN_OCAML_XENSTORE_CHECK()
+               ])
+               AS_IF([test "x$withval" != "xoxenstored" && test "x$withval" != 
"xcxenstored"], [
+                       AC_MSG_ERROR([Unsupported xenstored specified, 
supported types: oxenstored cxenstored])
+               ])
+       ],
+       [
+               AX_XEN_OCAML_XENSTORE_DEFAULTS()
+       ])
+])
+
+XENSTORE=$xenstore
+AC_SUBST(XENSTORE)
+
+AS_IF([test "x$XENSTORED" = "x"], [
+       XENSTORED=$xenstored
+])
+AC_SUBST(XENSTORED)
+
+AS_IF([test "x$XENSTORE" != "xcxenstored" && test "x$XENSTORE" != 
"xoxenstored"],
+       [AC_MSG_ERROR([Invalid xenstore: $XENSTORE])])
 ])
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index d6b0fbf..3c30004 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -17,6 +17,7 @@ m4_include([../m4/path_or_fail.m4])
 m4_include([../m4/depends.m4])
 m4_include([../m4/fetcher.m4])
 m4_include([../m4/expand_config.m4])
+m4_include([../m4/ocaml.m4])
 
 AX_XEN_EXPAND_CONFIG()
 
diff --git a/tools/configure.ac b/tools/configure.ac
index c7674a0..ac984a3 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -152,6 +152,17 @@ AC_PROG_INSTALL
 AC_PATH_PROG([BISON], [bison])
 AC_PATH_PROG([FLEX], [flex])
 AX_PATH_PROG_OR_FAIL([PERL], [perl])
+AS_IF([test "x$xapi" = "xy"], [
+    AX_PATH_PROG_OR_FAIL([CURL], [curl-config])
+    AX_PATH_PROG_OR_FAIL([XML], [xml2-config])
+])
+
+case $XENSTORE in
+       "cxenstored") ocamltools=n;;
+       "oxenstored") ocamltools=y;;
+       *) AC_MSG_ERROR([xenstore: $xenstore]);;
+esac
+
 AS_IF([test "x$ocamltools" = "xy"], [
     AC_PROG_OCAML
     AC_PROG_FINDLIB
diff --git a/tools/hotplug/Linux/init.d/xencommons 
b/tools/hotplug/Linux/init.d/xencommons
index 7195413..cbe2903 100644
--- a/tools/hotplug/Linux/init.d/xencommons
+++ b/tools/hotplug/Linux/init.d/xencommons
@@ -80,12 +80,6 @@ do_start () {
                if [ -n "$XENSTORED" ] ; then
                    echo -n Starting $XENSTORED...
                    $XENSTORED --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
-               elif [ -x ${SBINDIR}/oxenstored ] ; then
-                   echo -n Starting oxenstored...
-                   ${SBINDIR}/oxenstored --pid-file /var/run/xenstored.pid 
$XENSTORED_ARGS
-               elif [ -x ${SBINDIR}/xenstored ] ; then
-                   echo -n Starting C xenstored...
-                   ${SBINDIR}/xenstored --pid-file /var/run/xenstored.pid 
$XENSTORED_ARGS
                else
                    echo "No xenstored found"
                    exit 1
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.