Skip to contentSkip to conversation

xen: add systemd support

PATCH Superseded Luis R. Rodriguez 12 participants 84 messages Apr 30, 2014 – May 15, 2014 1 message not in the archive Kbuild

v4 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v4 cover xen: add systemd support

From: "Luis R. Rodriguez" <[email protected]>

This is my 4th series which I addresses all feedback from the first 3 series on adding systemd support into xen. I've taken things a bit further, I've been avoiding autoconf but in the end that proved to provide the best solution. Additionally not originally understanding systemd's socket stuff prompted me to look into that and decided its best to just switch to active sockets for systemd [0] intregration for both censtored and oxenstored. I've also decided its best to avoid separate service files for the two daemons given that we can do this cleanly with autoconf.

I've run time tested this against today's tip against the upstream kernel, on OpenSUSE using both censtored and oxenstored.

To build you can use either of with the default preferring oxenstored if ocaml tools are present:

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

Systems should just have to:

systemctl enable xenstored.socket

And then anything that will tickle the sockets:

/var/run/xenstored/socket
/var/run/xenstored/socket_ro

will trigger either censtored or oxenstored to activate. This example suffices:

nc -U /var/run/xenstored/socket_ro

This example also happens to test the order of supply / demand of sockets through sytsemd's active socket mechanism and our integration to do this in order. Sine we cannot currently stop the xenstore this means we cannot take advantage of dynamically switching xensrores live, but if that is fixed we should be able to dynamically swap even the different types of xenstore on a live system or just upgrade the xenstore without a reboot.

The ordering of active sockets implementation is begging to be shared with a common small library but given that xc / xl are not specific to the xenstore it would be pointless to stuff and duplicate code for both in there. Both the cxenstore and oxenstored handle their own store access on their own, if there's a desire to unify that small piece of code we should consider other things to stuff on it. For now this goes separately.

Systemd autconf support was split out as much as possible from xen to make it useful for any other project, perhaps this can go upstream to systemd.

Ocaml lacks support for systemd and as such I needed to extend oxenstored support through a small stub for access to systemd. System'd sd_listen_fds() can technically easily be implemented in ocaml *but* given that FD_CLOEXEC support through the new Unix.set_cloexec is only available on 4.00.1+dev which isn't yet widely available I decided agianst this, this lets systemd take care of FD_CLOEXEC for us. Proper support for systemd should instead in the end be merged upstream into ocaml, but who knows when that will happen.

Given the slew of autoconf updates to xen I only provide an autogen.sh update after the last change to make things easier to review.

[0] http://0pointer.de/blog/projects/socket-activation2.html
[1] http://caml.inria.fr/mantis/view.php?id=5569

Luis R. Rodriguez (15):
xenstore: add support for a retry open limit on xenstored
xencommons: use the retry limit instead of implementing our own
timeout
xenstored: enable usage of config.h on both xenstored and oxenstored
cxenstored: add support for systemd active sockets
oxenstored: add support for systemd active sockets tools/xendomains: make xl the default
tools/xendomains: do space cleanups
tools/xendomains: move to libexec and use a smaller init helper
autoconf: xen: force a refresh with autoconf
autoconf: update m4/pkg.m4
autoconf: xen: move standard variables to a generic place
autoconf: xen: peg the xenstored preference onto the top level config
systemd: add xen systemd service and module files
autoconf: xen: add systemd support into the build system
autoconf: xen: trigger an update with autogen.sh

 .gitignore                                         |    7 +
 Config.mk                                          |   13 -
 Makefile                                           |   11 +-
 autogen.sh                                         |    8 +-
 config/StdGNU.mk                                   |   19 +-
 config/Tools.mk.in                                 |    6 +
 config/Toplevel.mk.in                              |   27 +
 config/xen-environment-header.in                   |   16 +
 config/xen-environment-scripts.in                  |   18 +
 configure                                          | 2396 ++++++++++++++++-
 configure.ac                                       |   10 +-
 docs/man/xenstore.pod.1                            |    7 +-
 m4/expand_config.m4                                |  122 +
 m4/pkg.m4                                          |   88 +-
 m4/pkg.m4.README                                   |   21 +
 m4/systemd.m4                                      |  105 +
 stubdom/Makefile                                   |   17 +-
 stubdom/configure                                  | 2390 +++++++++++++++++
 stubdom/configure.ac                               |    4 +
 tools/config.h.in                                  |    3 +
 tools/configure                                    | 2815 +++++++++++++++++++-
 tools/configure.ac                                 |   29 +-
 tools/hotplug/Linux/Makefile                       |   14 +-
 tools/hotplug/Linux/init.d/xencommons              |   25 +-
 tools/hotplug/Linux/init.d/xendomains              |  567 +---
 tools/hotplug/Linux/systemd/Makefile               |   44 +
 tools/hotplug/Linux/systemd/proc-xen.mount.in      |    9 +
 .../Linux/systemd/var-lib-xenstored.mount.in       |   13 +
 .../systemd/xen-qemu-dom0-disk-backend.service.in  |   22 +
 .../hotplug/Linux/systemd/xen-watchdog.service.in  |   13 +
 .../Linux/systemd/xen.conf.modules-load.d.in       |   16 +
 tools/hotplug/Linux/systemd/xenconsoled.service.in |   20 +
 tools/hotplug/Linux/systemd/xendomains.service.in  |   16 +
 tools/hotplug/Linux/systemd/xenstored.service.in   |   25 +
 tools/hotplug/Linux/systemd/xenstored.socket.in    |    9 +
 tools/hotplug/Linux/xendomains                     |  585 ++++
 tools/hotplug/common/Makefile                      |    7 +-
 tools/libxl/Makefile                               |   11 +-
 tools/ocaml/xenstored/Makefile                     |   15 +-
 tools/ocaml/xenstored/systemd.ml                   |   16 +
 tools/ocaml/xenstored/systemd.mli                  |   21 +
 tools/ocaml/xenstored/systemd_stubs.c              |  166 ++
 tools/ocaml/xenstored/utils.ml                     |   21 +-
 tools/python/Makefile                              |    6 +-
 tools/xenstore/Makefile                            |    7 +
 tools/xenstore/xenstore_client.c                   |   40 +-
 tools/xenstore/xs.c                                |  127 +
 47 files changed, 9267 insertions(+), 680 deletions(-)
 create mode 100644 config/xen-environment-header.in
 create mode 100644 config/xen-environment-scripts.in
 create mode 100644 m4/expand_config.m4
 create mode 100644 m4/pkg.m4.README
 create mode 100644 m4/systemd.m4
 create mode 100644 tools/hotplug/Linux/systemd/Makefile
 create mode 100644 tools/hotplug/Linux/systemd/proc-xen.mount.in
 create mode 100644 tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
 create mode 100644 tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xen-watchdog.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in
 create mode 100644 tools/hotplug/Linux/systemd/xenconsoled.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xendomains.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xenstored.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xenstored.socket.in
 create mode 100644 tools/hotplug/Linux/xendomains
 create mode 100644 tools/ocaml/xenstored/systemd.ml
 create mode 100644 tools/ocaml/xenstored/systemd.mli
 create mode 100644 tools/ocaml/xenstored/systemd_stubs.c
Signature · 1 line
1.9.0
#1 lore raw

PATCH v4 1/15 xenstore: add support for a retry open limit on xenstored

From: "Luis R. Rodriguez" <[email protected]>

This adds support for a customizable retry limit on trying to open the xenstored unix domain socket, each retry is separated by 1 second. This should allow us to simplify both our LSB init scripts. For systemd we'll use socket activation.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 docs/man/xenstore.pod.1          |  7 ++++++-
 tools/xenstore/xenstore_client.c | 40 +++++++++++++++++++++++++++++-----------
 2 files changed, 35 insertions(+), 12 deletions(-)
docs/man/xenstore.pod.1 +6 -1
index 7417289..9647143 100644
@@ -4,12 +4,17 @@ xenstore - interact with Xenstore
 
 =head1 SYNOPSIS
 
-B<xenstore> I<CMD> ...
+B<xenstore> I<CMD> I[ --retries <num_open_retries> ] ...
 
 =head1 DESCRIPTION
 
 A set of utilities for interacting with Xenstore.
 
+All xenstore-* commands support the --retries long option which
+can be used to try to opening the unix domain socket a certain
+number of retries before giving up. Each new try occurs every
+second.
+
 =over
 
 =item B<xenstore-chmod>(1)
tools/xenstore/xenstore_client.c +29 -11
index 0ec103f..0ab40f7 100644
@@ -77,27 +77,28 @@ usage(enum mode mode, int incl_mode, const char *progname)
 	errx(1, "Usage: %s <mode> [-h] [...]", progname);
     case MODE_read:
 	mstr = incl_mode ? "read " : "";
-	errx(1, "Usage: %s %s[-h] [-p] [-s] key [...]", progname, mstr);
+	errx(1, "Usage: %s %s[-h] [ --retries <num_open_retries> ] [-p] [-s] key [...]",
+	     progname, mstr);
     case MODE_write:
 	mstr = incl_mode ? "write " : "";
-	errx(1, "Usage: %s %s[-h] [-s] key value [...]", progname, mstr);
+	errx(1, "Usage: %s %s[-h] [ --retries <num_open_retries> ] [-s] key value [...]", progname, mstr);
     case MODE_rm:
 	mstr = incl_mode ? "rm " : "";
-	errx(1, "Usage: %s %s[-h] [-s] [-t] key [...]", progname, mstr);
+	errx(1, "Usage: %s %s[-h] [ --retries <num_open_retries> ] [-s] [-t] key [...]", progname, mstr);
     case MODE_exists:
 	mstr = incl_mode ? "exists " : "";
     case MODE_list:
 	mstr = mstr ? : incl_mode ? "list " : "";
-	errx(1, "Usage: %s %s[-h] [-p] [-s] key [...]", progname, mstr);
+	errx(1, "Usage: %s %s[-h] [ --retries <num_open_retries> ] [-p] [-s] key [...]", progname, mstr);
     case MODE_ls:
 	mstr = mstr ? : incl_mode ? "ls " : "";
-	errx(1, "Usage: %s %s[-h] [-f] [-p] [-s] [path]", progname, mstr);
+	errx(1, "Usage: %s %s[-h] [ --retries <num_open_retries> ] [-f] [-p] [-s] [path]", progname, mstr);
     case MODE_chmod:
 	mstr = incl_mode ? "chmod " : "";
-	errx(1, "Usage: %s %s[-h] [-u] [-r] [-s] key <mode [modes...]>", progname, mstr);
+	errx(1, "Usage: %s %s[-h] [ --retries <num_open_retries> ] [-u] [-r] [-s] key <mode [modes...]>", progname, mstr);
     case MODE_watch:
 	mstr = incl_mode ? "watch " : "";
-	errx(1, "Usage: %s %s[-h] [-n NR] key", progname, mstr);
+	errx(1, "Usage: %s %s[-h] [ --retries <num_open_retries> ] [-n NR] key", progname, mstr);
     }
 }
 
@@ -493,9 +494,9 @@ static enum mode lookup_mode(const char *m)
 int
 main(int argc, char **argv)
 {
-    struct xs_handle *xsh;
+    struct xs_handle *xsh = NULL;
     xs_transaction_t xth = XBT_NULL;
-    int ret = 0, socket = 0;
+    int ret = 0, socket = 0, retries = 1;
     int prefix = 0;
     int tidy = 0;
     int upto = 0;
@@ -535,6 +536,7 @@ main(int argc, char **argv)
 	    {"upto",    0, 0, 'u'}, /* MODE_chmod */
 	    {"recurse", 0, 0, 'r'}, /* MODE_chmod */
 	    {"number",  1, 0, 'n'}, /* MODE_watch */
+	    {"retries", 1, 0,  0 }, /* index 8 - MODE_* */
 	    {0, 0, 0, 0}
 	};
 
@@ -544,6 +546,15 @@ main(int argc, char **argv)
 	    break;
 
 	switch (c) {
+	case 0:
+	    if (index == 8 && optarg) {
+		retries = atoi(optarg);
+		if (retries < 0) {
+                    retries = 1;
+                    usage(mode, switch_argv, argv[0]);
+		}
+	    }
+	    break;
 	case 'h':
 	    usage(mode, switch_argv, argv[0]);
 	    /* NOTREACHED */
@@ -632,8 +643,15 @@ main(int argc, char **argv)
 	    max_width = ws.ws_col - 2;
     }
 
-    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
-    if (xsh == NULL) err(1, "xs_open");
+    while (retries--) {
+	    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
+	    if (xsh)
+		    break;
+	    if (retries)
+		    sleep(1);
+    }
+    if (!xsh)
+	    err(1, "xs_open");
 
 again:
     if (transaction) {
Signature · 7 lines
1.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored

Quoted 25 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This adds support for a customizable retry limit on trying to open the xenstored unix domain socket, each retry is separated by 1 second. This should allow us to simplify both our LSB init scripts. For systemd we'll use socket activation.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 docs/man/xenstore.pod.1          |  7 ++++++-
 tools/xenstore/xenstore_client.c | 40 +++++++++++++++++++++++++++++-----------
 2 files changed, 35 insertions(+), 12 deletions(-)
docs/man/xenstore.pod.1 +0 -0
index 7417289..9647143 100644

docs/man/xenstore.pod.1 xenstore - interact with Xenstore · line 7

Quoted 5 lines
docs/man/xenstore.pod.1 +1 -1
@@ -4,12 +4,17 @@ xenstore - interact with Xenstore
 
 =head1 SYNOPSIS
 
-B<xenstore> I<CMD> ...
+B<xenstore> I<CMD> I[ --retries <num_open_retries> ] ...

I think "--retries <N>" is sufficient and less likely to push things up to >80 columns. (Same in the errx output which is in main())

docs/man/xenstore.pod.1 xenstore - interact with Xenstore · line 11

Quoted 4 lines
docs/man/xenstore.pod.1 +0 -0
 =head1 DESCRIPTION
 
 A set of utilities for interacting with Xenstore.

I think a bit more formatting can be applied here.

+ =head2 COMMON OPTIONS
+ =over
+ =item B<--retries <N>>

docs/man/xenstore.pod.1 xenstore - interact with Xenstore · line 16

Quoted 4 lines
docs/man/xenstore.pod.1 +4 -0
+All xenstore-* commands support the --retries long option which
+can be used to try to opening the unix domain socket a certain
+number of retries before giving up. Each new try occurs every
+second.

"Retry opening the Unix domain socket once a second for I<N> attempts."

+ =back

+ =head2 COMMANDS
+ =over

(some playing with it in real life might be required).

Quoted 14 lines

[...]

docs/man/xenstore.pod.1 +2 -2
@@ -493,9 +494,9 @@ static enum mode lookup_mode(const char *m)
 int
 main(int argc, char **argv)
 {
-    struct xs_handle *xsh;
+    struct xs_handle *xsh = NULL;
     xs_transaction_t xth = XBT_NULL;
-    int ret = 0, socket = 0;
+    int ret = 0, socket = 0, retries = 1;
     int prefix = 0;
     int tidy = 0;
     int upto = 0;

docs/man/xenstore.pod.1 main(int argc, char **argv) · line 539

Quoted 4 lines
docs/man/xenstore.pod.1 +1 -0
@@ -535,6 +536,7 @@ main(int argc, char **argv)
 	    {"upto",    0, 0, 'u'}, /* MODE_chmod */
 	    {"recurse", 0, 0, 'r'}, /* MODE_chmod */
 	    {"number",  1, 0, 'n'}, /* MODE_watch */
+	    {"retries", 1, 0,  0 }, /* index 8 - MODE_* */

The usual way to deal with the lack of a short character is to use a small non-zero integer unique to each long opt here and to switch on it.

So:

#define OPT_RETRIES 1
...
{"retries", 1, 0, OPT_RETRIES },
...

docs/man/xenstore.pod.1 main(int argc, char **argv) · line 540

Quoted 1 line
docs/man/xenstore.pod.1 +0 -0
 	switch (c) {

case OPT_RETIRES:

	retires = atoi(...)
	etc.

docs/man/xenstore.pod.1 main(int argc, char **argv) · line 651

Quoted 12 lines
docs/man/xenstore.pod.1 +6 -2
@@ -632,8 +643,15 @@ main(int argc, char **argv)
 	    max_width = ws.ws_col - 2;
     }
 
-    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
-    if (xsh == NULL) err(1, "xs_open");
+    while (retries--) {
+	    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
+	    if (xsh)
+		    break;
+	    if (retries)
+		    sleep(1);

I think a do {} while() would remove the need for the if(retries) (IOW sleep unconditionally, I don't think we need to worry unduly about an extra 1s sleep after the last attempt)

docs/man/xenstore.pod.1 main(int argc, char **argv) · line 657

Quoted 6 lines
docs/man/xenstore.pod.1 +3 -0
+    }
+    if (!xsh)
+	    err(1, "xs_open");
 
 again:
     if (transaction) {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

PATCH v4 1/15 xenstore: add support for a retry open limit on xenstored

In reply to Luis R. Rodriguez

Luis R. Rodriguez writes ("[PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored"):

Quoted 4 lines

This adds support for a customizable retry limit on trying to open the xenstored unix domain socket, each retry is separated by 1 second. This should allow us to simplify both our LSB init scripts. For systemd we'll use socket activation.

I'm afraid I fundamentally disagree with this timeout/polling based approach. Why is it necessary ?

Thanks,
Ian.

#4 lore raw

Re: [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored

Quoted 8 lines · Ian Jackson

Luis R. Rodriguez writes ("[PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored"):

Quoted 4 lines

This adds support for a customizable retry limit on trying to open the xenstored unix domain socket, each retry is separated by 1 second. This should allow us to simplify both our LSB init scripts. For systemd we'll use socket activation.

I'm afraid I fundamentally disagree with this timeout/polling based approach.

It already exists, all the first two patches in this series are doing is moving it from /etc/init.d/xencommons into the client utility.

Quoted 1 line

Why is it necessary ?

If xenstored has failed to start for some reason then the xenstore-write in the initscript would potentially block forever without a timeout.

As for the retry -- I suppose xenstored forks before it is really ready?

Ian.

#5 lore raw

Re: [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored

Quoted 11 lines · Ian Campbell
Quoted 8 lines · Ian Jackson

Luis R. Rodriguez writes ("[PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored"):

Quoted 4 lines

This adds support for a customizable retry limit on trying to open the xenstored unix domain socket, each retry is separated by 1 second. This should allow us to simplify both our LSB init scripts. For systemd we'll use socket activation.

I'm afraid I fundamentally disagree with this timeout/polling based approach.

As for the retry -- I suppose xenstored forks before it is really ready?

I guess this should be fixed in xenstored instead of hacking work-arounds in the client. When daemon start succeeds then the socket should be available and working. If it failed, no retry will help. If the daemon is still starting although the start command exited – than this sounds like a bug.

Jacek

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw

Re: [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored

Jacek Konieczny writes ("Re: [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored"):

Quoted 5 lines · Ian Campbell
Quoted 4 lines · Ian Jackson
Quoted 2 lines

I'm afraid I fundamentally disagree with this timeout/polling based approach.

Quoted 7 lines
Quoted 1 line

As for the retry -- I suppose xenstored forks before it is really ready?

I guess this should be fixed in xenstored instead of hacking work-arounds in the client. When daemon start succeeds then the socket should be available and working. If it failed, no retry will help. If the daemon is still starting although the start command exited – than this sounds like a bug.

Right.

I think moving this retry from a shell script into the client code is going in the wrong direction.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw

Re: [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored

Quoted 14 lines · Ian Jackson

Jacek Konieczny writes ("Re: [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored"):

Quoted 5 lines · Ian Campbell
Quoted 4 lines · Ian Jackson
Quoted 2 lines

I'm afraid I fundamentally disagree with this timeout/polling based approach.

Quoted 7 lines
Quoted 1 line

As for the retry -- I suppose xenstored forks before it is really ready?

I guess this should be fixed in xenstored instead of hacking work-arounds in the client. When daemon start succeeds then the socket should be available and working. If it failed, no retry will help. If the daemon is still starting although the start command exited – than this sounds like a bug.

Quoted 4 lines

Right.

I think moving this retry from a shell script into the client code is going in the wrong direction.

At this point the retry option can not only be used for opening the socket but for anything so its a bit different now. In terms of design of issues specifically to opening the socket -- I believe using systemd is actually a good step forward to move away from all this legacy bullshit.

Either way, I'm happy to drop this patch from my series, originally I just wanted to avoid nasty shell code and wanted to try to share code. You guys let me know if I should drop it, for now I'll keep it in the series.

Luis

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw

Re: [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored

In reply to Ian Jackson
Quoted 14 lines · Ian Jackson

Jacek Konieczny writes ("Re: [PATCH v4 01/15] xenstore: add support for a retry open limit on xenstored"):

Quoted 5 lines · Ian Campbell
Quoted 4 lines · Ian Jackson
Quoted 2 lines

I'm afraid I fundamentally disagree with this timeout/polling based approach.

Quoted 7 lines
Quoted 1 line

As for the retry -- I suppose xenstored forks before it is really ready?

I guess this should be fixed in xenstored instead of hacking work-arounds in the client. When daemon start succeeds then the socket should be available and working. If it failed, no retry will help. If the daemon is still starting although the start command exited – than this sounds like a bug.

Quoted 4 lines

Right.

I think moving this retry from a shell script into the client code is going in the wrong direction.

To be clear I will ignore this series of patches that deal with retries on LSB init.

Luis

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw

PATCH v4 2/15 xencommons: use the retry limit instead of implementing our own timeout

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

xenstore-read now has support to retry opening the xenstored unix domain socket a certain amount of times, once each second, use that instead of implementing our own timeout.

For systemd we'll be using socket activation. Details for that will follow.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 tools/hotplug/Linux/init.d/xencommons | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
tools/hotplug/Linux/init.d/xencommons +5 -14
index 4ebd636..7195413 100644
@@ -54,9 +54,6 @@ if test -f /proc/xen/capabilities && \
 fi
 
 do_start () {
-        local time=0
-	local timeout=30
-
 	modprobe xen-evtchn 2>/dev/null
 	modprobe xen-gntdev 2>/dev/null
 	modprobe xen-gntalloc 2>/dev/null
@@ -93,17 +90,11 @@ do_start () {
 		    echo "No xenstored found"
 		    exit 1
 		fi
-
-		# Wait for xenstored to actually come up, timing out after 30 seconds
-                while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do
-                    echo -n .
-		    time=$(($time+1))
-                    sleep 1
-                done
-		echo
-
-		# Exit if we timed out
-		if ! [ $time -lt $timeout ] ; then
+		# We try opening the xenstored socket every second up to the
+		# limit specified, if it hasn't opened by then assume
+		# failure.
+                ${BINDIR}/xenstore-read --retries 30 -s / >/dev/null 2>&1
+		if [ $? -ne 0 ] ; then
 		    echo Could not start xenstored
 		    exit 1
 		fi
Signature · 7 lines
1.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#10 lore raw

Re: [PATCH v4 02/15] xencommons: use the retry limit instead of implementing our own timeout

Quoted 45 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

xenstore-read now has support to retry opening the xenstored unix domain socket a certain amount of times, once each second, use that instead of implementing our own timeout.

For systemd we'll be using socket activation. Details for that will follow.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 tools/hotplug/Linux/init.d/xencommons | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
tools/hotplug/Linux/init.d/xencommons +0 -9
index 4ebd636..7195413 100644
@@ -54,9 +54,6 @@ if test -f /proc/xen/capabilities && \
 fi
 
 do_start () {
-        local time=0
-	local timeout=30
-
 	modprobe xen-evtchn 2>/dev/null
 	modprobe xen-gntdev 2>/dev/null
 	modprobe xen-gntalloc 2>/dev/null
@@ -93,17 +90,11 @@ do_start () {
 		    echo "No xenstored found"
 		    exit 1
 		fi
-
-		# Wait for xenstored to actually come up, timing out after 30 seconds
-                while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do
-                    echo -n .
-		    time=$(($time+1))
-                    sleep 1

tools/hotplug/Linux/init.d/xencommons do_start () { · line 97

Quoted 10 lines
tools/hotplug/Linux/init.d/xencommons +5 -5
-                done
-		echo
-
-		# Exit if we timed out
-		if ! [ $time -lt $timeout ] ; then
+		# We try opening the xenstored socket every second up to the
+		# limit specified, if it hasn't opened by then assume
+		# failure.
+                ${BINDIR}/xenstore-read --retries 30 -s / >/dev/null 2>&1
+		if [ $? -ne 0 ] ; then

Tabs vs spaces here.

~Andrew

tools/hotplug/Linux/init.d/xencommons do_start () { · line 100

Quoted 3 lines
tools/hotplug/Linux/init.d/xencommons +0 -0
 		    echo Could not start xenstored
 		    exit 1
 		fi

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#11 lore raw

Re: [PATCH v4 02/15] xencommons: use the retry limit instead of implementing our own timeout

Quoted 50 lines · Andrew Cooper
Quoted 49 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

xenstore-read now has support to retry opening the xenstored unix domain socket a certain amount of times, once each second, use that instead of implementing our own timeout.

For systemd we'll be using socket activation. Details for that will follow.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 tools/hotplug/Linux/init.d/xencommons | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
tools/hotplug/Linux/init.d/xencommons +0 -13
index 4ebd636..7195413 100644
@@ -54,9 +54,6 @@ if test -f /proc/xen/capabilities && \
 fi
 
 do_start () {
-        local time=0
-	local timeout=30
-
 	modprobe xen-evtchn 2>/dev/null
 	modprobe xen-gntdev 2>/dev/null
 	modprobe xen-gntalloc 2>/dev/null
@@ -93,17 +90,11 @@ do_start () {
 		    echo "No xenstored found"
 		    exit 1
 		fi
-
-		# Wait for xenstored to actually come up, timing out after 30 seconds
-                while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do
-                    echo -n .
-		    time=$(($time+1))
-                    sleep 1
-                done
-		echo
-
-		# Exit if we timed out
Quoted 8 lines

tools/hotplug/Linux/init.d/xencommons do_start () { · line 97

Quoted 6 lines
tools/hotplug/Linux/init.d/xencommons +5 -1
-		if ! [ $time -lt $timeout ] ; then
+		# We try opening the xenstored socket every second up to the
+		# limit specified, if it hasn't opened by then assume
+		# failure.
+                ${BINDIR}/xenstore-read --retries 30 -s / >/dev/null 2>&1
+		if [ $? -ne 0 ] ; then

Tabs vs spaces here.

Thanks, I've fixed this now, and will send as part of a v5.

Luis

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw

Re: [PATCH v4 02/15] xencommons: use the retry limit instead of implementing our own timeout

In reply to Luis R. Rodriguez
Quoted 7 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

xenstore-read now has support to retry opening the xenstored unix domain socket a certain amount of times, once each second, use that instead of implementing our own timeout.

For systemd we'll be using socket activation. Details for that will follow.

No need to mention this last bit here.

Ian.

#13 lore raw

PATCH v4 3/15 xenstored: enable usage of config.h on both xenstored and oxenstored

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This will be used later for dynamic configuration paths on C code.

---
 tools/ocaml/xenstored/Makefile | 2 ++
 tools/xenstore/Makefile        | 1 +
 tools/xenstore/xs.c            | 2 ++
 3 files changed, 5 insertions(+)
tools/ocaml/xenstored/Makefile +2 -0
index b18f190..7fa8f53 100644
@@ -2,6 +2,8 @@ XEN_ROOT = $(CURDIR)/../../..
 OCAML_TOPLEVEL = $(CURDIR)/..
 include $(OCAML_TOPLEVEL)/common.make
 
+CFLAGS += -I$(XEN_ROOT)/tools/
+
 OCAMLINCLUDE += \
 	-I $(OCAML_TOPLEVEL)/libs/xb \
 	-I $(OCAML_TOPLEVEL)/libs/mmap \
tools/xenstore/Makefile +1 -0
index 262f401..21a3f11 100644
@@ -6,6 +6,7 @@ MINOR = 3
 
 CFLAGS += -Werror
 CFLAGS += -I.
+CFLAGS += -I$(XEN_ROOT)/tools/
 CFLAGS += $(CFLAGS_libxenctrl)
 
 CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
tools/xenstore/xs.c +2 -0
index 968141d..f1d0f99 100644
@@ -32,6 +32,8 @@
 #include <signal.h>
 #include <stdint.h>
 #include <errno.h>
+#include <config.h>
+
 #include "xenstore.h"
 #include "list.h"
 #include "utils.h"
Signature · 1 line
1.9.0
#15 lore raw

PATCH v4 4/15 cxenstored: add support for systemd active sockets

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This adds systemd socket activation support for the C xenstored. Active sockets enable xenstored to be loaded only if required by a system onto which Xen is installed on. Socket activation is handled by systemd, once a port for a service which claims a socket is used systemd will start the required services for it, on demand. For more details on socket activation refer to Lennart's socket-activation post regarding this [0].

Right now this code adds a no-op for this functionality, leaving the enablement to be done later once systemd is properly hooked into the build system. The socket activation is ordered in aligment with the socket activation order passed on to systemd.

[0] http://0pointer.de/blog/projects/socket-activation2.html

---
 tools/xenstore/xs.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 125 insertions(+)
tools/xenstore/xs.c +125 -0
index f1d0f99..9bbf736 100644
@@ -1,6 +1,7 @@
 /* 
     Xen Store Daemon interface providing simple tree-like database.
     Copyright (C) 2005 Rusty Russell IBM Corporation
+    Copyright (C) 2014 Luis R. Rodriguez <[email protected]>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -34,6 +35,10 @@
 #include <errno.h>
 #include <config.h>
 
+#if defined(HAVE_SYSTEMD)
+#include <systemd/sd-daemon.h>
+#endif
+
 #include "xenstore.h"
 #include "list.h"
 #include "utils.h"
@@ -182,11 +187,131 @@ int xs_fileno(struct xs_handle *h)
 	return h->watch_pipe[0];
 }
 
+#if defined(HAVE_SYSTEMD)
+
+/* Conforms to what we should send sd_is_socket_unix() */
+struct xen_systemd_active_socket {
+	int fd;
+	int type;
+	int listening;
+	const char *path;
+	size_t length;
+};
+
+/*
+ * We list stdin, stdout and stderr simply for documentation purposes
+ * and to help our array size fit the number of expected sockets we
+ * as sd_listen_fds() will return 5 for example if you set the socket
+ * service with 2 sockets.
+ */
+static struct xen_systemd_active_socket xenstore_active_sockets[] = {
+	{
+		.fd = SD_LISTEN_FDS_START -3,
+		.type = 0,
+		.listening = 0,
+		.path = "stdin",
+		.length = 0,
+	},
+	{
+		.fd = SD_LISTEN_FDS_START - 2,
+		.type = 0,
+		.listening = 0,
+		.path = "stderr",
+		.length = 0,
+	},
+	{
+		.fd = SD_LISTEN_FDS_START - 1,
+		.type = 0,
+		.listening = 0,
+		.path = "stderr",
+		.length = 0,
+	},
+	{
+		.fd = SD_LISTEN_FDS_START,
+		.type = SOCK_STREAM,
+		.listening = 0,
+		.path = "/var/run/xenstored/socket",
+		.length = 0,
+	},
+	{
+		.fd = SD_LISTEN_FDS_START + 1,
+		.type = SOCK_STREAM,
+		.listening = 0,
+		.path = "/var/run/xenstored/socket_ro",
+		.length = 0,
+	},
+};
+
+static struct xen_systemd_active_socket *get_xen_active_socket(const char *connect_to)
+{
+	unsigned int i;
+
+	for (i=0; i<ARRAY_SIZE(xenstore_active_sockets); i++) {
+		if (!strcmp(connect_to, xenstore_active_sockets[i].path)) {
+			if (!xenstore_active_sockets[i].type)
+				return NULL;
+			return &xenstore_active_sockets[i];
+		}
+	}
+
+	return NULL;
+}
+
+static int xs_get_active_socket(const char *connect_to)
+{
+	int n, r;
+	struct xen_systemd_active_socket *active_socket;
+
+	active_socket = get_xen_active_socket(connect_to);
+	if (!active_socket)
+		return -1;
+
+	n = sd_listen_fds(0);
+	if (n <= 0)
+		return -1;
+	else if (n >= (ARRAY_SIZE(xenstore_active_sockets)))
+		return -1;
+
+	r = sd_is_socket_unix(active_socket->fd,
+			      active_socket->type,
+			      active_socket->listening,
+			      active_socket->path,
+			      active_socket->length);
+	if (r < 0)
+		return r;
+
+	return active_socket->fd;
+}
+
+/*
+ * If xenstored was built to depend on systemd libraries
+ * we assume you want all the bells and whistles with
+ * systemd.
+ */
+static int xs_active_socket_required(void)
+{
+	return 1;
+}
+#else
+static int xs_get_active_socket(const char *connect_to)
+{
+	return -1;
+}
+
+static int xs_active_socket_required(void)
+{
+	return 0;
+}
+#endif
+
 static int get_socket(const char *connect_to)
 {
 	struct sockaddr_un addr;
 	int sock, saved_errno, flags;
 
+	if (xs_active_socket_required())
+		return xs_get_active_socket(connect_to);
+
 	sock = socket(PF_UNIX, SOCK_STREAM, 0);
 	if (sock < 0)
 		return -1;
Signature · 1 line
1.9.0
#16 lore raw

Re: [PATCH v4 04/15] cxenstored: add support for systemd active sockets

Quoted 55 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This adds systemd socket activation support for the C xenstored. Active sockets enable xenstored to be loaded only if required by a system onto which Xen is installed on. Socket activation is handled by systemd, once a port for a service which claims a socket is used systemd will start the required services for it, on demand. For more details on socket activation refer to Lennart's socket-activation post regarding this [0].

Right now this code adds a no-op for this functionality, leaving the enablement to be done later once systemd is properly hooked into the build system. The socket activation is ordered in aligment with the socket activation order passed on to systemd.

[0] http://0pointer.de/blog/projects/socket-activation2.html

---
 tools/xenstore/xs.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 125 insertions(+)
tools/xenstore/xs.c +11 -0
index f1d0f99..9bbf736 100644
@@ -1,6 +1,7 @@
 /* 
     Xen Store Daemon interface providing simple tree-like database.
     Copyright (C) 2005 Rusty Russell IBM Corporation
+    Copyright (C) 2014 Luis R. Rodriguez <[email protected]>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -34,6 +35,10 @@
 #include <errno.h>
 #include <config.h>
 
+#if defined(HAVE_SYSTEMD)
+#include <systemd/sd-daemon.h>
+#endif
+
 #include "xenstore.h"
 #include "list.h"
 #include "utils.h"
@@ -182,11 +187,131 @@ int xs_fileno(struct xs_handle *h)
 	return h->watch_pipe[0];
 }
 
+#if defined(HAVE_SYSTEMD)
+
+/* Conforms to what we should send sd_is_socket_unix() */
+struct xen_systemd_active_socket {
+	int fd;
+	int type;

tools/xenstore/xs.c int xs_fileno(struct xs_handle *h) · line 205

Quoted 10 lines
tools/xenstore/xs.c +10 -0
+	int listening;
+	const char *path;
+	size_t length;
+};
+
+/*
+ * We list stdin, stdout and stderr simply for documentation purposes
+ * and to help our array size fit the number of expected sockets we
+ * as sd_listen_fds() will return 5 for example if you set the socket
+ * service with 2 sockets.

This sounds gross, why is this needed?

SD_LISTEN_FDS_START seems to be the correct offset to apply.

Having ditched those 3 then the majority of the fields here become unnecessary and it seems like it would be far simpler to just implement the mapping from connect_to to the index directly by comparison with xs_daemon_socket_ro() et al.

Or even better refactor get_handle to split out the stuff which is common to both sockets and devices and use that to implement open_daemon_socket(int ro), which then just does the right thing when systemd is on, using ro to determine which socket offset to use.

Since there is more than one I think it is necessary to document the requirements for the number of sockets which are expected to be passed in.

Ian.

#17 lore raw

Re: [PATCH v4 04/15] cxenstored: add support for systemd active sockets

In reply to Luis R. Rodriguez

tools/xenstore/xs.c line 40

Quoted 3 lines · Luis R. Rodriguez
tools/xenstore/xs.c +3 -0
+#if defined(HAVE_SYSTEMD)
+#include <systemd/sd-daemon.h>
+#endif

Please document this new optional dependency in the top level makefile.

#18 lore raw

Re: [PATCH v4 04/15] cxenstored: add support for systemd active sockets

Quoted 6 lines · Ian Campbell

tools/xenstore/xs.c line 40

Quoted 3 lines · Luis R. Rodriguez
tools/xenstore/xs.c +3 -0
+#if defined(HAVE_SYSTEMD)
+#include <systemd/sd-daemon.h>
+#endif

Please document this new optional dependency in the top level makefile.

OK I think this is best done on the wiki once merged but will add stuff to the top level Makefile.

Luis

#19 lore raw

Re: [PATCH v4 04/15] cxenstored: add support for systemd active sockets

Quoted 10 lines · Luis R. Rodriguez
Quoted 6 lines · Ian Campbell

tools/xenstore/xs.c line 40

Quoted 3 lines · Luis R. Rodriguez
tools/xenstore/xs.c +3 -0
+#if defined(HAVE_SYSTEMD)
+#include <systemd/sd-daemon.h>
+#endif

Please document this new optional dependency in the top level makefile.

OK I think this is best done on the wiki once merged but will add stuff to the top level Makefile.

Sorry, I meant README not Makefile.

Ian.

#20 lore raw

Re: [PATCH v4 04/15] cxenstored: add support for systemd active sockets

Quoted 9 lines · Ian Campbell
Quoted 8 lines · Luis R. Rodriguez
Quoted 6 lines · Ian Campbell

tools/xenstore/xs.c line 40

Quoted 3 lines · Luis R. Rodriguez
tools/xenstore/xs.c +3 -0
+#if defined(HAVE_SYSTEMD)
+#include <systemd/sd-daemon.h>
+#endif

Please document this new optional dependency in the top level makefile.

Quoted 4 lines
Quoted 2 lines

OK I think this is best done on the wiki once merged but will add stuff to the top level Makefile.

Sorry, I meant README not Makefile.

Got it, my entire series now expands on that and elaborate more on the wiki. If my patches get merged I'll go to town on the wiki with more details.

Luis

#21 lore raw

PATCH v4 5/15 oxenstored: add support for systemd active sockets

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This adds systemd socket activation support for the Ocaml xenstored. Ocaml lacks systemd library support so we provide our own C helpers as is done with other functionality lacking on Ocaml.

Active sockets enables oxenstored to be loaded only if required by a system onto which Xen is installed on. Socket activation is handled by systemd, once a port for a service which claims a socket is used systemd will start the required services for it, on demand. For more details on socket activation refer to Lennart's socket-activation post regarding this [0].

An important different with socket activation is that systemd will set FD_CLOEXEC for us on the socket before giving it to us, Ocaml gets support for [1] Unix.set_cloexec but only as of 4.00.1+dev which isn't yet widely available on distributions.

Right now this code adds a no-op for this functionality, leaving the enablement to be done later once systemd is properly hooked into the build system. The socket activation is ordered in aligment with the socket activation order passed on to systemd.

[0] http://0pointer.de/blog/projects/socket-activation2.html
[1] http://caml.inria.fr/mantis/view.php?id=5569

Cc David Scott <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Vincent Hanquez <[email protected]>
---
 tools/ocaml/xenstored/Makefile        |   8 +-
 tools/ocaml/xenstored/systemd.ml      |  16 ++++
 tools/ocaml/xenstored/systemd.mli     |  21 +++++
 tools/ocaml/xenstored/systemd_stubs.c | 166 ++++++++++++++++++++++++++++++++++
 tools/ocaml/xenstored/utils.ml        |  21 +++--
 5 files changed, 224 insertions(+), 8 deletions(-)
 create mode 100644 tools/ocaml/xenstored/systemd.ml
 create mode 100644 tools/ocaml/xenstored/systemd.mli
 create mode 100644 tools/ocaml/xenstored/systemd_stubs.c
tools/ocaml/xenstored/Makefile +7 -1
index 7fa8f53..382a813 100644
@@ -15,6 +15,11 @@ syslog_OBJS = syslog
 syslog_C_OBJS = syslog_stubs
 OCAML_LIBRARY = syslog
 
+LIBS += systemd.cma systemd.cmxa
+systemd_OBJS = systemd
+systemd_C_OBJS = systemd_stubs
+OCAML_LIBRARY += systemd
+
 OBJS = define \
 	stdext \
 	trie \
@@ -36,11 +41,12 @@ OBJS = define \
 	process \
 	xenstored
 
-INTF = symbol.cmi trie.cmi syslog.cmi
+INTF = symbol.cmi trie.cmi syslog.cmi systemd.cmi
 
 XENSTOREDLIBS = \
 	unix.cmxa \
 	-ccopt -L -ccopt . syslog.cmxa \
+	-ccopt -L -ccopt . systemd.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/mmap $(OCAML_TOPLEVEL)/libs/mmap/xenmmap.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \
tools/ocaml/xenstored/systemd.ml new file +16 -0
new file mode 100644
index 0000000..cace794
@@ -0,0 +1,16 @@
+(*
+ * Copyright (C) 2014 Luis R. Rodriguez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds"
+external sd_active_socket_required: unit -> int = "ocaml_sd_active_socket_required"
tools/ocaml/xenstored/systemd.mli new file +21 -0
new file mode 100644
index 0000000..a65ea5e
@@ -0,0 +1,21 @@
+(*
+ * Copyright (C) 2014 Luis R. Rodriguez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+(** Calls the C library sd_listen_fds() function for us. Although
+ *  the library doesn't accept argument we send one over to help
+ *  us do sanity checks on the expected sockets *)
+val sd_listen_fds: string -> Unix.file_descr
+
+(** Tells us whether or not systemd support was compiled in *)
+val sd_active_socket_required: unit -> int
tools/ocaml/xenstored/systemd_stubs.c new file +166 -0

166 lines not on this page · raw message

tools/ocaml/xenstored/utils.ml +14 -7
index 68b70c5..d3d2e31 100644
@@ -73,14 +73,21 @@ let trim_path path =
 let join_by_null ls = String.concat "\000" ls
 
 (* unix utils *)
+let create_regular_unix_socket name =
+        Unixext.unlink_safe name;
+        Unixext.mkdir_rec (Filename.dirname name) 0o700;
+        let sockaddr = Unix.ADDR_UNIX(name) in
+        let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in
+        Unix.bind sock sockaddr;
+        Unix.listen sock 1;
+        sock
+
 let create_unix_socket name =
-	Unixext.unlink_safe name;
-	Unixext.mkdir_rec (Filename.dirname name) 0o700;
-	let sockaddr = Unix.ADDR_UNIX(name) in
-	let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in
-	Unix.bind sock sockaddr;
-	Unix.listen sock 1;
-	sock
+        let active_sockets = Systemd.sd_active_socket_required() in
+        if active_sockets = 1 then
+                Systemd.sd_listen_fds name
+        else
+                create_regular_unix_socket name
 
 let read_file_single_integer filename =
 	let fd = Unix.openfile filename [ Unix.O_RDONLY ] 0o640 in
Signature · 1 line
1.9.0
#22 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

Hi Luis,

Thanks for the patch!

On 30 Apr 2014, at 02:11, Luis R. Rodriguez <[email protected]> wrote:

...

Quoted 4 lines

An important different with socket activation is that systemd will set FD_CLOEXEC for us on the socket before giving it to us, Ocaml gets support for [1] Unix.set_cloexec but only as of 4.00.1+dev which isn't yet widely available on distributions.

I’m not familiar with systemd but I’m curious: if systems is setting the flag on the socket before giving it to us, why would we still need the Unix.set_cloexec function in OCaml?

...

Quoted 12 lines
tools/ocaml/xenstored/systemd.ml new file +6 -0
new file mode 100644
index 0000000..cace794
@@ -0,0 +1,16 @@
+(*
+ * Copyright (C) 2014 Luis R. Rodriguez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special

tools/ocaml/xenstored/systemd.ml line 16

Quoted 10 lines
tools/ocaml/xenstored/systemd.ml new file +10 -0
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds"
+external sd_active_socket_required: unit -> int = “ocaml_sd_active_socket_required"

Minor comment: It would be clearer if sd_active_socket_required was unit -> bool. In the C code you should use Val_true and Val_false from <caml/mlvalues.h>.

Everything else looks good to me!

Thanks,
Dave

#23 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

Quoted 9 lines · Dave Scott
Quoted 4 lines · Luis R. Rodriguez

An important different with socket activation is that systemd will set FD_CLOEXEC for us on the socket before giving it to us, Ocaml gets support for [1] Unix.set_cloexec but only as of 4.00.1+dev which isn't yet widely available on distributions.

I’m not familiar with systemd but I’m curious: if systems is setting the flag on the socket before giving it to us, why would we still need the Unix.set_cloexec function in OCaml?

systemd is setting the flag for us, my point was that Unix.set_cloexec is not being set yet for non-systemd cases. This can go in as a separate patch, I for some reason couldn't find this on documentation so I just checked out ocaml code to find the right call, would this be OK as a separate patch:

tools/ocaml/xenstored/utils.ml +1 -0
index d3d2e31..b206898 100644
@@ -78,13 +78,13 @@ let create_regular_unix_socket name =
         Unixext.mkdir_rec (Filename.dirname name) 0o700;
         let sockaddr = Unix.ADDR_UNIX(name) in
         let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in
+        Unix.set_close_on_exec sock;
         Unix.bind sock sockaddr;
         Unix.listen sock 1;
         sock
 
Quoted 19 lines

...

Quoted 18 lines
tools/ocaml/xenstored/systemd.ml new file +12 -0
new file mode 100644
index 0000000..cace794
@@ -0,0 +1,16 @@
+(*
+ * Copyright (C) 2014 Luis R. Rodriguez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
Quoted 8 lines

tools/ocaml/xenstored/systemd.ml line 16

Quoted 4 lines
tools/ocaml/xenstored/systemd.ml new file +4 -0
+ *)
+
+external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds"
+external sd_active_socket_required: unit -> int = “ocaml_sd_active_socket_required"

Minor comment: It would be clearer if sd_active_socket_required was unit -> bool. In the C code you should use Val_true and Val_false from <caml/mlvalues.h>.

Thanks! Like this? If so then I rolled this in, and can send as part of my v5.

tools/ocaml/xenstored/systemd.ml +1 -1
index cace794..baa1c00 100644
@@ -13,4 +13,4 @@
  *)
 
 external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds"
-external sd_active_socket_required: unit -> int = "ocaml_sd_active_socket_required"
+external sd_active_socket_required: unit -> bool = "ocaml_sd_active_socket_required"
tools/ocaml/xenstored/systemd.mli +1 -1
index a65ea5e..6f2db9c 100644
@@ -18,4 +18,4 @@
 val sd_listen_fds: string -> Unix.file_descr
 
 (** Tells us whether or not systemd support was compiled in *)
-val sd_active_socket_required: unit -> int
+val sd_active_socket_required: unit -> bool
tools/ocaml/xenstored/systemd_stubs.c +3 -2
index ded9542..942ae19 100644
@@ -13,6 +13,7 @@
  */
 
 #include <string.h>
+#include <stdbool.h>
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
 #include <caml/alloc.h>
@@ -139,7 +140,7 @@ CAMLprim value ocaml_sd_active_socket_required(void)
 	CAMLparam0();
 	CAMLlocal1(ret);
 
-	ret = Val_int(1);
+	ret = Val_true;
 
 	CAMLreturn(ret);
 }
@@ -159,7 +160,7 @@ CAMLprim value ocaml_sd_active_socket_required(void)
 	CAMLparam0();
 	CAMLlocal1(ret);
 
-	ret = Val_int(0);
+	ret = Val_false;
 
 	CAMLreturn(ret);
 }
tools/ocaml/xenstored/utils.ml +1 -2
index d3d2e31..50f05c1 100644
@@ -83,8 +83,7 @@ let create_regular_unix_socket name =
         sock
 
 let create_unix_socket name =
-        let active_sockets = Systemd.sd_active_socket_required() in
-        if active_sockets = 1 then
+        if Systemd.sd_active_socket_required() then
                 Systemd.sd_listen_fds name
         else
                 create_regular_unix_socket name
Quoted 2 lines

Everything else looks good to me!

Thanks, can I sprinkle an Acked-by: Dave Scott <[email protected]> ?

Luis

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by
#24 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

Quoted 21 lines · Luis R. Rodriguez
Quoted 9 lines · Dave Scott
Quoted 4 lines · Luis R. Rodriguez

An important different with socket activation is that systemd will set FD_CLOEXEC for us on the socket before giving it to us, Ocaml gets support for [1] Unix.set_cloexec but only as of 4.00.1+dev which isn't yet widely available on distributions.

I’m not familiar with systemd but I’m curious: if systems is setting the flag on the socket before giving it to us, why would we still need the Unix.set_cloexec function in OCaml?

systemd is setting the flag for us, my point was that Unix.set_cloexec is not being set yet for non-systemd cases. This can go in as a separate patch, I for some reason couldn't find this on documentation so I just checked out ocaml code to find the right call, would this be OK as a separate patch:

tools/ocaml/xenstored/utils.ml +0 -0
index d3d2e31..b206898 100644

tools/ocaml/xenstored/utils.ml let create_regular_unix_socket name = · line 84

Quoted 7 lines
tools/ocaml/xenstored/utils.ml +1 -0
@@ -78,13 +78,13 @@ let create_regular_unix_socket name =
        Unixext.mkdir_rec (Filename.dirname name) 0o700;
        let sockaddr = Unix.ADDR_UNIX(name) in
        let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in
+        Unix.set_close_on_exec sock;
        Unix.bind sock sockaddr;
        Unix.listen sock 1;
        sock

Sure, a separate patch is fine. I don’t think oxenstored ever execs, but there’s no harm in being careful just in case that changes in future.

Quoted 96 lines
Quoted 20 lines

...

Quoted 18 lines
tools/ocaml/xenstored/systemd.ml new file +12 -0
new file mode 100644
index 0000000..cace794
@@ -0,0 +1,16 @@
+(*
+ * Copyright (C) 2014 Luis R. Rodriguez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
Quoted 8 lines

tools/ocaml/xenstored/systemd.ml line 16

Quoted 4 lines
tools/ocaml/xenstored/systemd.ml new file +4 -0
+ *)
+
+external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds"
+external sd_active_socket_required: unit -> int = “ocaml_sd_active_socket_required"

Minor comment: It would be clearer if sd_active_socket_required was unit -> bool. In the C code you should use Val_true and Val_false from <caml/mlvalues.h>.

Thanks! Like this? If so then I rolled this in, and can send as part of my v5.

tools/ocaml/xenstored/systemd.ml +0 -0
index cace794..baa1c00 100644
@@ -13,4 +13,4 @@
 *)
 

external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds"

tools/ocaml/xenstored/systemd.ml +1 -1
-external sd_active_socket_required: unit -> int = "ocaml_sd_active_socket_required"
+external sd_active_socket_required: unit -> bool = "ocaml_sd_active_socket_required"
tools/ocaml/xenstored/systemd.mli +0 -0
index a65ea5e..6f2db9c 100644
@@ -18,4 +18,4 @@

val sd_listen_fds: string -> Unix.file_descr

(** Tells us whether or not systemd support was compiled in *)

tools/ocaml/xenstored/systemd.mli +1 -1
-val sd_active_socket_required: unit -> int
+val sd_active_socket_required: unit -> bool
tools/ocaml/xenstored/systemd_stubs.c +3 -2
index ded9542..942ae19 100644
@@ -13,6 +13,7 @@
 */
 
 #include <string.h>
+#include <stdbool.h>
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
 #include <caml/alloc.h>
@@ -139,7 +140,7 @@ CAMLprim value ocaml_sd_active_socket_required(void)
 	CAMLparam0();
 	CAMLlocal1(ret);
 
-	ret = Val_int(1);
+	ret = Val_true;
 
 	CAMLreturn(ret);
 }
@@ -159,7 +160,7 @@ CAMLprim value ocaml_sd_active_socket_required(void)
 	CAMLparam0();
 	CAMLlocal1(ret);
 
-	ret = Val_int(0);
+	ret = Val_false;
 
 	CAMLreturn(ret);
 }
tools/ocaml/xenstored/utils.ml +0 -0
index d3d2e31..50f05c1 100644
@@ -83,8 +83,7 @@ let create_regular_unix_socket name =
        sock
 

let create_unix_socket name =

tools/ocaml/xenstored/utils.ml +1 -2
-        let active_sockets = Systemd.sd_active_socket_required() in
-        if active_sockets = 1 then
+        if Systemd.sd_active_socket_required() then
                Systemd.sd_listen_fds name
        else
                create_regular_unix_socket name
Quoted 1 line
Quoted 3 lines
Quoted 1 line

Everything else looks good to me!

Thanks, can I sprinkle an Acked-by: Dave Scott <[email protected]> ?

If you also add the parameter that Anil pointed out, then

Thanks,
Dave

#25 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

In reply to Luis R. Rodriguez
Quoted 6 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This adds systemd socket activation support for the Ocaml xenstored. Ocaml lacks systemd library support so we provide our own C helpers as is done with other functionality lacking on Ocaml.

<snip>

The definition of sd_active_socket_required (unit ->int) below doesn't match the C stub:

Quoted 5 lines
tools/ocaml/xenstored/systemd_stubs.c new file +4 -0
+
+external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds"
+external sd_active_socket_required: unit -> int = "ocaml_sd_active_socket_required"
 
+

tools/ocaml/xenstored/systemd_stubs.c line 166

Quoted 10 lines
tools/ocaml/xenstored/systemd_stubs.c new file +10 -0
+CAMLprim value ocaml_sd_active_socket_required(void)
+{
+	CAMLparam0();
+	CAMLlocal1(ret);
+
+	ret = Val_int(0);
+
+	CAMLreturn(ret);
+}
+#endif

That should be:

CAMLprim value ocaml_sd_active_socket_required(value u) {
CAMLparam1(u);
CAMLlocal1(ret);
ret = Val_int(0);
CAMLreturn(ret);
}

(Since the function isn't doing any heap allocation, it's actually just safe to compress it to "return (Val_int(0))", but it's probably better to keep it like this to avoid any surprises).

As Dave notes, returning Val_true and setting the OCaml signature to bool would be a clearer interface.

-anil

#26 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

Quoted 31 lines · Anil Madhavapeddy
Quoted 6 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This adds systemd socket activation support for the Ocaml xenstored. Ocaml lacks systemd library support so we provide our own C helpers as is done with other functionality lacking on Ocaml.

<snip>

The definition of sd_active_socket_required (unit ->int) below doesn't match the C stub:

Quoted 5 lines
tools/ocaml/xenstored/systemd_stubs.c new file +4 -0
+
+external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds"
+external sd_active_socket_required: unit -> int = "ocaml_sd_active_socket_required"
 
+

tools/ocaml/xenstored/systemd_stubs.c line 166

Quoted 10 lines
tools/ocaml/xenstored/systemd_stubs.c new file +10 -0
+CAMLprim value ocaml_sd_active_socket_required(void)
+{
+	CAMLparam0();
+	CAMLlocal1(ret);
+
+	ret = Val_int(0);
+
+	CAMLreturn(ret);
+}
+#endif

That should be:

Quoted 7 lines

CAMLprim value ocaml_sd_active_socket_required(value u) {
CAMLparam1(u);
CAMLlocal1(ret);
ret = Val_int(0);
CAMLreturn(ret);
}

Do we have to require an argument though?

Quoted 6 lines

(Since the function isn't doing any heap allocation, it's actually just safe to compress it to "return (Val_int(0))", but it's probably better to keep it like this to avoid any surprises).

As Dave notes, returning Val_true and setting the OCaml signature to bool would be a clearer interface.

OK thanks for the review! Let me know what you think of the other changes I sent in reply to Dave.

Luis

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#27 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

Quoted 2 lines · Luis R. Rodriguez

Do we have to require an argument though?

External bindings needs to be functions, yes. The unit argument ensures that you can call the binding multiple times. It's a little wasteful to have a C binding just to return a constant compile-time value, and this could be improved by using optcomp (the OCaml equivalent of cpp) to put this logic into the OCaml code rather than C. A separate patchset, though.

Quoted 10 lines
Quoted 7 lines

(Since the function isn't doing any heap allocation, it's actually just safe to compress it to "return (Val_int(0))", but it's probably better to keep it like this to avoid any surprises).

As Dave notes, returning Val_true and setting the OCaml signature to bool would be a clearer interface.

OK thanks for the review! Let me know what you think of the other changes I sent in reply to Dave.

Look good to me with the argument addition and switch to bool;

-anil

#28 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

In reply to Luis R. Rodriguez
Quoted 6 lines · Luis R. Rodriguez

+/*
+ * We list stdin, stdout and stderr simply for documentation purposes
+ * and to help our array size fit the number of expected sockets we
+ * as sd_listen_fds() will return 5 for example if you set the socket
+ * service with 2 sockets.
+ */

I think my comments/simplifications made on the C version probably apply here.

Ian.

#29 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

Quoted 11 lines · Ian Campbell
Quoted 6 lines · Luis R. Rodriguez

+/*
+ * We list stdin, stdout and stderr simply for documentation purposes
+ * and to help our array size fit the number of expected sockets we
+ * as sd_listen_fds() will return 5 for example if you set the socket
+ * service with 2 sockets.
+ */

I think my comments/simplifications made on the C version probably apply here.

Sure, will roll into my series.

Luis

#30 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

In reply to Luis R. Rodriguez

Luis R. Rodriguez writes ("[PATCH v4 05/15] oxenstored: add support for systemd active sockets"):
...

tools/ocaml/xenstored/systemd_stubs.c line 41

Quoted 8 lines
tools/ocaml/xenstored/systemd_stubs.c new file +8 -0
+/* Conforms to what we should send sd_is_socket_unix() */
+struct xen_systemd_active_socket {
+	int fd;
+	int type;
+	int listening;
+	const char *path;
+	size_t length;
+};

This is quite a lot of extraneous stuff, AFAICT. For example, we always set listening to 0.

Why is this array not const ?

Quoted 6 lines

+/*
+ * We list stdin, stdout and stderr simply for documentation purposes
+ * and to help our array size fit the number of expected sockets we
+ * as sd_listen_fds() will return 5 for example if you set the socket
+ * service with 2 sockets.
+ */

This doesn't seem very convincing to me.

tools/ocaml/xenstored/systemd_stubs.c line 111

Quoted 10 lines
tools/ocaml/xenstored/systemd_stubs.c new file +10 -0
+CAMLprim value ocaml_sd_listen_fds(value connect_to)
+{
+	CAMLparam1(connect_to);
+	CAMLlocal1(sock_ret);
+	int n, r;
+	struct xen_systemd_active_socket *active_socket;
+
+	active_socket = get_xen_active_socket((const char *) String_val(connect_to));
+	if (!active_socket)
+		caml_failwith("ocaml_sd_listen_fds() got invalid request");

The sole purpose of this is to convert the string to an entry in the the table ? I.e., essentially, just the table index ?

Quoted 5 lines

+/*
+ * If xenstored was built to depend on systemd libraries
+ * we assume you want all the bells and whistles with
+ * systemd.
+ */

This is not correct. A distro might want to use the same binary for both systemd and non-systemd installations. You need to use a runtime test.

Thanks,
Ian.

#31 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

Quoted 14 lines · Ian Jackson

Luis R. Rodriguez writes ("[PATCH v4 05/15] oxenstored: add support for systemd active sockets"):
...

tools/ocaml/xenstored/systemd_stubs.c line 41

Quoted 8 lines
tools/ocaml/xenstored/systemd_stubs.c new file +8 -0
+/* Conforms to what we should send sd_is_socket_unix() */
+struct xen_systemd_active_socket {
+     int fd;
+     int type;
+     int listening;
+     const char *path;
+     size_t length;
+};

This is quite a lot of extraneous stuff, AFAICT. For example, we always set listening to 0.

Quoted 1 line

Why is this array not const ?

Its set to 0 as this is and only should be used for the different xenstores for initialization, I have a some fixes and optimizations for this where I ended up sharing most of this code into a library that can be used by cenxstored and oxenstored, will send it out soon.

I'll make the entire thing const.

Quoted 8 lines
Quoted 6 lines

+/*
+ * We list stdin, stdout and stderr simply for documentation purposes
+ * and to help our array size fit the number of expected sockets we
+ * as sd_listen_fds() will return 5 for example if you set the socket
+ * service with 2 sockets.
+ */

This doesn't seem very convincing to me.

Not sure what you mean, this is describing the logic used by systemd + the order in which systemd gets our declared sockets to help keep order once we ask for them.

Quoted 5 lines
Quoted 5 lines
tools/ocaml/xenstored/systemd_stubs.c new file +5 -0
+CAMLprim value ocaml_sd_listen_fds(value connect_to)
+{
+     CAMLparam1(connect_to);
+     CAMLlocal1(sock_ret);
+     int n, r;
Quoted 8 lines

tools/ocaml/xenstored/systemd_stubs.c line 111

Quoted 5 lines
tools/ocaml/xenstored/systemd_stubs.c new file +5 -0
+     struct xen_systemd_active_socket *active_socket;
+
+     active_socket = get_xen_active_socket((const char *) String_val(connect_to));
+     if (!active_socket)
+             caml_failwith("ocaml_sd_listen_fds() got invalid request");

The sole purpose of this is to convert the string to an entry in the the table ? I.e., essentially, just the table index ?

A few things actually:

1. Used to that the path is expected by the program / systemd
2. Lets then tell systemd we are ready for that socket
3. Verification of the integrity of the socket as we expected it to be set up
4. Verification that we only get from systemd the number of sockets expected

Quoted 9 lines
Quoted 5 lines

+/*
+ * If xenstored was built to depend on systemd libraries
+ * we assume you want all the bells and whistles with
+ * systemd.
+ */

This is not correct. A distro might want to use the same binary for both systemd and non-systemd installations. You need to use a runtime test.

Will give dynamic checking a try in my new series.

Luis

#32 lore raw

Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets

Quoted 14 lines · Luis R. Rodriguez
Quoted 5 lines
Quoted 5 lines
tools/ocaml/xenstored/systemd_stubs.c new file +5 -0
+CAMLprim value ocaml_sd_listen_fds(value connect_to)
+{
+     CAMLparam1(connect_to);
+     CAMLlocal1(sock_ret);
+     int n, r;
Quoted 8 lines

tools/ocaml/xenstored/systemd_stubs.c line 111

Quoted 5 lines
tools/ocaml/xenstored/systemd_stubs.c new file +5 -0
+     struct xen_systemd_active_socket *active_socket;
+
+     active_socket = get_xen_active_socket((const char *) String_val(connect_to));
+     if (!active_socket)
+             caml_failwith("ocaml_sd_listen_fds() got invalid request");

The sole purpose of this is to convert the string to an entry in the the table ? I.e., essentially, just the table index ?

Quoted 6 lines

A few things actually:

1. Used to that the path is expected by the program / systemd
2. Lets then tell systemd we are ready for that socket
3. Verification of the integrity of the socket as we expected it to be set up
4. Verification that we only get from systemd the number of sockets expected

I think this should be refactored to be something like:

        /* NB these should also be documented somewhere... */
        #define SOCKET_ACTIVATION_RW_INDEX 3
        #define SOCKET_ACTIVATION_RO_INDEX 4
        
        static int get_handle(int ro)
        {
        	if (systemd_active())
        		return get_systemd_handle(ro ?
        			SOCKET_ACTIVATION_RO_INDEX : 
        			SOCKET_ACTIVATION_RW_INDEX);
        	else
        		return get_unix_socket_handle(ro ?
        			xs_daemon_socket_ro() :
        			xs_daemon_socket());
        }

That's a rough outline and subject to coding style and my not having looked at the actual naming conventions in that file etc. I suspect the existing get_handle() needs to be refactored into something which get_systemd_handle(), get_unix_socket_handle() and the xs_domain_dev() path can all use.

Ian.

#33 lore raw

PATCH v4 6/15 tools/xendomains: make xl the default

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

If that fails backoff to using xm.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 tools/hotplug/Linux/init.d/xendomains | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/hotplug/Linux/init.d/xendomains +4 -4
index 59f1e3d..6cb1032 100644
@@ -29,13 +29,13 @@
 
 . /etc/xen/scripts/hotplugpath.sh
 
-CMD=${SBINDIR}/xm
-HEADCOMP="LinuxGuestRecord"
+CMD=${SBINDIR}/xl
+HEADCOMP="Xen saved domain"
 $CMD list &> /dev/null
 if test $? -ne 0
 then
-	CMD=${SBINDIR}/xl
-	HEADCOMP="Xen saved domain"
+	CMD=${SBINDIR}/xm
+	HEADCOMP="LinuxGuestRecord"
 fi
 
 $CMD list &> /dev/null
Signature · 7 lines
1.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#34 lore raw

Re: [PATCH v4 06/15] tools/xendomains: make xl the default

Quoted 1 line · Luis R. Rodriguez

If that fails backoff to using xm.

xm is gone, so that part can be removed in this or a followup patch.

Olaf

#35 lore raw

Re: [PATCH v4 06/15] tools/xendomains: make xl the default

Quoted 5 lines · Olaf Hering
Quoted 1 line · Luis R. Rodriguez

If that fails backoff to using xm.

xm is gone, so that part can be removed in this or a followup patch.

OK thanks for the review, how about this as a patch after this one:

commit 1d70fb3a7c49a9d4728ac159e09b7bcbad9f1960

Author: Luis R. Rodriguez <[email protected]>
Date:   Wed Apr 30 10:42:05 2014 -0700

tools/xendomains: remove xm usage as its gone

As per Olaf xm is gone, so don't even bother looking for it.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
tools/hotplug/Linux/init.d/xendomains +1 -2
index 6cb1032..f68fd2b 100644
@@ -34,8 +34,7 @@ HEADCOMP="Xen saved domain"
 $CMD list &> /dev/null
 if test $? -ne 0
 then
-	CMD=${SBINDIR}/xm
-	HEADCOMP="LinuxGuestRecord"
+	exit $?
 fi
 
 $CMD list &> /dev/null

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#36 lore raw

Re: [PATCH v4 06/15] tools/xendomains: make xl the default

Quoted 8 lines · Luis R. Rodriguez
Quoted 5 lines · Olaf Hering
Quoted 1 line · Luis R. Rodriguez

If that fails backoff to using xm.

xm is gone, so that part can be removed in this or a followup patch.

OK thanks for the review, how about this as a patch after this one:

Please fold it in to one patch to just forget about xm in one go.

#37 lore raw

PATCH v4 7/15 tools/xendomains: do space cleanups

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This has no functional changes. This is just to prepare the file to be moved, so you won't blind your eyes or get git am to complain.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 tools/hotplug/Linux/init.d/xendomains | 62 +++++++++++++++++------------------
 1 file changed, 31 insertions(+), 31 deletions(-)
tools/hotplug/Linux/init.d/xendomains +31 -31
index 6cb1032..587568d 100644
@@ -23,7 +23,7 @@
 # Default-Start:     2 3 5
 # Default-Stop:      0 1 6
 # Short-Description: Start/stop secondary xen domains
-# Description:       Start / stop domains automatically when domain 0 
+# Description:       Start / stop domains automatically when domain 0
 #                    boots / shuts down.
 ### END INIT INFO
 
@@ -44,7 +44,7 @@ then
 	exit 0;
 fi
 
-# Correct exit code would probably be 5, but it's enough 
+# Correct exit code would probably be 5, but it's enough
 # if xend complains if we're not running as privileged domain
 if ! [ -e /proc/xen/privcmd ]; then
 	exit 0
@@ -74,7 +74,7 @@ test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
 if test -e /etc/rc.status; then
     # SUSE rc script library
     . /etc/rc.status
-else    
+else
     _cmd=$1
     declare -a _SMSG
     if test "${_cmd}" = "status"; then
@@ -97,7 +97,7 @@ else
 	    fi
 	}
     elif test -e /lib/lsb/init-functions; then
-	# LSB    
+	# LSB
     	. /lib/lsb/init-functions
         if alias log_success_msg >/dev/null 2>/dev/null; then
 	  echo_rc()
@@ -114,7 +114,7 @@ else
 	    fi
 	  }
         fi
-    else    
+    else
 	# emulate it
 	echo_rc()
 	{
@@ -124,17 +124,17 @@ else
     rc_reset() { _RC_RV=0; }
     rc_failed()
     {
-	if test -z "$1"; then 
+	if test -z "$1"; then
 	    _RC_RV=1;
-	elif test "$1" != "0"; then 
-	    _RC_RV=$1; 
-    	fi
+	elif test "$1" != "0"; then
+	    _RC_RV=$1;
+	fi
 	return ${_RC_RV}
     }
     rc_check()
     {
 	return rc_failed $?
-    }	
+    }
     rc_status()
     {
 	rc_failed $?
@@ -146,7 +146,7 @@ else
 	return ${_RC_RV}
     }
     rc_exit() { exit ${_RC_RV}; }
-    rc_active() 
+    rc_active()
     {
 	if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi
 	if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
@@ -193,13 +193,13 @@ rdnames()
 {
     NAMES=
     if ! contains_something "$XENDOMAINS_AUTO"
-    then 
+    then
 	return
     fi
     for dom in $XENDOMAINS_AUTO/*; do
 	rdname $dom
-	if test -z $NAMES; then 
-	    NAMES=$NM; 
+	if test -z $NAMES; then
+	    NAMES=$NM;
 	else
 	    NAMES="$NAMES|$NM"
 	fi
@@ -232,7 +232,7 @@ is_running()
     while read LN; do
 	parseln "$LN" || continue
 	if test $id = 0; then continue; fi
-	case $name in 
+	case $name in
 	    ($NM)
 		RC=0
 		;;
@@ -241,11 +241,11 @@ is_running()
     return $RC
 }
 
-start() 
+start()
 {
-    if [ -f $LOCKFILE ]; then 
+    if [ -f $LOCKFILE ]; then
 	echo -e "xendomains already running (lockfile exists)"
-	return; 
+	return;
     fi
 
     saved_domains=" "
@@ -285,10 +285,10 @@ start()
 	# XENDOMAINS_AUTO - they could just be symlinks to files elsewhere
 
 	# Create all domains with config files in XENDOMAINS_AUTO.
-	# TODO: We should record which domain name belongs 
+	# TODO: We should record which domain name belongs
 	# so we have the option to selectively shut down / migrate later
 	# If a domain statefile from $XENDOMAINS_SAVE matches a domain name
-	# in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't 
+	# in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't
 	# restore correctly it requires administrative attention.
 	for dom in $XENDOMAINS_AUTO/*; do
 	    echo -n " ${dom##*/}"
@@ -349,14 +349,14 @@ watchdog_xencmd()
     read PSF PSUID PSPID PSPPID < <(echo "$PSAX")
     # kill $CMD $1
     kill $PSPID >/dev/null 2>&1
-    
+
     echo -e .
 }
 
 stop()
 {
     exec 3>&2 2> /dev/null
-    
+
     # Collect list of domains to shut down
     if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
 	rdnames
@@ -380,7 +380,7 @@ stop()
 	    esac
 	    "
 	fi
-	# XENDOMAINS_SYSRQ chould be something like just "s" 
+	# XENDOMAINS_SYSRQ chould be something like just "s"
 	# or "s e i u" or even "s e s i u o"
 	# for the latter, you should set XENDOMAINS_USLEEP to 1200000 or so
 	if test -n "$XENDOMAINS_SYSRQ"; then
@@ -413,7 +413,7 @@ stop()
 		kill $WDOG_PID >/dev/null 2>&1
 	    else
 		kill $WDOG_PID >/dev/null 2>&1
-		
+
 		echo -e .
 		usleep 1000
 		continue
@@ -472,7 +472,7 @@ stop()
 
     # Unconditionally delete lock file
     rm -f $LOCKFILE
-    
+
     exec 2>&3
 }
 
@@ -482,7 +482,7 @@ check_domain_up()
     while read LN; do
 	parseln "$LN" || continue
 	if test $id = 0; then continue; fi
-	case $name in 
+	case $name in
 	    ($1)
 		return 0
 		;;
@@ -501,9 +501,9 @@ check_all_auto_domains_up()
     for nm in $XENDOMAINS_AUTO/*; do
 	rdname $nm
 	found=0
-	if check_domain_up "$NM"; then 
+	if check_domain_up "$NM"; then
 	    echo -n " $name"
-	else 
+	else
 	    missing="$missing $NM"
 	fi
     done
@@ -516,7 +516,7 @@ check_all_auto_domains_up()
 
 check_all_saved_domains_up()
 {
-    if ! contains_something "$XENDOMAINS_SAVE" 
+    if ! contains_something "$XENDOMAINS_SAVE"
     then
       return 0
     fi
@@ -563,8 +563,8 @@ case "$1" in
 	;;
 
     status)
-	echo -n "Checking for xendomains:" 
-	if test ! -f $LOCKFILE; then 
+	echo -n "Checking for xendomains:"
+	if test ! -f $LOCKFILE; then
 	    rc_failed 3
 	else
 	    check_all_auto_domains_up
Signature · 7 lines
1.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#38 lore raw

PATCH v4 8/15 tools/xendomains: move to libexec and use a smaller init helper

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

The xendomains script can be reused with systemd systems as it does not control services or sockets per se, but does a one shot scrape of domUs it needs start bring up, stop, reload so we're going to reuse it. This moves the core of the script to libexec and leaves only a helper on init.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 tools/hotplug/Linux/Makefile          |   6 +
 tools/hotplug/Linux/init.d/xendomains | 567 +-------------------------------
 tools/hotplug/Linux/xendomains        | 585 ++++++++++++++++++++++++++++++++++
 3 files changed, 607 insertions(+), 551 deletions(-)
 create mode 100644 tools/hotplug/Linux/xendomains
tools/hotplug/Linux/Makefile +6 -0
index 4874ec5..7e6646e 100644
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 # Init scripts.
 XENDOMAINS_INITD = init.d/xendomains
+XENDOMAINS_LIBEXEC = xendomains
 XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains
 
 XENCOMMONS_INITD = init.d/xencommons
@@ -45,6 +46,11 @@ install: all install-initd install-scripts install-udev
 install-initd:
 	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
+	[ -d $(DESTDIR)$(LIBEXEC) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
+ifeq ($(CONFIG_XEND),y)
+	$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(INITD_DIR)
+endif
+	$(INSTALL_PROG) $(XENDOMAINS_LIBEXEC) $(DESTDIR)$(LIBEXEC)
 	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
 	$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
 	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
tools/hotplug/Linux/init.d/xendomains +16 -551

598 lines not on this page · raw message

tools/hotplug/Linux/xendomains new file +585 -0

585 lines not on this page · raw message

Signature · 7 lines
1.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#39 lore raw

Re: [PATCH v4 08/15] tools/xendomains: move to libexec and use a smaller init helper

Quoted 16 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

The xendomains script can be reused with systemd systems as it does not control services or sockets per se, but does a one shot scrape of domUs it needs start bring up, stop, reload so we're going to reuse it. This moves the core of the script to libexec and leaves only a helper on init.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
Quoted 4 lines
---
 tools/hotplug/Linux/Makefile          |   6 +
 tools/hotplug/Linux/init.d/xendomains | 567 +-------------------------------
 tools/hotplug/Linux/xendomains        | 585 ++++++++++++++++++++++++++++++++++

Did you use the -M option here?

tools/hotplug/Linux/Makefile install: all install-initd install-scripts install-udev · line 51

Quoted 7 lines
tools/hotplug/Linux/Makefile +3 -0
@@ -45,6 +46,11 @@ install: all install-initd install-scripts install-udev
 install-initd:
 	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
+	[ -d $(DESTDIR)$(LIBEXEC) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
+ifeq ($(CONFIG_XEND),y)
+	$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(INITD_DIR)

With xend's removal this can now go.

tools/hotplug/Linux/init.d/xendomains

Quoted 9 lines
tools/hotplug/Linux/Makefile +2 -0
+endif
+	$(INSTALL_PROG) $(XENDOMAINS_LIBEXEC) $(DESTDIR)$(LIBEXEC)
 	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
 	$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
 	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
tools/hotplug/Linux/init.d/xendomains +0 -0
index 587568d..d0122fc 100644

I think I need to apply the series and examine with git to figure out what changed here, which I'll do another time.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#40 lore raw

Re: [PATCH v4 08/15] tools/xendomains: move to libexec and use a smaller init helper

Quoted 22 lines · Ian Campbell
Quoted 16 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

The xendomains script can be reused with systemd systems as it does not control services or sockets per se, but does a one shot scrape of domUs it needs start bring up, stop, reload so we're going to reuse it. This moves the core of the script to libexec and leaves only a helper on init.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
Quoted 4 lines
---
 tools/hotplug/Linux/Makefile          |   6 +
 tools/hotplug/Linux/init.d/xendomains | 567 +-------------------------------
 tools/hotplug/Linux/xendomains        | 585 ++++++++++++++++++++++++++++++++++
Quoted 1 line

Did you use the -M option here?

I always do, hence my original concern -- but we determined last that even though the output did not show the move the commit does, so I think we're good. Will be good to follow up on the possible discprepancy with upstreamg git though.

Quoted 9 lines

tools/hotplug/Linux/Makefile install: all install-initd install-scripts install-udev · line 51

Quoted 7 lines
tools/hotplug/Linux/Makefile +3 -0
@@ -45,6 +46,11 @@ install: all install-initd install-scripts install-udev
 install-initd:
 	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
+	[ -d $(DESTDIR)$(LIBEXEC) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
+ifeq ($(CONFIG_XEND),y)
+	$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(INITD_DIR)

With xend's removal this can now go.

Done.

Quoted 13 lines

tools/hotplug/Linux/init.d/xendomains

Quoted 10 lines
tools/hotplug/Linux/Makefile +2 -0
+endif
+	$(INSTALL_PROG) $(XENDOMAINS_LIBEXEC) $(DESTDIR)$(LIBEXEC)
 	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
 	$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
 	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
tools/hotplug/Linux/init.d/xendomains +0 -0
index 587568d..d0122fc 100644

I think I need to apply the series and examine with git to figure out what changed here, which I'll do another time.

Better try my next series.

Luis

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#41 lore raw

PATCH v4 9/15 autoconf: xen: force a refresh with autoconf

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

With some new functionality introduced we can't keep around the old cache.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 autogen.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
autogen.sh +4 -4
index b5c9688..2be8360 100755
@@ -1,12 +1,12 @@
 #!/bin/sh -e
-autoconf
+autoconf -f
 ( cd tools
-  autoconf
+  autoconf -f
   autoheader
 )
 ( cd stubdom
-  autoconf
+  autoconf -f
 )
 ( cd docs
-  autoconf
+  autoconf -f
 )
Signature · 1 line
1.9.0
#42 lore raw

Re: [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf

Quoted 3 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

With some new functionality introduced we can't keep around the old cache.

This seems likely to be correct, but I don't understand this commit message. What new functionality? Xen's or autoconf's?

Ian.

#43 lore raw

Re: [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf

In reply to Luis R. Rodriguez
Quoted 25 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

With some new functionality introduced we can't keep around the old cache.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 autogen.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
autogen.sh +2 -2
index b5c9688..2be8360 100755
@@ -1,12 +1,12 @@
 #!/bin/sh -e
-autoconf
+autoconf -f
 ( cd tools
-  autoconf
+  autoconf -f

autogen.sh line 12

Quoted 10 lines
autogen.sh +2 -2
   autoheader
 )
 ( cd stubdom
-  autoconf
+  autoconf -f
 )
 ( cd docs
-  autoconf
+  autoconf -f
 )

Not that is that important, but why do you need to force the regen of all files? I expect autoconf should be able to detect which files need rebuilding.

#44 lore raw

Re: [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf

Quoted 32 lines · Roger Pau Monné
Quoted 31 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

With some new functionality introduced we can't keep around the old cache.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 autogen.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
autogen.sh +3 -3
index b5c9688..2be8360 100755
@@ -1,12 +1,12 @@
 #!/bin/sh -e
-autoconf
+autoconf -f
 ( cd tools
-  autoconf
+  autoconf -f
   autoheader
 )
 ( cd stubdom
-  autoconf
+  autoconf -f
 )
Quoted 8 lines

autogen.sh line 12

Quoted 4 lines
autogen.sh +1 -1
 ( cd docs
-  autoconf
+  autoconf -f
 )

Not that is that important, but why do you need to force the regen of all files? I expect autoconf should be able to detect which files need rebuilding.

I've observed it not doing so, when I thought it should, I never figured out why and/or if I was mistaken though

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#45 lore raw

Re: [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf

Quoted 42 lines · Ian Campbell
Quoted 32 lines · Roger Pau Monné
Quoted 31 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

With some new functionality introduced we can't keep around the old cache.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 autogen.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
autogen.sh +3 -3
index b5c9688..2be8360 100755
@@ -1,12 +1,12 @@
 #!/bin/sh -e
-autoconf
+autoconf -f
 ( cd tools
-  autoconf
+  autoconf -f
   autoheader
 )
 ( cd stubdom
-  autoconf
+  autoconf -f
 )
Quoted 8 lines

autogen.sh line 12

Quoted 4 lines
autogen.sh +1 -1
 ( cd docs
-  autoconf
+  autoconf -f
 )

Not that is that important, but why do you need to force the regen of all files? I expect autoconf should be able to detect which files need rebuilding.

Quoted 2 lines

I've observed it not doing so, when I thought it should, I never figured out why and/or if I was mistaken though

I have not seen this myself, but if it's the case (and provided that the commit message is reworded to reflect this):

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#46 lore raw

Re: [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf

Quoted 43 lines · Roger Pau Monné
Quoted 42 lines · Ian Campbell
Quoted 40 lines · Roger Pau Monné
Quoted 25 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

With some new functionality introduced we can't keep around the old cache.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 autogen.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
autogen.sh +2 -2
index b5c9688..2be8360 100755
@@ -1,12 +1,12 @@
 #!/bin/sh -e
-autoconf
+autoconf -f
 ( cd tools
-  autoconf
+  autoconf -f

autogen.sh line 12

Quoted 10 lines
autogen.sh +2 -2
   autoheader
 )
 ( cd stubdom
-  autoconf
+  autoconf -f
 )
 ( cd docs
-  autoconf
+  autoconf -f
 )

Not that is that important, but why do you need to force the regen of all files? I expect autoconf should be able to detect which files need rebuilding.

Quoted 7 lines
Quoted 2 lines

I've observed it not doing so, when I thought it should, I never figured out why and/or if I was mistaken though

I have not seen this myself, but if it's the case (and provided that the commit message is reworded to reflect this):

I spotted what I think is a bug on autoconf where I observed inconsistent behaviour when you touch a file, sometimes it yielded the results you wanted, sometimes it did not, in the end I got close to linking the issue to the cache somehow, but before I dove myself deeper into autoconf I found a force prevents this issue which let me conserve some of the remaining sanity I have left. I'll follow up with upstream autoconf on this eventually but figured providing all the glory details on this on the commit log was not worth it. I'll respin and add all the glory details.

Luis

#47 lore raw

Re: [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf

Luis R. Rodriguez writes ("Re: [Xen-devel] [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf"):

Quoted 9 lines

I spotted what I think is a bug on autoconf where I observed inconsistent behaviour when you touch a file, sometimes it yielded the results you wanted, sometimes it did not, in the end I got close to linking the issue to the cache somehow, but before I dove myself deeper into autoconf I found a force prevents this issue which let me conserve some of the remaining sanity I have left. I'll follow up with upstream autoconf on this eventually but figured providing all the glory details on this on the commit log was not worth it. I'll respin and add all the glory details.

What are the downsides to the -f option ? Do they apply in our situation ? This needs to be discussed.

(I haven't gone and read the autoconf manual; IMO this question ought to be answered, at least with a prima facie explanation, in the commit message.)

Ian.

#48 lore raw

Re: [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf

Quoted 11 lines · Ian Jackson

Luis R. Rodriguez writes ("Re: [Xen-devel] [PATCH v4 09/15] autoconf: xen: force a refresh with autoconf"):

Quoted 9 lines

I spotted what I think is a bug on autoconf where I observed inconsistent behaviour when you touch a file, sometimes it yielded the results you wanted, sometimes it did not, in the end I got close to linking the issue to the cache somehow, but before I dove myself deeper into autoconf I found a force prevents this issue which let me conserve some of the remaining sanity I have left. I'll follow up with upstream autoconf on this eventually but figured providing all the glory details on this on the commit log was not worth it. I'll respin and add all the glory details.

Quoted 6 lines

What are the downsides to the -f option ? Do they apply in our situation ? This needs to be discussed.

(I haven't gone and read the autoconf manual; IMO this question ought to be answered, at least with a prima facie explanation, in the commit message.)

Other projects do it all the time, the impact is just that it will take longer, I don't think that is an issue since this is an overhead only incurred on developers and the maintainers. I'll try to verify the bug I had mentioned and document it on the commit log but think its pointless to wait on autoconf to get that fixed / verified before we move on with -f considering other projects tend to use this.

Luis

#49 lore raw

PATCH v4 10/15 autoconf: update m4/pkg.m4

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

The provenance of the m4 pkg.m4 macro library was not documented and it was not clear how and if we can update this without breaking things. Document where this comes from, update us to the latest release from git and put a warning about avoiding private evolutions so that instead things go upstream.

The pkg-config m4 macro library comes from the upstream pkg-config git repository [0]. If you update the m4 library update this file with provenance and last commit ID information. For documentation on how to use this read the pkg-config(1) man page.

Tree: git://anongit.freedesktop.org/pkg-config

The last synch was from commit:

commit 4f0084d9d3b8726a797a373c7ec5e406000995d0

Author: Dan Nicholson <[email protected]>
Date:   Mon Feb 3 15:59:18 2014 -0800

glib: Fix Makefiles to suppress warnings from automake

With the newly added glib.mk, some of the noinst_* variables need to use += in the evaluation to avoid multiple definition warnings from automake.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 m4/pkg.m4        | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 m4/pkg.m4.README | 21 ++++++++++++++
 2 files changed, 103 insertions(+), 6 deletions(-)
 create mode 100644 m4/pkg.m4.README
m4/pkg.m4 +82 -6
index 9bb3e06..62995f0 100644
@@ -26,7 +26,8 @@
 # ----------------------------------
 AC_DEFUN([PKG_PROG_PKG_CONFIG],
 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
 AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
 AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
@@ -72,7 +73,8 @@ m4_define([_PKG_CONFIG],
     pkg_cv_[]$1="$$1"
  elif test -n "$PKG_CONFIG"; then
     PKG_CHECK_EXISTS([$3],
-                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes ],
 		     [pkg_failed=yes])
  else
     pkg_failed=untried
@@ -120,9 +122,9 @@ if test $pkg_failed = yes; then
    	AC_MSG_RESULT([no])
         _PKG_SHORT_ERRORS_SUPPORTED
         if test $_pkg_short_errors_supported = yes; then
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
         else 
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
@@ -135,7 +137,7 @@ $$1_PKG_ERRORS
 Consider adjusting the PKG_CONFIG_PATH environment variable if you
 installed software in a non-standard prefix.
 
-_PKG_TEXT])dnl
+_PKG_TEXT])[]dnl
         ])
 elif test $pkg_failed = untried; then
      	AC_MSG_RESULT([no])
@@ -146,7 +148,7 @@ path to pkg-config.
 
 _PKG_TEXT
 
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
         ])
 else
 	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
@@ -155,3 +157,77 @@ else
 	$3
 fi[]dnl
 ])# PKG_CHECK_MODULES
+
+
+# PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+# ---------------------------------------------------------------------
+# Checks for existence of MODULES and gathers its build flags with
+# static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+# and VARIABLE-PREFIX_LIBS from --libs.
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES_STATIC might not happen, you should be sure to include
+# an explicit call to PKG_PROG_PKG_CONFIG in your configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])
+
+
+# PKG_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable pkgconfigdir as the location where a module
+# should install pkg-config .pc files. By default the directory is
+# $libdir/pkgconfig, but the default can be changed by passing
+# DIRECTORY. The user can override through the --with-pkgconfigdir
+# parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+    [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_INSTALLDIR
+
+
+# PKG_NOARCH_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable noarch_pkgconfigdir as the location where a
+# module should install arch-independent pkg-config .pc files. By
+# default the directory is $datadir/pkgconfig, but the default can be
+# changed by passing DIRECTORY. The user can override through the
+# --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+    [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_NOARCH_INSTALLDIR
+
+
+# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -------------------------------------------
+# Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])# PKG_CHECK_VAR
m4/pkg.m4.README new file +21 -0
new file mode 100644
index 0000000..9705040
@@ -0,0 +1,21 @@
+The pkg-config m4 macro library comes from the upstream pkg-config
+git repository [0]. If you update the m4 library update this file
+with provenance and last commit ID information. For documentation
+on how to use this read the pkg-config(1) man page.
+
+Do not modify this file yourself, if you want to evolve it send
+patches upstream and then synch back here.
+
+Tree: git://anongit.freedesktop.org/pkg-config
+
+The last synch was from commit:
+
+commit 4f0084d9d3b8726a797a373c7ec5e406000995d0
+Author: Dan Nicholson <[email protected]>
+Date:   Mon Feb 3 15:59:18 2014 -0800
+
+    glib: Fix Makefiles to suppress warnings from automake
+    
+    With the newly added glib.mk, some of the noinst_* variables need to use
+    += in the evaluation to avoid multiple definition warnings from
+    automake.
Signature · 1 line
1.9.0
Acked-by on v4 10/15
#50 lore raw

Re: [PATCH v4 10/15] autoconf: update m4/pkg.m4

Quoted 27 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

The provenance of the m4 pkg.m4 macro library was not documented and it was not clear how and if we can update this without breaking things. Document where this comes from, update us to the latest release from git and put a warning about avoiding private evolutions so that instead things go upstream.

The pkg-config m4 macro library comes from the upstream pkg-config git repository [0]. If you update the m4 library update this file with provenance and last commit ID information. For documentation on how to use this read the pkg-config(1) man page.

Tree: git://anongit.freedesktop.org/pkg-config

The last synch was from commit:

commit 4f0084d9d3b8726a797a373c7ec5e406000995d0

Author: Dan Nicholson <[email protected]>
Date:   Mon Feb 3 15:59:18 2014 -0800

glib: Fix Makefiles to suppress warnings from automake

With the newly added glib.mk, some of the noinst_* variables need to use += in the evaluation to avoid multiple definition warnings from automake.

Quoted 6 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
Quoted 1 line

---

Please note here (after the --- marker) if the committer should rerun autogen.sh.

m4/pkg.m4.README

Quoted 1 line
m4/pkg.m4.README +0 -0

Since it seems like the advice here could apply to multiple modules I wonder if we should start off with m4/README.source or some such and a list of the relevant upstreams (a list of 1 entry now, I don't expect you to reverse engineer the others)?

#51 lore raw

Re: [PATCH v4 10/15] autoconf: update m4/pkg.m4

Quoted 42 lines · Ian Campbell
Quoted 27 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

The provenance of the m4 pkg.m4 macro library was not documented and it was not clear how and if we can update this without breaking things. Document where this comes from, update us to the latest release from git and put a warning about avoiding private evolutions so that instead things go upstream.

The pkg-config m4 macro library comes from the upstream pkg-config git repository [0]. If you update the m4 library update this file with provenance and last commit ID information. For documentation on how to use this read the pkg-config(1) man page.

Tree: git://anongit.freedesktop.org/pkg-config

The last synch was from commit:

commit 4f0084d9d3b8726a797a373c7ec5e406000995d0

Author: Dan Nicholson <[email protected]>
Date:   Mon Feb 3 15:59:18 2014 -0800

glib: Fix Makefiles to suppress warnings from automake

With the newly added glib.mk, some of the noinst_* variables need to use += in the evaluation to avoid multiple definition warnings from automake.

Quoted 6 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
Quoted 1 line

---

Please note here (after the --- marker) if the committer should rerun autogen.sh.

Quoted 6 lines

m4/pkg.m4.README

Quoted 1 line
m4/pkg.m4.README +0 -0

Since it seems like the advice here could apply to multiple modules I wonder if we should start off with m4/README.source or some such and a list of the relevant upstreams (a list of 1 entry now, I don't expect you to reverse engineer the others)?

Sure makes senses.

Luis

Acked-by on v4 10/15
#52 lore raw

Re: [PATCH v4 10/15] autoconf: update m4/pkg.m4

In reply to Luis R. Rodriguez
Quoted 27 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

The provenance of the m4 pkg.m4 macro library was not documented and it was not clear how and if we can update this without breaking things. Document where this comes from, update us to the latest release from git and put a warning about avoiding private evolutions so that instead things go upstream.

The pkg-config m4 macro library comes from the upstream pkg-config git repository [0]. If you update the m4 library update this file with provenance and last commit ID information. For documentation on how to use this read the pkg-config(1) man page.

Tree: git://anongit.freedesktop.org/pkg-config

The last synch was from commit:

commit 4f0084d9d3b8726a797a373c7ec5e406000995d0

Author: Dan Nicholson <[email protected]>
Date:   Mon Feb 3 15:59:18 2014 -0800

glib: Fix Makefiles to suppress warnings from automake

With the newly added glib.mk, some of the noinst_* variables need to use += in the evaluation to avoid multiple definition warnings from automake.

Quoted 6 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
#53 lore raw

PATCH v4 11/15 autoconf: xen: move standard variables to a generic place

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This moves all generic variables to the top level makefile, tons of files use these so just make them general enough. This also paves the way to let us easily dynamically configure these with autoconf, for now we leave the same presets as was present before.

This work was prompted by looking for an autoconf way to do replacements for the hotplug global file, while at it I realized that a few other files use the same variables and have in places around the tree the same constructs for generating their own files. This replaces all that with a two central files, one for shell scripts and another for C header files. We should later optimize this further by only having one target file and generating the two needed from that.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Samuel Thibault <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 .gitignore                        |  2 ++
 Config.mk                         | 13 ---------
 config/StdGNU.mk                  | 19 ++----------
 config/Toplevel.mk.in             | 24 +++++++++++++++
 config/xen-environment-header.in  | 13 +++++++++
 config/xen-environment-scripts.in | 15 ++++++++++
 configure.ac                      |  9 +++++-
 m4/expand_config.m4               | 61 +++++++++++++++++++++++++++++++++++++++
 stubdom/Makefile                  | 17 ++++++-----
 stubdom/configure.ac              |  3 ++
 tools/configure.ac                |  3 ++
 tools/hotplug/common/Makefile     |  6 ++--
 tools/libxl/Makefile              | 11 ++-----
 tools/python/Makefile             |  6 ++--
 14 files changed, 149 insertions(+), 53 deletions(-)
 create mode 100644 config/xen-environment-header.in
 create mode 100644 config/xen-environment-scripts.in
 create mode 100644 m4/expand_config.m4
.gitignore +2 -0
index 562c262..fd1b627 100644
@@ -36,6 +36,8 @@ config.log
 config.status
 config.cache
 config/Toplevel.mk
+config/xen-environment-scripts
+config/xen-environment-header
 
 build-*
 dist/*
Config.mk +0 -13
index 6a93533..84f79a0 100644
@@ -166,19 +166,6 @@ define move-if-changed
 	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
 endef
 
-buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1)))
-define buildmakevars2file-closure
-    .PHONY: genpath
-    genpath:
-	rm -f $(1).tmp;                                                     \
-	$(foreach var,                                                      \
-	          SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR     \
-	          XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \
-	          XEN_RUN_DIR XEN_PAGING_DIR,                               \
-	          echo "$(var)=\"$($(var))\"" >>$(1).tmp;)        \
-	$(call move-if-changed,$(1).tmp,$(1))
-endef
-
 ifeq ($(debug_symbols),y)
 CFLAGS += -g
 endif
config/StdGNU.mk +2 -17
index 25fc594..00b47de 100644
@@ -1,3 +1,5 @@
+include $(XEN_ROOT)/config/Toplevel.mk
+
 AS         = $(CROSS_COMPILE)as
 LD         = $(CROSS_COMPILE)ld
 ifeq ($(clang),y)
@@ -27,30 +29,13 @@ INSTALL_DIR  = $(INSTALL) -d -m0755 -p
 INSTALL_DATA = $(INSTALL) -m0644 -p
 INSTALL_PROG = $(INSTALL) -m0755 -p
 
-PREFIX ?= /usr
-BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBEXEC = $(PREFIX)/lib/xen/bin
-SHAREDIR = $(PREFIX)/share
 MANDIR = $(SHAREDIR)/man
 MAN1DIR = $(MANDIR)/man1
 MAN8DIR = $(MANDIR)/man8
-SBINDIR = $(PREFIX)/sbin
-XENFIRMWAREDIR = $(PREFIX)/lib/xen/boot
-
-PRIVATE_PREFIX = $(LIBDIR)/xen
-PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
-
-CONFIG_DIR = /etc
-XEN_LOCK_DIR = /var/lock
-XEN_RUN_DIR = /var/run/xen
-XEN_PAGING_DIR = /var/lib/xen/xenpaging
 
 SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
 
-XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
-XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
-
 SOCKET_LIBS =
 UTIL_LIBS = -lutil
 DLOPEN_LIBS = -ldl
config/Toplevel.mk.in +24 -0
index 4db7eaf..fc2754c 100644
@@ -1 +1,25 @@
 SUBSYSTEMS               := @SUBSYSTEMS@
+
+SBINDIR                  := @SBINDIR@
+BINDIR                   := @BINDIR@
+LIBEXEC                  := @LIBEXEC@
+
+SHAREDIR                 := @SHAREDIR@
+LIBDIR                   := @LIBDIR@
+
+XEN_RUN_DIR              := @XEN_RUN_DIR@
+XEN_LOG_DIR              := @XEN_LOG_DIR@
+XEN_LIB_STORED           := @XEN_LIB_STORED@
+
+CONFIG_DIR               := @CONFIG_DIR@
+XEN_LOCK_DIR             := @XEN_LOCK_DIR@
+XEN_PAGING_DIR           := @XEN_PAGING_DIR@
+
+PRIVATE_PREFIX           := @PRIVATE_PREFIX@
+PRIVATE_PREFIX           := @PKG_XEN_PREFIX@
+PRIVATE_BINDIR           := @PRIVATE_BINDIR@
+
+XENFIRMWAREDIR           := @XENFIRMWAREDIR@
+
+XEN_CONFIG_DIR           := @XEN_CONFIG_DIR@
+XEN_SCRIPT_DIR           := @XEN_SCRIPT_DIR@
config/xen-environment-header.in new file +13 -0
new file mode 100644
index 0000000..7dd7a53
@@ -0,0 +1,13 @@
+#define SBINDIR "@SBINDIR@"
+#define BINDIR "@BINDIR@"
+#define LIBEXEC "@LIBEXEC@"
+#define LIBDIR "@LIBDIR@"
+#define SHAREDIR "@SHAREDIR@"
+
+#define PRIVATE_BINDIR "@PRIVATE_BINDIR@"
+#define XENFIRMWAREDIR "@XENFIRMWAREDIR@"
+#define XEN_CONFIG_DIR "@XEN_CONFIG_DIR@"
+#define XEN_SCRIPT_DIR "@XEN_SCRIPT_DIR@"
+#define XEN_LOCK_DIR "@XEN_LOCK_DIR@"
+#define XEN_RUN_DIR "@XEN_RUN_DIR@"
+#define XEN_PAGING_DIR "@XEN_PAGING_DIR@"
config/xen-environment-scripts.in new file +15 -0
new file mode 100644
index 0000000..9623231
@@ -0,0 +1,15 @@
+SBINDIR="@SBINDIR@"
+BINDIR="@BINDIR@"
+LIBEXEC="@LIBEXEC@"
+LIBDIR="@LIBDIR@"
+SHAREDIR="@SHAREDIR@"
+
+PRIVATE_BINDIR="@PRIVATE_BINDIR@"
+XENFIRMWAREDIR="@XENFIRMWAREDIR@"
+XEN_CONFIG_DIR="@XEN_CONFIG_DIR@"
+XEN_SCRIPT_DIR="@XEN_SCRIPT_DIR@"
+XEN_LOCK_DIR="@XEN_LOCK_DIR@"
+XEN_LOG_DIR="@XEN_LOG_DIR@"
+XEN_LIB_STORED="@XEN_LIB_STORED@"
+XEN_RUN_DIR="@XEN_RUN_DIR@"
+XEN_PAGING_DIR="@XEN_PAGING_DIR@"
configure.ac +8 -1
index 6c14524..3f26a39 100644
@@ -5,12 +5,19 @@ AC_PREREQ([2.67])
 AC_INIT([Xen Hypervisor], m4_esyscmd([./version.sh ./xen/Makefile]),
     [[email protected]], [xen], [http://www.xen.org/])
 AC_CONFIG_SRCDIR([./xen/common/kernel.c])
-AC_CONFIG_FILES([./config/Toplevel.mk])
+AC_CONFIG_FILES([
+	config/Toplevel.mk
+	config/xen-environment-scripts
+	config/xen-environment-header
+])
 
 AC_CANONICAL_HOST
 
 m4_include([m4/features.m4])
 m4_include([m4/subsystem.m4])
+m4_include([m4/expand_config.m4])
+
+AX_XEN_EXPAND_CONFIG()
 
 dnl mini-os is only ported to certain platforms
 case "$host_cpu" in
m4/expand_config.m4 new file +61 -0

61 lines not on this page · raw message

stubdom/Makefile +9 -8
index b1822b7..bf2ee1d 100644
@@ -48,18 +48,19 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib
 
 TARGETS=$(STUBDOM_TARGETS)
 
+STUBDOMPATH="stubdompath.sh"
+
+$(STUBDOMPATH): $(XEN_ROOT)/config/xen-environment-scripts
+	@cp $(XEN_ROOT)/config/xen-environment-scripts $@
+
 .PHONY: all
 all: build
 ifeq ($(STUBDOM_SUPPORTED),1)
-build: genpath $(STUBDOM_BUILD)
+build: $(STUBDOMPATH) $(STUBDOM_BUILD)
 else
-build: genpath
+build: $(STUBDOMPATH)
 endif
 
-STUBDOMPATH="stubdompath.sh"
-genpath-target = $(call buildmakevars2file,$(STUBDOMPATH))
-$(eval $(genpath-target))
-
 ##############
 # Cross-newlib
 ##############
@@ -446,9 +447,9 @@ xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxc xenstore
 #########
 
 ifeq ($(STUBDOM_SUPPORTED),1)
-install: genpath install-readme $(STUBDOM_INSTALL)
+install: $(STUBDOMPATH) install-readme $(STUBDOM_INSTALL)
 else
-install: genpath
+install: $(STUBDOMPATH)
 endif
 
 install-readme:
stubdom/configure.ac +3 -0
index 6468203..d6b0fbf 100644
@@ -16,6 +16,9 @@ m4_include([../m4/features.m4])
 m4_include([../m4/path_or_fail.m4])
 m4_include([../m4/depends.m4])
 m4_include([../m4/fetcher.m4])
+m4_include([../m4/expand_config.m4])
+
+AX_XEN_EXPAND_CONFIG()
 
 # Enable/disable stub domains
 AX_STUBDOM_CONDITIONAL([ioemu-stubdom], [ioemu])
tools/configure.ac +3 -0
index 00fb47b..c7674a0 100644
@@ -47,6 +47,9 @@ m4_include([../m4/ptyfuncs.m4])
 m4_include([../m4/extfs.m4])
 m4_include([../m4/fetcher.m4])
 m4_include([../m4/ax_compare_version.m4])
+m4_include([../m4/expand_config.m4])
+
+AX_XEN_EXPAND_CONFIG()
 
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
tools/hotplug/common/Makefile +3 -3
index 18d87aa..4a63f40 100644
@@ -9,14 +9,14 @@ HOTPLUGPATH="hotplugpath.sh"
 XEN_SCRIPTS =
 XEN_SCRIPT_DATA = $(HOTPLUGPATH)
 
-genpath-target = $(call buildmakevars2file,$(HOTPLUGPATH))
-$(eval $(genpath-target))
+$(HOTPLUGPATH): $(XEN_ROOT)/config/xen-environment-scripts
+	@cp $(XEN_ROOT)/config/xen-environment-scripts $@
 
 .PHONY: all
 all: build
 
 .PHONY: build
-build: genpath
+build: $(HOTPLUGPATH)
 
 .PHONY: install
 install: all install-scripts
tools/libxl/Makefile +3 -8
index 755b666..1b8852c 100644
@@ -97,6 +97,9 @@ TEST_PROGS += $(foreach t, $(LIBXL_TESTS),test_$t)
 
 $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): CFLAGS += $(CFLAGS_LIBXL) -include $(XEN_ROOT)/tools/config.h
 
+_paths.h: $(XEN_ROOT)/config/xen-environment-header
+	@cp $(XEN_ROOT)/config/xen-environment-header $@
+
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \
 	libxlu_disk_l.h _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
 AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
@@ -141,9 +144,6 @@ $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS) \
 	@rm -f $*.[ch]
 	$(FLEX) --header-file=$*.h --outfile=$*.c $<
 
-genpath-target = $(call buildmakevars2file,_paths.h.tmp)
-$(eval $(genpath-target))
-
 libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
@@ -154,11 +154,6 @@ _%.api-for-check: %.h $(AUTOINCS)
 		>[email protected]
 	mv -f [email protected] $@
 
-_paths.h: genpath
-	sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" [email protected] >[email protected]
-	rm -f [email protected]
-	$(call move-if-changed,[email protected],$@)
-
 _libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
 	$(PERL) $^ --prefix=libxl >[email protected]
 	$(call move-if-changed,[email protected],$@)
tools/python/Makefile +3 -3
index 74ed027..99479d6 100644
@@ -6,11 +6,11 @@ all: build
 
 XENPATH = "xen/util/path.py"
 
-genpath-target = $(call buildmakevars2file,$(XENPATH))
-$(eval $(genpath-target))
+$(XENPATH): $(XEN_ROOT)/config/xen-environment-scripts
+	@cp $(XEN_ROOT)/config/xen-environment-scripts $@
 
 .PHONY: build
-build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
+build: $(XENPATH) genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		$(XEN_ROOT)/tools/libxl/idl.py
 	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
 		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
Signature · 1 line
1.9.0
#54 lore raw

Re: [PATCH v4 11/15] autoconf: xen: move standard variables to a generic place

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 30.04.14 at 03:12, <[email protected]> wrote:

This moves all generic variables to the top level makefile, tons of files use these so just make them general enough. This also paves the way to let us easily dynamically configure these with autoconf, for now we leave the same presets as was present before.

Am I right understanding that this then will require ./configure to be run even for hypervisor-only building? If so, I objected to that idea already when the configuration process got introduced, and I continue to do so now.

Jan

A message that is not in the archive (sent off-list or not yet received): [email protected]

#56 lore raw

Re: [PATCH v4 11/15] autoconf: xen: move standard variables to a generic place

Quoted 9 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 30.04.14 at 03:12, <[email protected]> wrote:

This moves all generic variables to the top level makefile, tons of files use these so just make them general enough. This also paves the way to let us easily dynamically configure these with autoconf, for now we leave the same presets as was present before.

Am I right understanding that this then will require ./configure to be run even for hypervisor-only building?

Its unclear what you mean by that, can you describe what is required to accomplish this on a fresh git tree. Can you describe what expectations you have on build time to see if this patch breaks that and if so see what can be done to avoid this? All the changes I did here really was to toss around variables to be set through autoconf and if building the hypervisor requries them then yes, but fixing that should be as easy as adding schecks to add sensible defaults if configure has not been run.

Quoted 3 lines

If so, I objected to that
idea already when the configuration process got introduced, and I continue to do so now.

OK

Luis

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#57 lore raw

Re: [PATCH v4 11/15] autoconf: xen: move standard variables to a generic place

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 30.04.14 at 19:53, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 30.04.14 at 03:12, <[email protected]> wrote:

This moves all generic variables to the top level makefile, tons of files use these so just make them general enough. This also paves the way to let us easily dynamically configure these with autoconf, for now we leave the same presets as was present before.

Am I right understanding that this then will require ./configure to be run even for hypervisor-only building?

Quoted 8 lines

Its unclear what you mean by that, can you describe what is required to accomplish this on a fresh git tree. Can you describe what expectations you have on build time to see if this patch breaks that and if so see what can be done to avoid this? All the changes I did here really was to toss around variables to be set through autoconf and if building the hypervisor requries them then yes, but fixing that should be as easy as adding schecks to add sensible defaults if configure has not been run.

The main problem I see is with config/StdGNU.mk now including config/Toplevel.mk, with the latter only being generated by the configure process. What I expect to continue to work is "make xen" (and - hopefully unaffected, albeit I didn't check - "make -C extras/mini-os") without anything else done on a fresh tree.

Jan

#58 lore raw

Re: [PATCH v4 11/15] autoconf: xen: move standard variables to a generic place

Quoted 21 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 30.04.14 at 19:53, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 30.04.14 at 03:12, <[email protected]> wrote:

This moves all generic variables to the top level makefile, tons of files use these so just make them general enough. This also paves the way to let us easily dynamically configure these with autoconf, for now we leave the same presets as was present before.

Am I right understanding that this then will require ./configure to be run even for hypervisor-only building?

Quoted 8 lines

Its unclear what you mean by that, can you describe what is required to accomplish this on a fresh git tree. Can you describe what expectations you have on build time to see if this patch breaks that and if so see what can be done to avoid this? All the changes I did here really was to toss around variables to be set through autoconf and if building the hypervisor requries them then yes, but fixing that should be as easy as adding schecks to add sensible defaults if configure has not been run.

Quoted 6 lines

The main problem I see is with config/StdGNU.mk now including config/Toplevel.mk, with the latter only being generated by the configure process. What I expect to continue to work is "make xen" (and - hopefully unaffected, albeit I didn't check - "make -C extras/mini-os") without anything else done on a fresh tree.

OK thanks, I've addressed this by not requiring that file but also providing defaults that the system can override once configure is used. Will roll it into my series.

Luis

#59 lore raw

PATCH v4 12/15 autoconf: xen: peg the xenstored preference onto the top level config

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

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 <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 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(-)
config/Toplevel.mk.in +3 -0
index fc2754c..bea9d96 100644
@@ -23,3 +23,6 @@ XENFIRMWAREDIR           := @XENFIRMWAREDIR@
 
 XEN_CONFIG_DIR           := @XEN_CONFIG_DIR@
 XEN_SCRIPT_DIR           := @XEN_SCRIPT_DIR@
+
+XENSTORED                := @XENSTORED@
+XENSTORE                 := @XENSTORE@
config/xen-environment-header.in +3 -0
index 7dd7a53..3ee8e32 100644
@@ -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@
config/xen-environment-scripts.in +3 -0
index 9623231..a17e0e9 100644
@@ -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@"
configure.ac +1 -0
index 3f26a39..f5faa4f 100644
@@ -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()
 
m4/expand_config.m4 +61 -0

65 lines not on this page · raw message

stubdom/configure.ac +1 -0
index d6b0fbf..3c30004 100644
@@ -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()
 
tools/configure.ac +11 -0
index c7674a0..ac984a3 100644
@@ -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
tools/hotplug/Linux/init.d/xencommons +0 -6
index 7195413..cbe2903 100644
@@ -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
Signature · 1 line
1.9.0
#60 lore raw

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

Quoted 1 line · Luis R. Rodriguez

Enabling cxenstored will then disable ocamltools.

I think there is ocaml code other than oxenstored which people might want to use. I don't see any harm in building all the ocaml stuff (including oxenstored) even if the default requested here is cxenstored. Having both allows the user to switch later if they want, by editing /etc/sysconfig etc.

#61 lore raw

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

Quoted 8 lines · Ian Campbell
Quoted 1 line · Luis R. Rodriguez

Enabling cxenstored will then disable ocamltools.

I think there is ocaml code other than oxenstored which people might want to use. I don't see any harm in building all the ocaml stuff (including oxenstored) even if the default requested here is cxenstored. Having both allows the user to switch later if they want, by editing /etc/sysconfig etc.

OK I'll skip that disablement logic.

Luis

#62 lore raw

PATCH v4 13/15 systemd: add xen systemd service and module files

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This adds the systemd xen service / module files. All of this is disabled for now, and won't install / build until we hook up proper support for systemd into the build system.

These are originally based on the Fedora systemd files.

Changes made from Fedora's systemd files:

* use autoconf to replace @variable@ paths for us which piggy backs on top of the latest autoconf changes to xen
* removes oxenstored service file in favor of a build systemd dynamic change, that is upon build time you pick what xentore you want, we don't want multiple service files floating around, although its possible to support with this target files this seems rather pointless right now specially since we cannot stop [co]xenstored. We instead strive for simplicity with one direct target build.
* enables systemd socket activation for C xenstored and Ocaml oxenstored
* simplifies startup to not require polling on the sockets
as initial socket management is handled by systemd, we just take on the socket later once anything pokes at it, a simple nc -U on the socket files can activate the service for example. Anything queued up will be sent to us once we start. Socket activation should in theory also let us dynamically switch between xenstores but more importantly we could upgrade xenstored while keeping all active socket communication queued up, but in order to take advantage of this we eventually would need to remove the requirement of not being able to bring down the xenstored.
* allow for xenstored configuration through *either* of these configuration files:
- /etc/sysconfig/xenstored
- /etc/default/xenstored
The /etc/default/xenstored will let debian based systems do the same, while SUSE/OpenSUSE/Fedora/RedHat can keep on chugging with sysconfig
* ensures we create the run directory as most systems will likely be using a tmpfs for run dirs for the pid files
* Some systems define the selinux context in the systemd Option for the /var/lib/xenstored tmpfs:
Options=mode=755,context="system_u:object_r:xenstored_var_lib_t:s0"
For the upstream version we remove that and let systems specify the context on their system /etc/default/xenstored or /etc/sysconfig/xenstored $XENSTORED_MOUNT_CTX variable
* defines a modules-load.d for us
* takes advantage of the shared xendomains helper for the xendomains service
* Add the new dom0 that gets kicked off for disk backend access into its own systemd service associated to xen

We end up with these systemd files:

General requirements:

* proc-xen.mount
* var-lib-xenstored.mount

xenstored:

* xenstored.service
* xenstored.socket
* xenconsoled.service
* xen-qemu-dom0-disk-backend.service.in

Optional:

* xendomains.service
* xen-watchdog.service

As for integration with xen, we house keep all the systemd files under a new directory tools/hotplug/Linux/systemd/ and will be targetted by default when building on Linux systems with systemd enabled.

The systemd files will be sanitized for meta @VARIABLES@ upon configuration and installed upon the install target. Systems that do not use systemd will not have these files installed and will end up using the old LSB init scripts.

If you don't specify a prefix you will end up with the services files under /usr/local/lib/systemd/system/ by default, and systemd modules-load.d conf files under /usr/local/lib/modules-load.d/ which systemd does look for (although it seems this is not documented).

Distributions are expected to provide their /usr/ prefix to end up in the more generic location upon distribution install at /usr/lib/systemd/system/ and /usr/lib/modules-load.d/ respectively.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 .gitignore                                         |  5 +++
 Makefile                                           | 11 +++++-
 tools/configure.ac                                 | 12 +++++-
 tools/hotplug/Linux/Makefile                       |  8 ++--
 tools/hotplug/Linux/systemd/Makefile               | 44 ++++++++++++++++++++++
 tools/hotplug/Linux/systemd/proc-xen.mount.in      |  9 +++++
 .../Linux/systemd/var-lib-xenstored.mount.in       | 13 +++++++
 .../systemd/xen-qemu-dom0-disk-backend.service.in  | 22 +++++++++++
 .../hotplug/Linux/systemd/xen-watchdog.service.in  | 13 +++++++
 .../Linux/systemd/xen.conf.modules-load.d.in       | 16 ++++++++
 tools/hotplug/Linux/systemd/xenconsoled.service.in | 20 ++++++++++
 tools/hotplug/Linux/systemd/xendomains.service.in  | 16 ++++++++
 tools/hotplug/Linux/systemd/xenstored.service.in   | 25 ++++++++++++
 tools/hotplug/Linux/systemd/xenstored.socket.in    |  9 +++++
 14 files changed, 218 insertions(+), 5 deletions(-)
 create mode 100644 tools/hotplug/Linux/systemd/Makefile
 create mode 100644 tools/hotplug/Linux/systemd/proc-xen.mount.in
 create mode 100644 tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
 create mode 100644 tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xen-watchdog.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in
 create mode 100644 tools/hotplug/Linux/systemd/xenconsoled.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xendomains.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xenstored.service.in
 create mode 100644 tools/hotplug/Linux/systemd/xenstored.socket.in
.gitignore +5 -0
index fd1b627..5ece576 100644
@@ -390,3 +390,8 @@ tools/xenstore/xenstore-watch
 docs/txt/misc/*.txt
 docs/txt/man/*.txt
 docs/figs/*.png
+
+tools/hotplug/Linux/systemd/*.conf
+tools/hotplug/Linux/systemd/*.mount
+tools/hotplug/Linux/systemd/*.socket
+tools/hotplug/Linux/systemd/*.service
Makefile +10 -1
index 41dabbf..5330985 100644
@@ -216,8 +216,17 @@ uninstall:
 	rm -f  $(D)$(CONFIG_DIR)/udev/rules.d/xen-backend.rules
 	rm -f  $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules
 	rm -f  $(D)$(SYSCONFIG_DIR)/xendomains
+	rm -f  $(D)$(SBINDIR)/xendomains
 	rm -f  $(D)$(SYSCONFIG_DIR)/xencommons
-	rm -rf $(D)/var/run/xen* $(D)/var/lib/xen*
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/xenconsoled.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/xendomains.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/xenstored.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/oxenstored.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/xen-watchdog.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/proc-xen.mount
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/var-lib-xenstored.mount
+	rm -f  $(D)$(XEN_SYSTEMD_MODULES_LOAD)/xen.conf
+	rm -rf $(D)${XEN_RUN_DIR}* $(D)/var/lib/xen*
 	make -C tools uninstall
 	rm -rf $(D)/boot/tboot*
 
tools/configure.ac +11 -1
index ac984a3..8a8831f 100644
@@ -5,7 +5,17 @@ AC_PREREQ([2.67])
 AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]),
     [[email protected]], [xen], [http://www.xen.org/])
 AC_CONFIG_SRCDIR([libxl/libxl.c])
-AC_CONFIG_FILES([../config/Tools.mk])
+AC_CONFIG_FILES([
+../config/Tools.mk
+hotplug/Linux/systemd/proc-xen.mount
+hotplug/Linux/systemd/var-lib-xenstored.mount
+hotplug/Linux/systemd/xenstored.socket
+hotplug/Linux/systemd/xenstored.service
+hotplug/Linux/systemd/xenconsoled.service
+hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service
+hotplug/Linux/systemd/xendomains.service
+hotplug/Linux/systemd/xen-watchdog.service
+])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([../])
 
tools/hotplug/Linux/Makefile +5 -3
index 7e6646e..540e908 100644
@@ -25,6 +25,8 @@ XEN_SCRIPTS += vscsi
 XEN_SCRIPTS += block-iscsi
 XEN_SCRIPTS += $(XEN_SCRIPTS-y)
 
+SUBDIRS-$(CONFIG_SYSTEMD) += systemd
+
 XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
 XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
 XEN_SCRIPT_DATA += block-common.sh
@@ -33,13 +35,13 @@ UDEV_RULES_DIR = $(CONFIG_DIR)/udev
 UDEV_RULES = xen-backend.rules $(UDEV_RULES-y)
 
 .PHONY: all
-all:
+all: subdirs-all
 
 .PHONY: build
 build:
 
 .PHONY: install
-install: all install-initd install-scripts install-udev
+install: all install-initd install-scripts install-udev subdirs-install
 
 # See docs/misc/distro_mapping.txt for INITD_DIR location
 .PHONY: install-initd
@@ -80,4 +82,4 @@ install-udev:
 	done
 
 .PHONY: clean
-clean:
+clean: subdirs-clean
tools/hotplug/Linux/systemd/Makefile new file +44 -0

44 lines not on this page · raw message

tools/hotplug/Linux/systemd/proc-xen.mount.in new file +9 -0
new file mode 100644
index 0000000..6eb61b2
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mount /proc/xen files
+ConditionPathIsDirectory=/proc/xen
+RefuseManualStop=true
+
+[Mount]
+What=xenfs
+Where=/proc/xen
+Type=xenfs
tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in new file +13 -0
new file mode 100644
index 0000000..a393b06
@@ -0,0 +1,13 @@
+[Unit]
+Description=mount xenstore file system
+ConditionPathIsDirectory=/proc/xen
+RefuseManualStop=true
+
+[Mount]
+Environment=XENSTORED_MOUNT_CTX=
+EnvironmentFile=-/etc/sysconfig/xenstored
+EnvironmentFile=-/etc/default/xenstored
+What=xenstore
+Where=@XEN_LIB_STORED@
+Type=tmpfs
+Options=mode=755,context="$XENSTORED_MOUNT_CTX"
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in new file +22 -0
new file mode 100644
index 0000000..1855719
@@ -0,0 +1,22 @@
+[Unit]
+Description=qemu for xen dom0 disk backend
+Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
+After=xenstored.service xenconsoled.service
+Before=xendomains.service libvirtd.service libvirt-guests.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+EnvironmentFile=-/etc/default/xenstored
+EnvironmentFile=-/etc/sysconfig/xenstored
+PIDFile=@XEN_RUN_DIR@/qemu-dom0.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=/bin/mkdir -p /var/run/xen
+ExecStart=@LIBEXEC@/qemu-system-i386 -xen-domid 0 \
+	-xen-attach -name dom0 -nographic -M xenpv -daemonize \
+	-monitor /dev/null -serial /dev/null -parallel /dev/null \
+	-pidfile @XEN_RUN_DIR@/qemu-dom0.pid
+
+[Install]
+WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xen-watchdog.service.in new file +13 -0
new file mode 100644
index 0000000..c202fe9
@@ -0,0 +1,13 @@
+[Unit]
+Description=Xen-watchdog - run xen watchdog daemon
+Requires=proc-xen.mount
+After=proc-xen.mount xendomains.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/xenwatchdogd 30 15
+KillSignal=USR1
+
+[Install]
+WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in new file +16 -0
new file mode 100644
index 0000000..3fbd59b
@@ -0,0 +1,16 @@
+xen-evtchn
+xen-gntdev
+xen-gntalloc
+xen-blkback
+xen-netback
+xen-pciback
+evtchn
+gntdev
+netbk
+blkbk
+xen-scsibk
+usbbk
+pciback
+xen-acpi-processor
+blktap2
+blktap
tools/hotplug/Linux/systemd/xenconsoled.service.in new file +20 -0
new file mode 100644
index 0000000..50fe583
@@ -0,0 +1,20 @@
+[Unit]
+Description=Xenconsoled - handles logging from guest consoles and hypervisor
+Requires=xenstored.socket
+After=xenstored.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=simple
+Environment=XENCONSOLED_ARGS=
+Environment=XENCONSOLED_LOG=none
+Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console
+EnvironmentFile=-/etc/default/xenconsoled
+EnvironmentFile=-/etc/sysconfig/xenconsoled
+PIDFile=@XEN_RUN_DIR@/xenconsoled.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@
+ExecStart=@SBINDIR@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS
+
+[Install]
+WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xendomains.service.in new file +16 -0
new file mode 100644
index 0000000..ee44484
@@ -0,0 +1,16 @@
+[Unit]
+Description=Xendomains - start and stop guests on boot and shutdown
+Requires=xenstored.socket
+After=xenstored.service xenconsoled.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStart=-@LIBEXEC@/xendomains start
+ExecStop=@LIBEXEC@/xendomains stop
+ExecReload=@LIBEXEC@/xendomains restart
+
+[Install]
+WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xenstored.service.in new file +25 -0
new file mode 100644
index 0000000..f64dfa1
@@ -0,0 +1,25 @@
+[Unit]
+Description=Xenstored - daemon managing xenstore file system
+Requires=xenstored.socket proc-xen.mount var-lib-xenstored.mount
+After=proc-xen.mount var-lib-xenstored.mount
+Before=libvirtd.service libvirt-guests.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen
+ConditionFileIsExecutable=@XENSTORED@
+
+[Service]
+Type=forking
+Environment=XENSTORED_ARGS=
+Environment=XENSTORED_ROOTDIR=@XEN_LIB_STORED@
+EnvironmentFile=-/etc/default/xenstored
+EnvironmentFile=-/etc/sysconfig/xenstored
+PIDFile=@XEN_RUN_DIR@/xenstored.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb*
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@
+ExecStart=@XENSTORED@ --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
+ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
+ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/domid" 0
+
+[Install]
+WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xenstored.socket.in new file +9 -0
new file mode 100644
index 0000000..3270f4d
@@ -0,0 +1,9 @@
+[Unit]
+Description=Xen xenstored / oxenstored Activation Socket
+
+[Socket]
+ListenStream=/var/run/xenstored/socket
+ListenStream=/var/run/xenstored/socket_ro
+
+[Install]
+WantedBy=sockets.target
Signature · 7 lines
1.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#63 lore raw

Re: [PATCH v4 13/15] systemd: add xen systemd service and module files

Quoted 4 lines · Luis R. Rodriguez

* simplifies startup to not require polling on the sockets as initial socket management is handled by systemd, we just take on the socket later once anything pokes at it, a simple nc -U on the socket files can activate the service for example.

What about xenstore users which don't use the sockets but instead use the kernel ring interface? Does this mean that if only those users are present nothing starts xenstored?

Quoted 7 lines

* allow for xenstored configuration through *either* of these configuration files:
- /etc/sysconfig/xenstored
- /etc/default/xenstored
The /etc/default/xenstored will let debian based systems do the same, while SUSE/OpenSUSE/Fedora/RedHat can keep on chugging with sysconfig

Is the usual systemd way?

Quoted 1 line

* defines a modules-load.d for us

Does this duplicate the existing list in the LSB initscript, meaning we have to keep two places up to date? Can we avoid that somehow?

Ian.

#64 lore raw

Re: [PATCH v4 13/15] systemd: add xen systemd service and module files

Quoted 9 lines · Ian Campbell
Quoted 4 lines · Luis R. Rodriguez

* simplifies startup to not require polling on the sockets as initial socket management is handled by systemd, we just take on the socket later once anything pokes at it, a simple nc -U on the socket files can activate the service for example.

What about xenstore users which don't use the sockets but instead use the kernel ring interface? Does this mean that if only those users are present nothing starts xenstored?

It depends on how you use the service files, what you say is true only if the xenstored.socket is enabled:

systemctl enable xenstored.socket

If however an administrator or a Linux distribution does this:

systemctl enable xenstored.service

then the xenstored will always be guaranteed to be started regardless. If someone wants to test active socket working they should just enable the socket and then tickle it with nc -U to see it working, that's all.

Quoted 9 lines
Quoted 7 lines

* allow for xenstored configuration through *either* of these configuration files:
- /etc/sysconfig/xenstored
- /etc/default/xenstored
The /etc/default/xenstored will let debian based systems do the same, while SUSE/OpenSUSE/Fedora/RedHat can keep on chugging with sysconfig

Is the usual systemd way?

Yes and no. Yes in the sense that its what daemons have been using for ages, as such existing deamons need to keep working with what they've been used to, in order to avoid huge changes. In the long run though at least Lennert has expressed disdain towards these two practices of using /etc/sysconfig and /etc/default -- and calls for developers to abandon them. You can read the full rant here:

http://0pointer.de/blog/projects/on-etc-sysinit.html

The replacement should then be to start moving towards abandoning these, however this is a radical change and I would encourage this to be done as a phased step rather than a requirement.

Quoted 4 lines
Quoted 1 line

* defines a modules-load.d for us

Does this duplicate the existing list in the LSB initscript, meaning we have to keep two places up to date? Can we avoid that somehow?

Its a good idea to keep only one, will work on that as part of my next series.

Luis

#65 lore raw

Re: [PATCH v4 13/15] systemd: add xen systemd service and module files

In reply to Ian Campbell
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Luis R. Rodriguez

* simplifies startup to not require polling on the sockets as initial socket management is handled by systemd, we just take on the socket later once anything pokes at it, a simple nc -U on the socket files can activate the service for example.

What about xenstore users which don't use the sockets but instead use the kernel ring interface? Does this mean that if only those users are present nothing starts xenstored?

That should still work.

Luis

#66 lore raw

Re: [PATCH v4 13/15] systemd: add xen systemd service and module files

In reply to Luis R. Rodriguez

Thanks for pursuing this. I have some comments:

Luis R. Rodriguez writes ("[PATCH v4 13/15] systemd: add xen systemd service and module files"):
...

Quoted 6 lines
tools/hotplug/Linux/systemd/proc-xen.mount.in new file +0 -0
new file mode 100644
index 0000000..6eb61b2

tools/hotplug/Linux/systemd/proc-xen.mount.in line 9

Quoted 9 lines
tools/hotplug/Linux/systemd/proc-xen.mount.in new file +9 -0
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mount /proc/xen files
+ConditionPathIsDirectory=/proc/xen
+RefuseManualStop=true
+
+[Mount]
+What=xenfs
+Where=/proc/xen
+Type=xenfs

Blimey. All of this to replace one line in a shell script.

Can you explain why this needs to be broken out into a separate systemd service ? Could it be bundled into some script which is already being run ?

If it can be bundled into a script somewhere, that would be better because it avoids duplicating the information.

Quoted 13 lines
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in new file +7 -0
new file mode 100644
index 0000000..1855719
@@ -0,0 +1,22 @@
+[Unit]
+Description=qemu for xen dom0 disk backend
+Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
+After=xenstored.service xenconsoled.service
+Before=xendomains.service libvirtd.service libvirt-guests.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen

...

tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in line 19

Quoted 4 lines
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in new file +4 -0
+ExecStart=@LIBEXEC@/qemu-system-i386 -xen-domid 0 \
+	-xen-attach -name dom0 -nographic -M xenpv -daemonize \
+	-monitor /dev/null -serial /dev/null -parallel /dev/null \
+	-pidfile @XEN_RUN_DIR@/qemu-dom0.pid

IMO duplicating this command line isn't acceptable. It is likely to have to change in the future and there needs to be one copy of it in the source tree.

Quoted 12 lines
tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in new file +6 -0
new file mode 100644
index 0000000..3fbd59b
@@ -0,0 +1,16 @@
+xen-evtchn
+xen-gntdev
+xen-gntalloc
+xen-blkback
+xen-netback
+xen-pciback

tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in line 16

Quoted 10 lines
tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in new file +10 -0
+evtchn
+gntdev
+netbk
+blkbk
+xen-scsibk
+usbbk
+pciback
+xen-acpi-processor
+blktap2
+blktap

This duplicates the list of modules from one of the init scripts. Again, I think we need a common list.

(In theory we shouldn't need manual module loading, but it seems that failure to load module bugs continue to exist in Linux.)

tools/hotplug/Linux/systemd/xenconsoled.service.in

Quoted 11 lines
tools/hotplug/Linux/systemd/xenconsoled.service.in +10 -0
+[Service]
+Type=simple
+Environment=XENCONSOLED_ARGS=
+Environment=XENCONSOLED_LOG=none
+Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console
+EnvironmentFile=-/etc/default/xenconsoled
+EnvironmentFile=-/etc/sysconfig/xenconsoled
+PIDFile=@XEN_RUN_DIR@/xenconsoled.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@> +ExecStart=@SBINDIR@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS

This should use a non-forking startup protocol, rather than pid files.

tools/hotplug/Linux/systemd/xenstored.service.in line 2

Quoted 8 lines
tools/hotplug/Linux/systemd/xenstored.service.in new file +2 -0
new file mode 100644
index 0000000..f64dfa1
@@ -0,0 +1,25 @@
+[Unit]
+Description=Xenstored - daemon managing xenstore file system

xenstore isn't a file system. The /var/run area it uses is just something it needs for its private data.

tools/hotplug/Linux/systemd/xenstored.socket.in line 6

Quoted 4 lines
tools/hotplug/Linux/systemd/xenstored.socket.in +3 -0
+[Socket]
+ListenStream=/var/run/xenstored/socket
+ListenStream=/var/run/xenstored/socket_ro

AIUI the systemd socket activation protocol requires the systemd config and the daemon code/configuration to correspond.

There should be a comment explaining where the corresponding configuration in xenstored is (ie referring to the code in both daemons listing the sockets).

Thanks,
Ian.

#67 lore raw

Re: [PATCH v4 13/15] systemd: add xen systemd service and module files

Quoted 22 lines · Ian Jackson

Thanks for pursuing this. I have some comments:

Luis R. Rodriguez writes ("[PATCH v4 13/15] systemd: add xen systemd service and module files"):
...

Quoted 6 lines
tools/hotplug/Linux/systemd/proc-xen.mount.in new file +0 -0
new file mode 100644
index 0000000..6eb61b2

tools/hotplug/Linux/systemd/proc-xen.mount.in line 9

Quoted 9 lines
tools/hotplug/Linux/systemd/proc-xen.mount.in new file +9 -0
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mount /proc/xen files
+ConditionPathIsDirectory=/proc/xen
+RefuseManualStop=true
+
+[Mount]
+What=xenfs
+Where=/proc/xen
+Type=xenfs

Blimey. All of this to replace one line in a shell script.

Quoted 2 lines

Can you explain why this needs to be broken out into a separate systemd service ?

Because that is how mount points are configured in systemd.

One could drop /etc/fstab all together and use a shell script to mount every file system. Would that be better?

In fact mounting /proc/xen from within a script instead of using fstab entry is hack required because /etc/fstab cannot be reliably updated on Xen install or activation.

The systemd mount units seem verbose, but they contain not much more than an /etc/fstab line and allow more flexibility (conditions and ordering).

Quoted 1 line

Could it be bundled into some script which is already being run ?

No. Scripts are bad way for configuring mounts. Doing it in the script is the necessary evil in systems without drop-in configuration like systemd provides.

Quoted 5 lines
Quoted 5 lines
tools/hotplug/Linux/systemd/xenconsoled.service.in +4 -0
+[Service]
+Type=simple
+Environment=XENCONSOLED_ARGS=
+Environment=XENCONSOLED_LOG=none
Quoted 8 lines

tools/hotplug/Linux/systemd/xenconsoled.service.in

Quoted 6 lines
tools/hotplug/Linux/systemd/xenconsoled.service.in +6 -0
+Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console
+EnvironmentFile=-/etc/default/xenconsoled
+EnvironmentFile=-/etc/sysconfig/xenconsoled
+PIDFile=@XEN_RUN_DIR@/xenconsoled.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@> +ExecStart=@SBINDIR@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS

This should use a non-forking startup protocol, rather than pid files.

I would say more: it seems weird to use both 'Type=simple' and 'PIDFile=' – PIDFile seems unnecessary here. sd_notify support (Type=notify) would be the best option here, but it must be implemented in the daemon.

Quoted 10 lines

xenstore isn't a file system. The /var/run area it uses is just something it needs for its private data.

tools/hotplug/Linux/systemd/xenstored.socket.in line 6

Quoted 4 lines
tools/hotplug/Linux/systemd/xenstored.socket.in +3 -0
+[Socket]
+ListenStream=/var/run/xenstored/socket
+ListenStream=/var/run/xenstored/socket_ro

AIUI the systemd socket activation protocol requires the systemd config and the daemon code/configuration to correspond.

The daemon may have no own configuration when the systemd-provided sockets are used – the daemon does not need to know the paths, just that the first socked is read-write, and the other is read-only.

Quoted 3 lines

There should be a comment explaining where the corresponding configuration in xenstored is (ie referring to the code in both daemons listing the sockets).

Comment about the expected sockets would not hurt, I guess.

Jacek

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#68 lore raw

Re: [PATCH v4 13/15] systemd: add xen systemd service and module files

Jacek Konieczny writes ("Re: [PATCH v4 13/15] systemd: add xen systemd service and module files"):

Quoted 6 lines · Ian Jackson
Quoted 4 lines

Blimey. All of this to replace one line in a shell script.

Can you explain why this needs to be broken out into a separate systemd service ?

Quoted 8 lines

Because that is how mount points are configured in systemd.

One could drop /etc/fstab all together and use a shell script to mount every file system. Would that be better?

In fact mounting /proc/xen from within a script instead of using fstab entry is hack required because /etc/fstab cannot be reliably updated on Xen install or activation.

Arguably, yes.

Quoted 3 lines

The systemd mount units seem verbose, but they contain not much more than an /etc/fstab line and allow more flexibility (conditions and ordering).

My question was whether the same ordering and conditionality could be left in an existing script without causing bugs. That would be preferable IMO.

Quoted 5 lines
Quoted 1 line

Could it be bundled into some script which is already being run ?

No. Scripts are bad way for configuring mounts. Doing it in the script is the necessary evil in systems without drop-in configuration like systemd provides.

I'm afraid that this isn't a reason, it's just an assertion.

Quoted 6 lines
Quoted 1 line

This should use a non-forking startup protocol, rather than pid files.

I would say more: it seems weird to use both 'Type=simple' and 'PIDFile=' – PIDFile seems unnecessary here. sd_notify support (Type=notify) would be the best option here, but it must be implemented in the daemon.

I would not object to sd_notify support.

Quoted 11 lines
Quoted 10 lines

xenstore isn't a file system. The /var/run area it uses is just something it needs for its private data.

tools/hotplug/Linux/systemd/xenstored.socket.in line 6

Quoted 4 lines
tools/hotplug/Linux/systemd/xenstored.socket.in +3 -0
+[Socket]
+ListenStream=/var/run/xenstored/socket
+ListenStream=/var/run/xenstored/socket_ro

AIUI the systemd socket activation protocol requires the systemd config and the daemon code/configuration to correspond.

Quoted 3 lines

The daemon may have no own configuration when the systemd-provided sockets are used – the daemon does not need to know the paths, just that the first socked is read-write, and the other is read-only.

Indeed. But that information is spread in multiple places and I think it should be written down clearly.

And where that's helpful these multiple places should refer to each other. Finding the systemd config given the code will be straightforward. The other way around is less clear - particularly given that there are two xenstored implementations and a change to this startup arrangement might involve changing both.

Quoted 5 lines
Quoted 3 lines

There should be a comment explaining where the corresponding configuration in xenstored is (ie referring to the code in both daemons listing the sockets).

Comment about the expected sockets would not hurt, I guess.

Right, and a reference to the places in the code where it's implemented.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#69 lore raw

Re: [PATCH v4 13/15] systemd: add xen systemd service and module files

Quoted 18 lines · Ian Jackson

Jacek Konieczny writes ("Re: [PATCH v4 13/15] systemd: add xen systemd service and module files"):

Quoted 6 lines · Ian Jackson
Quoted 4 lines

Blimey. All of this to replace one line in a shell script.

Can you explain why this needs to be broken out into a separate systemd service ?

Quoted 8 lines

Because that is how mount points are configured in systemd.

One could drop /etc/fstab all together and use a shell script to mount every file system. Would that be better?

In fact mounting /proc/xen from within a script instead of using fstab entry is hack required because /etc/fstab cannot be reliably updated on Xen install or activation.

Arguably, yes.

Quoted 7 lines
Quoted 3 lines

The systemd mount units seem verbose, but they contain not much more than an /etc/fstab line and allow more flexibility (conditions and ordering).

My question was whether the same ordering and conditionality could be left in an existing script without causing bugs. That would be preferable IMO.

Systemd provides a guarantee of dependencies being met if defined on the unit files, which is what has been done. I'd put a bit more trust over the unit service dependency mapping over LSB scripts.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Could it be bundled into some script which is already being run ?

No. Scripts are bad way for configuring mounts. Doing it in the script is the necessary evil in systems without drop-in configuration like systemd provides.

I'm afraid that this isn't a reason, it's just an assertion.

Don't think about weighing service files vs scripts -- think about the design goals that systemd is trying achieve, only then will replacing scripts make some sort of sense.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

This should use a non-forking startup protocol, rather than pid files.

I would say more: it seems weird to use both 'Type=simple' and 'PIDFile=' – PIDFile seems unnecessary here. sd_notify support (Type=notify) would be the best option here, but it must be implemented in the daemon.

I would not object to sd_notify support.

sd_notify() support is indeed reasonable but at this point I'd prefer if we provide support for it separately as an atomic evolution, I don't see it as a requirement.

Quoted 15 lines
Quoted 11 lines
Quoted 10 lines

xenstore isn't a file system. The /var/run area it uses is just something it needs for its private data.

tools/hotplug/Linux/systemd/xenstored.socket.in line 6

Quoted 4 lines
tools/hotplug/Linux/systemd/xenstored.socket.in +3 -0
+[Socket]
+ListenStream=/var/run/xenstored/socket
+ListenStream=/var/run/xenstored/socket_ro

AIUI the systemd socket activation protocol requires the systemd config and the daemon code/configuration to correspond.

Quoted 3 lines

The daemon may have no own configuration when the systemd-provided sockets are used – the daemon does not need to know the paths, just that the first socked is read-write, and the other is read-only.

Quoted 8 lines

Indeed. But that information is spread in multiple places and I think it should be written down clearly.

And where that's helpful these multiple places should refer to each other. Finding the systemd config given the code will be straightforward. The other way around is less clear - particularly given that there are two xenstored implementations and a change to this startup arrangement might involve changing both.

The complexity on xen is due to its wide support for different systems, as xen grows to support two init systems for one OS this will obviously grow, and making it a requirement to share can and should be part of the design goals. This however should be clearly accepted then as an overhead in terms of design, so give me a bit more time and I'll bake something up as part of the next series.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

There should be a comment explaining where the corresponding configuration in xenstored is (ie referring to the code in both daemons listing the sockets).

Comment about the expected sockets would not hurt, I guess.

Right, and a reference to the places in the code where it's implemented.

Sure, this is crucial.

Luis

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#70 lore raw

Re: [PATCH v4 13/15] systemd: add xen systemd service and module files

In reply to Ian Jackson
Quoted 22 lines · Ian Jackson

Thanks for pursuing this. I have some comments:

Luis R. Rodriguez writes ("[PATCH v4 13/15] systemd: add xen systemd service and module files"):
...

Quoted 6 lines
tools/hotplug/Linux/systemd/proc-xen.mount.in new file +0 -0
new file mode 100644
index 0000000..6eb61b2

tools/hotplug/Linux/systemd/proc-xen.mount.in line 9

Quoted 9 lines
tools/hotplug/Linux/systemd/proc-xen.mount.in new file +9 -0
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mount /proc/xen files
+ConditionPathIsDirectory=/proc/xen
+RefuseManualStop=true
+
+[Mount]
+What=xenfs
+Where=/proc/xen
+Type=xenfs

Blimey. All of this to replace one line in a shell script.

Quoted 3 lines

Can you explain why this needs to be broken out into a separate systemd service ? Could it be bundled into some script which is already being run ?

I don't see why, systemd wants to know exactly what it needs to be set up and this is component based, mounts are one type of component, stuffing it into a shell scripts hides an important system component.

Quoted 2 lines

If it can be bundled into a script somewhere, that would be better because it avoids duplicating the information.

One of the objectives of systemd is to help enable a different way to think about initializing a system and scripts don't really contribute any component information to the system that let systemd use to help ensure things are done efficiently. Using scripts was what got us into the position we are in today with the legacy init, doing away with that requires components to be split up and for logic of requirements to be dealt with through systemd, in this case service files.

Quoted 14 lines
Quoted 13 lines
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in new file +7 -0
new file mode 100644
index 0000000..1855719
@@ -0,0 +1,22 @@
+[Unit]
+Description=qemu for xen dom0 disk backend
+Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
+After=xenstored.service xenconsoled.service
+Before=xendomains.service libvirtd.service libvirt-guests.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen

...

Quoted 8 lines

tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in line 19

Quoted 4 lines
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in new file +4 -0
+ExecStart=@LIBEXEC@/qemu-system-i386 -xen-domid 0 \
+     -xen-attach -name dom0 -nographic -M xenpv -daemonize \
+     -monitor /dev/null -serial /dev/null -parallel /dev/null \
+     -pidfile @XEN_RUN_DIR@/qemu-dom0.pid

IMO duplicating this command line isn't acceptable. It is likely to have to change in the future and there needs to be one copy of it in the source tree.

Xen is already a complicated boat that tries to accommodate many Operating Systems, supporting two different init systems for one Operating System likely incurs a duplicate or sharing effort penalty cost. I do agree trying to share is better for this case and will try it out somehow in my next series.

Quoted 17 lines
Quoted 17 lines
tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in new file +11 -0
new file mode 100644
index 0000000..3fbd59b
@@ -0,0 +1,16 @@
+xen-evtchn
+xen-gntdev
+xen-gntalloc
+xen-blkback
+xen-netback
+xen-pciback
+evtchn
+gntdev
+netbk
+blkbk
+xen-scsibk
Quoted 8 lines

tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in line 16

Quoted 5 lines
tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in new file +5 -0
+usbbk
+pciback
+xen-acpi-processor
+blktap2
+blktap

This duplicates the list of modules from one of the init scripts. Again, I think we need a common list.

Sure.

Quoted 2 lines

(In theory we shouldn't need manual module loading, but it seems that failure to load module bugs continue to exist in Linux.)

Once I'm done with systemd I'm going to jump on the kernel and would like to know exactly which modules there is an issue for on this. Do you have pointers?

Quoted 5 lines
Quoted 5 lines
tools/hotplug/Linux/systemd/xenconsoled.service.in +4 -0
+[Service]
+Type=simple
+Environment=XENCONSOLED_ARGS=
+Environment=XENCONSOLED_LOG=none
Quoted 8 lines

tools/hotplug/Linux/systemd/xenconsoled.service.in

Quoted 6 lines
tools/hotplug/Linux/systemd/xenconsoled.service.in +6 -0
+Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console
+EnvironmentFile=-/etc/default/xenconsoled
+EnvironmentFile=-/etc/sysconfig/xenconsoled
+PIDFile=@XEN_RUN_DIR@/xenconsoled.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@> +ExecStart=@SBINDIR@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS

This should use a non-forking startup protocol, rather than pid files.

Not sure what you mean. Systemd already knows of the PID file, this is just to help forward port the old behavior and expectations. Are you providing some hints as to what you wish for systemd to do ? If so consider any users of the PID file.

Quoted 11 lines

tools/hotplug/Linux/systemd/xenstored.service.in line 2

Quoted 8 lines
tools/hotplug/Linux/systemd/xenstored.service.in new file +2 -0
new file mode 100644
index 0000000..f64dfa1
@@ -0,0 +1,25 @@
+[Unit]
+Description=Xenstored - daemon managing xenstore file system

xenstore isn't a file system. The /var/run area it uses is just something it needs for its private data.

Feel free to provide a better alternative description that suits anyone's likings.

Quoted 11 lines

tools/hotplug/Linux/systemd/xenstored.socket.in line 6

Quoted 4 lines
tools/hotplug/Linux/systemd/xenstored.socket.in +3 -0
+[Socket]
+ListenStream=/var/run/xenstored/socket
+ListenStream=/var/run/xenstored/socket_ro

AIUI the systemd socket activation protocol requires the systemd config and the daemon code/configuration to correspond.

There should be a comment explaining where the corresponding configuration in xenstored is (ie referring to the code in both daemons listing the sockets).

Sure that makes sense and this is pretty important information. I consider this an area that could likely be enhanced upstream on systemd in the future to help making this crystal clear as part of the design of the system, but that's homework for later.

Luis

#71 lore raw

Re: [PATCH v4 13/15] systemd: add xen systemd service and module files

Quoted 7 lines · Luis R. Rodriguez
Quoted 2 lines · Ian Jackson

(In theory we shouldn't need manual module loading, but it seems that failure to load module bugs continue to exist in Linux.)

Once I'm done with systemd I'm going to jump on the kernel and would like to know exactly which modules there is an issue for on this. Do you have pointers?

The list you have in this patch is a pretty good start.

But one thing to remember is that this needs to handle not just the current kernel (which may have many of these bugs fixed) but also older distro kernels which may still have them. Figuring out which is which would be some serious archeology, and even then it's not clear what could be done with the knowledge, perhaps annotate this list with the oldest kernel/distro which doesn't autoload and prune as we move the support window forward.

Also some of these drivers might suffer the same sort of issue as loop.ko, which is that there is no obvious trigger for when to load them i.e. there's no bus, and the old "open /dev/loop and have the driver loaded approach no longer works since udev was introduced.

Ian.

#72 lore raw

PATCH v4 14/15 autoconf: xen: add systemd support into the build system

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This adds autoconf systemd support into the build system. Autoconf support for system has been split up as much as possible into its own set of helpers in hopes that this might be useful for other daemons and I was unable to find anything generic. You can use either one of two helpers depending on whether or not you want to make systemd required or optional:

* AX_ENABLE_SYSTEMD() - requires systemd
* AX_ALLOW_SYSTEMD() - lets you enable systemd with configure

This then lets you use the variables in your build system:

* SYSTEMD_CFLAGS
* SYSTEMD_LIBS
* SYSTEMD_DIR
* SYSTEMD_MODULES_LOAD

Systemd support is left disabled by default given xen can be built for non-systemd systems and enabling systemd support will require support of having libsystemd-daemon present in order to use active sockets. We use AX_ALLOW_SYSTEMD() then, you can enable systemd support into the build system by using the --enable-systemd configure flag, you will have been expected to have installed your distribution's version of the package systemd-devel.

This integration currently does not make use of

pkg-config --variable=systemdsystemunitdir systemd

for setting of the SYSTEMD_DIR where the unit files are stored given upstream systemd pc files it do not respect the ${prefix} overriding and fixing that upstream on system is a bit complicated, to account for that we provide a path helper --with-systemd which can be used to override the path to the service files. Upstream systemd also lacks a pc file placement for a modules load path, we can add that upstream but for now we enable overriding through the flag configure flag --with-systemd-modules-load. By default you're preferred ${prefix} will be respected, this means /usr/local/ will be used for both as prefix if none is provided thereby leaving your own distribution's files in place if present.

Enabling systemd will trigger a config.h define for HAVE_SYSTEMD which is used by C xensotred and Ocaml oxenstored for active socket communication.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 config/Tools.mk.in             |   6 +++
 m4/systemd.m4                  | 105 +++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac             |   3 ++
 tools/hotplug/common/Makefile  |   1 +
 tools/ocaml/xenstored/Makefile |   5 ++
 tools/xenstore/Makefile        |   6 +++
 6 files changed, 126 insertions(+)
 create mode 100644 m4/systemd.m4
config/Tools.mk.in +6 -0
index 0bdf37a..c47e6af 100644
@@ -55,6 +55,12 @@ CONFIG_QEMU_TRAD    := @qemu_traditional@
 CONFIG_QEMU_XEN     := @qemu_xen@
 CONFIG_BLKTAP1      := @blktap1@
 
+CONFIG_SYSTEMD      := @systemd@
+SYSTEMD_CFLAGS      := @SYSTEMD_CFLAGS@
+SYSTEMD_LIBS        := @SYSTEMD_LIBS@
+XEN_SYSTEMD_DIR     := @SYSTEMD_DIR@
+XEN_SYSTEMD_MODULES_LOAD := @SYSTEMD_MODULES_LOAD@
+
 #System options
 ZLIB                := @zlib@
 CONFIG_LIBICONV     := @libiconv@
m4/systemd.m4 new file +105 -0

105 lines not on this page · raw message

tools/configure.ac +3 -0
index 8a8831f..24d1109 100644
@@ -58,6 +58,7 @@ m4_include([../m4/extfs.m4])
 m4_include([../m4/fetcher.m4])
 m4_include([../m4/ax_compare_version.m4])
 m4_include([../m4/expand_config.m4])
+m4_include([../m4/systemd.m4])
 
 AX_XEN_EXPAND_CONFIG()
 
@@ -261,5 +262,7 @@ esac
 # Checks for header files.
 AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h])
 
+dnl Once and if systemd is prevalent we can just use AX_ENABLE_SYSTEMD()
+AX_ALLOW_SYSTEMD()
 AC_OUTPUT()
 
tools/hotplug/common/Makefile +1 -0
index 4a63f40..45fd840 100644
@@ -1,5 +1,6 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/config/Tools.mk
 
 HOTPLUGPATH="hotplugpath.sh"
 
tools/ocaml/xenstored/Makefile +5 -0
index 382a813..068e04a 100644
@@ -3,6 +3,11 @@ OCAML_TOPLEVEL = $(CURDIR)/..
 include $(OCAML_TOPLEVEL)/common.make
 
 CFLAGS += -I$(XEN_ROOT)/tools/
+CFLAGS-$(CONFIG_SYSTEMD)  += $(SYSTEMD_CFLAGS)
+LDFLAGS-$(CONFIG_SYSTEMD) += $(SYSTEMD_LIBS)
+
+CFLAGS  += $(CFLAGS-y)
+LDFLAGS += $(LDFLAGS-y)
 
 OCAMLINCLUDE += \
 	-I $(OCAML_TOPLEVEL)/libs/xb \
tools/xenstore/Makefile +6 -0
index 21a3f11..6adac7f 100644
@@ -9,6 +9,12 @@ CFLAGS += -I.
 CFLAGS += -I$(XEN_ROOT)/tools/
 CFLAGS += $(CFLAGS_libxenctrl)
 
+CFLAGS-$(CONFIG_SYSTEMD)  += $(SYSTEMD_CFLAGS)
+LDFLAGS-$(CONFIG_SYSTEMD) += $(SYSTEMD_LIBS)
+
+CFLAGS  += $(CFLAGS-y)
+LDFLAGS += $(LDFLAGS-y)
+
 CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
 CLIENTS += xenstore-write xenstore-ls xenstore-watch
 
Signature · 7 lines
1.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#73 lore raw

Re: [PATCH v4 14/15] autoconf: xen: add systemd support into the build system

Quoted 209 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This adds autoconf systemd support into the build system. Autoconf support for system has been split up as much as possible into its own set of helpers in hopes that this might be useful for other daemons and I was unable to find anything generic. You can use either one of two helpers depending on whether or not you want to make systemd required or optional:

* AX_ENABLE_SYSTEMD() - requires systemd
* AX_ALLOW_SYSTEMD() - lets you enable systemd with configure

This then lets you use the variables in your build system:

* SYSTEMD_CFLAGS
* SYSTEMD_LIBS
* SYSTEMD_DIR
* SYSTEMD_MODULES_LOAD

Systemd support is left disabled by default given xen can be built for non-systemd systems and enabling systemd support will require support of having libsystemd-daemon present in order to use active sockets. We use AX_ALLOW_SYSTEMD() then, you can enable systemd support into the build system by using the --enable-systemd configure flag, you will have been expected to have installed your distribution's version of the package systemd-devel.

This integration currently does not make use of

pkg-config --variable=systemdsystemunitdir systemd

for setting of the SYSTEMD_DIR where the unit files are stored given upstream systemd pc files it do not respect the ${prefix} overriding and fixing that upstream on system is a bit complicated, to account for that we provide a path helper --with-systemd which can be used to override the path to the service files. Upstream systemd also lacks a pc file placement for a modules load path, we can add that upstream but for now we enable overriding through the flag configure flag --with-systemd-modules-load. By default you're preferred ${prefix} will be respected, this means /usr/local/ will be used for both as prefix if none is provided thereby leaving your own distribution's files in place if present.

Enabling systemd will trigger a config.h define for HAVE_SYSTEMD which is used by C xensotred and Ocaml oxenstored for active socket communication.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 config/Tools.mk.in             |   6 +++
 m4/systemd.m4                  | 105 +++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac             |   3 ++
 tools/hotplug/common/Makefile  |   1 +
 tools/ocaml/xenstored/Makefile |   5 ++
 tools/xenstore/Makefile        |   6 +++
 6 files changed, 126 insertions(+)
 create mode 100644 m4/systemd.m4
config/Tools.mk.in +6 -0
index 0bdf37a..c47e6af 100644
@@ -55,6 +55,12 @@ CONFIG_QEMU_TRAD    := @qemu_traditional@
 CONFIG_QEMU_XEN     := @qemu_xen@
 CONFIG_BLKTAP1      := @blktap1@
 
+CONFIG_SYSTEMD      := @systemd@
+SYSTEMD_CFLAGS      := @SYSTEMD_CFLAGS@
+SYSTEMD_LIBS        := @SYSTEMD_LIBS@
+XEN_SYSTEMD_DIR     := @SYSTEMD_DIR@
+XEN_SYSTEMD_MODULES_LOAD := @SYSTEMD_MODULES_LOAD@
+
 #System options
 ZLIB                := @zlib@
 CONFIG_LIBICONV     := @libiconv@
m4/systemd.m4 new file +105 -0
new file mode 100644
index 0000000..d5734d4
@@ -0,0 +1,105 @@
+# systemd.m4 - Macros to check for and enable systemd          -*- Autoconf -*-
+#
+# Copyright (C) 2014 Luis R. Rodriguez <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+dnl Some optional path options
+AC_DEFUN([AX_SYSTEMD_OPTIONS], [
+	AC_ARG_WITH(systemd, [  --with-systemd          set directory for systemd service files],
+		SYSTEMD_DIR="$withval", SYSTEMD_DIR="")
+	AC_SUBST(SYSTEMD_DIR)
+
+	AC_ARG_WITH(systemd, [  --with-systemd-modules-load          set directory for systemd modules load files],
+		SYSTEMD_MODULES_LOAD="$withval", SYSTEMD_MODULES_LOAD="")
+	AC_SUBST(SYSTEMD_MODULES_LOAD)
+])
+
+dnl Enables systemd by default and requires a --disable-systemd option flag
+dnl to configure if you want to disable.
+AC_DEFUN([AX_ENABLE_SYSTEMD_OPTS], [
+	AX_ARG_DEFAULT_ENABLE([systemd], [Disable systemd support])
+	AX_SYSTEMD_OPTIONS()
+])
+
+dnl Systemd will be disabled by default and requires you to run configure with
+dnl --enable-systemd to look for and enable systemd.
+AC_DEFUN([AX_ALLOW_SYSTEMD_OPTS], [
+	AX_ARG_DEFAULT_DISABLE([systemd], [Enable systemd support])
+	AX_SYSTEMD_OPTIONS()
+])
+
+AC_DEFUN([AX_CHECK_SYSTEMD_LIBS], [
+	AC_CHECK_HEADER([systemd/sd-daemon.h], [
+	    AC_CHECK_LIB([systemd-daemon], [sd_listen_fds], [libsystemddaemon="y"])
+	])
+	AS_IF([test "x$libsystemddaemon" = x], [
+	    AC_MSG_ERROR([Unable to find a suitable libsystemd-daemon library])
+	])
+
+	PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon])
+	dnl pkg-config older than 0.24 does not set these for
+	dnl PKG_CHECK_MODULES() worth also noting is that as of version 208
+	dnl of systemd pkg-config --cflags currently yields no extra flags yet.
+	AC_SUBST([SYSTEMD_CFLAGS])
+	AC_SUBST([SYSTEMD_LIBS])
+
+	AS_IF([test "x$SYSTEMD_DIR" = x], [
+	    dnl In order to use the line below we need to fix upstream systemd
+	    dnl to properly ${prefix} for child variables in
+	    dnl src/core/systemd.pc.in but this is a bit complex at the
+	    dnl moment as they depend on another rootprefix, which can vary
+	    dnl from prefix in practice. We provide our own definition as we
+	    dnl *know* where systemd will dump this to, but this does limit
+	    dnl us to stick to a non custom systemdsystemunitdir, dnl to work
+	    dnl around this we provide the additional configure option
+	    dnl --with-systemd where you can specify the directory for the unit
+	    dnl files. It would also be best to just extend the upstream
+	    dnl pkg-config  pkg.m4 with an AC_DEFUN() to do this neatly.
+	    dnl SYSTEMD_DIR="`$PKG_CONFIG --define-variable=prefix=$PREFIX --variable=systemdsystemunitdir systemd`"
+	    SYSTEMD_DIR="\$(prefix)/lib/systemd/system/"
+	], [])
+
+	AS_IF([test "x$SYSTEMD_DIR" = x], [
+	    AC_MSG_ERROR([SYSTEMD_DIR is unset])
+	], [])
+
+	dnl There is no variable for this yet for some reason
+	AS_IF([test "x$SYSTEMD_MODULES_LOAD" = x], [
+	    SYSTEMD_MODULES_LOAD="\$(prefix)/lib/modules-load.d/"
+	], [])
+
+	AS_IF([test "x$SYSTEMD_MODULES_LOAD" = x], [
+	    AC_MSG_ERROR([SYSTEMD_MODULES_LOAD is unset])
+	], [])
+])
+
+AC_DEFUN([AX_CHECK_SYSTEMD], [
+	AS_IF([test "x$systemd" = "xy" ], [
+	    AC_DEFINE([HAVE_SYSTEMD], [1], [Systemd available and enabled])
+	    systemd=y
+	    AX_CHECK_SYSTEMD_LIBS()
+	],[systemd=n])
+])
+
+AC_DEFUN([AX_ENABLE_SYSTEMD], [
+	AX_ENABLE_SYSTEMD_OPTS()
+	AX_CHECK_SYSTEMD()
+])
+
+AC_DEFUN([AX_ALLOW_SYSTEMD], [
+	AX_ALLOW_SYSTEMD_OPTS()
+	AX_CHECK_SYSTEMD()
+])
tools/configure.ac +1 -0
index 8a8831f..24d1109 100644
@@ -58,6 +58,7 @@ m4_include([../m4/extfs.m4])
 m4_include([../m4/fetcher.m4])
 m4_include([../m4/ax_compare_version.m4])
 m4_include([../m4/expand_config.m4])
+m4_include([../m4/systemd.m4])
 
 AX_XEN_EXPAND_CONFIG()
 

tools/configure.ac esac · line 266

Quoted 5 lines
tools/configure.ac +2 -0
@@ -261,5 +262,7 @@ esac
 # Checks for header files.
 AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h])
 
+dnl Once and if systemd is prevalent we can just use AX_ENABLE_SYSTEMD()
+AX_ALLOW_SYSTEMD()

Shouldn't systemd init scripts be installed by default if systemd is detect on the host?

Or are there cases of distros that install systemd but don't use it?

If I'm understanding this right, the user has to always pass --enable-systemd in order to get systemd init scripts installed.

tools/hotplug/common/Makefile line 3

Quoted 10 lines
tools/configure.ac +0 -0
 AC_OUTPUT()
 
tools/hotplug/common/Makefile +1 -0
index 4a63f40..45fd840 100644
@@ -1,5 +1,6 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/config/Tools.mk

tools/Rules.mk already includes config/Tools.mk

Quoted 27 lines
tools/hotplug/common/Makefile +0 -0
 HOTPLUGPATH="hotplugpath.sh"
 
tools/ocaml/xenstored/Makefile +5 -0
index 382a813..068e04a 100644
@@ -3,6 +3,11 @@ OCAML_TOPLEVEL = $(CURDIR)/..
 include $(OCAML_TOPLEVEL)/common.make
 
 CFLAGS += -I$(XEN_ROOT)/tools/
+CFLAGS-$(CONFIG_SYSTEMD)  += $(SYSTEMD_CFLAGS)
+LDFLAGS-$(CONFIG_SYSTEMD) += $(SYSTEMD_LIBS)
+
+CFLAGS  += $(CFLAGS-y)
+LDFLAGS += $(LDFLAGS-y)
 
 OCAMLINCLUDE += \
 	-I $(OCAML_TOPLEVEL)/libs/xb \
tools/xenstore/Makefile +0 -0
index 21a3f11..6adac7f 100644
@@ -9,6 +9,12 @@ CFLAGS += -I.
 CFLAGS += -I$(XEN_ROOT)/tools/
 CFLAGS += $(CFLAGS_libxenctrl)

tools/xenstore/Makefile CFLAGS += -I. · line 20

Quoted 10 lines
tools/xenstore/Makefile +6 -0
 
+CFLAGS-$(CONFIG_SYSTEMD)  += $(SYSTEMD_CFLAGS)
+LDFLAGS-$(CONFIG_SYSTEMD) += $(SYSTEMD_LIBS)
+
+CFLAGS  += $(CFLAGS-y)
+LDFLAGS += $(LDFLAGS-y)
+
 CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
 CLIENTS += xenstore-write xenstore-ls xenstore-watch
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#74 lore raw

Re: [PATCH v4 14/15] autoconf: xen: add systemd support into the build system

Quoted 7 lines · Roger Pau Monné

tools/configure.ac esac · line 266

Quoted 3 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

tools/configure.ac +2 -0
+dnl Once and if systemd is prevalent we can just use AX_ENABLE_SYSTEMD()
+AX_ALLOW_SYSTEMD()

Shouldn't systemd init scripts be installed by default if systemd is detect on the host?

That is up to whoever is building the stuff, if systemd is enabled then both old init scripts and systemd scripts will be installed.

Quoted 1 line

Or are there cases of distros that install systemd but don't use it?

There are cases where a system can have libraries for systemd but not have systemd.

Quoted 2 lines

If I'm understanding this right, the user has to always pass --enable-systemd in order to get systemd init scripts installed.

For now I think this is a good option as we get systemd widely tested, eventually I agree that this should be switched to AX_ENABLE_SYSTEMD() which will then enable systemd if systemd libraries are detected. I'd prefer we do this once we get all all this widely tested.

Quoted 12 lines

tools/hotplug/common/Makefile line 3

Quoted 10 lines

AC_OUTPUT()

tools/hotplug/common/Makefile +1 -0
index 4a63f40..45fd840 100644
@@ -1,5 +1,6 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/config/Tools.mk

tools/Rules.mk already includes config/Tools.mk

Good catch, changed.

Luis

#75 lore raw

Re: [PATCH v4 14/15] autoconf: xen: add systemd support into the build system

Quoted 9 lines · Luis R. Rodriguez
Quoted 7 lines · Roger Pau Monné

tools/configure.ac esac · line 266

Quoted 3 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

tools/configure.ac +2 -0
+dnl Once and if systemd is prevalent we can just use AX_ENABLE_SYSTEMD()
+AX_ALLOW_SYSTEMD()

Shouldn't systemd init scripts be installed by default if systemd is detect on the host?

Quoted 7 lines

That is up to whoever is building the stuff, if systemd is enabled then both old init scripts and systemd scripts will be installed.

Quoted 1 line

Or are there cases of distros that install systemd but don't use it?

There are cases where a system can have libraries for systemd but not have systemd.

At least in Debian there is support for installing systemd without having it supply /sbin/init, so that you can test by using init=/sbin/systemd without replacing your existing init.

And for distros generally it is certainly the case that you might want the distro binary package to support systemd without necessarily insisting on systemd at runtime.

Quoted 7 lines
Quoted 2 lines

If I'm understanding this right, the user has to always pass --enable-systemd in order to get systemd init scripts installed.

For now I think this is a good option as we get systemd widely tested, eventually I agree that this should be switched to AX_ENABLE_SYSTEMD() which will then enable systemd if systemd libraries are detected. I'd prefer we do this once we get all all this widely tested.

Since things must still work without systemd at runtime even if systemd was enable at build time I don't think there is any downside to enabling this by default if the libraries are present at configure time.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#76 lore raw

PATCH v4 15/15 autoconf: xen: trigger an update with autogen.sh

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

Now that all the series of autoconf updates have gone in trigger an updates so that downstream users don't have to run autogen.sh.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 configure         | 2396 ++++++++++++++++++++++++++++++++++++++++++++-
 stubdom/configure | 2390 +++++++++++++++++++++++++++++++++++++++++++++
 tools/config.h.in |    3 +
 tools/configure   | 2815 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 7583 insertions(+), 21 deletions(-)
configure +2394 -2
index d5c8500..c0f3ef2 100755
@@ -594,6 +594,39 @@ stubdom
 tools
 xen
 subdirs
+XENSTORED
+XENSTORE
+OCAMLFIND
+OCAMLBUILD
+OCAMLDOC
+OCAMLMKLIB
+OCAMLMKTOP
+OCAMLDEP
+OCAML
+OCAMLOPTDOTOPT
+OCAMLCDOTOPT
+OCAMLBEST
+OCAMLOPT
+OCAMLLIB
+OCAMLVERSION
+OCAMLC
+XEN_PAGING_DIR
+XEN_LOCK_DIR
+XEN_SCRIPT_DIR
+XEN_CONFIG_DIR
+CONFIG_DIR
+XENFIRMWAREDIR
+PRIVATE_BINDIR
+PKG_XEN_PREFIX
+PRIVATE_PREFIX
+SHAREDIR
+XEN_LIB_STORED
+XEN_LOG_DIR
+XEN_RUN_DIR
+LIBDIR
+LIBEXEC
+SBINDIR
+BINDIR
 host_os
 host_vendor
 host_cpu
@@ -643,6 +676,7 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+with_xenstored
 enable_xen
 enable_tools
 enable_stubdom
@@ -1272,6 +1306,21 @@ Optional Features:
   --enable-stubdom        Enable build and install of stubdom
   --disable-docs          Disable build and install of docs
 
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --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
+
 Report bugs to <[email protected]>.
 Xen Hypervisor home page: <http://www.xen.org/>.
 _ACEOF
@@ -1702,7 +1751,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ./config/Toplevel.mk"
+ac_config_files="$ac_config_files config/Toplevel.mk config/xen-environment-scripts config/xen-environment-header"
 
 
 ac_aux_dir=
@@ -1829,6 +1878,2347 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
+test "x$exec_prefix" = "xNONE" && exec_prefix=$ac_default_prefix
+
+BINDIR=$prefix/bin
+
+
+SBINDIR=$prefix/sbin
+
+
+LIBEXEC=$prefix/lib/xen/bin
+
+
+LIBDIR=`eval echo $libdir`
+
+
+XEN_RUN_DIR=/var/run/xen
+
+
+XEN_LOG_DIR=/var/log/xen
+
+
+XEN_LIB_STORED=/var/lib/xenstored
+
+
+SHAREDIR=$prefix/share
+
+
+PRIVATE_PREFIX=$LIBDIR/xen
+
+
+PKG_XEN_PREFIX=$LIBDIR/xen
+
+
+PRIVATE_BINDIR=$PRIVATE_PREFIX/bin
+
+
+XENFIRMWAREDIR=$prefix/lib/xen/boot
+
+
+CONFIG_DIR=/etc
+
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+
+
+XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
+
+
+XEN_LOCK_DIR=/var/lock
+
+
+XEN_RUN_DIR=/var/run/xen
+
+
+XEN_PAGING_DIR=/var/lib/xen/xenpaging
+
+
+
+
+
+
+if test "x$XENSTORE" = "x"; then :
+
+
+# Check whether --with-xenstored was given.
+if test "${with_xenstored+set}" = set; then :
+  withval=$with_xenstored;
+		if test "x$withval" = "xcxenstored"; then :
+
+			xenstore="cxenstored"
+			xenstored=$SBINDIR/xenstored
+
+fi
+		if test "x$withval" = "xoxenstored"; then :
+
+			xenstore="oxenstored"
+			xenstored=$SBINDIR/oxenstored
+
+	  # checking for ocamlc
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLC"; then
+  ac_cv_prog_OCAMLC="$OCAMLC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLC="${ac_tool_prefix}ocamlc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLC=$ac_cv_prog_OCAMLC
+if test -n "$OCAMLC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLC" >&5
+$as_echo "$OCAMLC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLC"; then
+  ac_ct_OCAMLC=$OCAMLC
+  # Extract the first word of "ocamlc", so it can be a program name with args.
+set dummy ocamlc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLC"; then
+  ac_cv_prog_ac_ct_OCAMLC="$ac_ct_OCAMLC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLC="ocamlc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLC=$ac_cv_prog_ac_ct_OCAMLC
+if test -n "$ac_ct_OCAMLC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLC" >&5
+$as_echo "$ac_ct_OCAMLC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLC" = x; then
+    OCAMLC="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLC=$ac_ct_OCAMLC
+  fi
+else
+  OCAMLC="$ac_cv_prog_OCAMLC"
+fi
+
+
+  if test "$OCAMLC" != "no"; then
+     OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'`
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml version is $OCAMLVERSION" >&5
+$as_echo "OCaml version is $OCAMLVERSION" >&6; }
+     # If OCAMLLIB is set, use it
+     if test "$OCAMLLIB" = ""; then
+        OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4`
+     else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCAMLLIB previously set; preserving it." >&5
+$as_echo "OCAMLLIB previously set; preserving it." >&6; }
+     fi
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml library path is $OCAMLLIB" >&5
+$as_echo "OCaml library path is $OCAMLLIB" >&6; }
+
+
+
+
+     # checking for ocamlopt
+     if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlopt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlopt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLOPT"; then
+  ac_cv_prog_OCAMLOPT="$OCAMLOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLOPT="${ac_tool_prefix}ocamlopt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLOPT=$ac_cv_prog_OCAMLOPT
+if test -n "$OCAMLOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPT" >&5
+$as_echo "$OCAMLOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLOPT"; then
+  ac_ct_OCAMLOPT=$OCAMLOPT
+  # Extract the first word of "ocamlopt", so it can be a program name with args.
+set dummy ocamlopt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLOPT"; then
+  ac_cv_prog_ac_ct_OCAMLOPT="$ac_ct_OCAMLOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLOPT="ocamlopt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLOPT=$ac_cv_prog_ac_ct_OCAMLOPT
+if test -n "$ac_ct_OCAMLOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPT" >&5
+$as_echo "$ac_ct_OCAMLOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLOPT" = x; then
+    OCAMLOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLOPT=$ac_ct_OCAMLOPT
+  fi
+else
+  OCAMLOPT="$ac_cv_prog_OCAMLOPT"
+fi
+
+     OCAMLBEST=byte
+     if test "$OCAMLOPT" = "no"; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find ocamlopt; bytecode compilation only." >&5
+$as_echo "$as_me: WARNING: Cannot find ocamlopt; bytecode compilation only." >&2;}
+     else
+	TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlopt discarded." >&5
+$as_echo "versions differs from ocamlc; ocamlopt discarded." >&6; }
+	    OCAMLOPT=no
+	else
+	    OCAMLBEST=opt
+	fi
+     fi
+
+
+
+     # checking for ocamlc.opt
+     if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlc.opt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlc.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLCDOTOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLCDOTOPT"; then
+  ac_cv_prog_OCAMLCDOTOPT="$OCAMLCDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLCDOTOPT="${ac_tool_prefix}ocamlc.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLCDOTOPT=$ac_cv_prog_OCAMLCDOTOPT
+if test -n "$OCAMLCDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLCDOTOPT" >&5
+$as_echo "$OCAMLCDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLCDOTOPT"; then
+  ac_ct_OCAMLCDOTOPT=$OCAMLCDOTOPT
+  # Extract the first word of "ocamlc.opt", so it can be a program name with args.
+set dummy ocamlc.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLCDOTOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLCDOTOPT"; then
+  ac_cv_prog_ac_ct_OCAMLCDOTOPT="$ac_ct_OCAMLCDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLCDOTOPT="ocamlc.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLCDOTOPT=$ac_cv_prog_ac_ct_OCAMLCDOTOPT
+if test -n "$ac_ct_OCAMLCDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLCDOTOPT" >&5
+$as_echo "$ac_ct_OCAMLCDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLCDOTOPT" = x; then
+    OCAMLCDOTOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLCDOTOPT=$ac_ct_OCAMLCDOTOPT
+  fi
+else
+  OCAMLCDOTOPT="$ac_cv_prog_OCAMLCDOTOPT"
+fi
+
+     if test "$OCAMLCDOTOPT" != "no"; then
+	TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlc.opt discarded." >&5
+$as_echo "versions differs from ocamlc; ocamlc.opt discarded." >&6; }
+	else
+	    OCAMLC=$OCAMLCDOTOPT
+	fi
+     fi
+
+     # checking for ocamlopt.opt
+     if test "$OCAMLOPT" != "no" ; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlopt.opt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlopt.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLOPTDOTOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLOPTDOTOPT"; then
+  ac_cv_prog_OCAMLOPTDOTOPT="$OCAMLOPTDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLOPTDOTOPT="${ac_tool_prefix}ocamlopt.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLOPTDOTOPT=$ac_cv_prog_OCAMLOPTDOTOPT
+if test -n "$OCAMLOPTDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPTDOTOPT" >&5
+$as_echo "$OCAMLOPTDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLOPTDOTOPT"; then
+  ac_ct_OCAMLOPTDOTOPT=$OCAMLOPTDOTOPT
+  # Extract the first word of "ocamlopt.opt", so it can be a program name with args.
+set dummy ocamlopt.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLOPTDOTOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLOPTDOTOPT"; then
+  ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="$ac_ct_OCAMLOPTDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="ocamlopt.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLOPTDOTOPT=$ac_cv_prog_ac_ct_OCAMLOPTDOTOPT
+if test -n "$ac_ct_OCAMLOPTDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPTDOTOPT" >&5
+$as_echo "$ac_ct_OCAMLOPTDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLOPTDOTOPT" = x; then
+    OCAMLOPTDOTOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLOPTDOTOPT=$ac_ct_OCAMLOPTDOTOPT
+  fi
+else
+  OCAMLOPTDOTOPT="$ac_cv_prog_OCAMLOPTDOTOPT"
+fi
+
+	if test "$OCAMLOPTDOTOPT" != "no"; then
+	   TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	   if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	      { $as_echo "$as_me:${as_lineno-$LINENO}: result: version differs from ocamlc; ocamlopt.opt discarded." >&5
+$as_echo "version differs from ocamlc; ocamlopt.opt discarded." >&6; }
+	   else
+	      OCAMLOPT=$OCAMLOPTDOTOPT
+	   fi
+        fi
+     fi
+
+
+  fi
+
+
+
+  # checking for ocaml toplevel
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocaml", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocaml; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAML+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAML"; then
+  ac_cv_prog_OCAML="$OCAML" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAML="${ac_tool_prefix}ocaml"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAML=$ac_cv_prog_OCAML
+if test -n "$OCAML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAML" >&5
+$as_echo "$OCAML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAML"; then
+  ac_ct_OCAML=$OCAML
+  # Extract the first word of "ocaml", so it can be a program name with args.
+set dummy ocaml; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAML+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAML"; then
+  ac_cv_prog_ac_ct_OCAML="$ac_ct_OCAML" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAML="ocaml"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAML=$ac_cv_prog_ac_ct_OCAML
+if test -n "$ac_ct_OCAML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAML" >&5
+$as_echo "$ac_ct_OCAML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAML" = x; then
+    OCAML="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAML=$ac_ct_OCAML
+  fi
+else
+  OCAML="$ac_cv_prog_OCAML"
+fi
+
+
+  # checking for ocamldep
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamldep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamldep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLDEP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLDEP"; then
+  ac_cv_prog_OCAMLDEP="$OCAMLDEP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLDEP="${ac_tool_prefix}ocamldep"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLDEP=$ac_cv_prog_OCAMLDEP
+if test -n "$OCAMLDEP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDEP" >&5
+$as_echo "$OCAMLDEP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLDEP"; then
+  ac_ct_OCAMLDEP=$OCAMLDEP
+  # Extract the first word of "ocamldep", so it can be a program name with args.
+set dummy ocamldep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLDEP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLDEP"; then
+  ac_cv_prog_ac_ct_OCAMLDEP="$ac_ct_OCAMLDEP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLDEP="ocamldep"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLDEP=$ac_cv_prog_ac_ct_OCAMLDEP
+if test -n "$ac_ct_OCAMLDEP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDEP" >&5
+$as_echo "$ac_ct_OCAMLDEP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLDEP" = x; then
+    OCAMLDEP="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLDEP=$ac_ct_OCAMLDEP
+  fi
+else
+  OCAMLDEP="$ac_cv_prog_OCAMLDEP"
+fi
+
+
+  # checking for ocamlmktop
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlmktop", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlmktop; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLMKTOP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLMKTOP"; then
+  ac_cv_prog_OCAMLMKTOP="$OCAMLMKTOP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLMKTOP="${ac_tool_prefix}ocamlmktop"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLMKTOP=$ac_cv_prog_OCAMLMKTOP
+if test -n "$OCAMLMKTOP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKTOP" >&5
+$as_echo "$OCAMLMKTOP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLMKTOP"; then
+  ac_ct_OCAMLMKTOP=$OCAMLMKTOP
+  # Extract the first word of "ocamlmktop", so it can be a program name with args.
+set dummy ocamlmktop; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLMKTOP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLMKTOP"; then
+  ac_cv_prog_ac_ct_OCAMLMKTOP="$ac_ct_OCAMLMKTOP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLMKTOP="ocamlmktop"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLMKTOP=$ac_cv_prog_ac_ct_OCAMLMKTOP
+if test -n "$ac_ct_OCAMLMKTOP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKTOP" >&5
+$as_echo "$ac_ct_OCAMLMKTOP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLMKTOP" = x; then
+    OCAMLMKTOP="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLMKTOP=$ac_ct_OCAMLMKTOP
+  fi
+else
+  OCAMLMKTOP="$ac_cv_prog_OCAMLMKTOP"
+fi
+
+
+  # checking for ocamlmklib
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlmklib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlmklib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLMKLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLMKLIB"; then
+  ac_cv_prog_OCAMLMKLIB="$OCAMLMKLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLMKLIB="${ac_tool_prefix}ocamlmklib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLMKLIB=$ac_cv_prog_OCAMLMKLIB
+if test -n "$OCAMLMKLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKLIB" >&5
+$as_echo "$OCAMLMKLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLMKLIB"; then
+  ac_ct_OCAMLMKLIB=$OCAMLMKLIB
+  # Extract the first word of "ocamlmklib", so it can be a program name with args.
+set dummy ocamlmklib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLMKLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLMKLIB"; then
+  ac_cv_prog_ac_ct_OCAMLMKLIB="$ac_ct_OCAMLMKLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLMKLIB="ocamlmklib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLMKLIB=$ac_cv_prog_ac_ct_OCAMLMKLIB
+if test -n "$ac_ct_OCAMLMKLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKLIB" >&5
+$as_echo "$ac_ct_OCAMLMKLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLMKLIB" = x; then
+    OCAMLMKLIB="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLMKLIB=$ac_ct_OCAMLMKLIB
+  fi
+else
+  OCAMLMKLIB="$ac_cv_prog_OCAMLMKLIB"
+fi
+
+
+  # checking for ocamldoc
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamldoc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamldoc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLDOC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLDOC"; then
+  ac_cv_prog_OCAMLDOC="$OCAMLDOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLDOC="${ac_tool_prefix}ocamldoc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLDOC=$ac_cv_prog_OCAMLDOC
+if test -n "$OCAMLDOC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDOC" >&5
+$as_echo "$OCAMLDOC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLDOC"; then
+  ac_ct_OCAMLDOC=$OCAMLDOC
+  # Extract the first word of "ocamldoc", so it can be a program name with args.
+set dummy ocamldoc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLDOC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLDOC"; then
+  ac_cv_prog_ac_ct_OCAMLDOC="$ac_ct_OCAMLDOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLDOC="ocamldoc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLDOC=$ac_cv_prog_ac_ct_OCAMLDOC
+if test -n "$ac_ct_OCAMLDOC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDOC" >&5
+$as_echo "$ac_ct_OCAMLDOC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLDOC" = x; then
+    OCAMLDOC="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLDOC=$ac_ct_OCAMLDOC
+  fi
+else
+  OCAMLDOC="$ac_cv_prog_OCAMLDOC"
+fi
+
+
+  # checking for ocamlbuild
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlbuild", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlbuild; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLBUILD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLBUILD"; then
+  ac_cv_prog_OCAMLBUILD="$OCAMLBUILD" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLBUILD="${ac_tool_prefix}ocamlbuild"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLBUILD=$ac_cv_prog_OCAMLBUILD
+if test -n "$OCAMLBUILD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLBUILD" >&5
+$as_echo "$OCAMLBUILD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLBUILD"; then
+  ac_ct_OCAMLBUILD=$OCAMLBUILD
+  # Extract the first word of "ocamlbuild", so it can be a program name with args.
+set dummy ocamlbuild; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLBUILD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLBUILD"; then
+  ac_cv_prog_ac_ct_OCAMLBUILD="$ac_ct_OCAMLBUILD" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLBUILD="ocamlbuild"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLBUILD=$ac_cv_prog_ac_ct_OCAMLBUILD
+if test -n "$ac_ct_OCAMLBUILD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLBUILD" >&5
+$as_echo "$ac_ct_OCAMLBUILD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLBUILD" = x; then
+    OCAMLBUILD="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLBUILD=$ac_ct_OCAMLBUILD
+  fi
+else
+  OCAMLBUILD="$ac_cv_prog_OCAMLBUILD"
+fi
+
+
+
+  # checking for ocamlfind
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlfind", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlfind; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLFIND+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLFIND"; then
+  ac_cv_prog_OCAMLFIND="$OCAMLFIND" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLFIND="${ac_tool_prefix}ocamlfind"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLFIND=$ac_cv_prog_OCAMLFIND
+if test -n "$OCAMLFIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLFIND" >&5
+$as_echo "$OCAMLFIND" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLFIND"; then
+  ac_ct_OCAMLFIND=$OCAMLFIND
+  # Extract the first word of "ocamlfind", so it can be a program name with args.
+set dummy ocamlfind; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLFIND+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLFIND"; then
+  ac_cv_prog_ac_ct_OCAMLFIND="$ac_ct_OCAMLFIND" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLFIND="ocamlfind"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLFIND=$ac_cv_prog_ac_ct_OCAMLFIND
+if test -n "$ac_ct_OCAMLFIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLFIND" >&5
+$as_echo "$ac_ct_OCAMLFIND" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLFIND" = x; then
+    OCAMLFIND="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLFIND=$ac_ct_OCAMLFIND
+  fi
+else
+  OCAMLFIND="$ac_cv_prog_OCAMLFIND"
+fi
+
+
+
+	if test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"; then :
+
+		as_fn_error $? "Missing ocaml dependencies for oxenstored, try installing ocaml ocaml-compiler-libs ocaml-runtime ocaml-findlib" "$LINENO" 5
+
+fi
+
+
+fi
+		if test "x$withval" != "xoxenstored" && test "x$withval" != "xcxenstored"; then :
+
+			as_fn_error $? "Unsupported xenstored specified, supported types: oxenstored cxenstored" "$LINENO" 5
+
+fi
+
+else
+
+
+	xenstore="oxenstored"
+	xenstored=$SBINDIR/oxenstored
+	  # checking for ocamlc
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLC"; then
+  ac_cv_prog_OCAMLC="$OCAMLC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLC="${ac_tool_prefix}ocamlc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLC=$ac_cv_prog_OCAMLC
+if test -n "$OCAMLC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLC" >&5
+$as_echo "$OCAMLC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLC"; then
+  ac_ct_OCAMLC=$OCAMLC
+  # Extract the first word of "ocamlc", so it can be a program name with args.
+set dummy ocamlc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLC"; then
+  ac_cv_prog_ac_ct_OCAMLC="$ac_ct_OCAMLC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLC="ocamlc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLC=$ac_cv_prog_ac_ct_OCAMLC
+if test -n "$ac_ct_OCAMLC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLC" >&5
+$as_echo "$ac_ct_OCAMLC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLC" = x; then
+    OCAMLC="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLC=$ac_ct_OCAMLC
+  fi
+else
+  OCAMLC="$ac_cv_prog_OCAMLC"
+fi
+
+
+  if test "$OCAMLC" != "no"; then
+     OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'`
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml version is $OCAMLVERSION" >&5
+$as_echo "OCaml version is $OCAMLVERSION" >&6; }
+     # If OCAMLLIB is set, use it
+     if test "$OCAMLLIB" = ""; then
+        OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4`
+     else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCAMLLIB previously set; preserving it." >&5
+$as_echo "OCAMLLIB previously set; preserving it." >&6; }
+     fi
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml library path is $OCAMLLIB" >&5
+$as_echo "OCaml library path is $OCAMLLIB" >&6; }
+
+
+
+
+     # checking for ocamlopt
+     if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlopt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlopt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLOPT"; then
+  ac_cv_prog_OCAMLOPT="$OCAMLOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLOPT="${ac_tool_prefix}ocamlopt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLOPT=$ac_cv_prog_OCAMLOPT
+if test -n "$OCAMLOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPT" >&5
+$as_echo "$OCAMLOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLOPT"; then
+  ac_ct_OCAMLOPT=$OCAMLOPT
+  # Extract the first word of "ocamlopt", so it can be a program name with args.
+set dummy ocamlopt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLOPT"; then
+  ac_cv_prog_ac_ct_OCAMLOPT="$ac_ct_OCAMLOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLOPT="ocamlopt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLOPT=$ac_cv_prog_ac_ct_OCAMLOPT
+if test -n "$ac_ct_OCAMLOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPT" >&5
+$as_echo "$ac_ct_OCAMLOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLOPT" = x; then
+    OCAMLOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLOPT=$ac_ct_OCAMLOPT
+  fi
+else
+  OCAMLOPT="$ac_cv_prog_OCAMLOPT"
+fi
+
+     OCAMLBEST=byte
+     if test "$OCAMLOPT" = "no"; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find ocamlopt; bytecode compilation only." >&5
+$as_echo "$as_me: WARNING: Cannot find ocamlopt; bytecode compilation only." >&2;}
+     else
+	TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlopt discarded." >&5
+$as_echo "versions differs from ocamlc; ocamlopt discarded." >&6; }
+	    OCAMLOPT=no
+	else
+	    OCAMLBEST=opt
+	fi
+     fi
+
+
+
+     # checking for ocamlc.opt
+     if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlc.opt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlc.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLCDOTOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLCDOTOPT"; then
+  ac_cv_prog_OCAMLCDOTOPT="$OCAMLCDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLCDOTOPT="${ac_tool_prefix}ocamlc.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLCDOTOPT=$ac_cv_prog_OCAMLCDOTOPT
+if test -n "$OCAMLCDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLCDOTOPT" >&5
+$as_echo "$OCAMLCDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLCDOTOPT"; then
+  ac_ct_OCAMLCDOTOPT=$OCAMLCDOTOPT
+  # Extract the first word of "ocamlc.opt", so it can be a program name with args.
+set dummy ocamlc.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLCDOTOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLCDOTOPT"; then
+  ac_cv_prog_ac_ct_OCAMLCDOTOPT="$ac_ct_OCAMLCDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLCDOTOPT="ocamlc.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLCDOTOPT=$ac_cv_prog_ac_ct_OCAMLCDOTOPT
+if test -n "$ac_ct_OCAMLCDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLCDOTOPT" >&5
+$as_echo "$ac_ct_OCAMLCDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLCDOTOPT" = x; then
+    OCAMLCDOTOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLCDOTOPT=$ac_ct_OCAMLCDOTOPT
+  fi
+else
+  OCAMLCDOTOPT="$ac_cv_prog_OCAMLCDOTOPT"
+fi
+
+     if test "$OCAMLCDOTOPT" != "no"; then
+	TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlc.opt discarded." >&5
+$as_echo "versions differs from ocamlc; ocamlc.opt discarded." >&6; }
+	else
+	    OCAMLC=$OCAMLCDOTOPT
+	fi
+     fi
+
+     # checking for ocamlopt.opt
+     if test "$OCAMLOPT" != "no" ; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlopt.opt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlopt.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLOPTDOTOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLOPTDOTOPT"; then
+  ac_cv_prog_OCAMLOPTDOTOPT="$OCAMLOPTDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLOPTDOTOPT="${ac_tool_prefix}ocamlopt.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLOPTDOTOPT=$ac_cv_prog_OCAMLOPTDOTOPT
+if test -n "$OCAMLOPTDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPTDOTOPT" >&5
+$as_echo "$OCAMLOPTDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLOPTDOTOPT"; then
+  ac_ct_OCAMLOPTDOTOPT=$OCAMLOPTDOTOPT
+  # Extract the first word of "ocamlopt.opt", so it can be a program name with args.
+set dummy ocamlopt.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLOPTDOTOPT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLOPTDOTOPT"; then
+  ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="$ac_ct_OCAMLOPTDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="ocamlopt.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLOPTDOTOPT=$ac_cv_prog_ac_ct_OCAMLOPTDOTOPT
+if test -n "$ac_ct_OCAMLOPTDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPTDOTOPT" >&5
+$as_echo "$ac_ct_OCAMLOPTDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLOPTDOTOPT" = x; then
+    OCAMLOPTDOTOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLOPTDOTOPT=$ac_ct_OCAMLOPTDOTOPT
+  fi
+else
+  OCAMLOPTDOTOPT="$ac_cv_prog_OCAMLOPTDOTOPT"
+fi
+
+	if test "$OCAMLOPTDOTOPT" != "no"; then
+	   TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	   if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	      { $as_echo "$as_me:${as_lineno-$LINENO}: result: version differs from ocamlc; ocamlopt.opt discarded." >&5
+$as_echo "version differs from ocamlc; ocamlopt.opt discarded." >&6; }
+	   else
+	      OCAMLOPT=$OCAMLOPTDOTOPT
+	   fi
+        fi
+     fi
+
+
+  fi
+
+
+
+  # checking for ocaml toplevel
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocaml", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocaml; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAML+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAML"; then
+  ac_cv_prog_OCAML="$OCAML" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAML="${ac_tool_prefix}ocaml"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAML=$ac_cv_prog_OCAML
+if test -n "$OCAML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAML" >&5
+$as_echo "$OCAML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAML"; then
+  ac_ct_OCAML=$OCAML
+  # Extract the first word of "ocaml", so it can be a program name with args.
+set dummy ocaml; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAML+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAML"; then
+  ac_cv_prog_ac_ct_OCAML="$ac_ct_OCAML" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAML="ocaml"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAML=$ac_cv_prog_ac_ct_OCAML
+if test -n "$ac_ct_OCAML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAML" >&5
+$as_echo "$ac_ct_OCAML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAML" = x; then
+    OCAML="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAML=$ac_ct_OCAML
+  fi
+else
+  OCAML="$ac_cv_prog_OCAML"
+fi
+
+
+  # checking for ocamldep
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamldep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamldep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLDEP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLDEP"; then
+  ac_cv_prog_OCAMLDEP="$OCAMLDEP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLDEP="${ac_tool_prefix}ocamldep"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLDEP=$ac_cv_prog_OCAMLDEP
+if test -n "$OCAMLDEP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDEP" >&5
+$as_echo "$OCAMLDEP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLDEP"; then
+  ac_ct_OCAMLDEP=$OCAMLDEP
+  # Extract the first word of "ocamldep", so it can be a program name with args.
+set dummy ocamldep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLDEP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLDEP"; then
+  ac_cv_prog_ac_ct_OCAMLDEP="$ac_ct_OCAMLDEP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLDEP="ocamldep"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLDEP=$ac_cv_prog_ac_ct_OCAMLDEP
+if test -n "$ac_ct_OCAMLDEP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDEP" >&5
+$as_echo "$ac_ct_OCAMLDEP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLDEP" = x; then
+    OCAMLDEP="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLDEP=$ac_ct_OCAMLDEP
+  fi
+else
+  OCAMLDEP="$ac_cv_prog_OCAMLDEP"
+fi
+
+
+  # checking for ocamlmktop
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlmktop", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlmktop; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLMKTOP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLMKTOP"; then
+  ac_cv_prog_OCAMLMKTOP="$OCAMLMKTOP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLMKTOP="${ac_tool_prefix}ocamlmktop"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLMKTOP=$ac_cv_prog_OCAMLMKTOP
+if test -n "$OCAMLMKTOP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKTOP" >&5
+$as_echo "$OCAMLMKTOP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLMKTOP"; then
+  ac_ct_OCAMLMKTOP=$OCAMLMKTOP
+  # Extract the first word of "ocamlmktop", so it can be a program name with args.
+set dummy ocamlmktop; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLMKTOP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLMKTOP"; then
+  ac_cv_prog_ac_ct_OCAMLMKTOP="$ac_ct_OCAMLMKTOP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLMKTOP="ocamlmktop"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLMKTOP=$ac_cv_prog_ac_ct_OCAMLMKTOP
+if test -n "$ac_ct_OCAMLMKTOP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKTOP" >&5
+$as_echo "$ac_ct_OCAMLMKTOP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLMKTOP" = x; then
+    OCAMLMKTOP="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLMKTOP=$ac_ct_OCAMLMKTOP
+  fi
+else
+  OCAMLMKTOP="$ac_cv_prog_OCAMLMKTOP"
+fi
+
+
+  # checking for ocamlmklib
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlmklib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlmklib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLMKLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLMKLIB"; then
+  ac_cv_prog_OCAMLMKLIB="$OCAMLMKLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLMKLIB="${ac_tool_prefix}ocamlmklib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLMKLIB=$ac_cv_prog_OCAMLMKLIB
+if test -n "$OCAMLMKLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKLIB" >&5
+$as_echo "$OCAMLMKLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLMKLIB"; then
+  ac_ct_OCAMLMKLIB=$OCAMLMKLIB
+  # Extract the first word of "ocamlmklib", so it can be a program name with args.
+set dummy ocamlmklib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLMKLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLMKLIB"; then
+  ac_cv_prog_ac_ct_OCAMLMKLIB="$ac_ct_OCAMLMKLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLMKLIB="ocamlmklib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLMKLIB=$ac_cv_prog_ac_ct_OCAMLMKLIB
+if test -n "$ac_ct_OCAMLMKLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKLIB" >&5
+$as_echo "$ac_ct_OCAMLMKLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLMKLIB" = x; then
+    OCAMLMKLIB="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLMKLIB=$ac_ct_OCAMLMKLIB
+  fi
+else
+  OCAMLMKLIB="$ac_cv_prog_OCAMLMKLIB"
+fi
+
+
+  # checking for ocamldoc
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamldoc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamldoc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLDOC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLDOC"; then
+  ac_cv_prog_OCAMLDOC="$OCAMLDOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLDOC="${ac_tool_prefix}ocamldoc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLDOC=$ac_cv_prog_OCAMLDOC
+if test -n "$OCAMLDOC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDOC" >&5
+$as_echo "$OCAMLDOC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLDOC"; then
+  ac_ct_OCAMLDOC=$OCAMLDOC
+  # Extract the first word of "ocamldoc", so it can be a program name with args.
+set dummy ocamldoc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLDOC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLDOC"; then
+  ac_cv_prog_ac_ct_OCAMLDOC="$ac_ct_OCAMLDOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLDOC="ocamldoc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLDOC=$ac_cv_prog_ac_ct_OCAMLDOC
+if test -n "$ac_ct_OCAMLDOC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDOC" >&5
+$as_echo "$ac_ct_OCAMLDOC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLDOC" = x; then
+    OCAMLDOC="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLDOC=$ac_ct_OCAMLDOC
+  fi
+else
+  OCAMLDOC="$ac_cv_prog_OCAMLDOC"
+fi
+
+
+  # checking for ocamlbuild
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlbuild", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlbuild; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLBUILD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLBUILD"; then
+  ac_cv_prog_OCAMLBUILD="$OCAMLBUILD" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLBUILD="${ac_tool_prefix}ocamlbuild"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLBUILD=$ac_cv_prog_OCAMLBUILD
+if test -n "$OCAMLBUILD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLBUILD" >&5
+$as_echo "$OCAMLBUILD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLBUILD"; then
+  ac_ct_OCAMLBUILD=$OCAMLBUILD
+  # Extract the first word of "ocamlbuild", so it can be a program name with args.
+set dummy ocamlbuild; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLBUILD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLBUILD"; then
+  ac_cv_prog_ac_ct_OCAMLBUILD="$ac_ct_OCAMLBUILD" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLBUILD="ocamlbuild"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLBUILD=$ac_cv_prog_ac_ct_OCAMLBUILD
+if test -n "$ac_ct_OCAMLBUILD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLBUILD" >&5
+$as_echo "$ac_ct_OCAMLBUILD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLBUILD" = x; then
+    OCAMLBUILD="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLBUILD=$ac_ct_OCAMLBUILD
+  fi
+else
+  OCAMLBUILD="$ac_cv_prog_OCAMLBUILD"
+fi
+
+
+
+  # checking for ocamlfind
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlfind", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlfind; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLFIND+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLFIND"; then
+  ac_cv_prog_OCAMLFIND="$OCAMLFIND" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OCAMLFIND="${ac_tool_prefix}ocamlfind"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLFIND=$ac_cv_prog_OCAMLFIND
+if test -n "$OCAMLFIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLFIND" >&5
+$as_echo "$OCAMLFIND" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLFIND"; then
+  ac_ct_OCAMLFIND=$OCAMLFIND
+  # Extract the first word of "ocamlfind", so it can be a program name with args.
+set dummy ocamlfind; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OCAMLFIND+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLFIND"; then
+  ac_cv_prog_ac_ct_OCAMLFIND="$ac_ct_OCAMLFIND" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OCAMLFIND="ocamlfind"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLFIND=$ac_cv_prog_ac_ct_OCAMLFIND
+if test -n "$ac_ct_OCAMLFIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLFIND" >&5
+$as_echo "$ac_ct_OCAMLFIND" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLFIND" = x; then
+    OCAMLFIND="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLFIND=$ac_ct_OCAMLFIND
+  fi
+else
+  OCAMLFIND="$ac_cv_prog_OCAMLFIND"
+fi
+
+
+
+	if test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"; then :
+
+		xenstore="cxenstored"
+		xenstored=$SBINDIR/xenstored
+
+fi
+
+
+fi
+
+
+fi
+
+XENSTORE=$xenstore
+
+
+if test "x$XENSTORED" = "x"; then :
+
+	XENSTORED=$xenstored
+
+fi
+
+
+if test "x$XENSTORE" != "xcxenstored" && test "x$XENSTORE" != "xoxenstored"; then :
+  as_fn_error $? "Invalid xenstore: $XENSTORE" "$LINENO" 5
+fi
+
+
 case "$host_cpu" in
     i[3456]86|x86_64)
         arch_enable_stubdom=y
@@ -2749,7 +5139,9 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
-    "./config/Toplevel.mk") CONFIG_FILES="$CONFIG_FILES ./config/Toplevel.mk" ;;
+    "config/Toplevel.mk") CONFIG_FILES="$CONFIG_FILES config/Toplevel.mk" ;;
+    "config/xen-environment-scripts") CONFIG_FILES="$CONFIG_FILES config/xen-environment-scripts" ;;
+    "config/xen-environment-header") CONFIG_FILES="$CONFIG_FILES config/xen-environment-header" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
stubdom/configure +2390 -0

568 lines not on this page · raw message

tools/config.h.in +3 -0
index 015f2a1..c005c36 100644

Lines of this file are not shown. View the raw message.

tools/configure +2796 -19

2,815 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 7 lines
1.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Part of the diff is not shown here. View the raw message.

#77 lore raw

Re: [PATCH v4 15/15] autoconf: xen: trigger an update with autogen.sh

Quoted 4 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

Now that all the series of autoconf updates have gone in trigger an updates so that downstream users don't have to run autogen.sh.

Please do this bit by bit as you update the sources and include a note for the committer to rerun autogen.sh. (up to you if you want to also include the regeneration in the patch, but it is usually less bulky to not do so)

#78 lore raw

Re: [PATCH v4 15/15] autoconf: xen: trigger an update with autogen.sh

Quoted 10 lines · Ian Campbell
Quoted 4 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

Now that all the series of autoconf updates have gone in trigger an updates so that downstream users don't have to run autogen.sh.

Please do this bit by bit as you update the sources and include a note for the committer to rerun autogen.sh. (up to you if you want to also include the regeneration in the patch, but it is usually less bulky to not do so)

To be clear you don't need the generation yourself, but instead will do it yourself? If so then yeah that'd be great, this output is a waste of bytes IMHO and just clutters the mailing list.

Luis

#79 lore raw

Re: [PATCH v4 15/15] autoconf: xen: trigger an update with autogen.sh

Quoted 7 lines · Luis R. Rodriguez
Quoted 6 lines · Ian Campbell
Quoted 4 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

Now that all the series of autoconf updates have gone in trigger an updates so that downstream users don't have to run autogen.sh.

Quoted 7 lines
Quoted 4 lines

Please do this bit by bit as you update the sources and include a note for the committer to rerun autogen.sh. (up to you if you want to also include the regeneration in the patch, but it is usually less bulky to not do so)

To be clear you don't need the generation yourself, but instead will do it yourself?

Yes I can regenerate while committing. Please note in each patch where this needs to be done, after the commit message and --- marker, e.g. as Roger did in
http://article.gmane.org/gmane.comp.emulators.xen.devel/195900

Ian.

#80 lore raw
In reply to Luis R. Rodriguez
Quoted 1 line · Luis R. Rodriguez

nc -U /var/run/xenstored/socket_ro

Note that xl doesn't look for the socket first, when systemd is enabled this optimization can now be enabled and therefore would be triggered upon demand. I'm not going to work on that though.

Luis

#81 lore raw
Quoted 5 lines · Luis R. Rodriguez
Quoted 1 line · Luis R. Rodriguez

nc -U /var/run/xenstored/socket_ro

Note that xl doesn't look for the socket first,

ISTR there was a reason for that, but I don't recall what it was...

Ian.

#82 lore raw
In reply to Luis R. Rodriguez
Quoted 65 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This is my 4th series which I addresses all feedback from the first 3 series on adding systemd support into xen. I've taken things a bit further, I've been avoiding autoconf but in the end that proved to provide the best solution. Additionally not originally understanding systemd's socket stuff prompted me to look into that and decided its best to just switch to active sockets for systemd [0] intregration for both censtored and oxenstored. I've also decided its best to avoid separate service files for the two daemons given that we can do this cleanly with autoconf.

I've run time tested this against today's tip against the upstream kernel, on OpenSUSE using both censtored and oxenstored.

To build you can use either of with the default preferring oxenstored if ocaml tools are present:

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

Systems should just have to:

systemctl enable xenstored.socket

And then anything that will tickle the sockets:

/var/run/xenstored/socket
/var/run/xenstored/socket_ro

will trigger either censtored or oxenstored to activate. This example suffices:

nc -U /var/run/xenstored/socket_ro

This example also happens to test the order of supply / demand of sockets through sytsemd's active socket mechanism and our integration to do this in order. Sine we cannot currently stop the xenstore this means we cannot take advantage of dynamically switching xensrores live, but if that is fixed we should be able to dynamically swap even the different types of xenstore on a live system or just upgrade the xenstore without a reboot.

The ordering of active sockets implementation is begging to be shared with a common small library but given that xc / xl are not specific to the xenstore it would be pointless to stuff and duplicate code for both in there. Both the cxenstore and oxenstored handle their own store access on their own, if there's a desire to unify that small piece of code we should consider other things to stuff on it. For now this goes separately.

Systemd autconf support was split out as much as possible from xen to make it useful for any other project, perhaps this can go upstream to systemd.

Ocaml lacks support for systemd and as such I needed to extend oxenstored support through a small stub for access to systemd. System'd sd_listen_fds() can technically easily be implemented in ocaml *but* given that FD_CLOEXEC support through the new Unix.set_cloexec is only available on 4.00.1+dev which isn't yet widely available I decided agianst this, this lets systemd take care of FD_CLOEXEC for us. Proper support for systemd should instead in the end be merged upstream into ocaml, but who knows when that will happen.

Quoted 6 lines

Given the slew of autoconf updates to xen I only provide an autogen.sh update after the last change to make things easier to review.

[0] http://0pointer.de/blog/projects/socket-activation2.html
[1] http://caml.inria.fr/mantis/view.php?id=5569

Hi,

I gave a try to this patch series, the "./configure; make install" and the systemd services.

A) First, what when wrong during make install:

When I do ./configure --prefix=/usr, make install will put libs into /usr/local/lib ... (full list at the bottom of the mail, to help debug). Also, it would be nice if the --sbindir configure option was working.

B) Next, xenstored.socket:

I install xen, activate the socket, reboot the machine, and:

$ xl info
xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error
libxl: error: libxl.c:99:libxl_ctx_alloc: cannot open libxc handle: No such file or directory
cannot init xl context

So I tried nc -U /var/run/xenstored/socket_ro, but it appear that /var/lib/xenstored those not mount because of an empty context= option. Once the context= options have been removed, xenstored is finaly started.

Then, xl create hvm_guest. This does not return ...
I think qemu is not happy about xenstore, this is what I get from a `xl
-vvv create hvm_guest`:
libxl: debug: libxl_event.c:570:libxl__ev_xswatch_register: watch w=0x127b9a8 wpath=/local/domain/0/device-model/3/state token=3/0: register slotnum=3
libxl: debug: libxl_create.c:1370:do_domain_create: ao 0x127ce90: inprogress: poller=0x127c5e0, flags=i
libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x127b9a8 wpath=/local/domain/0/device-model/3/state token=3/0: event epath=/local/domain/0/device-model/3/state (qemu is running)
Actually, dmesg said that both xl and qemu-system-i386 proccess are
blocked. I suppose qemu is not able to access xenstore.

That is from me for now.

Regards,

usr/local/lib
usr/local/lib/fs
usr/local/lib/fs/ext2fs-lib usr/local/lib/fs/ext2fs-lib/fsimage.so usr/local/lib/fs/fat usr/local/lib/fs/fat/fsimage.so usr/local/lib/fs/iso9660 usr/local/lib/fs/iso9660/fsimage.so usr/local/lib/fs/reiserfs usr/local/lib/fs/reiserfs/fsimage.so usr/local/lib/fs/ufs usr/local/lib/fs/ufs/fsimage.so usr/local/lib/fs/xfs usr/local/lib/fs/xfs/fsimage.so usr/local/lib/fs/zfs usr/local/lib/fs/zfs/fsimage.so usr/local/lib/libblktapctl.so -> libblktapctl.so.1.0 usr/local/lib/libblktapctl.so.1.0 -> libblktapctl.so.1.0.0 usr/local/lib/libblktapctl.so.1.0.0 usr/local/lib/libfsimage.so -> libfsimage.so.1.0 usr/local/lib/libfsimage.so.1.0 -> libfsimage.so.1.0.0 usr/local/lib/libfsimage.so.1.0.0 usr/local/lib/libvhd.so -> libvhd.so.1.0 usr/local/lib/libvhd.so.1.0 -> libvhd.so.1.0.0 usr/local/lib/libvhd.so.1.0.0 usr/local/lib/libxenctrl.so -> libxenctrl.so.4.4 usr/local/lib/libxenctrl.so.4.4 -> libxenctrl.so.4.4.0 usr/local/lib/libxenctrl.so.4.4.0 usr/local/lib/libxenguest.so -> libxenguest.so.4.4 usr/local/lib/libxenguest.so.4.4 -> libxenguest.so.4.4.0 usr/local/lib/libxenguest.so.4.4.0 usr/local/lib/libxenlight.so -> libxenlight.so.4.4 usr/local/lib/libxenlight.so.4.4 -> libxenlight.so.4.4.0 usr/local/lib/libxenlight.so.4.4.0 usr/local/lib/libxenstat.so -> libxenstat.so.0 usr/local/lib/libxenstat.so.0 -> libxenstat.so.0.0 usr/local/lib/libxenstat.so.0.0 usr/local/lib/libxenstore.so -> libxenstore.so.3.0 usr/local/lib/libxenstore.so.3.0 -> libxenstore.so.3.0.3 usr/local/lib/libxenstore.so.3.0.3 usr/local/lib/libxenvchan.so -> libxenvchan.so.1.0 usr/local/lib/libxenvchan.so.1.0 -> libxenvchan.so.1.0.0 usr/local/lib/libxenvchan.so.1.0.0 usr/local/lib/libxlutil.so -> libxlutil.so.4.3 usr/local/lib/libxlutil.so.4.3 -> libxlutil.so.4.3.0 usr/local/lib/libxlutil.so.4.3.0 usr/local/lib/xen
usr/local/lib/xen/bin usr/local/lib/xen/bin/libxl-save-helper usr/local/lib/xen/bin/lsevtchn usr/local/lib/xen/bin/pygrub usr/local/lib/xen/bin/readnotes usr/local/lib/xen/bin/xenconsole usr/local/lib/xen/bin/xenctx usr/local/lib/xen/bin/xenpvnetboot

Signature · 1 line
Anthony PERARD
#83 lore raw
Quoted 10 lines · Anthony PERARD

Hi,

I gave a try to this patch series, the "./configure; make install" and the systemd services.

A) First, what when wrong during make install:

When I do ./configure --prefix=/usr, make install will put libs into /usr/local/lib ... (full list at the bottom of the mail, to help debug).

That is not an issue with --prefix not being respected but rather that libs will be installed under the libdir variable which is what Xen likes to use, so you will have to use --libdir=/usr/lib64/ to override that.

If we want to change this to use prefix we can do it but I went with what was used by the default configuration.

Quoted 1 line

Also, it would be nice if the --sbindir configure option was working.

--sbindir was not used before so my changes don't add support for it, so adding support for that is easy but its a separate change, but easy and I'd rather we do this separately. Right now we respect the old behaviour and use SBINDIR=$prefix/sbin

Quoted 7 lines

B) Next, xenstored.socket:

I install xen, activate the socket, reboot the machine, and:

$ xl info
xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error
libxl: error: libxl.c:99:libxl_ctx_alloc: cannot open libxc handle: No such file or directory
cannot init xl context

You need to make sure ldconfig us run on the system after installation. I noted this in the mailing list and I was told that we never do this on the build system, so the onus is on the person installing to use this. This also bit me on the ass a few times, and hence why I wanted to also run it within the build system.

Quoted 1 line

So I tried nc -U /var/run/xenstored/socket_ro,

I made some changes which will require now this to be run as root as I had left the socket open widely, my next series addresses that.

Quoted 3 lines

but it appear that
/var/lib/xenstored those not mount because of an empty context= option. Once the context= options have been removed, xenstored is finaly started.

Well that is odd, an empty context works here, what system are you using? Mind if we roll in the changes as we have them now and address this separately? Can't think of a way to deal with this cleanly right now.

Quoted 9 lines

Then, xl create hvm_guest. This does not return ...
I think qemu is not happy about xenstore, this is what I get from a `xl
-vvv create hvm_guest`:
libxl: debug: libxl_event.c:570:libxl__ev_xswatch_register: watch w=0x127b9a8 wpath=/local/domain/0/device-model/3/state token=3/0: register slotnum=3
libxl: debug: libxl_create.c:1370:do_domain_create: ao 0x127ce90: inprogress: poller=0x127c5e0, flags=i
libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x127b9a8 wpath=/local/domain/0/device-model/3/state token=3/0: event epath=/local/domain/0/device-model/3/state (qemu is running)
Actually, dmesg said that both xl and qemu-system-i386 proccess are
blocked. I suppose qemu is not able to access xenstore.

I traced this down to that bug fix on mmap() failing, and the unchecked failure on madvise with the fork option. Apart from this I also found that the xl library should not use systemd but rather just open the socket regularly, I've fixed this on my series and will push out the new changes soon.

Luis

#84 lore raw
In reply to Anthony PERARD
Quoted 3 lines · Anthony PERARD

it appear that
/var/lib/xenstored those not mount because of an empty context= option. Once the context= options have been removed, xenstored is finaly started.

Actually I can reproduce on debian, the fix is to use context=none by default. I'll roll this into my series by default, folks who need this can specify the context on sysconfig.

Luis