Skip to contentSkip to conversation

build: add autoconf to replace custom checks in tools/check

PATCH Superseded Roger Pau Monne 1 participant 1 message Jan 10, 2012 Kbuild

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 build: add autoconf to replace custom checks in tools/check

# HG changeset patch
# User Roger Pau Monne <[email protected]>
# Date 1326219181 -3600
# Node ID d665d94dab0f2788fe431ee13343e3b78b323b11 # Parent 4086e4811547ddffb9a53fbf2efb6c2fa436b70a
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/Autoconf.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 still not used anywhere, and is automatically created by autoheader, altough this migh change when we start to include this file.

Just a first release, and since it's my first autoconf script I guess there will be many things to polish here... Please review and comment.

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.

.hgignore +6 -0
diff -r 4086e4811547 -r d665d94dab0f .hgignore
@@ -308,6 +308,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$
Config.mk +0 -30
diff -r 4086e4811547 -r d665d94dab0f Config.mk
@@ -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,22 +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
 
-# 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
@@ -222,17 +206,3 @@ QEMU_TAG ?= bb36d632e4cabf47882adff07a45
 # Note that using SeaBIOS requires the use the upstream qemu as the
 # device model.
 SEABIOS_DIR ?= 
-
-# 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
-
-ifeq ($(OCAML_TOOLS),y)
-OCAML_TOOLS := $(shell ocamlopt -v > /dev/null 2>&1 && echo "y" || echo "n")
-endif
Makefile +0 -2
diff -r 4086e4811547 -r d665d94dab0f Makefile
@@ -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
README +4 -0
diff -r 4086e4811547 -r d665d94dab0f README
@@ -87,9 +87,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.
 
autogen.sh new file +9 -0
diff -r 4086e4811547 -r d665d94dab0f autogen.sh
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+rm -rf configure
+cd tools
+autoheader
+autoconf
+cd ..
+echo "#!/bin/sh -e" >> configure
+echo "cd tools && ./configure \$@" >> configure
+chmod +x configure
config/Tools.mk.in new file +50 -0

50 lines not on this page · raw message

configure new file +2 -0
diff -r 4086e4811547 -r d665d94dab0f configure
@@ -0,0 +1,2 @@
+#!/bin/sh -e
+cd tools && ./configure $@
tools/Makefile +2 -1
diff -r 4086e4811547 -r d665d94dab0f tools/Makefile
@@ -6,7 +6,6 @@ SUBDIRS-libaio := libaio
 endif
 
 SUBDIRS-y :=
-SUBDIRS-y += check
 SUBDIRS-y += include
 SUBDIRS-y += libxc
 SUBDIRS-y += flask
@@ -76,6 +75,8 @@ clean: subdirs-clean
 .PHONY: distclean
 distclean: subdirs-distclean
 	rm -rf ioemu-dir ioemu-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) \
tools/Rules.mk +5 -2
diff -r 4086e4811547 -r d665d94dab0f tools/Rules.mk
@@ -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
tools/blktap/drivers/Makefile +1 -1
diff -r 4086e4811547 -r d665d94dab0f tools/blktap/drivers/Makefile
@@ -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
tools/blktap/drivers/check_gcrypt deleted +0 -14
diff -r 4086e4811547 -r d665d94dab0f tools/blktap/drivers/check_gcrypt
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-cat > .gcrypt.c << EOF
-#include <gcrypt.h>
-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*
tools/check/Makefile deleted +0 -26
diff -r 4086e4811547 -r d665d94dab0f tools/check/Makefile
@@ -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
tools/check/README deleted +0 -20
diff -r 4086e4811547 -r d665d94dab0f tools/check/README
@@ -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
tools/check/check_brctl deleted +0 -13
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_brctl
@@ -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
tools/check/check_crypto_lib deleted +0 -11
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_crypto_lib
@@ -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"
tools/check/check_curl deleted +0 -13
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_curl
@@ -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"
tools/check/check_iproute deleted +0 -15
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_iproute
@@ -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
tools/check/check_libaio_devel deleted +0 -11
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_libaio_devel
@@ -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
tools/check/check_libaio_lib deleted +0 -9
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_libaio_lib
@@ -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"
tools/check/check_openssl_devel deleted +0 -6
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_openssl_devel
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header openssl/md5.h || fail "missing openssl headers"
tools/check/check_python deleted +0 -13
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_python
@@ -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"
tools/check/check_python_devel deleted +0 -17
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_python_devel
@@ -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"
tools/check/check_python_xml deleted +0 -12
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_python_xml
@@ -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"
tools/check/check_udev deleted +0 -22
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_udev
@@ -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
tools/check/check_uuid_devel deleted +0 -7
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_uuid_devel
@@ -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)"
tools/check/check_x11_devel deleted +0 -9
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_x11_devel
@@ -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"
tools/check/check_xgettext deleted +0 -6
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_xgettext
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_or_fail xgettext
tools/check/check_xml2 deleted +0 -14
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_xml2
@@ -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"
tools/check/check_yajl_devel deleted +0 -8
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_yajl_devel
@@ -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"
tools/check/check_yajl_lib deleted +0 -6
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_yajl_lib
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-has_lib libyajl.so.1 || fail "can't find libyajl.so.1 version 1"
tools/check/check_zlib_devel deleted +0 -6
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_zlib_devel
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header zlib.h || fail "can't find zlib headers"
tools/check/check_zlib_lib deleted +0 -12
diff -r 4086e4811547 -r d665d94dab0f tools/check/check_zlib_lib
@@ -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"
tools/check/chk deleted +0 -63

63 lines not on this page · raw message

tools/check/funcs.sh deleted +0 -106

106 lines not on this page · raw message

tools/config.guess new file +1501 -0

1,501 lines not on this page · raw message

tools/config.h.in new file +468 -0

468 lines not on this page · raw message

tools/config.sub new file +1705 -0

401 lines not on this page · raw message

tools/configure new file +10181 -0

10,181 lines not on this page · raw message

tools/configure.ac new file +189 -0

189 lines not on this page · raw message

tools/debugger/gdbsx/xg/Makefile +0 -1
diff -r 4086e4811547 -r d665d94dab0f tools/debugger/gdbsx/xg/Makefile

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

tools/install.sh new file +1 -0
diff -r 4086e4811547 -r d665d94dab0f tools/install.sh

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

tools/libfsimage/Makefile +5 -1
diff -r 4086e4811547 -r d665d94dab0f tools/libfsimage/Makefile

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

tools/libfsimage/check-libext2fs deleted +0 -21
diff -r 4086e4811547 -r d665d94dab0f tools/libfsimage/check-libext2fs

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

tools/libxen/Makefile +4 -4
diff -r 4086e4811547 -r d665d94dab0f tools/libxen/Makefile

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

tools/m4/default_lib.m4 new file +8 -0
diff -r 4086e4811547 -r d665d94dab0f tools/m4/default_lib.m4

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

tools/m4/disable_feature.m4 new file +13 -0
diff -r 4086e4811547 -r d665d94dab0f tools/m4/disable_feature.m4

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

tools/m4/enable_feature.m4 new file +13 -0
diff -r 4086e4811547 -r d665d94dab0f tools/m4/enable_feature.m4

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

tools/m4/ocaml.m4 new file +241 -0

241 lines not on this page · raw message

tools/m4/path_or_fail.m4 new file +6 -0
diff -r 4086e4811547 -r d665d94dab0f tools/m4/path_or_fail.m4

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

tools/m4/python_devel.m4 new file +18 -0
diff -r 4086e4811547 -r d665d94dab0f tools/m4/python_devel.m4

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

tools/m4/python_version.m4 new file +12 -0
diff -r 4086e4811547 -r d665d94dab0f tools/m4/python_version.m4

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

tools/m4/python_xml.m4 new file +10 -0
diff -r 4086e4811547 -r d665d94dab0f tools/m4/python_xml.m4

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

tools/m4/set_cflags_ldflags.m4 new file +20 -0
diff -r 4086e4811547 -r d665d94dab0f tools/m4/set_cflags_ldflags.m4

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

tools/m4/udev.m4 new file +32 -0
diff -r 4086e4811547 -r d665d94dab0f tools/m4/udev.m4

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

version.sh new file +4 -0
diff -r 4086e4811547 -r d665d94dab0f version.sh

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

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

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

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