expr: prevent stack overflow
[jimtcl.git] / autosetup / autosetup-find-tclsh
blobdfe70f8a1fa7b7d5323bf3151af31ca8ce09ab25
1 #!/bin/sh
2 # Looks for a suitable tclsh or jimsh in the PATH
3 # If not found, builds a bootstrap jimsh from source
4 # Prefer $autosetup_tclsh if is set in the environment
5 d=`dirname "$0"`
6 { "$d/jimsh0" "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
7 PATH="$PATH:$d"; export PATH
8 for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
9 { $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
10 done
11 echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
12 for cc in ${CC_FOR_BUILD:-cc} gcc; do
13 { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
14 "$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0
15 done
16 echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
17 echo false