# HG changeset patch # User Roger Pau Monne # Date 1329784804 -3600 # Node ID b6071c710f6cb6200aaf134a46e80bc937382f7a # Parent ca80eca9cfa39d1b60d1216948dac5711d550b83 build: add autoconf to replace custom checks in tools/check Added autotools magic to replace custom check scripts. The previous checks have been ported to autoconf, and some additional ones have been added (plus the suggestions from running autoscan). Two files are created as a result from executing configure script, config/Tools.mk and config.h. conf/Tools.mk is included by tools/Rules.mk, and contains most of the options previously defined in .config, that can now be set passing parameters or defining environment variables when executing configure script. config.h is only used by libxl/xl to detect yajl_version.h. Changes since v5: * Remove dummy configure generation from autogen.sh since it's already on the source tree. * Removed autogen.sh since it was only a wrapper for calling autoconf. * Remove comment regarding yajl_version.h from configure.ac. Changes since v4: * Updated to tip. * Include config.h from compiler command line when building libxl and xl to assure yajl_version.h presence and correctly detect yajl version. * Added glib-2.0 check with appropiate m4 macros. * Purged config.h.in from unnecessary defines that could mess with the build system. * Removed tools/config.sub, tools/config.guess, tools/configure and configure to make the patch fit mailing list limit. Changes since v3: * Copied config.guess and config.sub from automake 1.11. * Added a test to check for uuid.h on BSD and uuid/uuid.h on Linux. Changes since v2: * Changed order of config/Tools.mk include. * Added "-e" to autogen.sh shebang. * Added necessary files (config.*) and output from Autoheader and Autoconf. * Removed Autoconf from build dependencies and updated README. Changes since v1: * Moved autoconf stuff inside tools folder. * Add Makefile rules for cleaning. * Removed Automake dependency. * Create autogen.sh to automatically create configure script when building from source repository. * Cached values of options passed from command line. * Add necessary ignores to .hgignore. * Added Autoconf to the list of dependencies. * Changed hypen to underscore in XML2 and CURL variable names. * Added script to get version from xen/Makefile. * Set Ocaml tools to optional. * Added procedence of m4/ocaml.m4. Signed-off-by: Roger Pau Monne diff -r ca80eca9cfa3 -r b6071c710f6c .hgignore --- a/.hgignore Mon Feb 20 18:34:14 2012 +0000 +++ b/.hgignore Tue Feb 21 01:40:04 2012 +0100 @@ -303,6 +303,12 @@ ^tools/ocaml/libs/xl/xenlight\.ml$ ^tools/ocaml/libs/xl/xenlight\.mli$ ^tools/ocaml/xenstored/oxenstored$ +^tools/autom4te\.cache$ +^tools/config\.h$ +^tools/config\.log$ +^tools/config\.status$ +^tools/config\.cache$ +^config/Tools\.mk$ ^xen/\.banner.*$ ^xen/BLOG$ ^xen/System.map$ diff -r ca80eca9cfa3 -r b6071c710f6c Config.mk --- a/Config.mk Mon Feb 20 18:34:14 2012 +0000 +++ b/Config.mk Tue Feb 21 01:40:04 2012 +0100 @@ -70,9 +70,6 @@ EXTRA_INCLUDES += $(EXTRA_PREFIX)/includ EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR) endif -BISON ?= bison -FLEX ?= flex - PYTHON ?= python PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)" # The above requires that PREFIX contains *no spaces*. This variable is here @@ -175,32 +172,9 @@ CFLAGS += $(foreach i, $(PREPEND_INCLUDE APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i)) APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i)) -CHECK_LIB = $(EXTRA_LIB) $(PREPEND_LIB) $(APPEND_LIB) -CHECK_INCLUDES = $(EXTRA_INCLUDES) $(PREPEND_INCLUDES) $(APPEND_INCLUDES) - EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -CONFIG_LIBICONV := $(shell export OS="`uname -s`"; \ - export CHECK_LIB="$(CHECK_LIB)"; \ - . $(XEN_ROOT)/tools/check/funcs.sh; \ - has_lib libiconv.so && echo 'y' || echo 'n') - -CONFIG_YAJL_VERSION := $(shell export OS="`uname -s`"; \ - export CHECK_INCLUDES="$(CHECK_INCLUDES)"; \ - . $(XEN_ROOT)/tools/check/funcs.sh; \ - has_header yajl/yajl_version.h && echo 'y' || echo 'n') - -# Enable XSM security module (by default, Flask). -XSM_ENABLE ?= n -FLASK_ENABLE ?= $(XSM_ENABLE) - -# Download GIT repositories via HTTP or GIT's own protocol? -# GIT's protocol is faster and more robust, when it works at all (firewalls -# may block it). We make it the default, but if your GIT repository downloads -# fail or hang, please specify GIT_HTTP=y in your environment. -GIT_HTTP ?= n - XEN_EXTFILES_URL=http://xenbits.xensource.com/xen-extfiles # All the files at that location were downloaded from elsewhere on # the internet. The original download URL is preserved as a comment @@ -239,17 +213,4 @@ QEMU_TAG ?= 128de2549c5f24e4a437b86bd2e4 # Short answer -- do not enable this unless you know what you are # doing and are prepared for some pain. -# Optional components -XENSTAT_XENTOP ?= y -VTPM_TOOLS ?= n -LIBXENAPI_BINDINGS ?= n -PYTHON_TOOLS ?= y -OCAML_TOOLS ?= y -CONFIG_MINITERM ?= n -CONFIG_LOMOUNT ?= n -CONFIG_SYSTEM_LIBAIO ?= y CONFIG_TESTS ?= y - -ifeq ($(OCAML_TOOLS),y) -OCAML_TOOLS := $(shell ocamlopt -v > /dev/null 2>&1 && echo "y" || echo "n") -endif diff -r ca80eca9cfa3 -r b6071c710f6c Makefile --- a/Makefile Mon Feb 20 18:34:14 2012 +0000 +++ b/Makefile Tue Feb 21 01:40:04 2012 +0100 @@ -40,11 +40,9 @@ dist: DESTDIR=$(DISTDIR)/install dist: dist-xen dist-kernels dist-tools dist-stubdom dist-docs dist-misc dist-misc: - $(INSTALL_DIR) $(DISTDIR)/check $(INSTALL_DATA) ./COPYING $(DISTDIR) $(INSTALL_DATA) ./README $(DISTDIR) $(INSTALL_PROG) ./install.sh $(DISTDIR) - $(INSTALL_PROG) tools/check/chk tools/check/check_* tools/check/funcs.sh $(DISTDIR)/check dist-%: DESTDIR=$(DISTDIR)/install dist-%: install-% @: # do nothing diff -r ca80eca9cfa3 -r b6071c710f6c README --- a/README Mon Feb 20 18:34:14 2012 +0000 +++ b/README Tue Feb 21 01:40:04 2012 +0100 @@ -89,9 +89,13 @@ 2. cd to xen-unstable (or whatever you s 3. For the very first build, or if you want to destroy build trees, perform the following steps: + # ./configure # make world # make install + If you want, you can run ./configure --help to see the list of + options available options when building and installing Xen. + This will create and install onto the local machine. It will build the xen binary (xen.gz), the tools and the documentation. diff -r ca80eca9cfa3 -r b6071c710f6c config/Tools.mk.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/Tools.mk.in Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,50 @@ +# Prefix and install folder +PREFIX := @prefix@ +LIBLEAFDIR_x86_64 := @LIB_PATH@ + +# A debug build of tools? +debug := @debug@ + +# Tools path +BISON := @BISON@ +FLEX := @FLEX@ +PYTHON := @PYTHON@ +PYTHON_PATH := @PYTHONPATH@ +PERL := @PERL@ +BRCTL := @BRCTL@ +IP := @IP@ +CURL_CONFIG := @CURL@ +XML2_CONFIG := @XML@ +BASH := @BASH@ +XGETTTEXT := @XGETTEXT@ + +# Extra folder for libs/includes +PREPEND_INCLUDES := @PREPEND_INCLUDES@ +PREPEND_LIB := @PREPEND_LIB@ +APPEND_INCLUDES := @APPEND_INCLUDES@ +APPEND_LIB := @APPEND_LIB@ + +# Enable XSM security module (by default, Flask). +XSM_ENABLE := @xsm@ +FLASK_ENABLE := @xsm@ + +# Download GIT repositories via HTTP or GIT's own protocol? +# GIT's protocol is faster and more robust, when it works at all (firewalls +# may block it). We make it the default, but if your GIT repository downloads +# fail or hang, please specify GIT_HTTP=y in your environment. +GIT_HTTP := @githttp@ + +# Optional components +XENSTAT_XENTOP := @monitors@ +VTPM_TOOLS := @vtpm@ +LIBXENAPI_BINDINGS := @xapi@ +PYTHON_TOOLS := @pythontools@ +OCAML_TOOLS := @ocamltools@ +CONFIG_MINITERM := @miniterm@ +CONFIG_LOMOUNT := @lomount@ + +#System options +CONFIG_SYSTEM_LIBAIO:= @system_aio@ +CONFIG_LIBICONV := @libiconv@ +CONFIG_GCRYPT := @libgcrypt@ +CONFIG_EXT2FS := @libext2fs@ diff -r ca80eca9cfa3 -r b6071c710f6c configure --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/configure Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,2 @@ +#!/bin/sh -e +cd tools && ./configure $@ diff -r ca80eca9cfa3 -r b6071c710f6c tools/Makefile --- a/tools/Makefile Mon Feb 20 18:34:14 2012 +0000 +++ b/tools/Makefile Tue Feb 21 01:40:04 2012 +0100 @@ -6,7 +6,6 @@ SUBDIRS-libaio := libaio endif SUBDIRS-y := -SUBDIRS-y += check SUBDIRS-y += include SUBDIRS-y += libxc SUBDIRS-y += flask @@ -79,6 +78,8 @@ clean: subdirs-clean distclean: subdirs-distclean rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote rm -rf qemu-xen-dir qemu-xen-dir-remote + rm -rf ../config/Tools.mk config.h config.log config.status \ + config.cache autom4te.cache ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH)) IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \ diff -r ca80eca9cfa3 -r b6071c710f6c tools/Rules.mk --- a/tools/Rules.mk Mon Feb 20 18:34:14 2012 +0000 +++ b/tools/Rules.mk Tue Feb 21 01:40:04 2012 +0100 @@ -4,6 +4,7 @@ all: include $(XEN_ROOT)/Config.mk +include $(XEN_ROOT)/config/Tools.mk export _INSTALL := $(INSTALL) INSTALL = $(XEN_ROOT)/tools/cross-install @@ -80,8 +81,6 @@ check-$(CONFIG_X86) = $(call cc-ver-chec "Xen requires at least gcc-3.4") $(eval $(check-y)) -_PYTHON_PATH := $(shell which $(PYTHON)) -PYTHON_PATH ?= $(_PYTHON_PATH) INSTALL_PYTHON_PROG = \ $(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG) @@ -109,3 +108,7 @@ subdir-all-% subdir-clean-% subdir-insta subdir-distclean-%: .phony $(MAKE) -C $* clean + +$(XEN_ROOT)/config/Tools.mk: + @echo "You have to run ./configure before building or installing the tools" + @exit 1 diff -r ca80eca9cfa3 -r b6071c710f6c tools/blktap/drivers/Makefile --- a/tools/blktap/drivers/Makefile Mon Feb 20 18:34:14 2012 +0000 +++ b/tools/blktap/drivers/Makefile Tue Feb 21 01:40:04 2012 +0100 @@ -13,7 +13,7 @@ CFLAGS += $(CFLAGS_libxenstore) CFLAGS += -I $(MEMSHR_DIR) CFLAGS += -D_GNU_SOURCE -ifeq ($(shell . ./check_gcrypt $(CC)),yes) +ifeq ($CONFIG_GCRYPT,y) CFLAGS += -DUSE_GCRYPT CRYPT_LIB := -lgcrypt else diff -r ca80eca9cfa3 -r b6071c710f6c tools/blktap/drivers/check_gcrypt --- a/tools/blktap/drivers/check_gcrypt Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#!/bin/sh - -cat > .gcrypt.c << EOF -#include -int main(void) { return 0; } -EOF - -if $1 -o .gcrypt .gcrypt.c -lgcrypt 2>/dev/null ; then - echo "yes" -else - echo "no" -fi - -rm -f .gcrypt* diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/Makefile --- a/tools/check/Makefile Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -XEN_ROOT = $(CURDIR)/../.. -include $(XEN_ROOT)/tools/Rules.mk - -# Export the necessary environment variables for the tests -export PYTHON -export LIBXENAPI_BINDINGS -export CHECK_INCLUDES -export CHECK_LIB -export CONFIG_SYSTEM_LIBAIO - -.PHONY: all install -all install: check-build - -# Check this machine is OK for building on. -.PHONY: check-build -check-build: - ./chk build - -# Check this machine is OK for installing on. -.PHONY: check-install -check-install: - ./chk install - -.PHONY: clean -clean: - ./chk clean diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/README --- a/tools/check/README Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -Checks for the suitability of a machine for Xen build or install. -To check for build suitability use - - ./chk build - -To check for install suitability use - - ./chk install - -The chk script will run checks in this directory and print -the ones that failed. It prints nothing if checks succeed. -The chk script exits with 0 on success and 1 on failure. - -The chk script runs executable files in this directory whose -names begin with 'check_'. Files containing CHECK-BUILD -are run for the build check, and files containing CHECK-INSTALL -are run for the install check. - -Detailed output from the check scripts is in .chkbuild for build -and .chkinstall for install. \ No newline at end of file diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_brctl --- a/tools/check/check_brctl Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#!/bin/sh -# CHECK-INSTALL - -. ./funcs.sh - -case $OS in -OpenBSD|NetBSD|FreeBSD) - has_or_fail brconfig ;; -Linux) - has_or_fail brctl ;; -*) - fail "unknown OS" ;; -esac diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_crypto_lib --- a/tools/check/check_crypto_lib Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#!/bin/sh -# CHECK-BUILD CHECK-INSTALL - -. ./funcs.sh - -case $OS in -FreeBSD|NetBSD|OpenBSD) - exit 0 ;; -esac - -has_lib libcrypto.so || fail "missing libcrypto.so" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_curl --- a/tools/check/check_curl Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#!/bin/sh -# CHECK-BUILD CHECK-INSTALL - -. ./funcs.sh - -if [ "$LIBXENAPI_BINDINGS" != "y" ]; then - echo -n "unused, " - exit 0 -fi - -has_or_fail curl-config -curl_libs=`curl-config --libs` || fail "curl-config --libs failed" -test_link $curl_libs || fail "dependency libraries for curl are missing" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_iproute --- a/tools/check/check_iproute Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#!/bin/sh -# CHECK-INSTALL - -. ./funcs.sh - -PATH=/sbin:$PATH - -case $OS in -OpenBSD|NetBSD|FreeBSD) - has_or_fail ifconfig ;; -Linux) - has_or_fail ip ;; -*) - fail "unknown OS" ;; -esac diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_libaio_devel --- a/tools/check/check_libaio_devel Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#!/bin/sh -# CHECK-BUILD - -. ./funcs.sh - -if [ X${CONFIG_SYSTEM_LIBAIO} != X"y" ] ; then - exit 0 -fi -if ! has_header libaio.h ; then - fail "can't find libaio headers, install libaio devel package or set CONFIG_SYSTEM_LIBAIO=n" -fi diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_libaio_lib --- a/tools/check/check_libaio_lib Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/bin/sh -# CHECK-BUILD CHECK-INSTALL - -. ./funcs.sh - -if [ X${CONFIG_SYSTEM_LIBAIO} != X"y" ] ; then - exit 0 -fi -has_lib libaio.so || fail "can't find libaio" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_openssl_devel --- a/tools/check/check_openssl_devel Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#!/bin/sh -# CHECK-BUILD - -. ./funcs.sh - -has_header openssl/md5.h || fail "missing openssl headers" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_python --- a/tools/check/check_python Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#!/bin/sh -# CHECK-BUILD CHECK-INSTALL - -. ./funcs.sh - -if test -z ${PYTHON}; then - PYTHON=python -fi - -${PYTHON} -c ' -import sys -sys.exit(sys.version_info[0] < 2 or sys.version_info[1] < 3) -' || fail "need python version >= 2.3" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_python_devel --- a/tools/check/check_python_devel Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -#!/bin/sh -# CHECK-BUILD - -. ./funcs.sh - -if test -z ${PYTHON}; then - PYTHON=python -fi -has_or_fail ${PYTHON} - -${PYTHON} -c ' -import os.path, sys -for p in sys.path: - if os.path.exists(p + "/config/Makefile"): - sys.exit(0) -sys.exit(1) -' || fail "can't find python devel files" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_python_xml --- a/tools/check/check_python_xml Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#!/bin/sh -# CHECK-INSTALL - -. ./funcs.sh - -if test -z ${PYTHON}; then - PYTHON=python -fi -has_or_fail ${PYTHON} - -${PYTHON} -c 'import xml.dom.minidom' 2>/dev/null || \ -fail "can't import xml.dom.minidom" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_udev --- a/tools/check/check_udev Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#!/bin/sh -# CHECK-INSTALL - -. ./funcs.sh - -case $OS in -OpenBSD|NetBSD|FreeBSD) - has_or_fail vnconfig - ;; -Linux) - has /sbin/udevadm && \ - udevver=`/sbin/udevadm info -V | awk '{print $NF}'` - [ -z "$udevver" ] && has_or_fail udevinfo && \ - udevver=`udevinfo -V | awk '{print $NF}'` - [ "$udevver" -ge 59 ] 2>/dev/null || \ - has hotplug || \ - fail "udev is too old, upgrade to version 59 or later" - ;; -*) - fail "unknown OS" - ;; -esac diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_uuid_devel --- a/tools/check/check_uuid_devel Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -#!/bin/sh -# CHECK-BUILD - -. ./funcs.sh - -has_header uuid.h || \ -has_header uuid/uuid.h || fail "missing uuid headers (package uuid-dev)" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_x11_devel --- a/tools/check/check_x11_devel Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#!/bin/sh -# CHECK-BUILD - -. ./funcs.sh - -has_header X11/keysymdef.h || \ -has_header /usr/X11R6/include/X11/keysymdef.h || \ -has_header /usr/X11R7/include/X11/keysymdef.h || \ -warning "can't find X11 headers" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_xgettext --- a/tools/check/check_xgettext Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#!/bin/sh -# CHECK-BUILD - -. ./funcs.sh - -has_or_fail xgettext diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_xml2 --- a/tools/check/check_xml2 Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#!/bin/sh -# CHECK-BUILD CHECK-INSTALL - -. ./funcs.sh - -if [ ! "$LIBXENAPI_BINDINGS" = "y" ] -then - echo -n "unused, " - exit 0 -fi - -has_or_fail xml2-config -xml2_libs=`xml2-config --libs` || fail "xml2-config --libs failed" -test_link $xml2_libs || fail "dependency libraries for xml2 are missing" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_yajl_devel --- a/tools/check/check_yajl_devel Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#!/bin/sh -# CHECK-BUILD - -. ./funcs.sh - -has_header yajl/yajl_parse.h || fail "can't find yajl/yajl_parse.h" -has_header yajl/yajl_gen.h || fail "can't find yajl/yajl_gen.h" -has_lib libyajl.so || fail "can't find libyajl.so" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_zlib_devel --- a/tools/check/check_zlib_devel Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#!/bin/sh -# CHECK-BUILD - -. ./funcs.sh - -has_header zlib.h || fail "can't find zlib headers" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/check_zlib_lib --- a/tools/check/check_zlib_lib Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#!/bin/sh -# CHECK-BUILD CHECK-INSTALL - -. ./funcs.sh - -case $OS in -FreeBSD|NetBSD|OpenBSD) - exit 0 - ;; -esac - -has_lib libz.so || fail "can't find zlib" diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/chk --- a/tools/check/chk Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -#!/bin/sh - -func_usage () -{ - echo "Usage:" - echo " $0 [build|install|clean]" - echo - echo "Check suitability for Xen build or install." - echo "Exit with 0 if OK, 1 if not." - echo - echo "Calling with 'clean' removes generated files." - exit 1 -} - -PATH=$PATH:/sbin:/usr/sbin -OS=`uname -s` -export PATH OS - -if [ "$OS" = "SunOS" ]; then - exit 0 -fi - -case $1 in - build) - check="CHECK-BUILD" - ;; - install) - check="CHECK-INSTALL" - ;; - clean) - exit 0 - ;; - *) - func_usage - ;; -esac - -failed=0 - -echo "Xen ${check} " `date` -for f in check_* ; do - case $f in - *~) - continue - ;; - *) - ;; - esac - if ! [ -x $f ] ; then - continue - fi - if ! grep -Fq "$check" $f ; then - continue - fi - echo -n "Checking $f: " - if ./$f 2>&1 ; then - echo OK - else - failed=1 - fi -done - -exit ${failed} diff -r ca80eca9cfa3 -r b6071c710f6c tools/check/funcs.sh --- a/tools/check/funcs.sh Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -# has is the same as which, except it handles cross environments -has() { - if [ -z "$CROSS_COMPILE" ]; then - command which "$@" - return $? - fi - - check_sys_root || return 1 - - # subshell to prevent pollution of caller's IFS - ( - IFS=: - for p in $PATH; do - if [ -x "$CROSS_SYS_ROOT/$p/$1" ]; then - echo "$CROSS_SYS_ROOT/$p/$1" - return 0 - fi - done - return 1 - ) -} - -has_or_fail() { - has "$1" >/dev/null || fail "can't find $1" -} - -has_header() { - check_sys_root || return 1 - - case $1 in - /*) ;; - *) - if [ -r "$CROSS_SYS_ROOT/usr/include/$1" ]; then - return 0 - fi - for path in ${CHECK_INCLUDES}; do - if [ -r "$CROSS_SYS_ROOT${path}/$1" ]; then - return 0 - fi - done - ;; - esac - - return 1 -} - -has_lib() { - check_sys_root || return 1 - - # subshell to prevent pollution of caller's environment - ( - PATH=/sbin:$PATH # for ldconfig - LIBRARIES="$CHECK_LIB /usr/lib" - - # This relatively common in a sys-root; libs are installed but - # ldconfig hasn't run there, so ldconfig -p won't work. - if [ "$OS" = Linux -a ! -f "$CROSS_SYS_ROOT/etc/ld.so.cache" ]; then - echo "Please run ldconfig -r \"$CROSS_SYS_ROOT\" to generate ld.so.cache" - # fall through; ldconfig test below should fail - fi - if [ "${OS}" = "Linux" ]; then - ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1" - return $? - fi - if [ "${OS}" = "NetBSD" ]; then - ls -1 ${LIBRARIES} | grep -Fq "$1" - return $? - fi - return 1 - ) -} - -test_link() { - # subshell to trap removal of tmpfile - ( - unset tmpfile - trap 'rm -f "$tmpfile"; exit' 0 1 2 15 - tmpfile=`mktemp` || return 1 - ld "$@" -o "$tmpfile" >/dev/null 2>&1 - return $? - ) -} - -# this function is used commonly above -check_sys_root() { - [ -z "$CROSS_COMPILE" ] && return 0 - if [ -z "$CROSS_SYS_ROOT" ]; then - echo "please set CROSS_SYS_ROOT in the environment" - return 1 - fi - if [ ! -d "$CROSS_SYS_ROOT" ]; then - echo "no sys-root found at $CROSS_SYS_ROOT" - return 1 - fi -} - -warning() { - echo - echo " *** `basename "$0"` FAILED${*+: $*}" -} - -fail() { - echo - echo " *** `basename "$0"` FAILED${*+: $*}" - exit 1 -} diff -r ca80eca9cfa3 -r b6071c710f6c tools/config.h.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/config.h.in Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2012 + * + * 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. + */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_YAJL_YAJL_VERSION_H diff -r ca80eca9cfa3 -r b6071c710f6c tools/configure.ac --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/configure.ac Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,192 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.67]) +AC_INIT([Xen Hypervisor], m4_esyscmd([../version.sh ../xen/Makefile]), + [xen-devel@xxxxxxxxxxxxxxxxxxx]) +AC_CONFIG_SRCDIR([libxl/libxl.c]) +AC_CONFIG_FILES([../config/Tools.mk]) +AC_CONFIG_HEADERS([config.h]) +AC_PREFIX_DEFAULT([/usr]) +AC_CONFIG_AUX_DIR([.]) + +# Check if CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is set and print a warning + +AS_IF([test -n "$CC$CFLAGS$LDFLAGS$LIBS$CPPFLAGS$CPP"], [ + AC_MSG_WARN( +[Setting CC, CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is not \ +recommended, use PREPEND_INCLUDES, PREPEND_LIB, \ +APPEND_INCLUDES and APPEND_LIB instead when possible.]) +]) + +AC_USE_SYSTEM_EXTENSIONS +AC_CANONICAL_HOST + +# M4 Macro includes +m4_include([m4/enable_feature.m4]) +m4_include([m4/disable_feature.m4]) +m4_include([m4/path_or_fail.m4]) +m4_include([m4/python_xml.m4]) +m4_include([m4/python_version.m4]) +m4_include([m4/python_devel.m4]) +m4_include([m4/udev.m4]) +m4_include([m4/ocaml.m4]) +m4_include([m4/default_lib.m4]) +m4_include([m4/set_cflags_ldflags.m4]) +m4_include([m4/uuid.m4]) +m4_include([m4/pkg.m4]) + +# Enable/disable options +AX_ARG_ENABLE_AND_EXPORT([xsm], + [Enable XSM security module (by default, Flask)]) +AX_ARG_ENABLE_AND_EXPORT([githttp], [Download GIT repositories via HTTP]) +AX_ARG_DISABLE_AND_EXPORT([monitors], + [Disable xenstat and xentop monitoring tools]) +AX_ARG_ENABLE_AND_EXPORT([vtpm], [Enable Virtual Trusted Platform Module]) +AX_ARG_ENABLE_AND_EXPORT([xapi], [Enable Xen API Bindings]) +AX_ARG_DISABLE_AND_EXPORT([pythontools], [Disable Python tools]) +AX_ARG_DISABLE_AND_EXPORT([ocamltools], [Disable Ocaml tools]) +AX_ARG_ENABLE_AND_EXPORT([miniterm], [Enable miniterm]) +AX_ARG_ENABLE_AND_EXPORT([lomount], [Enable lomount]) +AX_ARG_DISABLE_AND_EXPORT([debug], [Disable debug build of Xen and tools]) + +AC_ARG_VAR([PREPEND_INCLUDES], + [List of include folders to prepend to CFLAGS (without -I)]) +AC_ARG_VAR([PREPEND_LIB], + [List of library folders to prepend to LDFLAGS (without -L)]) +AC_ARG_VAR([APPEND_INCLUDES], + [List of include folders to append to CFLAGS (without -I)]) +AC_ARG_VAR([APPEND_LIB], + [List of library folders to append to LDFLAGS (without -L)]) + +AX_SET_FLAGS + +AC_ARG_VAR([PYTHON], [Path to the Python parser]) +AC_ARG_VAR([PERL], [Path to Perl parser]) +AC_ARG_VAR([BRCTL], [Path to brctl tool]) +AC_ARG_VAR([IP], [Path to ip tool]) +AC_ARG_VAR([BISON], [Path to Bison parser generator]) +AC_ARG_VAR([FLEX], [Path to Flex lexical analyser generator]) +AC_ARG_VAR([CURL], [Path to curl-config tool]) +AC_ARG_VAR([XML], [Path to xml2-config tool]) +AC_ARG_VAR([BASH], [Path to bash shell]) +AC_ARG_VAR([XGETTEXT], [Path to xgetttext tool]) + +# Checks for programs. +AC_PROG_SED +AC_PROG_CC +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_INSTALL +AX_PATH_PROG_OR_FAIL([PERL], [perl]) +AX_PATH_PROG_OR_FAIL([BRCTL], [brctl]) +AX_PATH_PROG_OR_FAIL([IP], [ip]) +AX_PATH_PROG_OR_FAIL([BISON], [bison]) +AX_PATH_PROG_OR_FAIL([FLEX], [flex]) +AS_IF([test "x$xapi" = "xy"], [ + AX_PATH_PROG_OR_FAIL([CURL], [curl-config]) + AX_PATH_PROG_OR_FAIL([XML], [xml2-config]) +]) +AS_IF([test "x$ocamltools" = "xy"], [ + AC_PROG_OCAML + AS_IF([test "x$OCAMLC" = "xno"], [ + AS_IF([test "x$enable_ocamltools" = "xyes"], [ + AC_MSG_ERROR([Ocaml tools enabled, but unable to find Ocaml])]) + ocamltools="n" + ]) +]) +AX_PATH_PROG_OR_FAIL([BASH], [bash]) +AS_IF([test "x$pythontools" = "xy"], [ + AS_IF([echo "$PYTHON" | grep -q "^/"], [ + PYTHONPATH=$PYTHON + PYTHON=`basename $PYTHONPATH` + ],[test -z "$PYTHON"], [PYTHON="python"], + [AC_MSG_ERROR([PYTHON specified, but is not an absolute path])]) + AX_PATH_PROG_OR_FAIL([PYTHONPATH], [$PYTHON]) + AX_CHECK_PYTHON_VERSION([2], [3]) + AX_CHECK_PYTHON_XML() + AX_CHECK_PYTHON_DEVEL() +]) +AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext]) +AX_CHECK_UDEV([59]) +AX_CHECK_UUID +PKG_CHECK_MODULES(glib, glib-2.0) + +# Check library path +AX_DEFAULT_LIB + +# Checks for libraries. +AC_CHECK_LIB([aio], [io_setup], [system_aio="y"], [system_aio="n"]) +AC_SUBST(system_aio) +AC_CHECK_LIB([crypto], [MD5], [], [AC_MSG_ERROR([Could not find libcrypto])]) +AC_CHECK_LIB([ext2fs], [ext2fs_open2], [libext2fs="y"], [libext2fs="n"]) +AC_SUBST(libext2fs) +AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"]) +AC_SUBST(libgcrypt) +AC_CHECK_LIB([pthread], [pthread_create], [] , + [AC_MSG_ERROR([Could not find libpthread])]) +AC_CHECK_LIB([rt], [clock_gettime]) +AC_CHECK_LIB([uuid], [uuid_clear], [], + [AC_MSG_ERROR([Could not find libuuid])]) +AC_CHECK_LIB([yajl], [yajl_alloc], [], + [AC_MSG_ERROR([Could not find yajl])]) +AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])]) +AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"]) +AC_SUBST(libiconv) + +# Checks for header files. +AC_FUNC_ALLOCA +AC_CHECK_HEADERS([ \ + arpa/inet.h fcntl.h inttypes.h libintl.h limits.h malloc.h \ + netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h \ + strings.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h \ + sys/socket.h sys/statvfs.h sys/time.h syslog.h termios.h \ + unistd.h yajl/yajl_version.h \ + ]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_TYPE_UID_T +AC_C_INLINE +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_INT8_T +AC_TYPE_MODE_T +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_C_RESTRICT +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_CHECK_MEMBERS([struct stat.st_blksize]) +AC_STRUCT_ST_BLOCKS +AC_CHECK_MEMBERS([struct stat.st_rdev]) +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T +AC_CHECK_TYPES([ptrdiff_t]) + +# Checks for library functions. +AC_FUNC_ERROR_AT_LINE +AC_FUNC_FORK +AC_FUNC_FSEEKO +AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +AC_HEADER_MAJOR +AC_FUNC_MALLOC +AC_FUNC_MKTIME +AC_FUNC_MMAP +AC_FUNC_REALLOC +AC_FUNC_STRNLEN +AC_FUNC_STRTOD +AC_CHECK_FUNCS([ \ + alarm atexit bzero clock_gettime dup2 fdatasync ftruncate \ + getcwd gethostbyname gethostname getpagesize gettimeofday \ + inet_ntoa isascii localtime_r memchr memmove memset mkdir \ + mkfifo munmap pathconf realpath regcomp rmdir select setenv \ + socket strcasecmp strchr strcspn strdup strerror strndup \ + strpbrk strrchr strspn strstr strtol strtoul strtoull tzset \ + uname \ + ]) + +AC_OUTPUT() diff -r ca80eca9cfa3 -r b6071c710f6c tools/debugger/gdbsx/xg/Makefile --- a/tools/debugger/gdbsx/xg/Makefile Mon Feb 20 18:34:14 2012 +0000 +++ b/tools/debugger/gdbsx/xg/Makefile Tue Feb 21 01:40:04 2012 +0100 @@ -21,7 +21,6 @@ xg_all.a: $(XG_OBJS) Makefile $(XG_HDRS) # $(CC) -m32 -c -o $@ $^ xen-headers: - $(MAKE) -C ../../../check $(MAKE) -C ../../../include # xg_main.o: xg_main.c Makefile $(XG_HDRS) diff -r ca80eca9cfa3 -r b6071c710f6c tools/install.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/install.sh Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,1 @@ +../install.sh \ No newline at end of file diff -r ca80eca9cfa3 -r b6071c710f6c tools/libfsimage/Makefile --- a/tools/libfsimage/Makefile Mon Feb 20 18:34:14 2012 +0000 +++ b/tools/libfsimage/Makefile Tue Feb 21 01:40:04 2012 +0100 @@ -3,7 +3,11 @@ include $(XEN_ROOT)/tools/Rules.mk SUBDIRS-y = common ufs reiserfs iso9660 fat zfs SUBDIRS-$(CONFIG_X86) += xfs -SUBDIRS-y += $(shell env CC="$(CC)" ./check-libext2fs) +ifeq ($(CONFIG_EXT2FS), y) + SUBDIRS-y += ext2fs-lib +else + SUBDIRS-y += ext2fs +endif .PHONY: all clean install all clean install: %: subdirs-% diff -r ca80eca9cfa3 -r b6071c710f6c tools/libfsimage/check-libext2fs --- a/tools/libfsimage/check-libext2fs Mon Feb 20 18:34:14 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#!/bin/sh - -cat >ext2-test.c < - -int main() -{ - ext2fs_open2; -} -EOF - -${CC-gcc} -o ext2-test ext2-test.c -lext2fs >/dev/null 2>&1 -if [ $? = 0 ]; then - echo ext2fs-lib -else - echo ext2fs -fi - -rm -f ext2-test ext2-test.c - -exit 0 diff -r ca80eca9cfa3 -r b6071c710f6c tools/libxen/Makefile --- a/tools/libxen/Makefile Mon Feb 20 18:34:14 2012 +0000 +++ b/tools/libxen/Makefile Tue Feb 21 01:40:04 2012 +0100 @@ -22,12 +22,12 @@ MAJOR = 1.0 MINOR = 0 CFLAGS += -Iinclude \ - $(shell xml2-config --cflags) \ - $(shell curl-config --cflags) \ + $(shell $(XML2_CONFIG) --cflags) \ + $(shell $(CURL_CONFIG) --cflags) \ -fPIC -LDFLAGS += $(shell xml2-config --libs) \ - $(shell curl-config --libs) +LDFLAGS += $(shell $(XML2_CONFIG) --libs) \ + $(shell $(CURL_CONFIG) --libs) LIBXENAPI_HDRS = $(wildcard include/xen/api/*.h) include/xen/api/xen_all.h LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c)) diff -r ca80eca9cfa3 -r b6071c710f6c tools/libxl/Makefile --- a/tools/libxl/Makefile Mon Feb 20 18:34:14 2012 +0000 +++ b/tools/libxl/Makefile Tue Feb 21 01:40:04 2012 +0100 @@ -19,10 +19,6 @@ ifeq ($(CONFIG_Linux),y) LIBUUID_LIBS += -luuid endif -ifeq ($(CONFIG_YAJL_VERSION),y) -CFLAGS += -DHAVE_YAJL_VERSION -endif - LIBXL_LIBS = LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS) $(LIBUUID_LIBS) @@ -56,7 +52,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_c libxl_qmp.o libxl_event.o $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o -$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) +$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -include $(XEN_ROOT)/tools/config.h AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c @@ -69,6 +65,7 @@ CLIENTS = xl testidl XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h $(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight) +$(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it. testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight) testidl.c: libxl_types.idl gentest.py libxl.h $(AUTOINCS) diff -r ca80eca9cfa3 -r b6071c710f6c tools/libxl/libxl_json.h --- a/tools/libxl/libxl_json.h Mon Feb 20 18:34:14 2012 +0000 +++ b/tools/libxl/libxl_json.h Tue Feb 21 01:40:04 2012 +0100 @@ -18,7 +18,7 @@ #include #include -#ifdef HAVE_YAJL_VERSION +#ifdef HAVE_YAJL_YAJL_VERSION_H # include #endif diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/default_lib.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/default_lib.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,8 @@ +AC_DEFUN([AX_DEFAULT_LIB], +[AS_IF([test -d "$prefix/lib64"], [ + LIB_PATH="lib64" +],[ + LIB_PATH="lib" +]) +AC_SUBST(LIB_PATH)]) + diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/disable_feature.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/disable_feature.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,13 @@ +AC_DEFUN([AX_ARG_DISABLE_AND_EXPORT], +[AC_ARG_ENABLE([$1], + AS_HELP_STRING([--disable-$1], [$2])) + +AS_IF([test "x$enable_$1" = "xno"], [ + ax_cv_$1="n" +], [test "x$enable_$1" = "xyes"], [ + ax_cv_$1="y" +], [test -z $ax_cv_$1], [ + ax_cv_$1="y" +]) +$1=$ax_cv_$1 +AC_SUBST($1)]) diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/enable_feature.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/enable_feature.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,13 @@ +AC_DEFUN([AX_ARG_ENABLE_AND_EXPORT], +[AC_ARG_ENABLE([$1], + AS_HELP_STRING([--enable-$1], [$2])) + +AS_IF([test "x$enable_$1" = "xyes"], [ + ax_cv_$1="y" +], [test "x$enable_$1" = "xno"], [ + ax_cv_$1="n" +], [test -z $ax_cv_$1], [ + ax_cv_$1="n" +]) +$1=$ax_cv_$1 +AC_SUBST($1)]) diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/ocaml.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/ocaml.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,241 @@ +dnl autoconf macros for OCaml +dnl from http://forge.ocamlcore.org/ +dnl +dnl Copyright © 2009 Richard W.M. Jones +dnl Copyright © 2009 Stefano Zacchiroli +dnl Copyright © 2000-2005 Olivier Andrieu +dnl Copyright © 2000-2005 Jean-Christophe Filliâtre +dnl Copyright © 2000-2005 Georges Mariano +dnl +dnl For documentation, please read the ocaml.m4 man page. + +AC_DEFUN([AC_PROG_OCAML], +[dnl + # checking for ocamlc + AC_CHECK_TOOL([OCAMLC],[ocamlc],[no]) + + if test "$OCAMLC" != "no"; then + OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'` + AC_MSG_RESULT([OCaml version is $OCAMLVERSION]) + # 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 + AC_MSG_RESULT([OCAMLLIB previously set; preserving it.]) + fi + AC_MSG_RESULT([OCaml library path is $OCAMLLIB]) + + AC_SUBST([OCAMLVERSION]) + AC_SUBST([OCAMLLIB]) + + # checking for ocamlopt + AC_CHECK_TOOL([OCAMLOPT],[ocamlopt],[no]) + OCAMLBEST=byte + if test "$OCAMLOPT" = "no"; then + AC_MSG_WARN([Cannot find ocamlopt; bytecode compilation only.]) + else + TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + AC_MSG_RESULT([versions differs from ocamlc; ocamlopt discarded.]) + OCAMLOPT=no + else + OCAMLBEST=opt + fi + fi + + AC_SUBST([OCAMLBEST]) + + # checking for ocamlc.opt + AC_CHECK_TOOL([OCAMLCDOTOPT],[ocamlc.opt],[no]) + if test "$OCAMLCDOTOPT" != "no"; then + TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + AC_MSG_RESULT([versions differs from ocamlc; ocamlc.opt discarded.]) + else + OCAMLC=$OCAMLCDOTOPT + fi + fi + + # checking for ocamlopt.opt + if test "$OCAMLOPT" != "no" ; then + AC_CHECK_TOOL([OCAMLOPTDOTOPT],[ocamlopt.opt],[no]) + if test "$OCAMLOPTDOTOPT" != "no"; then + TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + AC_MSG_RESULT([version differs from ocamlc; ocamlopt.opt discarded.]) + else + OCAMLOPT=$OCAMLOPTDOTOPT + fi + fi + fi + + AC_SUBST([OCAMLOPT]) + fi + + AC_SUBST([OCAMLC]) + + # checking for ocaml toplevel + AC_CHECK_TOOL([OCAML],[ocaml],[no]) + + # checking for ocamldep + AC_CHECK_TOOL([OCAMLDEP],[ocamldep],[no]) + + # checking for ocamlmktop + AC_CHECK_TOOL([OCAMLMKTOP],[ocamlmktop],[no]) + + # checking for ocamlmklib + AC_CHECK_TOOL([OCAMLMKLIB],[ocamlmklib],[no]) + + # checking for ocamldoc + AC_CHECK_TOOL([OCAMLDOC],[ocamldoc],[no]) + + # checking for ocamlbuild + AC_CHECK_TOOL([OCAMLBUILD],[ocamlbuild],[no]) +]) + + +AC_DEFUN([AC_PROG_OCAMLLEX], +[dnl + # checking for ocamllex + AC_CHECK_TOOL([OCAMLLEX],[ocamllex],[no]) + if test "$OCAMLLEX" != "no"; then + AC_CHECK_TOOL([OCAMLLEXDOTOPT],[ocamllex.opt],[no]) + if test "$OCAMLLEXDOTOPT" != "no"; then + OCAMLLEX=$OCAMLLEXDOTOPT + fi + fi + AC_SUBST([OCAMLLEX]) +]) + +AC_DEFUN([AC_PROG_OCAMLYACC], +[dnl + AC_CHECK_TOOL([OCAMLYACC],[ocamlyacc],[no]) + AC_SUBST([OCAMLYACC]) +]) + + +AC_DEFUN([AC_PROG_CAMLP4], +[dnl + AC_REQUIRE([AC_PROG_OCAML])dnl + + # checking for camlp4 + AC_CHECK_TOOL([CAMLP4],[camlp4],[no]) + if test "$CAMLP4" != "no"; then + TMPVERSION=`$CAMLP4 -v 2>&1| sed -n -e 's|.*version *\(.*\)$|\1|p'` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + AC_MSG_RESULT([versions differs from ocamlc]) + CAMLP4=no + fi + fi + AC_SUBST([CAMLP4]) + + # checking for companion tools + AC_CHECK_TOOL([CAMLP4BOOT],[camlp4boot],[no]) + AC_CHECK_TOOL([CAMLP4O],[camlp4o],[no]) + AC_CHECK_TOOL([CAMLP4OF],[camlp4of],[no]) + AC_CHECK_TOOL([CAMLP4OOF],[camlp4oof],[no]) + AC_CHECK_TOOL([CAMLP4ORF],[camlp4orf],[no]) + AC_CHECK_TOOL([CAMLP4PROF],[camlp4prof],[no]) + AC_CHECK_TOOL([CAMLP4R],[camlp4r],[no]) + AC_CHECK_TOOL([CAMLP4RF],[camlp4rf],[no]) + AC_SUBST([CAMLP4BOOT]) + AC_SUBST([CAMLP4O]) + AC_SUBST([CAMLP4OF]) + AC_SUBST([CAMLP4OOF]) + AC_SUBST([CAMLP4ORF]) + AC_SUBST([CAMLP4PROF]) + AC_SUBST([CAMLP4R]) + AC_SUBST([CAMLP4RF]) +]) + + +AC_DEFUN([AC_PROG_FINDLIB], +[dnl + AC_REQUIRE([AC_PROG_OCAML])dnl + + # checking for ocamlfind + AC_CHECK_TOOL([OCAMLFIND],[ocamlfind],[no]) + AC_SUBST([OCAMLFIND]) +]) + + +dnl Thanks to Jim Meyering for working this next bit out for us. +dnl XXX We should define AS_TR_SH if it's not defined already +dnl (eg. for old autoconf). +AC_DEFUN([AC_CHECK_OCAML_PKG], +[dnl + AC_REQUIRE([AC_PROG_FINDLIB])dnl + + AC_MSG_CHECKING([for OCaml findlib package $1]) + + unset found + unset pkg + found=no + for pkg in $1 $2 ; do + if $OCAMLFIND query $pkg >/dev/null 2>/dev/null; then + AC_MSG_RESULT([found]) + AS_TR_SH([OCAML_PKG_$1])=$pkg + found=yes + break + fi + done + if test "$found" = "no" ; then + AC_MSG_RESULT([not found]) + AS_TR_SH([OCAML_PKG_$1])=no + fi + + AC_SUBST(AS_TR_SH([OCAML_PKG_$1])) +]) + + +AC_DEFUN([AC_CHECK_OCAML_MODULE], +[dnl + AC_MSG_CHECKING([for OCaml module $2]) + + cat > conftest.ml <&5 2>&5 ; then + found=yes + break + fi + done + + if test "$found" ; then + AC_MSG_RESULT([$$1]) + else + AC_MSG_RESULT([not found]) + $1=no + fi + AC_SUBST([$1]) +]) + + +dnl XXX Cross-compiling +AC_DEFUN([AC_CHECK_OCAML_WORD_SIZE], +[dnl + AC_REQUIRE([AC_PROG_OCAML])dnl + AC_MSG_CHECKING([for OCaml compiler word size]) + cat > conftest.ml < conftest.ml <. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +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]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + 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_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES 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], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +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` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/python_devel.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/python_devel.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,18 @@ +AC_DEFUN([AX_CHECK_PYTHON_DEVEL], +[AC_MSG_CHECKING([for python devel]) + +`$PYTHON -c ' +import os.path, sys +for p in sys.path: + if os.path.exists(p + "/config/Makefile"): + sys.exit(0) +sys.exit(1) +' > /dev/null 2>&1` + +if test "$?" != "0" +then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Python devel package not found]) +else + AC_MSG_RESULT([yes]) +fi]) diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/python_version.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/python_version.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,12 @@ +AC_DEFUN([AX_CHECK_PYTHON_VERSION], +[AC_MSG_CHECKING([for python version >= $1.$2 ]) +`$PYTHON -c 'import sys; exit(eval("sys.version_info < ($1, $2)"))'` +if test "$?" != "0" +then + python_version=`$PYTHON -V 2>&1` + AC_MSG_RESULT([no]) + AC_MSG_ERROR( + [$python_version is too old, minimum required version is $1.$2]) +else + AC_MSG_RESULT([yes]) +fi]) diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/python_xml.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/python_xml.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,10 @@ +AC_DEFUN([AX_CHECK_PYTHON_XML], +[AC_MSG_CHECKING([for python xml.dom.minidom]) +`$PYTHON -c 'import xml.dom.minidom'` +if test "$?" != "0" +then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Unable to find xml.dom.minidom module]) +else + AC_MSG_RESULT([yes]) +fi]) diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/set_cflags_ldflags.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/set_cflags_ldflags.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,20 @@ +AC_DEFUN([AX_SET_FLAGS], +[for cflag in $PREPEND_INCLUDES +do + PREPEND_CFLAGS+=" -I$cflag" +done +for ldflag in $PREPEND_LIB +do + PREPEND_LDFLAGS+=" -L$ldflag" +done +for cflag in $APPEND_INCLUDES +do + APPEND_CFLAGS+=" -I$cflag" +done +for ldflag in $APPEND_LIB +do + APPEND_LDFLAGS+=" -L$ldflag" +done +CFLAGS="$PREPEND_CFLAGS $CFLAGS $APPEND_CFLAGS" +LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPEND_LDFLAGS"]) + diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/udev.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/udev.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,32 @@ +AC_DEFUN([AX_CHECK_UDEV], +[if test "x$host_os" == "xlinux-gnu" +then + AC_PATH_PROG([UDEVADM], [udevadm], [no]) + if test x"${UDEVADM}" == x"no" + then + AC_PATH_PROG([UDEVINFO], [udevinfo], [no]) + if test x"${UDEVINFO}" == x"no" + then + AC_MSG_ERROR( + [Unable to find udevadm or udevinfo, please install udev]) + fi + udevver=`${UDEVINFO} -V | awk '{print $NF}'` + else + udevver=`${UDEVADM} info -V | awk '{print $NF}'` + fi + if test ${udevver} -lt 59 + then + AC_PATH_PROG([HOTPLUG], [hotplug], [no]) + if test x"${HOTPLUG}" == x"no" + then + AC_MSG_ERROR([udev is too old, upgrade to version 59 or later]) + fi + fi +else + AC_PATH_PROG([VNCONFIG], [vnconfig], [no]) + if test x"${VNCONFIG}" == x"no" + then + AC_MSG_ERROR([Not a Linux system and unable to find vnd]) + fi +fi +]) diff -r ca80eca9cfa3 -r b6071c710f6c tools/m4/uuid.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/m4/uuid.m4 Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,10 @@ +AC_DEFUN([AX_CHECK_UUID], +[if test "x$host_os" == "xlinux-gnu" +then + AC_CHECK_HEADER([uuid/uuid.h],, + [AC_MSG_ERROR([cannot find uuid headers])]) +else + AC_CHECK_HEADER([uuid.h],, + [AC_MSG_ERROR([cannot find uuid headers])]) +fi +]) diff -r ca80eca9cfa3 -r b6071c710f6c version.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/version.sh Tue Feb 21 01:40:04 2012 +0100 @@ -0,0 +1,5 @@ +#!/bin/sh + +MAJOR=`grep "export XEN_VERSION" $1 | sed 's/.*=//g' | tr -s " "` +MINOR=`grep "export XEN_SUBVERSION" $1 | sed 's/.*=//g' | tr -s " "` +printf "%d.%d" $MAJOR $MINOR