From: Felix Fietkau <nbd@openwrt.org>
Date: Fri, 13 Oct 2006 22:47:39 +0000 (+0000)
Subject: fix tar detection
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=518b039995a6e0dbdd2edfbf3099b867c63da732;p=openwrt%2Fstaging%2Fansuel.git

fix tar detection

SVN-Revision: 5061
---

diff --git a/include/host.mk b/include/host.mk
index 3a5fd9683e..11522184b7 100644
--- a/include/host.mk
+++ b/include/host.mk
@@ -22,10 +22,11 @@ $(TOPDIR)/.host.mk: $(INCLUDE_DIR)/host.mk
 		echo "HOST_OS:=$$HOST_OS" > $@; \
 		echo "HOST_ARCH:=$$HOST_ARCH" >> $@; \
 		echo "GNU_HOST_NAME:=$$GNU_HOST_NAME" >> $@; \
-		if tar --version 2>&1 | grep 'GNU' >/dev/null; then \
+		TAR=`which gtar`; \
+		[ -n "$$TAR" -a -x "$$TAR" ] || TAR=`which tar`; \
+		echo "TAR:=$$TAR" >> $@; \
+		if $$TAR --version 2>&1 | grep 'GNU' >/dev/null; then \
 			echo "TAR_WILDCARDS:=--wildcards" >> $@; \
 		fi; \
-		TAR=`which gtar tar | head -n 1`; \
-		echo "TAR:=$$TAR" >> $@; \
 	)