[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v6 10/13] autoconf: xen: move standard path variables to config/Paths.mk.in



On Thu, 2014-06-12 at 18:18 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx>
> 
> 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@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 autogen.sh after applying.
> 
>  .gitignore           |  1 +
>  config/Paths.mk.in   | 37 +++++++++++++++++++++++++++++++
>  config/Stubdom.mk.in |  1 +
>  configure.ac         |  8 ++++++-
>  m4/paths.m4          | 61 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  stubdom/Makefile     |  1 +
>  tools/Rules.mk       |  1 +
>  7 files changed, 109 insertions(+), 1 deletion(-)
>  create mode 100644 config/Paths.mk.in
>  create mode 100644 m4/paths.m4
> 
> diff --git a/.gitignore b/.gitignore
> index 562c262..588a76d 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -36,6 +36,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
> index 0000000..507b6d1
> --- /dev/null
> +++ b/config/Paths.mk.in
> @@ -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@
> diff --git a/config/Stubdom.mk.in b/config/Stubdom.mk.in
> index 302842e..6bce206 100644
> --- a/config/Stubdom.mk.in
> +++ b/config/Stubdom.mk.in
> @@ -1,4 +1,5 @@
>  # Prefix and install folder
> +include $(XEN_ROOT)/config/Paths.mk
>  prefix              := @prefix@
>  PREFIX              := $(prefix)
>  exec_prefix         := @exec_prefix@
> diff --git a/configure.ac b/configure.ac
> index 6c14524..f32f9af 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -5,12 +5,18 @@ 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/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
> index 0000000..717fcd1
> --- /dev/null
> +++ b/m4/paths.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

This is a bit of shame. I suppose this needs to happen in the middle of
AC_OUTPUT which isn't possible?

autoconf itself seems to quote the prefix so it is not expanded until
later, i.e. when config.status is run. Would that work here?

Or perhaps we should just PREFIX=$prefix AC_SUBST(PREFIX) and put all
the BINDIR=$PREFIX/bin into Paths.mk.in after PREFIX=@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`

Why is this one an eval?

> diff --git a/stubdom/Makefile b/stubdom/Makefile
> index c41de27..ef99e3e 100644
> --- a/stubdom/Makefile
> +++ b/stubdom/Makefile
> @@ -7,6 +7,7 @@ export stubdom=y
>  export debug=y
>  include $(XEN_ROOT)/Config.mk
>  -include $(XEN_ROOT)/config/Stubdom.mk
> +include $(XEN_ROOT)/config/Paths.mk

The reason for the -include of Stubdom.mk is so that if it doesn't exist
enogh of the Makefile is still run to get:
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
$(XEN_ROOT)/config/Stubdom.mk:
        $(error You have to run ./configure before building or installing 
stubdom)
endif

You included Paths.mk from Stubdom.mk (and Tools.mk etc) so I think
these ones are redundant.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.