aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-11-11 15:21:42 -0500
committerHisham Muhammad <hisham@gobolinux.org>2015-11-11 15:21:42 -0500
commit579cd7541b0ed9bf9df3e9e87df7a5af4d490baa (patch)
tree84d9af729e5248e1faa30777f5613df3e644d9f6
parentce3ea550e02da88cb3236309655ef890f32a0ed8 (diff)
parent62017cc5a39a0298a3227ebb6182fd83f28b5e22 (diff)
downloadluarocks-579cd7541b0ed9bf9df3e9e87df7a5af4d490baa.tar.gz
luarocks-579cd7541b0ed9bf9df3e9e87df7a5af4d490baa.tar.bz2
luarocks-579cd7541b0ed9bf9df3e9e87df7a5af4d490baa.zip
Merge pull request #448 from zoresvit/patch-1
Fix `find_program` function to be less fragile
-rwxr-xr-xconfigure21
1 files changed, 1 insertions, 20 deletions
diff --git a/configure b/configure
index bd962edf..8b99b2ae 100755
--- a/configure
+++ b/configure
@@ -71,26 +71,7 @@ EOF
71# Helper functions 71# Helper functions
72 72
73find_program() { 73find_program() {
74 path="$PATH" 74 command -v "$1" 2>/dev/null
75 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
76 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
77 found="no"
78 while [ -n "$item" ]
79 do
80 if [ -f "$item/$1" ]
81 then
82 found="yes"
83 break
84 fi
85 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
86 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
87 done
88 if [ "$found" = "yes" ]
89 then
90 echo "$item"
91 else
92 echo ""
93 fi
94} 75}
95 76
96die() { 77die() {