autoconf: xen: move standard path variables to config/Paths.mk.in
authorLuis R. Rodriguez <mcgrof@suse.com>
Sat, 26 Jul 2014 02:14:17 +0000 (19:14 -0700)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 28 Jul 2014 12:44:18 +0000 (13:44 +0100)
This moves all generic path variables to a new the config/Paths.mk.in
input source file to be processed at configure time, tons of files use
these so this just share them. 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 makes use of the old buildmakevars2file() but generalizes
the definition of the paths at configure time and spreads the
new definitions out throughout the build system.

This has no impact on building the hypervisor and extras/mini-os,
you do not need to, and are not expected to, run configure to build
those targets.

While at it lets add some documentation on the for the two files on
the source file, we can 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@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- reran autogen.sh ]

.gitignore
config/Paths.mk.in [new file with mode: 0644]
config/Stubdom.mk.in
configure
configure.ac
m4/paths.m4 [new file with mode: 0644]
tools/Rules.mk

index fefe13c93c16af5f924ee4a99809875379e32596..f1d1b9c6f8352de13818f9dc988436988a48cc8c 100644 (file)
@@ -37,6 +37,7 @@ config.log
 config.status
 config.cache
 config/Toplevel.mk
+config/Paths.mk
 
 build-*
 dist/*
diff --git a/config/Paths.mk.in b/config/Paths.mk.in
new file mode 100644 (file)
index 0000000..507b6d1
--- /dev/null
@@ -0,0 +1,37 @@
+# Xen system configuration
+# ========================
+#
+# Xen uses a set of variables for system configuration and at build time,
+# because of this these variables are defined on one master input source file
+# and is generated after running ./configure. The master source is located
+# on the xen source tree at under config/Paths.mk.in and it is used to
+# generate shell or header files by the build system upon demand through the
+# use of the helper makefile helper buildmakevars2file().
+#
+# For more documentation you can refer to the wiki:
+#
+# http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration
+
+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@
index 302842e2e56f1d7cb6ff5a796ac2adb87818e25c..6bce2060503970d573f16783e4f1b23938923cb6 100644 (file)
@@ -1,4 +1,5 @@
 # Prefix and install folder
+include $(XEN_ROOT)/config/Paths.mk
 prefix              := @prefix@
 PREFIX              := $(prefix)
 exec_prefix         := @exec_prefix@
index d5c8500786ef7c6524d9f9245303aa9be71aa7bd..1ff0a44d3e6e2db1e9e6d7d9bb1072ec7c0ff2ab 100755 (executable)
--- a/configure
+++ b/configure
@@ -594,6 +594,23 @@ stubdom
 tools
 xen
 subdirs
+XEN_PAGING_DIR
+XEN_LOCK_DIR
+XEN_SCRIPT_DIR
+XEN_CONFIG_DIR
+CONFIG_DIR
+XENFIRMWAREDIR
+PRIVATE_BINDIR
+PKG_XEN_PREFIX
+PRIVATE_PREFIX
+SHAREDIR
+XEN_LIB_STORED
+XEN_LOG_DIR
+XEN_RUN_DIR
+LIBDIR
+LIBEXEC
+SBINDIR
+BINDIR
 host_os
 host_vendor
 host_cpu
@@ -1702,7 +1719,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ./config/Toplevel.mk"
+ac_config_files="$ac_config_files config/Toplevel.mk config/Paths.mk"
 
 
 ac_aux_dir=
@@ -1826,6 +1843,67 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
 
+
+
+
+
+
+
+test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
+test "x$exec_prefix" = "xNONE" && exec_prefix=$ac_default_prefix
+
+BINDIR=$prefix/bin
+
+
+SBINDIR=$prefix/sbin
+
+
+LIBEXEC=$prefix/lib/xen/bin
+
+
+LIBDIR=`eval echo $libdir`
+
+
+XEN_RUN_DIR=/var/run/xen
+
+
+XEN_LOG_DIR=/var/log/xen
+
+
+XEN_LIB_STORED=/var/lib/xenstored
+
+
+SHAREDIR=$prefix/share
+
+
+PRIVATE_PREFIX=$LIBDIR/xen
+
+
+PKG_XEN_PREFIX=$LIBDIR/xen
+
+
+PRIVATE_BINDIR=$PRIVATE_PREFIX/bin
+
+
+XENFIRMWAREDIR=$prefix/lib/xen/boot
+
+
+CONFIG_DIR=/etc
+
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+
+
+XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
+
+
+XEN_LOCK_DIR=/var/lock
+
+
+XEN_RUN_DIR=/var/run/xen
+
+
+XEN_PAGING_DIR=/var/lib/xen/xenpaging
 
 
 
@@ -2749,7 +2827,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
-    "./config/Toplevel.mk") CONFIG_FILES="$CONFIG_FILES ./config/Toplevel.mk" ;;
+    "config/Toplevel.mk") CONFIG_FILES="$CONFIG_FILES config/Toplevel.mk" ;;
+    "config/Paths.mk") CONFIG_FILES="$CONFIG_FILES config/Paths.mk" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
index 6c145240498f0eaa63d5c4ad5e3cacbf642f723f..f32f9af976ef521b77e4d3c529549764710c6cea 100644 (file)
@@ -5,12 +5,18 @@ AC_PREREQ([2.67])
 AC_INIT([Xen Hypervisor], m4_esyscmd([./version.sh ./xen/Makefile]),
     [xen-devel@lists.xen.org], [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/Paths.mk
+])
 
 AC_CANONICAL_HOST
 
 m4_include([m4/features.m4])
 m4_include([m4/subsystem.m4])
+m4_include([m4/paths.m4])
+
+AX_XEN_EXPAND_CONFIG()
 
 dnl mini-os is only ported to certain platforms
 case "$host_cpu" in
diff --git a/m4/paths.m4 b/m4/paths.m4
new file mode 100644 (file)
index 0000000..717fcd1
--- /dev/null
@@ -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)
+])
index 9ac8541475a721095e4e477f7550de02a2c6227e..0aa1e6bdc66c79b44f232d9db1d56d076e42f2b3 100644 (file)
@@ -5,6 +5,7 @@ all:
 
 -include $(XEN_ROOT)/config/Tools.mk
 include $(XEN_ROOT)/Config.mk
+include $(XEN_ROOT)/config/Paths.mk
 
 export _INSTALL := $(INSTALL)
 INSTALL = $(XEN_ROOT)/tools/cross-install