xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: xen-devel@lists.xenproject.org
Cc: Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>, Tim Deegan <tim@xen.org>,
	"Luis R. Rodriguez" <mcgrof@suse.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v4 12/15] autoconf: xen: peg the xenstored preference onto the top level config
Date: Tue, 29 Apr 2014 18:12:05 -0700	[thread overview]
Message-ID: <1398820328-15132-13-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1398820328-15132-1-git-send-email-mcgrof@do-not-panic.com>

From: "Luis R. Rodriguez" <mcgrof@suse.com>

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@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 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

  parent reply	other threads:[~2014-04-30  1:13 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30  1:11 [PATCH v4 00/15] xen: add systemd support Luis R. Rodriguez
2014-04-30  1:11 ` [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored Luis R. Rodriguez
2014-05-07 15:03   ` Ian Campbell
2014-05-12 13:50   ` Ian Jackson
2014-05-12 14:18     ` Ian Campbell
2014-05-12 14:40       ` Jacek Konieczny
2014-05-12 15:37         ` Ian Jackson
2014-05-12 18:59           ` Luis R. Rodriguez
2014-05-13 21:33           ` Luis R. Rodriguez
2014-04-30  1:11 ` [PATCH v4 02/15] xencommons: use the retry limit instead of implementing our own timeout Luis R. Rodriguez
2014-04-30  9:33   ` Andrew Cooper
2014-04-30 16:36     ` Luis R. Rodriguez
2014-05-07 15:05   ` Ian Campbell
2014-04-30  1:11 ` [PATCH v4 03/15] xenstored: enable usage of config.h on both xenstored and oxenstored Luis R. Rodriguez
2014-05-07 15:06   ` Ian Campbell
2014-04-30  1:11 ` [PATCH v4 04/15] cxenstored: add support for systemd active sockets Luis R. Rodriguez
2014-05-07 15:18   ` Ian Campbell
2014-05-07 15:46   ` Ian Campbell
2014-05-13 22:17     ` Luis R. Rodriguez
2014-05-14  8:44       ` Ian Campbell
2014-05-15  1:50         ` Luis R. Rodriguez
2014-04-30  1:11 ` [PATCH v4 05/15] oxenstored: " Luis R. Rodriguez
2014-04-30  8:35   ` Dave Scott
2014-04-30 17:30     ` Luis R. Rodriguez
2014-05-01 10:21       ` Dave Scott
2014-04-30  9:27   ` Anil Madhavapeddy
2014-04-30 17:35     ` Luis R. Rodriguez
2014-05-01  9:16       ` Anil Madhavapeddy
2014-05-07 15:20   ` Ian Campbell
2014-05-12 19:09     ` Luis R. Rodriguez
2014-05-12 13:57   ` Ian Jackson
2014-05-12 18:11     ` Luis R. Rodriguez
2014-05-13  8:53       ` Ian Campbell
2014-04-30  1:11 ` [PATCH v4 06/15] tools/xendomains: make xl the default Luis R. Rodriguez
2014-04-30  7:02   ` Olaf Hering
2014-04-30 17:43     ` Luis R. Rodriguez
2014-05-07 15:21       ` Ian Campbell
2014-04-30  1:12 ` [PATCH v4 07/15] tools/xendomains: do space cleanups Luis R. Rodriguez
2014-04-30  1:12 ` [PATCH v4 08/15] tools/xendomains: move to libexec and use a smaller init helper Luis R. Rodriguez
2014-05-07 15:24   ` Ian Campbell
2014-05-13 22:21     ` Luis R. Rodriguez
2014-04-30  1:12 ` [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf Luis R. Rodriguez
2014-05-07 15:25   ` Ian Campbell
2014-05-07 16:12   ` Roger Pau Monné
2014-05-07 16:21     ` Ian Campbell
2014-05-07 16:44       ` Roger Pau Monné
2014-05-07 18:28         ` Luis R. Rodriguez
2014-05-12 14:00           ` Ian Jackson
2014-05-12 18:14             ` Luis R. Rodriguez
2014-04-30  1:12 ` [PATCH v4 10/15] autoconf: update m4/pkg.m4 Luis R. Rodriguez
2014-05-07 15:28   ` Ian Campbell
2014-05-13 22:32     ` Luis R. Rodriguez
2014-05-07 16:17   ` Roger Pau Monné
2014-04-30  1:12 ` [PATCH v4 11/15] autoconf: xen: move standard variables to a generic place Luis R. Rodriguez
2014-04-30  6:52   ` Jan Beulich
     [not found]   ` <5360B9CB020000780000D9BB@suse.com>
2014-04-30 17:53     ` Luis R. Rodriguez
2014-05-02  8:12       ` Jan Beulich
2014-05-13 23:03         ` Luis R. Rodriguez
2014-04-30  1:12 ` Luis R. Rodriguez [this message]
2014-05-07 15:32   ` [PATCH v4 12/15] autoconf: xen: peg the xenstored preference onto the top level config Ian Campbell
2014-05-13 23:05     ` Luis R. Rodriguez
2014-04-30  1:12 ` [PATCH v4 13/15] systemd: add xen systemd service and module files Luis R. Rodriguez
2014-05-07 15:46   ` Ian Campbell
2014-05-12 18:22     ` Luis R. Rodriguez
2014-05-13 23:28     ` Luis R. Rodriguez
2014-05-12 14:11   ` Ian Jackson
2014-05-12 14:32     ` Jacek Konieczny
2014-05-12 15:36       ` Ian Jackson
2014-05-12 18:55         ` Luis R. Rodriguez
2014-05-12 18:46     ` Luis R. Rodriguez
2014-05-13  8:57       ` Ian Campbell
2014-04-30  1:12 ` [PATCH v4 14/15] autoconf: xen: add systemd support into the build system Luis R. Rodriguez
2014-05-07 16:40   ` Roger Pau Monné
2014-05-15  1:58     ` Luis R. Rodriguez
2014-05-15  9:02       ` Ian Campbell
2014-04-30  1:12 ` [PATCH v4 15/15] autoconf: xen: trigger an update with autogen.sh Luis R. Rodriguez
2014-05-07 15:47   ` Ian Campbell
2014-05-07 18:34     ` Luis R. Rodriguez
2014-05-08  8:42       ` Ian Campbell
2014-04-30  1:15 ` [PATCH v4 00/15] xen: add systemd support Luis R. Rodriguez
2014-05-07 15:18   ` Ian Campbell
2014-05-08 11:28 ` Anthony PERARD
2014-05-15  2:12   ` Luis R. Rodriguez
2014-05-15  6:14   ` Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1398820328-15132-13-git-send-email-mcgrof@do-not-panic.com \
    --to=mcgrof@do-not-panic.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=mcgrof@suse.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).