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

[Xen-API] [PATCH 1 of 4] Use autoconf to detect: xen headers; XS_RESTRICT in patchqueue; ocaml packages xmlm, type-conf; libdevicemapper; and linux-specific CDROM ioctls



# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1257961308 0
# Node ID 9a44d2645ddc107af42e78589e092e39ea93000b
# Parent  b6110bfb2c6f3c39c8043de14727f96a1022ffe4
Use autoconf to detect: xen headers; XS_RESTRICT in patchqueue; ocaml packages 
xmlm, type-conf; libdevicemapper; and linux-specific CDROM ioctls.

Modify the xen-api-libs.hg master Makefile to conditionally compile only those 
libraries whose system dependencies are met. So we:
* don't compile the xen libraries (xc, xb etc) if xen/xen.h is missing
* don't compile the cdrom library if the linux ioctls are missing
* don't compile the xml-light2, rss libraries if xmlm is missing
* don't compile rpc-light if type-conv is missing
* don't compile camldm if libdevicemapper is missing

This makes it easier for these libs to be used by other tools which may not 
need (eg) the xen or devicemapper bindings. Note that xen-api.hg needs most of 
these so any missing library will lead to a xen-api.hg build failure.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r b6110bfb2c6f -r 9a44d2645ddc Makefile.in
--- a/Makefile.in       Fri Nov 06 10:50:06 2009 -0800
+++ b/Makefile.in       Wed Nov 11 17:41:48 2009 +0000
@@ -1,73 +1,110 @@
+AUTOMAKE_OPTIONS = foreign
+HAVE_XEN = @XEN@
+HAVE_DEVICE_MAPPER = @DEVICE_MAPPER@
+HAVE_LINUX_CDROM = @LINUX_CDROM@
+HAVE_XMLM = @OCAML_PKG_xmlm@
+HAVE_TYPECONV = @OCAML_PKG_type_conv@
+
 .PHONY: all
 all:
        $(MAKE) -C uuid
-       $(MAKE) -C camldm
        $(MAKE) -C stdext
        $(MAKE) -C log
        $(MAKE) -C stunnel
        $(MAKE) -C pciutil
-       $(MAKE) -C cdrom
-       $(MAKE) -C xml-light2
-       $(MAKE) -C rss
-       $(MAKE) -C rpc-light
        $(MAKE) -C http-svr
        $(MAKE) -C close-and-exec
        $(MAKE) -C sexpr
+ifeq ($(HAVE_TYPECONV),type-conv)
+       $(MAKE) -C rpc-light
+endif
+ifeq ($(HAVE_XMLM),xmlm)
+       $(MAKE) -C xml-light2
+       $(MAKE) -C rss
+endif
+ifeq ($(HAVE_LINUX_CDROM),1)
+       $(MAKE) -C cdrom
+endif
+ifeq ($(HAVE_DEVICE_MAPPER),1)
+       $(MAKE) -C camldm
+endif
 
 .PHONY: allxen
 allxen:
+ifeq ($(HAVE_XEN),1)
        $(MAKE) -C mmap
        $(MAKE) -C xc
        $(MAKE) -C xb
        $(MAKE) -C xs
        $(MAKE) -C xsrpc
        $(MAKE) -C eventchn
+endif
 
 install:
        $(MAKE) -C uuid install
-       $(MAKE) -C camldm install
        $(MAKE) -C stdext install
        $(MAKE) -C log install
        $(MAKE) -C stunnel install
        $(MAKE) -C pciutil install
-       $(MAKE) -C cdrom install
-       $(MAKE) -C xml-light2 install
-       $(MAKE) -C rss install
-       $(MAKE) -C rpc-light install
        $(MAKE) -C http-svr install
        $(MAKE) -C close-and-exec install
        $(MAKE) -C sexpr install
+ifeq ($(HAVE_TYPECONV),type-conv)
+       $(MAKE) -C rpc-light install
+endif
+ifeq ($(HAVE_XMLM),xmlm)
+       $(MAKE) -C xml-light2 install
+       $(MAKE) -C rss install
+endif
+ifeq ($(HAVE_LINUX_CDROM),1)
+       $(MAKE) -C cdrom install
+endif
+ifeq ($(HAVE_DEVICE_MAPPER),1)
+       $(MAKE) -C camldm install
+endif
 
 installxen:
+ifeq ($(HAVE_XEN),1)
        $(MAKE) -C mmap install
        $(MAKE) -C xc install
        $(MAKE) -C xb install
        $(MAKE) -C xs install
        $(MAKE) -C xsrpc install
        $(MAKE) -C eventchn install
+endif
 
 uninstall:
        $(MAKE) -C uuid uninstall
-       $(MAKE) -C camldm uninstall
        $(MAKE) -C stdext uninstall
        $(MAKE) -C log uninstall
        $(MAKE) -C stunnel uninstall
        $(MAKE) -C pciutil uninstall
-       $(MAKE) -C cdrom uninstall
-       $(MAKE) -C xml-light2 uninstall
-       $(MAKE) -C rss uninstall
-       $(MAKE) -C rpc-light uninstall
        $(MAKE) -C http-svr uninstall
        $(MAKE) -C close-and-exec uninstall
        $(MAKE) -C sexpr uninstall
+ifeq ($(HAVE_TYPECONV),type-conv)
+       $(MAKE) -C rpc-light uninstall
+endif
+ifeq ($(HAVE_XMLM),xmlm)
+       $(MAKE) -C xml-light2 uninstall
+       $(MAKE) -C rss uninstall
+endif
+ifeq ($(HAVE_LINUX_CDROM),1)
+       $(MAKE) -C cdrom uninstall
+endif
+ifeq ($(HAVE_DEVICE_MAPPER),1)
+       $(MAKE) -C camldm uninstall
+endif
 
 uninstallxen:
+ifeq ($(HAVE_XEN),1)
        $(MAKE) -C eventchn uninstall
        $(MAKE) -C xsrpc uninstall
        $(MAKE) -C xs uninstall
        $(MAKE) -C xb uninstall
        $(MAKE) -C xc uninstall
        $(MAKE) -C mmap uninstall
+endif
 
 bins:
        $(MAKE) -C pciutil bins
diff -r b6110bfb2c6f -r 9a44d2645ddc configure.ac
--- a/configure.ac      Fri Nov 06 10:50:06 2009 -0800
+++ b/configure.ac      Wed Nov 11 17:41:48 2009 +0000
@@ -1,10 +1,10 @@
 # -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-AC_PREREQ([2.63])
+AC_PREREQ([2.59])
 AC_INIT([xen-api-libs], [0.1], [xen-api@xxxxxxxxxxxxxxxxxxx])
 AC_CONFIG_SRCDIR([])
-AC_CONFIG_HEADERS([stdext/config.h])
+AC_CONFIG_HEADERS([include/config.h])
 AC_CONFIG_AUX_DIR(./mk)
 
 AC_CANONICAL_SYSTEM
@@ -26,8 +26,17 @@
 
 # Checks for header files.
 AC_CHECK_HEADERS([string.h sys/param.h])
+AC_CHECK_HEADERS([xen/xen.h],[XEN=1],[XEN=0])
+AC_CHECK_HEADERS([libdevmapper.h], [DEVICE_MAPPER=1], [DEVICE_MAPPER=0])
+AC_CHECK_HEADERS([linux/cdrom.h], [LINUX_CDROM=1], [LINUX_CDROM=0])
 
 # Checks for typedefs, structures, and compiler characteristics.
+AC_CHECK_DECLS([XS_RESTRICT],[],[],[
+[
+#include <errno.h>
+#include <xenctrl.h>
+#include <xen/io/xs_wire.h>
+]])
 
 # Checks for library functions.
 AC_CHECK_FUNCS([realpath])
@@ -42,5 +51,13 @@
   AC_MSG_ERROR([You must install OCaml findlib (the ocamlfind command)])
 fi
 
+AC_CHECK_OCAML_PKG([xmlm])
+AC_CHECK_OCAML_PKG([type-conv])
+
 AC_CONFIG_FILES([Makefile])
+AC_SUBST([XEN])
+AC_SUBST([DEVICE_MAPPER])
+AC_SUBST([LINUX_CDROM])
+AC_SUBST([OCAML_PKG_xmlm])
+AC_SUBST([OCAML_PKG_type_conv])
 AC_OUTPUT
diff -r b6110bfb2c6f -r 9a44d2645ddc include/config.h.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/include/config.h.in       Wed Nov 11 17:41:48 2009 +0000
@@ -0,0 +1,65 @@
+/* include/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the declaration of `XS_RESTRICT', and to 0 if you
+   don't. */
+#undef HAVE_DECL_XS_RESTRICT
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <libdevmapper.h> header file. */
+#undef HAVE_LIBDEVMAPPER_H
+
+/* Define to 1 if you have the <linux/cdrom.h> header file. */
+#undef HAVE_LINUX_CDROM_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `realpath' function. */
+#undef HAVE_REALPATH
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <xen/xen.h> header file. */
+#undef HAVE_XEN_XEN_H
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
diff -r b6110bfb2c6f -r 9a44d2645ddc log/Makefile
--- a/log/Makefile      Fri Nov 06 10:50:06 2009 -0800
+++ b/log/Makefile      Wed Nov 11 17:41:48 2009 +0000
@@ -1,5 +1,6 @@
 CC = gcc
-CFLAGS = -Wall -fPIC -O2 -I/opt/xensource/lib/ocaml
+OCAMLLOC := $(shell ocamlc -where)
+CFLAGS = -Wall -fPIC -O2 -I/opt/xensource/lib/ocaml -I$(OCAMLLOC)
 OCAMLC = ocamlc
 OCAMLOPT = ocamlopt 
 
diff -r b6110bfb2c6f -r 9a44d2645ddc log/syslog_stubs.c
--- a/log/syslog_stubs.c        Fri Nov 06 10:50:06 2009 -0800
+++ b/log/syslog_stubs.c        Wed Nov 11 17:41:48 2009 +0000
@@ -13,10 +13,12 @@
  */
 
 #include <syslog.h>
+#include <string.h>
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
 #include <caml/alloc.h>
 #include <caml/custom.h>
+#include <caml/signals.h>
 
 static int __syslog_level_table[] = {
        LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING,
diff -r b6110bfb2c6f -r 9a44d2645ddc stdext/config.h.in
--- a/stdext/config.h.in        Fri Nov 06 10:50:06 2009 -0800
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-// Autoconf config.h file
6 files changed, 140 insertions(+), 19 deletions(-)
Makefile.in         |   67 +++++++++++++++++++++++++++++++++++++++------------
configure.ac        |   21 ++++++++++++++-
include/config.h.in |   65 +++++++++++++++++++++++++++++++++++++++++++++++++
log/Makefile        |    3 +-
log/syslog_stubs.c  |    2 +
stdext/config.h.in  |    1 


Attachment: xen-api-libs.hg-4.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

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