world:
-DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep -E '\/usr' | head -n 1)
+DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -E '\/usr' | head -n 1)
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
ifneq ($(OPENWRT_BUILD),1)
else
BPF_PATH:=$(PATH)
endif
- CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' which clang clang-13 clang-12 clang-11))
+ CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' command -v clang clang-13 clang-12 clang-11))
LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
endif
ifneq ($(CONFIG_USE_LLVM_PREBUILT),)
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1)
else
- cmake_tool=$(shell which $(1))
+ cmake_tool=$(shell command -v $(1))
endif
ifeq ($(CONFIG_CCACHE),)
define RequireCommand
define Require/$(1)
- which $(1)
+ command -v $(1)
endef
$$(eval $$(call Require,$(1),$(2)))
$(call QuoteHostCommand,$(11)) $(call QuoteHostCommand,$(12)); do \
if [ -n "$$$$$$$$cmd" ]; then \
bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \
- which "$$$$$$$${cmd%% *}")"; \
+ command -v "$$$$$$$${cmd%% *}")"; \
if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \
mkdir -p "$(STAGING_DIR_HOST)/bin"; \
ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \
--- /dev/null
+#! /bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Reduced version of which -a using command utility
+
+case $PATH in
+ (*[!:]:) PATH="$PATH:" ;;
+esac
+
+for ELEMENT in $(echo $PATH | tr ":" "\n"); do
+ PATH=$ELEMENT command -v "$@"
+done
sub which($) {
my $prog = shift;
- my $res = `which $prog`;
+ my $res = `command -v $prog`;
$res or return undef;
- $res =~ /^no / and return undef;
- $res =~ /not found/ and return undef;
return $res;
}
$ENV{GIT_CONFIG_PARAMETERS}="'core.autocrlf=false'";
$ENV{GREP_OPTIONS}="";
-my $mk=`which gmake 2>/dev/null`; # select the right 'make' program
+my $mk=`command -v gmake 2>/dev/null`; # select the right 'make' program
chomp($mk); # trim trailing newline
$mk or $mk = "make"; # default to 'make'
exit 1
fi
-ubinize="$( which ubinize )"
+ubinize="$( command -v ubinize )"
if [ ! -x "$ubinize" ]; then
echo "ubinize tool not found or not usable"
exit 1
world:
-DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep -E '\/usr' | head -n 1)
+DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -E '\/usr' | head -n 1)
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
ifneq ($(OPENWRT_BUILD),1)