[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx> 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. Building the hypervisor and extras/mini-os without requiring configure is kept supported by providing a default configuration file with defaults that will be overwritten only if configure is used. While at it lets add some documentation on the README and enable us to expand further details on the wiki [0]. [0] http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Cc: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Keir Fraser <keir@xxxxxxx> Cc: Tim Deegan <tim@xxxxxxx> Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxx> --- Please run ./autgen.sh after this patch is applied. .gitignore | 2 ++ Config.mk | 13 --------- README | 16 ++++++++++ config/StdGNU.mk | 28 +++++++++--------- config/Toplevel.mk.in | 24 +++++++++++++++ config/defaults.mk | 21 ++++++++++++++ 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 ++-- 16 files changed, 198 insertions(+), 50 deletions(-) create mode 100644 config/defaults.mk create mode 100644 config/xen-environment-header.in create mode 100644 config/xen-environment-scripts.in create mode 100644 m4/expand_config.m4 diff --git a/.gitignore b/.gitignore index 562c262..fd1b627 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,8 @@ config.log config.status config.cache config/Toplevel.mk +config/xen-environment-scripts +config/xen-environment-header build-* dist/* diff --git a/Config.mk b/Config.mk index 6a93533..84f79a0 100644 --- a/Config.mk +++ b/Config.mk @@ -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 diff --git a/README b/README index 9bbe734..079e6a9 100644 --- a/README +++ b/README @@ -129,6 +129,22 @@ performed with root privileges.] versions of those scripts, so that you can copy the dist directory to another machine and install from that distribution. +Xen system configuration +======================== + +Xen uses a set of variables for system configuration and upon build time, +because of this these variables are defined on a top level general input +source and are generated after running ./configure. There are two versions +of the input files, one for scripts (bash, python) and another for C / header +files: + + * config/xen-environment-header.in - used to generate config/xen-environment-header + * config/xen-environment-scripts.in - used to generate config/xen-environment-scripts + +Further documentation can be found on the wiki: + +http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration + Python Runtime Libraries ======================== diff --git a/config/StdGNU.mk b/config/StdGNU.mk index c6439f6..273f1e8 100644 --- a/config/StdGNU.mk +++ b/config/StdGNU.mk @@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk + +# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mk + AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld ifeq ($(clang),y) @@ -27,24 +41,10 @@ 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) diff --git a/config/Toplevel.mk.in b/config/Toplevel.mk.in index 4db7eaf..fc2754c 100644 --- a/config/Toplevel.mk.in +++ b/config/Toplevel.mk.in @@ -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@ diff --git a/config/defaults.mk b/config/defaults.mk new file mode 100644 index 0000000..d1d3d5a --- /dev/null +++ b/config/defaults.mk @@ -0,0 +1,21 @@ +# Build system defaults, in case you never ran ./configure, this is +# supported to be able to build the xen hypervisor and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +PREFIX ?= /usr +BINDIR = $(PREFIX)/bin +LIBEXEC = $(PREFIX)/lib/xen/bin +SHAREDIR = $(PREFIX)/share +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 diff --git a/config/xen-environment-header.in b/config/xen-environment-header.in new file mode 100644 index 0000000..7dd7a53 --- /dev/null +++ b/config/xen-environment-header.in @@ -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@" diff --git a/config/xen-environment-scripts.in b/config/xen-environment-scripts.in new file mode 100644 index 0000000..9623231 --- /dev/null +++ b/config/xen-environment-scripts.in @@ -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@" diff --git a/configure.ac b/configure.ac index 6c14524..3f26a39 100644 --- a/configure.ac +++ b/configure.ac @@ -5,12 +5,19 @@ AC_PREREQ([2.67]) AC_INIT([Xen Hypervisor], m4_esyscmd([./version.sh ./xen/Makefile]), [xen-devel@xxxxxxxxxxxxx], [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 diff --git a/m4/expand_config.m4 b/m4/expand_config.m4 new file mode 100644 index 0000000..717fcd1 --- /dev/null +++ b/m4/expand_config.m4 @@ -0,0 +1,61 @@ +AC_DEFUN([AX_XEN_EXPAND_CONFIG], [ +dnl expand these early so we can use this for substitutions +test "x$prefix" = "xNONE" && prefix=$ac_default_prefix +test "x$exec_prefix" = "xNONE" && exec_prefix=$ac_default_prefix + +BINDIR=$prefix/bin +AC_SUBST(BINDIR) + +SBINDIR=$prefix/sbin +AC_SUBST(SBINDIR) + +dnl XXX: this should be changed to use the passed $libexec +dnl but can be done as a second step +LIBEXEC=$prefix/lib/xen/bin +AC_SUBST(LIBEXEC) + +LIBDIR=`eval echo $libdir` +AC_SUBST(LIBDIR) + +XEN_RUN_DIR=/var/run/xen +AC_SUBST(XEN_RUN_DIR) + +XEN_LOG_DIR=/var/log/xen +AC_SUBST(XEN_LOG_DIR) + +XEN_LIB_STORED=/var/lib/xenstored +AC_SUBST(XEN_LIB_STORED) + +SHAREDIR=$prefix/share +AC_SUBST(SHAREDIR) + +PRIVATE_PREFIX=$LIBDIR/xen +AC_SUBST(PRIVATE_PREFIX) + +PKG_XEN_PREFIX=$LIBDIR/xen +AC_SUBST(PKG_XEN_PREFIX) + +PRIVATE_BINDIR=$PRIVATE_PREFIX/bin +AC_SUBST(PRIVATE_BINDIR) + +XENFIRMWAREDIR=$prefix/lib/xen/boot +AC_SUBST(XENFIRMWAREDIR) + +CONFIG_DIR=/etc +AC_SUBST(CONFIG_DIR) + +XEN_CONFIG_DIR=$CONFIG_DIR/xen +AC_SUBST(XEN_CONFIG_DIR) + +XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts +AC_SUBST(XEN_SCRIPT_DIR) + +XEN_LOCK_DIR=/var/lock +AC_SUBST(XEN_LOCK_DIR) + +XEN_RUN_DIR=/var/run/xen +AC_SUBST(XEN_RUN_DIR) + +XEN_PAGING_DIR=/var/lib/xen/xenpaging +AC_SUBST(XEN_PAGING_DIR) +]) diff --git a/stubdom/Makefile b/stubdom/Makefile index c41de27..f0f624a 100644 --- a/stubdom/Makefile +++ b/stubdom/Makefile @@ -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 ############## @@ -448,9 +449,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: diff --git a/stubdom/configure.ac b/stubdom/configure.ac index 6468203..d6b0fbf 100644 --- a/stubdom/configure.ac +++ b/stubdom/configure.ac @@ -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]) diff --git a/tools/configure.ac b/tools/configure.ac index 25d7ca3..470894a 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -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]) diff --git a/tools/hotplug/common/Makefile b/tools/hotplug/common/Makefile index 18d87aa..4a63f40 100644 --- a/tools/hotplug/common/Makefile +++ b/tools/hotplug/common/Makefile @@ -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 diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index 4cfa275..fedfd62 100644 --- a/tools/libxl/Makefile +++ b/tools/libxl/Makefile @@ -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) >$@.new mv -f $@.new $@ -_paths.h: genpath - sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" $@.tmp >$@.2.tmp - rm -f $@.tmp - $(call move-if-changed,$@.2.tmp,$@) - _libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h $(PERL) $^ --prefix=libxl >$@.new $(call move-if-changed,$@.new,$@) diff --git a/tools/python/Makefile b/tools/python/Makefile index c433cbe..5556ffa 100644 --- a/tools/python/Makefile +++ b/tools/python/Makefile @@ -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 \ -- 2.0.0.rc3.18.g00a5b79 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |