ia64/xen-unstable

changeset 14589:7c2e8bbe9ef8

In order to allow building as non-root with a non-default CC (which
root may not have access to through its $PATH), defer the generation
of an error until CC is actually needed.

Original patch by Jan Beulich <jbeulich@novell.com>

Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Mar 27 14:50:17 2007 +0100 (2007-03-27)
parents 035ce339d337
children 070cf119a7ec
files Config.mk tools/Rules.mk xen/arch/x86/Rules.mk xen/include/public/foreign/Makefile
line diff
     1.1 --- a/Config.mk	Tue Mar 27 14:34:34 2007 +0100
     1.2 +++ b/Config.mk	Tue Mar 27 14:50:17 2007 +0100
     1.3 @@ -31,17 +31,27 @@ EXTRA_INCLUDES += $(EXTRA_PREFIX)/includ
     1.4  EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
     1.5  endif
     1.6  
     1.7 -# cc-option
     1.8 +# cc-option: Check if compiler supports first option, else fall back to second.
     1.9  # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
    1.10  cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
    1.11                /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
    1.12  
    1.13 -# cc-ver
    1.14 +# cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
    1.15  # Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
    1.16  cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
    1.17             '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \
    1.18             then echo y; else echo n; fi ;)
    1.19  
    1.20 +# cc-ver-check: Check compiler is at least specified version, else fail.
    1.21 +# Usage: $(call cc-ver-check,CC,0x030400,"Require at least gcc-3.4")
    1.22 +cc-ver-check = $(eval $(call cc-ver-check-closure,$(1),$(2),$(3)))
    1.23 +define cc-ver-check-closure
    1.24 +    ifeq ($$(call cc-ver,$$($(1)),$(2)),n)
    1.25 +        override $(1) = echo "*** FATAL BUILD ERROR: "$(3) >&2; exit 1;
    1.26 +        cc-option := n
    1.27 +    endif
    1.28 +endef
    1.29 +
    1.30  ifneq ($(debug),y)
    1.31  CFLAGS += -DNDEBUG
    1.32  else
     2.1 --- a/tools/Rules.mk	Tue Mar 27 14:34:34 2007 +0100
     2.2 +++ b/tools/Rules.mk	Tue Mar 27 14:50:17 2007 +0100
     2.3 @@ -24,9 +24,9 @@ CFLAGS-$(CONFIG_X86_32) += $(call cc-opt
     2.4  CFLAGS += $(CFLAGS-y)
     2.5  
     2.6  # Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
     2.7 -ifeq ($(CONFIG_X86)$(call cc-ver,$(CC),0x030400),yn)
     2.8 -$(error Xen tools require at least gcc-3.4)
     2.9 -endif
    2.10 +check-$(CONFIG_X86) = $(call cc-ver-check,CC,0x030400,\
    2.11 +                        "Xen requires at least gcc-3.4")
    2.12 +$(eval $(check-y))
    2.13  
    2.14  %.opic: %.c
    2.15  	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
     3.1 --- a/xen/arch/x86/Rules.mk	Tue Mar 27 14:34:34 2007 +0100
     3.2 +++ b/xen/arch/x86/Rules.mk	Tue Mar 27 14:50:17 2007 +0100
     3.3 @@ -59,6 +59,4 @@ HDRS += $(wildcard $(BASEDIR)/include/as
     3.4  HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/vmx/*.h)
     3.5  
     3.6  # Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
     3.7 -ifneq ($(call cc-ver,$(CC),0x030400),y)
     3.8 -$(error Xen requires at least gcc-3.4)
     3.9 -endif
    3.10 +$(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4")
     4.1 --- a/xen/include/public/foreign/Makefile	Tue Mar 27 14:34:34 2007 +0100
     4.2 +++ b/xen/include/public/foreign/Makefile	Tue Mar 27 14:50:17 2007 +0100
     4.3 @@ -1,5 +1,5 @@
     4.4 -XEN_ROOT := ../../../..
     4.5 -include $(XEN_ROOT)/tools/Rules.mk
     4.6 +XEN_ROOT=../../../..
     4.7 +include $(XEN_ROOT)/Config.mk
     4.8  
     4.9  architectures := x86_32 x86_64 ia64
    4.10  headers := $(patsubst %, %.h, $(architectures))