xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
@ 2012-03-15 13:19 Olaf Hering
  2012-03-15 13:31 ` Jan Beulich
  2012-03-15 14:38 ` Roger Pau Monné
  0 siblings, 2 replies; 9+ messages in thread
From: Olaf Hering @ 2012-03-15 13:19 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1331817547 -3600
# Node ID 994ac398f4dc639ad0ca8aaabc4172ab72eb1358
# Parent  6dd1395c07cbc0f1408048f916bc6674dad19ef5
tools/configure: add options to pass EXTRA_CLFAGS

Currently qemu-xen gets build with CFLAGS only if CFLAGS was already in
the environment during make invocation. If CFLAGS is in environment then
make will append all of the various flags specified in xen Makefiles to
this environment variable, which is then used in qemu configure. Since
qemu-xen is not ready for compiler flags like -std=gnu99 compilation
will fail. If CFLAGS is not in environment, then configure will use just
"-O2 -g" because make does not export its own CFLAGS variable.

>From a distro perspective, its required to build libraries and binaries
with certain global cflags. Up to the point when qemu-xen was imported
it worked as expected by exporting CFLAGS before 'make tools'. Now
qemu-upstream reuses these CFLAGS, but it cant deal with the result.

This patch extends configure to recognize three environment variables
which will be written to config/Tools.mk so they will be reused with
each make invocation:
  EXTRA_CFLAGS_XEN_TOOLS= specifies CFLAGS for the tools build.
  EXTRA_CFLAGS_QEMU_TRADITIONAL= specifies CFLAGS for old qemu.
  EXTRA_CFLAGS_QEMU_XEN= specifies CFLAGS for new qemu.
The new feature can be used like this in a rpm xen.spec file:

   env \
   EXTRA_CFLAGS_XEN_TOOLS="${RPM_OPT_FLAGS}" \
   EXTRA_CFLAGS_QEMU_TRADITIONAL="${RPM_OPT_FLAGS}" \
   EXTRA_CFLAGS_QEMU_XEN="${RPM_OPT_FLAGS}" \
   ./configure \
   	--libdir=%{_libdir} \
   	--prefix=/usr
   make

To make sure the EXTRA_CFLAGS appear first in the command line
tools/Rules.mk must include config/Tools.mk before Config.mk.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r 6dd1395c07cb -r 994ac398f4dc config/Tools.mk.in
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -22,6 +22,10 @@ PREPEND_LIB         := @PREPEND_LIB@
 APPEND_INCLUDES     := @APPEND_INCLUDES@
 APPEND_LIB          := @APPEND_LIB@
 
+CFLAGS                        += @EXTRA_CFLAGS_XEN_TOOLS@
+EXTRA_CFLAGS_QEMU_TRADITIONAL += @EXTRA_CFLAGS_QEMU_TRADITIONAL@
+EXTRA_CFLAGS_QEMU_XEN         += @EXTRA_CFLAGS_QEMU_XEN@
+
 # 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
diff -r 6dd1395c07cb -r 994ac398f4dc tools/Makefile
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -122,6 +122,7 @@ subdir-all-qemu-xen-traditional-dir subd
 	set -e; \
 		$(buildmakevars2shellvars); \
 		cd qemu-xen-traditional-dir; \
+		env CFLAGS="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \
 		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS); \
 		$(MAKE) install
 
@@ -146,6 +147,7 @@ subdir-all-qemu-xen-dir subdir-install-q
 		source=.; \
 	fi; \
 	cd qemu-xen-dir; \
+	env CFLAGS="$(EXTRA_CFLAGS_QEMU_XEN)" \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
 		--source-path=$$source \
 		--extra-cflags="-I$(XEN_ROOT)/tools/include \
diff -r 6dd1395c07cb -r 994ac398f4dc tools/Rules.mk
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -3,8 +3,8 @@
 # `all' is the default target
 all:
 
+include $(XEN_ROOT)/config/Tools.mk
 include $(XEN_ROOT)/Config.mk
-include $(XEN_ROOT)/config/Tools.mk
 
 export _INSTALL := $(INSTALL)
 INSTALL = $(XEN_ROOT)/tools/cross-install
diff -r 6dd1395c07cb -r 994ac398f4dc tools/configure.ac
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -55,6 +55,12 @@ 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)])
+AC_ARG_VAR([EXTRA_CFLAGS_XEN_TOOLS],
+    [Extra CFLAGS to build tools])
+AC_ARG_VAR([EXTRA_CFLAGS_QEMU_TRADITIONAL],
+    [Extra CFLAGS to build qemu-traditional])
+AC_ARG_VAR([EXTRA_CFLAGS_QEMU_XEN],
+    [Extra CFLAGS to build qemu-xen])
 
 AX_SET_FLAGS

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
  2012-03-15 13:19 [PATCH] tools/configure: add options to pass EXTRA_CLFAGS Olaf Hering
@ 2012-03-15 13:31 ` Jan Beulich
  2012-03-15 13:46   ` Olaf Hering
  2012-03-15 14:38 ` Roger Pau Monné
  1 sibling, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2012-03-15 13:31 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

>>> On 15.03.12 at 14:19, Olaf Hering <olaf@aepfle.de> wrote:
> # HG changeset patch
> # User Olaf Hering <olaf@aepfle.de>
> # Date 1331817547 -3600
> # Node ID 994ac398f4dc639ad0ca8aaabc4172ab72eb1358
> # Parent  6dd1395c07cbc0f1408048f916bc6674dad19ef5
> tools/configure: add options to pass EXTRA_CLFAGS
> 
> Currently qemu-xen gets build with CFLAGS only if CFLAGS was already in
> the environment during make invocation. If CFLAGS is in environment then
> make will append all of the various flags specified in xen Makefiles to
> this environment variable, which is then used in qemu configure. Since
> qemu-xen is not ready for compiler flags like -std=gnu99 compilation
> will fail. If CFLAGS is not in environment, then configure will use just
> "-O2 -g" because make does not export its own CFLAGS variable.
> 
> From a distro perspective, its required to build libraries and binaries
> with certain global cflags. Up to the point when qemu-xen was imported
> it worked as expected by exporting CFLAGS before 'make tools'. Now
> qemu-upstream reuses these CFLAGS, but it cant deal with the result.
> 
> This patch extends configure to recognize three environment variables
> which will be written to config/Tools.mk so they will be reused with
> each make invocation:
>   EXTRA_CFLAGS_XEN_TOOLS= specifies CFLAGS for the tools build.
>   EXTRA_CFLAGS_QEMU_TRADITIONAL= specifies CFLAGS for old qemu.
>   EXTRA_CFLAGS_QEMU_XEN= specifies CFLAGS for new qemu.
> The new feature can be used like this in a rpm xen.spec file:
> 
>    env \
>    EXTRA_CFLAGS_XEN_TOOLS="${RPM_OPT_FLAGS}" \
>    EXTRA_CFLAGS_QEMU_TRADITIONAL="${RPM_OPT_FLAGS}" \
>    EXTRA_CFLAGS_QEMU_XEN="${RPM_OPT_FLAGS}" \
>    ./configure \
>    	--libdir=%{_libdir} \
>    	--prefix=/usr
>    make
> 
> To make sure the EXTRA_CFLAGS appear first in the command line

Wouldn't one rather want them to appear last (to eventually override
other settings, namely the optimization level)?

Jan

> tools/Rules.mk must include config/Tools.mk before Config.mk.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> 
> diff -r 6dd1395c07cb -r 994ac398f4dc config/Tools.mk.in
> --- a/config/Tools.mk.in
> +++ b/config/Tools.mk.in
> @@ -22,6 +22,10 @@ PREPEND_LIB         := @PREPEND_LIB@
>  APPEND_INCLUDES     := @APPEND_INCLUDES@
>  APPEND_LIB          := @APPEND_LIB@
>  
> +CFLAGS                        += @EXTRA_CFLAGS_XEN_TOOLS@
> +EXTRA_CFLAGS_QEMU_TRADITIONAL += @EXTRA_CFLAGS_QEMU_TRADITIONAL@
> +EXTRA_CFLAGS_QEMU_XEN         += @EXTRA_CFLAGS_QEMU_XEN@
> +
>  # 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
> diff -r 6dd1395c07cb -r 994ac398f4dc tools/Makefile
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -122,6 +122,7 @@ subdir-all-qemu-xen-traditional-dir subd
>  	set -e; \
>  		$(buildmakevars2shellvars); \
>  		cd qemu-xen-traditional-dir; \
> +		env CFLAGS="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \
>  		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS); \
>  		$(MAKE) install
>  
> @@ -146,6 +147,7 @@ subdir-all-qemu-xen-dir subdir-install-q
>  		source=.; \
>  	fi; \
>  	cd qemu-xen-dir; \
> +	env CFLAGS="$(EXTRA_CFLAGS_QEMU_XEN)" \
>  	$$source/configure --enable-xen --target-list=i386-softmmu \
>  		--source-path=$$source \
>  		--extra-cflags="-I$(XEN_ROOT)/tools/include \
> diff -r 6dd1395c07cb -r 994ac398f4dc tools/Rules.mk
> --- a/tools/Rules.mk
> +++ b/tools/Rules.mk
> @@ -3,8 +3,8 @@
>  # `all' is the default target
>  all:
>  
> +include $(XEN_ROOT)/config/Tools.mk
>  include $(XEN_ROOT)/Config.mk
> -include $(XEN_ROOT)/config/Tools.mk
>  
>  export _INSTALL := $(INSTALL)
>  INSTALL = $(XEN_ROOT)/tools/cross-install
> diff -r 6dd1395c07cb -r 994ac398f4dc tools/configure.ac
> --- a/tools/configure.ac
> +++ b/tools/configure.ac
> @@ -55,6 +55,12 @@ 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)])
> +AC_ARG_VAR([EXTRA_CFLAGS_XEN_TOOLS],
> +    [Extra CFLAGS to build tools])
> +AC_ARG_VAR([EXTRA_CFLAGS_QEMU_TRADITIONAL],
> +    [Extra CFLAGS to build qemu-traditional])
> +AC_ARG_VAR([EXTRA_CFLAGS_QEMU_XEN],
> +    [Extra CFLAGS to build qemu-xen])
>  
>  AX_SET_FLAGS
>  
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org 
> http://lists.xen.org/xen-devel 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
  2012-03-15 13:31 ` Jan Beulich
@ 2012-03-15 13:46   ` Olaf Hering
  0 siblings, 0 replies; 9+ messages in thread
From: Olaf Hering @ 2012-03-15 13:46 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

On Thu, Mar 15, Jan Beulich wrote:

> > This patch extends configure to recognize three environment variables
> > which will be written to config/Tools.mk so they will be reused with
> > each make invocation:
> >   EXTRA_CFLAGS_XEN_TOOLS= specifies CFLAGS for the tools build.
> >   EXTRA_CFLAGS_QEMU_TRADITIONAL= specifies CFLAGS for old qemu.
> >   EXTRA_CFLAGS_QEMU_XEN= specifies CFLAGS for new qemu.
> > The new feature can be used like this in a rpm xen.spec file:
> > 
> >    env \
> >    EXTRA_CFLAGS_XEN_TOOLS="${RPM_OPT_FLAGS}" \
> >    EXTRA_CFLAGS_QEMU_TRADITIONAL="${RPM_OPT_FLAGS}" \
> >    EXTRA_CFLAGS_QEMU_XEN="${RPM_OPT_FLAGS}" \
> >    ./configure \
> >    	--libdir=%{_libdir} \
> >    	--prefix=/usr
> >    make
> > 
> > To make sure the EXTRA_CFLAGS appear first in the command line
> 
> Wouldn't one rather want them to appear last (to eventually override
> other settings, namely the optimization level)?

If thats desired then the EXTRA_CFLAGS_XEN_TOOLS part is not needed,
APPEND_CFLAGS= could be used for that purpose. But this variable is not
yet handled as autoconf variable.

Olaf

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
  2012-03-15 13:19 [PATCH] tools/configure: add options to pass EXTRA_CLFAGS Olaf Hering
  2012-03-15 13:31 ` Jan Beulich
@ 2012-03-15 14:38 ` Roger Pau Monné
  2012-03-15 15:32   ` Olaf Hering
  1 sibling, 1 reply; 9+ messages in thread
From: Roger Pau Monné @ 2012-03-15 14:38 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

2012/3/15 Olaf Hering <olaf@aepfle.de>:
> # HG changeset patch
> # User Olaf Hering <olaf@aepfle.de>
> # Date 1331817547 -3600
> # Node ID 994ac398f4dc639ad0ca8aaabc4172ab72eb1358
> # Parent  6dd1395c07cbc0f1408048f916bc6674dad19ef5
> tools/configure: add options to pass EXTRA_CLFAGS
>
> Currently qemu-xen gets build with CFLAGS only if CFLAGS was already in
> the environment during make invocation. If CFLAGS is in environment then
> make will append all of the various flags specified in xen Makefiles to
> this environment variable, which is then used in qemu configure. Since
> qemu-xen is not ready for compiler flags like -std=gnu99 compilation
> will fail. If CFLAGS is not in environment, then configure will use just
> "-O2 -g" because make does not export its own CFLAGS variable.
>
> From a distro perspective, its required to build libraries and binaries
> with certain global cflags. Up to the point when qemu-xen was imported
> it worked as expected by exporting CFLAGS before 'make tools'. Now
> qemu-upstream reuses these CFLAGS, but it cant deal with the result.
>
> This patch extends configure to recognize three environment variables
> which will be written to config/Tools.mk so they will be reused with
> each make invocation:
>  EXTRA_CFLAGS_XEN_TOOLS= specifies CFLAGS for the tools build.
>  EXTRA_CFLAGS_QEMU_TRADITIONAL= specifies CFLAGS for old qemu.
>  EXTRA_CFLAGS_QEMU_XEN= specifies CFLAGS for new qemu.
> The new feature can be used like this in a rpm xen.spec file:
>
>   env \
>   EXTRA_CFLAGS_XEN_TOOLS="${RPM_OPT_FLAGS}" \
>   EXTRA_CFLAGS_QEMU_TRADITIONAL="${RPM_OPT_FLAGS}" \
>   EXTRA_CFLAGS_QEMU_XEN="${RPM_OPT_FLAGS}" \
>   ./configure \
>        --libdir=%{_libdir} \
>        --prefix=/usr
>   make
>
> To make sure the EXTRA_CFLAGS appear first in the command line
> tools/Rules.mk must include config/Tools.mk before Config.mk.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
>
> diff -r 6dd1395c07cb -r 994ac398f4dc config/Tools.mk.in
> --- a/config/Tools.mk.in
> +++ b/config/Tools.mk.in
> @@ -22,6 +22,10 @@ PREPEND_LIB         := @PREPEND_LIB@
>  APPEND_INCLUDES     := @APPEND_INCLUDES@
>  APPEND_LIB          := @APPEND_LIB@
>
> +CFLAGS                        += @EXTRA_CFLAGS_XEN_TOOLS@
> +EXTRA_CFLAGS_QEMU_TRADITIONAL += @EXTRA_CFLAGS_QEMU_TRADITIONAL@
> +EXTRA_CFLAGS_QEMU_XEN         += @EXTRA_CFLAGS_QEMU_XEN@
> +
>  # 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
> diff -r 6dd1395c07cb -r 994ac398f4dc tools/Makefile
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -122,6 +122,7 @@ subdir-all-qemu-xen-traditional-dir subd
>        set -e; \
>                $(buildmakevars2shellvars); \
>                cd qemu-xen-traditional-dir; \
> +               env CFLAGS="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \
>                $(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS); \
>                $(MAKE) install
>
> @@ -146,6 +147,7 @@ subdir-all-qemu-xen-dir subdir-install-q
>                source=.; \
>        fi; \
>        cd qemu-xen-dir; \
> +       env CFLAGS="$(EXTRA_CFLAGS_QEMU_XEN)" \
>        $$source/configure --enable-xen --target-list=i386-softmmu \
>                --source-path=$$source \
>                --extra-cflags="-I$(XEN_ROOT)/tools/include \
> diff -r 6dd1395c07cb -r 994ac398f4dc tools/Rules.mk
> --- a/tools/Rules.mk
> +++ b/tools/Rules.mk
> @@ -3,8 +3,8 @@
>  # `all' is the default target
>  all:
>
> +include $(XEN_ROOT)/config/Tools.mk
>  include $(XEN_ROOT)/Config.mk
> -include $(XEN_ROOT)/config/Tools.mk

Do we really need to change the order? User-defined flags should
appear after necessary tools build flags, if not a user might use some
flags that break the build without knowing.

>  export _INSTALL := $(INSTALL)
>  INSTALL = $(XEN_ROOT)/tools/cross-install
> diff -r 6dd1395c07cb -r 994ac398f4dc tools/configure.ac
> --- a/tools/configure.ac
> +++ b/tools/configure.ac
> @@ -55,6 +55,12 @@ 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)])
> +AC_ARG_VAR([EXTRA_CFLAGS_XEN_TOOLS],
> +    [Extra CFLAGS to build tools])
> +AC_ARG_VAR([EXTRA_CFLAGS_QEMU_TRADITIONAL],
> +    [Extra CFLAGS to build qemu-traditional])
> +AC_ARG_VAR([EXTRA_CFLAGS_QEMU_XEN],
> +    [Extra CFLAGS to build qemu-xen])

The change looks good to me in terms of configure modifications, but
I'm not sure of the names, shouldn't qemu-traditional be
qemu-xen(-traditional) and qemu-xen be qemu-(xen-)upstream?

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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
  2012-03-15 14:38 ` Roger Pau Monné
@ 2012-03-15 15:32   ` Olaf Hering
  0 siblings, 0 replies; 9+ messages in thread
From: Olaf Hering @ 2012-03-15 15:32 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: xen-devel

On Thu, Mar 15, Roger Pau Monné wrote:


> > To make sure the EXTRA_CFLAGS appear first in the command line
> > tools/Rules.mk must include config/Tools.mk before Config.mk.

> > +++ b/tools/Rules.mk
> > @@ -3,8 +3,8 @@
> >  # `all' is the default target
> >  all:
> >
> > +include $(XEN_ROOT)/config/Tools.mk
> >  include $(XEN_ROOT)/Config.mk
> > -include $(XEN_ROOT)/config/Tools.mk
> 
> Do we really need to change the order? User-defined flags should
> appear after necessary tools build flags, if not a user might use some
> flags that break the build without knowing.

This affects the tools build. If the extra flags really should go to the
end, then APPEND_CFLAGS can be reused and the ordering change above can
be removed.

> >  export _INSTALL := $(INSTALL)
> >  INSTALL = $(XEN_ROOT)/tools/cross-install
> > diff -r 6dd1395c07cb -r 994ac398f4dc tools/configure.ac
> > --- a/tools/configure.ac
> > +++ b/tools/configure.ac
> > @@ -55,6 +55,12 @@ 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)])
> > +AC_ARG_VAR([EXTRA_CFLAGS_XEN_TOOLS],
> > +    [Extra CFLAGS to build tools])
> > +AC_ARG_VAR([EXTRA_CFLAGS_QEMU_TRADITIONAL],
> > +    [Extra CFLAGS to build qemu-traditional])
> > +AC_ARG_VAR([EXTRA_CFLAGS_QEMU_XEN],
> > +    [Extra CFLAGS to build qemu-xen])
> 
> The change looks good to me in terms of configure modifications, but
> I'm not sure of the names, shouldn't qemu-traditional be
> qemu-xen(-traditional) and qemu-xen be qemu-(xen-)upstream?

I cant comment on that.

What I have seen right now is that other external tools may need their
own EXTRA_CFLAGS_xx variable. Like gcc47 is currently unhappy with ipxe
at least.

Olaf

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
@ 2012-03-27 12:42 Olaf Hering
  2012-03-27 13:04 ` Olaf Hering
  0 siblings, 1 reply; 9+ messages in thread
From: Olaf Hering @ 2012-03-27 12:42 UTC (permalink / raw)
  To: xen-devel; +Cc: Roger Pau Monné, Fabio Fantoni

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1332851995 -7200
# Node ID 9c6337771520b390ed624fa6b6b2f2edc8042701
# Parent  d9e6e8632bb6b9a2144e7e148bc7ea53ea4933fd
tools/configure: add options to pass EXTRA_CLFAGS

Currently qemu-xen will be compiled with CFLAGS only if CFLAGS was
already in the environment during make invocation. If CFLAGS is in
environment then make will append all of the various flags specified in
xen Makefiles to this environment variable, which is then used in qemu
configure. Since qemu-xen is not ready for compiler flags like
"-std=gnu99" compilation will fail. If CFLAGS is not in environment,
then configure will use just "-O2 -g" because make does not export its
own CFLAGS variable.

>From a distro perspective, it is required to build libraries and
binaries with certain global cflags (arbitrary gcc options). Up to the
point when qemu-xen was imported it worked as expected by exporting
CFLAGS before 'make tools'.  Now qemu-upstream reuses these CFLAGS, but
it cant deal with the result.

This patch extends configure to recognize three environment variables
which will be written to config/Tools.mk so they will be reused with
each make invocation:
  EXTRA_CFLAGS_XEN_TOOLS= specifies CFLAGS for the tools build.
  EXTRA_CFLAGS_QEMU_TRADITIONAL= specifies CFLAGS for old qemu.
  EXTRA_CFLAGS_QEMU_XEN= specifies CFLAGS for new qemu.
The new feature can be used like this in a rpm xen.spec file:

   env \
   EXTRA_CFLAGS_XEN_TOOLS="${RPM_OPT_FLAGS}" \
   EXTRA_CFLAGS_QEMU_TRADITIONAL="${RPM_OPT_FLAGS}" \
   EXTRA_CFLAGS_QEMU_XEN="${RPM_OPT_FLAGS}" \
   ./configure \
   	--libdir=%{_libdir} \
   	--prefix=/usr
   make

v2:
 - add new EXTRA_CFLAGS_XEN_TOOLS variable to config/Tools.mk.in instead
   of modifying CFLAGS in this file. Also remove include order change in
   tools/Rules.mk since its now not needed anymore
 - add EXTRA_CFLAGS_XEN_TOOLS to all rules in tools/Rules.mk
 - update help output in tools/configure.ac

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r d9e6e8632bb6 -r 9c6337771520 config/Tools.mk.in
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -22,6 +22,10 @@ PREPEND_LIB         := @PREPEND_LIB@
 APPEND_INCLUDES     := @APPEND_INCLUDES@
 APPEND_LIB          := @APPEND_LIB@
 
+EXTRA_CFLAGS_XEN_TOOLS        := @EXTRA_CFLAGS_XEN_TOOLS@
+EXTRA_CFLAGS_QEMU_TRADITIONAL := @EXTRA_CFLAGS_QEMU_TRADITIONAL@
+EXTRA_CFLAGS_QEMU_XEN         := @EXTRA_CFLAGS_QEMU_XEN@
+
 # 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
diff -r d9e6e8632bb6 -r 9c6337771520 tools/Makefile
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -122,6 +122,7 @@ subdir-all-qemu-xen-traditional-dir subd
 	set -e; \
 		$(buildmakevars2shellvars); \
 		cd qemu-xen-traditional-dir; \
+		env CFLAGS="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \
 		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS); \
 		$(MAKE) install
 
@@ -146,6 +147,7 @@ subdir-all-qemu-xen-dir subdir-install-q
 		source=.; \
 	fi; \
 	cd qemu-xen-dir; \
+	env CFLAGS="$(EXTRA_CFLAGS_QEMU_XEN)" \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
 		--source-path=$$source \
 		--extra-cflags="-I$(XEN_ROOT)/tools/include \
diff -r d9e6e8632bb6 -r 9c6337771520 tools/Rules.mk
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -85,18 +85,18 @@ INSTALL_PYTHON_PROG = \
 	$(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
 
 %.opic: %.c
-	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
+	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS)
 
 %.o: %.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $< $(APPEND_CFLAGS)
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $< $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS)
 
 %.o: %.cc
-	$(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $< $(APPEND_CFLAGS)
+	$(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $< $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS)
 
 %.o: %.S
-	$(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@ $(APPEND_CFLAGS)
+	$(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@ $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS)
 %.opic: %.S
-	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
+	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS)
 
 subdirs-all subdirs-clean subdirs-install subdirs-distclean: .phony
 	@set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
diff -r d9e6e8632bb6 -r 9c6337771520 tools/configure.ac
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -55,6 +55,12 @@ 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)])
+AC_ARG_VAR([EXTRA_CFLAGS_XEN_TOOLS],
+    [Extra CFLAGS to build Xen tools])
+AC_ARG_VAR([EXTRA_CFLAGS_QEMU_TRADITIONAL],
+    [Extra CFLAGS to build qemu-xen-traditional])
+AC_ARG_VAR([EXTRA_CFLAGS_QEMU_XEN],
+    [Extra CFLAGS to build qemu-xen-upstream])
 
 AX_SET_FLAGS

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
  2012-03-27 12:42 Olaf Hering
@ 2012-03-27 13:04 ` Olaf Hering
  0 siblings, 0 replies; 9+ messages in thread
From: Olaf Hering @ 2012-03-27 13:04 UTC (permalink / raw)
  To: xen-devel; +Cc: Roger Pau Monné, Fabio Fantoni

On Tue, Mar 27, Olaf Hering wrote:

> # HG changeset patch
> # User Olaf Hering <olaf@aepfle.de>
> # Date 1332851995 -7200
> # Node ID 9c6337771520b390ed624fa6b6b2f2edc8042701
> # Parent  d9e6e8632bb6b9a2144e7e148bc7ea53ea4933fd
> tools/configure: add options to pass EXTRA_CLFAGS
> 

>  - add EXTRA_CFLAGS_XEN_TOOLS to all rules in tools/Rules.mk

Unfortunately this approach does not seem to work:

ld -melf_i386 -s -r 32bitbios.o tcgbios/tcgbiosext.o util.o pmm.o -o 32bitbios_all.o
There are undefined symbols in the BIOS:
         U __stack_chk_fail
make[9]: *** [32bitbios_all.o] Error 11

I will revisit this change.

Olaf

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
@ 2012-03-28 18:56 Olaf Hering
  2012-04-03 17:13 ` Ian Jackson
  0 siblings, 1 reply; 9+ messages in thread
From: Olaf Hering @ 2012-03-28 18:56 UTC (permalink / raw)
  To: xen-devel; +Cc: Roger Pau Monné, Fabio Fantoni

 config/Tools.mk.in                  |  4 ++++
 tools/Makefile                      |  2 ++
 tools/blktap/drivers/Makefile       |  2 ++
 tools/blktap/lib/Makefile           |  2 ++
 tools/blktap2/Makefile              |  2 ++
 tools/blktap2/control/Makefile      |  2 ++
 tools/blktap2/drivers/Makefile      |  2 ++
 tools/blktap2/lvm/Makefile          |  2 ++
 tools/blktap2/vhd/Makefile          |  2 ++
 tools/blktap2/vhd/lib/Makefile      |  2 ++
 tools/configure.ac                  |  6 ++++++
 tools/console/Makefile              |  3 +++
 tools/debugger/kdd/Makefile         |  3 +++
 tools/debugger/xenitp/Makefile      |  2 ++
 tools/flask/utils/Makefile          |  2 ++
 tools/libaio/src/Makefile           |  3 +++
 tools/libfsimage/Makefile           |  2 ++
 tools/libvchan/Makefile             |  2 ++
 tools/libxc/Makefile                |  2 ++
 tools/libxen/Makefile               |  2 ++
 tools/libxl/Makefile                |  2 ++
 tools/memshr/Makefile               |  2 ++
 tools/misc/Makefile                 |  2 ++
 tools/misc/lomount/Makefile         |  4 +++-
 tools/misc/nsplitd/Makefile         |  2 ++
 tools/pygrub/Makefile               |  2 ++
 tools/python/Makefile               |  2 ++
 tools/tests/Makefile                |  3 +++
 tools/tests/mce-test/tools/Makefile |  2 ++
 tools/tests/mem-sharing/Makefile    |  2 ++
 tools/tests/xen-access/Makefile     |  2 ++
 tools/xcutils/Makefile              |  2 ++
 tools/xenbackendd/Makefile          |  3 +++
 tools/xenmon/Makefile               |  3 +++
 tools/xenpaging/Makefile            |  2 ++
 tools/xenpmd/Makefile               |  2 ++
 tools/xenstat/Makefile              |  2 ++
 tools/xenstat/libxenstat/Makefile   |  2 ++
 tools/xenstat/xentop/Makefile       |  2 ++
 tools/xenstore/Makefile             |  2 ++
 tools/xentrace/Makefile             |  3 +++
 41 files changed, 96 insertions(+), 1 deletions(-)


# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1332960970 -7200
# Node ID bb6c07589982cd206f7397d58cc73ac2cdb00fd0
# Parent  1821c05638dfe76f36625f3555c8b3e9108180e0
tools/configure: add options to pass EXTRA_CLFAGS

Currently qemu-xen will be compiled with CFLAGS only if CFLAGS was
already in the environment during make invocation. If CFLAGS is in
environment then make will append all of the various flags specified in
xen Makefiles to this environment variable, which is then used in qemu
configure. Since qemu-xen is not ready for compiler flags like
"-std=gnu99" compilation will fail. If CFLAGS is not in environment,
then configure will use just "-O2 -g" because make does not export its
own CFLAGS variable.

>From a distro perspective, it is required to build libraries and
binaries with certain global cflags (arbitrary gcc options). Up to the
point when qemu-xen was imported it worked as expected by exporting
CFLAGS before 'make tools'.  Now qemu-upstream reuses these CFLAGS, but
it cant deal with the result.

This patch extends configure to recognize three environment variables
which will be written to config/Tools.mk so they will be reused with
each make invocation:
  EXTRA_CFLAGS_XEN_TOOLS= specifies CFLAGS for the tools build.
  EXTRA_CFLAGS_QEMU_TRADITIONAL= specifies CFLAGS for old qemu.
  EXTRA_CFLAGS_QEMU_XEN= specifies CFLAGS for new qemu.
The new feature can be used like this in a rpm xen.spec file:

   env \
   EXTRA_CFLAGS_XEN_TOOLS="${RPM_OPT_FLAGS}" \
   EXTRA_CFLAGS_QEMU_TRADITIONAL="${RPM_OPT_FLAGS}" \
   EXTRA_CFLAGS_QEMU_XEN="${RPM_OPT_FLAGS}" \
   ./configure \
   	--libdir=%{_libdir} \
   	--prefix=/usr
   make

v3:
 - move EXTRA_CFLAGS_XEN_TOOLS from rules in tools/Rules.mk to every
   Makefile except firmware because it runs in guest context and can not
   deal with gcc options like -fstack-protector. This turns
   EXTRA_CFLAGS_XEN_TOOLS into a HOST_CFLAGS kind of thing.

v2:
 - add new EXTRA_CFLAGS_XEN_TOOLS variable to config/Tools.mk.in instead
   of modifying CFLAGS in this file. Also remove include order change in
   tools/Rules.mk since its now not needed anymore
 - add EXTRA_CFLAGS_XEN_TOOLS to all rules in tools/Rules.mk
 - update help output in tools/configure.ac

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r 1821c05638df -r bb6c07589982 config/Tools.mk.in
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -22,6 +22,10 @@ PREPEND_LIB         := @PREPEND_LIB@
 APPEND_INCLUDES     := @APPEND_INCLUDES@
 APPEND_LIB          := @APPEND_LIB@
 
+EXTRA_CFLAGS_XEN_TOOLS        := @EXTRA_CFLAGS_XEN_TOOLS@
+EXTRA_CFLAGS_QEMU_TRADITIONAL := @EXTRA_CFLAGS_QEMU_TRADITIONAL@
+EXTRA_CFLAGS_QEMU_XEN         := @EXTRA_CFLAGS_QEMU_XEN@
+
 # 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
diff -r 1821c05638df -r bb6c07589982 tools/Makefile
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -122,6 +122,7 @@ subdir-all-qemu-xen-traditional-dir subd
 	set -e; \
 		$(buildmakevars2shellvars); \
 		cd qemu-xen-traditional-dir; \
+		env CFLAGS="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \
 		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS); \
 		$(MAKE) install
 
@@ -146,6 +147,7 @@ subdir-all-qemu-xen-dir subdir-install-q
 		source=.; \
 	fi; \
 	cd qemu-xen-dir; \
+	env CFLAGS="$(EXTRA_CFLAGS_QEMU_XEN)" \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
 		--source-path=$$source \
 		--extra-cflags="-I$(XEN_ROOT)/tools/include \
diff -r 1821c05638df -r bb6c07589982 tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile
+++ b/tools/blktap/drivers/Makefile
@@ -35,6 +35,8 @@ else
 AIOLIBS     := -laio
 endif
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm -lpthread
 LDLIBS_img := $(AIOLIBS) $(CRYPT_LIB) -lpthread -lz
 
diff -r 1821c05638df -r bb6c07589982 tools/blktap/lib/Makefile
--- a/tools/blktap/lib/Makefile
+++ b/tools/blktap/lib/Makefile
@@ -19,6 +19,8 @@ CFLAGS   += -fPIC
 # get asprintf():
 CFLAGS   += -D _GNU_SOURCE
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 OBJS     = $(SRCS:.c=.o)
 OBJS_PIC = $(SRCS:.c=.opic)
 IBINS   :=
diff -r 1821c05638df -r bb6c07589982 tools/blktap2/Makefile
--- a/tools/blktap2/Makefile
+++ b/tools/blktap2/Makefile
@@ -2,6 +2,8 @@ XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += $(CFLAGS_libxenctrl)
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDLIBS += $(LDLIBS_libxenctrl)
 
 SUBDIRS-y :=
diff -r 1821c05638df -r bb6c07589982 tools/blktap2/control/Makefile
--- a/tools/blktap2/control/Makefile
+++ b/tools/blktap2/control/Makefile
@@ -16,6 +16,8 @@ CFLAGS            += $(CFLAGS_libxenctrl
 CFLAGS            += -D_GNU_SOURCE
 CFLAGS            += -DTAPCTL
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 CTL_OBJS  := tap-ctl-ipc.o
 CTL_OBJS  += tap-ctl-list.o
 CTL_OBJS  += tap-ctl-allocate.o
diff -r 1821c05638df -r bb6c07589982 tools/blktap2/drivers/Makefile
--- a/tools/blktap2/drivers/Makefile
+++ b/tools/blktap2/drivers/Makefile
@@ -49,6 +49,8 @@ ifeq ($(VHD_STATIC),y)
 td-util: CFLAGS += -static
 endif
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 PORTABLE-OBJS-y :=
 PORTABLE-OBJS-$(CONFIG_Linux)  += blk_linux.o
 PORTABLE-OBJS-$(CONFIG_NetBSD) += blk_netbsd.o
diff -r 1821c05638df -r bb6c07589982 tools/blktap2/lvm/Makefile
--- a/tools/blktap2/lvm/Makefile
+++ b/tools/blktap2/lvm/Makefile
@@ -15,6 +15,8 @@ ifeq ($(CONFIG_X86_64),y)
 CFLAGS            += -fPIC
 endif
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LVM-OBJS          := lvm-util.o
 
 all: build
diff -r 1821c05638df -r bb6c07589982 tools/blktap2/vhd/Makefile
--- a/tools/blktap2/vhd/Makefile
+++ b/tools/blktap2/vhd/Makefile
@@ -21,6 +21,8 @@ ifeq ($(VHD_STATIC),y)
 CFLAGS            += -static
 endif
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LIBS              := -Llib -lvhd
 
 all: subdirs-all build
diff -r 1821c05638df -r bb6c07589982 tools/blktap2/vhd/lib/Makefile
--- a/tools/blktap2/vhd/lib/Makefile
+++ b/tools/blktap2/vhd/lib/Makefile
@@ -19,6 +19,8 @@ CFLAGS          += -D_GNU_SOURCE
 CFLAGS          += -fPIC
 CFLAGS          += -g
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 ifeq ($(CONFIG_Linux),y)
 LIBS            := -luuid
 endif
diff -r 1821c05638df -r bb6c07589982 tools/configure.ac
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -55,6 +55,12 @@ 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)])
+AC_ARG_VAR([EXTRA_CFLAGS_XEN_TOOLS],
+    [Extra CFLAGS to build Xen tools])
+AC_ARG_VAR([EXTRA_CFLAGS_QEMU_TRADITIONAL],
+    [Extra CFLAGS to build qemu-xen-traditional])
+AC_ARG_VAR([EXTRA_CFLAGS_QEMU_XEN],
+    [Extra CFLAGS to build qemu-xen-upstream])
 
 AX_SET_FLAGS
 
diff -r 1821c05638df -r bb6c07589982 tools/console/Makefile
--- a/tools/console/Makefile
+++ b/tools/console/Makefile
@@ -5,6 +5,9 @@ CFLAGS  += -Werror
 
 CFLAGS  += $(CFLAGS_libxenctrl)
 CFLAGS  += $(CFLAGS_libxenstore)
+
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDLIBS += $(LDLIBS_libxenctrl)
 LDLIBS += $(LDLIBS_libxenstore)
 LDLIBS += $(SOCKET_LIBS)
diff -r 1821c05638df -r bb6c07589982 tools/debugger/kdd/Makefile
--- a/tools/debugger/kdd/Makefile
+++ b/tools/debugger/kdd/Makefile
@@ -2,6 +2,9 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += $(CFLAGS_libxenctrl)
+
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDLIBS  += $(LDLIBS_libxenctrl)
 
 CFILES  := kdd.c kdd-xen.c
diff -r 1821c05638df -r bb6c07589982 tools/debugger/xenitp/Makefile
--- a/tools/debugger/xenitp/Makefile
+++ b/tools/debugger/xenitp/Makefile
@@ -5,6 +5,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += $(CFLAGS_libxenctrl)
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LIBBIN   = 
 
 ifeq ($(XEN_TARGET_ARCH),ia64)
diff -r 1821c05638df -r bb6c07589982 tools/flask/utils/Makefile
--- a/tools/flask/utils/Makefile
+++ b/tools/flask/utils/Makefile
@@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Wall -g -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 TESTDIR  = testsuite/tmp
 TESTFLAGS= -DTESTING
 TESTENV  = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
diff -r 1821c05638df -r bb6c07589982 tools/libaio/src/Makefile
--- a/tools/libaio/src/Makefile
+++ b/tools/libaio/src/Makefile
@@ -7,6 +7,9 @@ libdir=$(prefix)/lib
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/)
 CFLAGS = -nostdlib -nostartfiles -Wall -I. -g -fomit-frame-pointer -O2 -fPIC
+
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 SO_CFLAGS=-shared $(CFLAGS)
 L_CFLAGS=$(CFLAGS)
 LINK_FLAGS=
diff -r 1821c05638df -r bb6c07589982 tools/libfsimage/Makefile
--- a/tools/libfsimage/Makefile
+++ b/tools/libfsimage/Makefile
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 SUBDIRS-y = common ufs reiserfs iso9660 fat zfs
 SUBDIRS-$(CONFIG_X86) += xfs
 ifeq ($(CONFIG_EXT2FS), y)
diff -r 1821c05638df -r bb6c07589982 tools/libvchan/Makefile
--- a/tools/libvchan/Makefile
+++ b/tools/libvchan/Makefile
@@ -19,6 +19,8 @@ MINOR = 0
 
 CFLAGS += -I../include -I.
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 .PHONY: all
 all: libxenvchan.so vchan-node1 vchan-node2 libxenvchan.a
 
diff -r 1821c05638df -r bb6c07589982 tools/libxc/Makefile
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -73,6 +73,8 @@ CFLAGS   += -I. $(CFLAGS_xeninclude)
 # Needed for posix_fadvise64() in xc_linux.c
 CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 # Define this to make it possible to run valgrind on code linked with these
 # libraries.
 #CFLAGS   += -DVALGRIND -O0 -ggdb3
diff -r 1821c05638df -r bb6c07589982 tools/libxen/Makefile
--- a/tools/libxen/Makefile
+++ b/tools/libxen/Makefile
@@ -26,6 +26,8 @@ CFLAGS += -Iinclude                     
           $(shell $(CURL_CONFIG) --cflags) \
           -fPIC
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDFLAGS += $(shell $(XML2_CONFIG) --libs) \
            $(shell $(CURL_CONFIG) --libs)
 
diff -r 1821c05638df -r bb6c07589982 tools/libxl/Makefile
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -72,6 +72,8 @@ testidl.c: libxl_types.idl gentest.py li
 	$(PYTHON) gentest.py libxl_types.idl testidl.c.new
 	mv testidl.c.new testidl.c
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 .PHONY: all
 all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
 	$(AUTOSRCS) $(AUTOINCS)
diff -r 1821c05638df -r bb6c07589982 tools/memshr/Makefile
--- a/tools/memshr/Makefile
+++ b/tools/memshr/Makefile
@@ -11,6 +11,8 @@ CFLAGS          += -D_GNU_SOURCE
 CFLAGS          += -fPIC
 CFLAGS          += -g
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LIB-SRCS        := interface.c
 LIB-SRCS        += shm.c
 LIB-SRCS        += bidir-daemon.c
diff -r 1821c05638df -r bb6c07589982 tools/misc/Makefile
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -30,6 +30,8 @@ INSTALL_SBIN := $(INSTALL_SBIN-y)
 # Include configure output (config.h) to headers search path
 CFLAGS += -I$(XEN_ROOT)/tools
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 .PHONY: all
 all: build
 
diff -r 1821c05638df -r bb6c07589982 tools/misc/lomount/Makefile
--- a/tools/misc/lomount/Makefile
+++ b/tools/misc/lomount/Makefile
@@ -3,6 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 .PHONY: all
 all: build
 
@@ -20,4 +22,4 @@ clean:
 lomount: lomount.o
 	$(CC) $(CFLAGS) -o $@ $< 
 
--include $(DEPS)
\ No newline at end of file
+-include $(DEPS)
diff -r 1821c05638df -r bb6c07589982 tools/misc/nsplitd/Makefile
--- a/tools/misc/nsplitd/Makefile
+++ b/tools/misc/nsplitd/Makefile
@@ -1,6 +1,8 @@
 XEN_ROOT := $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 CFILES = $(wildcard *.c)
 
 HDRS     = $(wildcard *.h)
diff -r 1821c05638df -r bb6c07589982 tools/pygrub/Makefile
--- a/tools/pygrub/Makefile
+++ b/tools/pygrub/Makefile
@@ -2,6 +2,8 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 .PHONY: all
 all: build
 .PHONY: build
diff -r 1821c05638df -r bb6c07589982 tools/python/Makefile
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 .PHONY: all
 all: build
 
diff -r 1821c05638df -r bb6c07589982 tools/tests/Makefile
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -2,6 +2,9 @@ XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += $(CFLAGS_libxenctrl)
+
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDLIBS += $(LDLIBS_libxenctrl)
 
 SUBDIRS-y :=
diff -r 1821c05638df -r bb6c07589982 tools/tests/mce-test/tools/Makefile
--- a/tools/tests/mce-test/tools/Makefile
+++ b/tools/tests/mce-test/tools/Makefile
@@ -7,6 +7,8 @@ CFLAGS += $(CFLAGS_libxenguest)
 CFLAGS += $(CFLAGS_libxenstore) 
 CFLAGS += $(CFLAGS_xeninclude) 
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 .PHONY: all
 all: xen-mceinj
 
diff -r 1821c05638df -r bb6c07589982 tools/tests/mem-sharing/Makefile
--- a/tools/tests/mem-sharing/Makefile
+++ b/tools/tests/mem-sharing/Makefile
@@ -6,6 +6,8 @@ CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_xeninclude)
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 TARGETS-y := 
 TARGETS-$(CONFIG_X86) += memshrtool
 TARGETS := $(TARGETS-y)
diff -r 1821c05638df -r bb6c07589982 tools/tests/xen-access/Makefile
--- a/tools/tests/xen-access/Makefile
+++ b/tools/tests/xen-access/Makefile
@@ -7,6 +7,8 @@ CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_libxenguest)
 CFLAGS += $(CFLAGS_xeninclude)
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 TARGETS-y := 
 TARGETS-$(CONFIG_X86) += xen-access
 TARGETS := $(TARGETS-y)
diff -r 1821c05638df -r bb6c07589982 tools/xcutils/Makefile
--- a/tools/xcutils/Makefile
+++ b/tools/xcutils/Makefile
@@ -15,6 +15,8 @@ PROGRAMS = xc_restore xc_save readnotes 
 
 CFLAGS += -Werror
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 CFLAGS_xc_restore.o := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
 CFLAGS_xc_save.o    := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore)
 CFLAGS_readnotes.o  := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
diff -r 1821c05638df -r bb6c07589982 tools/xenbackendd/Makefile
--- a/tools/xenbackendd/Makefile
+++ b/tools/xenbackendd/Makefile
@@ -14,6 +14,9 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
 CFLAGS  += $(CFLAGS_libxenstore)
+
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 CPPFLAGS += -DXEN_SCRIPT_DIR="\"$(XEN_SCRIPT_DIR)\""
 LDLIBS  += $(LDLIBS_libxenstore)
 
diff -r 1821c05638df -r bb6c07589982 tools/xenmon/Makefile
--- a/tools/xenmon/Makefile
+++ b/tools/xenmon/Makefile
@@ -15,6 +15,9 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
 CFLAGS  += $(CFLAGS_libxenctrl)
+
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDLIBS  += $(LDLIBS_libxenctrl)
 
 SCRIPTS = xenmon.py
diff -r 1821c05638df -r bb6c07589982 tools/xenpaging/Makefile
--- a/tools/xenpaging/Makefile
+++ b/tools/xenpaging/Makefile
@@ -14,6 +14,8 @@ CFLAGS   += -Werror
 CFLAGS   += -Wno-unused
 CFLAGS   += -g
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 OBJS     = $(SRCS:.c=.o)
 IBINS    = xenpaging
 
diff -r 1821c05638df -r bb6c07589982 tools/xenpmd/Makefile
--- a/tools/xenpmd/Makefile
+++ b/tools/xenpmd/Makefile
@@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenstore)
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDLIBS += $(LDLIBS_libxenstore)
 
 .PHONY: all
diff -r 1821c05638df -r bb6c07589982 tools/xenstat/Makefile
--- a/tools/xenstat/Makefile
+++ b/tools/xenstat/Makefile
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 SUBDIRS :=
 SUBDIRS += libxenstat
 
diff -r 1821c05638df -r bb6c07589982 tools/xenstat/libxenstat/Makefile
--- a/tools/xenstat/libxenstat/Makefile
+++ b/tools/xenstat/libxenstat/Makefile
@@ -39,6 +39,8 @@ WARN_FLAGS=-Wall -Werror
 CFLAGS+=-fPIC
 CFLAGS+=-Isrc $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude)
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDLIBS-y = $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl)
 LDLIBS-$(CONFIG_SunOS) += -lkstat
 
diff -r 1821c05638df -r bb6c07589982 tools/xenstat/xentop/Makefile
--- a/tools/xenstat/xentop/Makefile
+++ b/tools/xenstat/xentop/Makefile
@@ -25,6 +25,8 @@ CFLAGS += -DHOST_$(XEN_OS)
 # Include configure output (config.h) to headers search path
 CFLAGS += -I$(XEN_ROOT)/tools
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 .PHONY: all
 all: xentop
 
diff -r 1821c05638df -r bb6c07589982 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile
+++ b/tools/xenstore/Makefile
@@ -52,6 +52,8 @@ xenstored_probes.o: xenstored_solaris.o
 CFLAGS += -DHAVE_DTRACE=1
 endif
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 init-xenstore-domain.o: CFLAGS += $(CFLAGS_libxenguest)
 
 init-xenstore-domain: init-xenstore-domain.o $(LIBXENSTORE)
diff -r 1821c05638df -r bb6c07589982 tools/xentrace/Makefile
--- a/tools/xentrace/Makefile
+++ b/tools/xentrace/Makefile
@@ -4,6 +4,9 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Werror
 
 CFLAGS += $(CFLAGS_libxenctrl)
+
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 LDLIBS += $(LDLIBS_libxenctrl)
 
 BIN      = xentrace xentrace_setsize

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
  2012-03-28 18:56 Olaf Hering
@ 2012-04-03 17:13 ` Ian Jackson
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Jackson @ 2012-04-03 17:13 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel, Fabio Fantoni

Olaf Hering writes ("[Xen-devel] [PATCH] tools/configure: add options to pass EXTRA_CLFAGS"):
> tools/configure: add options to pass EXTRA_CLFAGS

Much of this looks good to me.  (Although you need to fix the typo
CLFLAGS in the subject...)

I'm happy with the changes to all the tools/*/Makefile.

> This patch extends configure to recognize three environment variables
> which will be written to config/Tools.mk so they will be reused with
> each make invocation:
>   EXTRA_CFLAGS_XEN_TOOLS= specifies CFLAGS for the tools build.
>   EXTRA_CFLAGS_QEMU_TRADITIONAL= specifies CFLAGS for old qemu.
>   EXTRA_CFLAGS_QEMU_XEN= specifies CFLAGS for new qemu.
> The new feature can be used like this in a rpm xen.spec file:

I'm not sure why it is necessary to plumb these through our configure
and Tools.mk.  Why can't we just take them from the environment (or
the make command line) ?

However, 

>  		cd qemu-xen-traditional-dir; \
> +		env CFLAGS="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \
>  		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS); \
>  		$(MAKE) install

I'm not really sure that this is a good idea.  Note that the xen-setup
script in qemu-xen-traditional already imports many of the settings
from the Xen tree.  I think this would be a better approach than a
blanket export of CFLAGS.

> @@ -146,6 +147,7 @@ subdir-all-qemu-xen-dir subdir-install-q
>  		source=.; \
>  	fi; \
>  	cd qemu-xen-dir; \
> +	env CFLAGS="$(EXTRA_CFLAGS_QEMU_XEN)" \
>  	$$source/configure --enable-xen --target-list=i386-softmmu \
>  		--source-path=$$source \
>  		--extra-cflags="-I$(XEN_ROOT)/tools/include \

And this definitely isn't a good idea, unless you can find me some
documentation from qemu upstream which says that it is a supported
approach.

Thanks,
Ian.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-04-03 17:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15 13:19 [PATCH] tools/configure: add options to pass EXTRA_CLFAGS Olaf Hering
2012-03-15 13:31 ` Jan Beulich
2012-03-15 13:46   ` Olaf Hering
2012-03-15 14:38 ` Roger Pau Monné
2012-03-15 15:32   ` Olaf Hering
  -- strict thread matches above, loose matches on Subject: below --
2012-03-27 12:42 Olaf Hering
2012-03-27 13:04 ` Olaf Hering
2012-03-28 18:56 Olaf Hering
2012-04-03 17:13 ` Ian Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).