[PATCH 1/2] kbuild: add host-cc-option helper

From: Thomas Weißschuh
Date: Tue Mar 12 2024 - 11:03:54 EST


This helper works the same as cc-option but for the host compiler.
It will be used by the gcc-plugins configuration to check for the gmp.h
header.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
scripts/Kconfig.include | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
index 3ee8ecfb8c04..84368e23b072 100644
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -27,6 +27,10 @@ failure = $(if-success,$(1),n,y)
# Return y if the compiler supports <flag>, n otherwise
cc-option = $(success,trap "rm -rf .tmp_$$" EXIT; mkdir .tmp_$$; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$/tmp.o)

+# $(host-cc-option,<flag>)
+# Return y if the host compiler supports <flag>, n otherwise
+host-cc-option = $(success,trap "rm -rf .tmp_$$" EXIT; mkdir .tmp_$$; $(HOSTCC) -Werror $(HOSTCFLAGS) $(1) -c -x c /dev/null -o .tmp_$$/tmp.o)
+
# $(ld-option,<flag>)
# Return y if the linker supports <flag>, n otherwise
ld-option = $(success,$(LD) -v $(1))

--
2.44.0