Browse files

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@eu.citrix.com>
  • Loading branch information...
1 parent 970b47b commit 69689cb3892d61907f21dfce2266c5ab4a34dd80 David Scott committed Nov 11, 2009
Showing with 140 additions and 19 deletions.
  1. +52 −15 Makefile.in
  2. +19 −2 configure.ac
  3. +65 −0 include/config.h.in
  4. +2 −1 log/Makefile
  5. +2 −0 log/syslog_stubs.c
  6. +0 −1 stdext/config.h.in
View
67 Makefile.in
@@ -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
View
21 configure.ac
@@ -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@lists.xensource.com])
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 @@ AC_PROG_MAKE_SET
# 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 @@ if test "$OCAMLFIND" = "no"; then
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
View
65 include/config.h.in
@@ -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
View
3 log/Makefile
@@ -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
View
2 log/syslog_stubs.c
@@ -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,
View
1 stdext/config.h.in
@@ -1 +0,0 @@
-// Autoconf config.h file

0 comments on commit 69689cb

Please sign in to comment.