# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1175003417 -3600
# Node ID 7c2e8bbe9ef8ec3d08390ecec4b406d5f592f32f
# Parent 035ce339d3370310c5cd4b764844530fb413392c
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@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
Config.mk | 14 ++++++++++++--
tools/Rules.mk | 6 +++---
xen/arch/x86/Rules.mk | 4 +---
xen/include/public/foreign/Makefile | 4 ++--
4 files changed, 18 insertions(+), 10 deletions(-)
diff -r 035ce339d337 -r 7c2e8bbe9ef8 Config.mk
--- a/Config.mk Tue Mar 27 14:34:34 2007 +0100
+++ b/Config.mk Tue Mar 27 14:50:17 2007 +0100
@@ -31,16 +31,26 @@ EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
endif
-# cc-option
+# cc-option: Check if compiler supports first option, else fall back to second.
# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
/dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
-# cc-ver
+# cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
# Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
'{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \
then echo y; else echo n; fi ;)
+
+# cc-ver-check: Check compiler is at least specified version, else fail.
+# Usage: $(call cc-ver-check,CC,0x030400,"Require at least gcc-3.4")
+cc-ver-check = $(eval $(call cc-ver-check-closure,$(1),$(2),$(3)))
+define cc-ver-check-closure
+ ifeq ($$(call cc-ver,$$($(1)),$(2)),n)
+ override $(1) = echo "*** FATAL BUILD ERROR: "$(3) >&2; exit 1;
+ cc-option := n
+ endif
+endef
ifneq ($(debug),y)
CFLAGS += -DNDEBUG
diff -r 035ce339d337 -r 7c2e8bbe9ef8 tools/Rules.mk
--- a/tools/Rules.mk Tue Mar 27 14:34:34 2007 +0100
+++ b/tools/Rules.mk Tue Mar 27 14:50:17 2007 +0100
@@ -24,9 +24,9 @@ CFLAGS += $(CFLAGS-y)
CFLAGS += $(CFLAGS-y)
# Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
-ifeq ($(CONFIG_X86)$(call cc-ver,$(CC),0x030400),yn)
-$(error Xen tools require at least gcc-3.4)
-endif
+check-$(CONFIG_X86) = $(call cc-ver-check,CC,0x030400,\
+ "Xen requires at least gcc-3.4")
+$(eval $(check-y))
%.opic: %.c
$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
diff -r 035ce339d337 -r 7c2e8bbe9ef8 xen/arch/x86/Rules.mk
--- a/xen/arch/x86/Rules.mk Tue Mar 27 14:34:34 2007 +0100
+++ b/xen/arch/x86/Rules.mk Tue Mar 27 14:50:17 2007 +0100
@@ -59,6 +59,4 @@ HDRS += $(wildcard $(BASEDIR)/include/as
HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/vmx/*.h)
# Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
-ifneq ($(call cc-ver,$(CC),0x030400),y)
-$(error Xen requires at least gcc-3.4)
-endif
+$(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4")
diff -r 035ce339d337 -r 7c2e8bbe9ef8 xen/include/public/foreign/Makefile
--- a/xen/include/public/foreign/Makefile Tue Mar 27 14:34:34 2007 +0100
+++ b/xen/include/public/foreign/Makefile Tue Mar 27 14:50:17 2007 +0100
@@ -1,5 +1,5 @@ XEN_ROOT := ../../../..
-XEN_ROOT := ../../../..
-include $(XEN_ROOT)/tools/Rules.mk
+XEN_ROOT=../../../..
+include $(XEN_ROOT)/Config.mk
architectures := x86_32 x86_64 ia64
headers := $(patsubst %, %.h, $(architectures))
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|