1_cc-option-supported = $(if $(shell $(CC$(sm)) $(1) -c -x c /dev/null -o /dev/null 2>/dev/null >/dev/null || echo "Not supported"),,1)
2_cc-opt-cached-var-name = $(subst =,~,$(strip cached-cc-option-$(1)-$(subst $(empty) $(empty),,$(CC$(sm)))))
3define _cc-option
4$(eval _var_name := $(call _cc-opt-cached-var-name,$(1)))
5$(eval $(_var_name) := $(if $(filter $(origin $(_var_name)),undefined),$(call _cc-option-supported,$(1)),$($(_var_name))))
6$(if $($(_var_name)),$(1),$(2))
7endef
8cc-option = $(strip $(call _cc-option,$(1),$(2)))
9
10_ld-option-supported = $(if $(shell ($(LD$(sm)) -v $(1) 2>&1 || echo warning) | grep warning),,1)
11_ld-opt-cached-var-name = $(subst =,~,$(subst $(empty) $(empty),,$(strip cached-ld-option-$(1)-$(LD$(sm)))))
12define _ld-option
13$(eval _var_name := $(call _ld-opt-cached-var-name,$(1)))
14$(eval $(_var_name) := $(if $(filter $(origin $(_var_name)),undefined),$(call _ld-option-supported,$(1)),$($(_var_name))))
15$(if $($(_var_name)),$(1),$(2))
16endef
17ld-option = $(strip $(call _ld-option,$(1),$(2)))
18