fix tar detection
authorFelix Fietkau <nbd@openwrt.org>
Fri, 13 Oct 2006 22:47:39 +0000 (22:47 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 13 Oct 2006 22:47:39 +0000 (22:47 +0000)
SVN-Revision: 5061

include/host.mk

index 3a5fd9683e3592f4750a80964a321075e388cde7..11522184b7ce7f72240493a7b189ed8d229161c9 100644 (file)
@@ -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" >> $@; \
        )