Option like -Og produces something like

  cc1: error: argument to '-O' should be a non-negative integer

with a compiler that doesn't support it.

Grepping for the exact option wouldn't work. Extend cc-option to take
into account the exit status of the test.

Signed-off-by: Jan Beulich <jbeul...@suse.com>
Signed-off-by: Wei Liu <wei.l...@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index b5ca57ce90..f1f466d7c1 100644
--- a/Config.mk
+++ b/Config.mk
@@ -100,7 +100,7 @@ PYTHON_PREFIX_ARG ?= --prefix="$(prefix)"
 #
 # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
 cc-option = $(shell if test -z "`echo 'void*p=1;' | \
-              $(1) $(2) -S -o /dev/null -x c - 2>&1 | grep -- $(2) -`"; \
+              { $(1) $(2) -S -o /dev/null -x c - 2>&1 || echo $(2); } | grep 
-- $(2) -`"; \
               then echo "$(2)"; else echo "$(3)"; fi ;)
 
 # cc-option-add: Add an option to compilation flags, but only if supported.
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to