return $to_tail
}
+where_gcc(){
+maj_ver=`echo $1 | awk -F. '{if(NF>0) print $1; else print 0}'`
+min_ver=`echo $1 | awk -F. '{if(NF>1) print $2; else print 0}'`
+rel_ver=`echo $1 | awk -F. '{if(NF>2) print $3; else print 0}'`
+let ver=$maj_ver*10000+$min_ver*100+$rel_ver
+newer=""
+newerver=0
+for i in `echo ${PATH}:/usr/bin:/usr/local/bin | sed -e"s%:% %g"` ; do
+ ret=`find $i -name gcc -maxdepth 1 2>/dev/null`
+ if [ -n "$ret" ] ; then
+ maj_ver=`$ret -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
+ min_ver=`$ret -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
+ rel_ver=`$ret -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
+ let ver1=$maj_ver*10000+$min_ver*100+$rel_ver
+ if [ $ver1 -eq $ver ] ; then
+ ret=`echo $ret | sed -e"s%/gcc$%%g"`
+ echo $ret
+ return 0
+ fi
+ if [ $ver1 -gt $ver ] && [ $ver1 -gt $newerver ] ; then
+ let newerver=$ver1
+ newer=`echo $ret | sed -e"s%/gcc$%%g"`
+ fi
+ fi
+done
+if [ -n "$newer" ] ; then
+ echo $newer
+ return 0
+fi
+return 1
+}
+
where_tcl(){
if test -z "${TCLHOME}"; then
TCLHOME=/usr
# looks for the native product and collects it's environment (used by make_env())
try_native(){
-gcc_root="`find_in_path gcc ${PATH}`"
-if [ -z "${gcc_root}" ] ; then
- gcc_root="`find_in_path gcc /usr/bin`"
-fi
+gcc_root="`where_gcc 3.3.5`"
if [ -n "${gcc_root}" ] ; then
gcc_root=`cd ${gcc_root}/..; pwd`
# get version number: <major>, <minor> and <release>
# <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
# version number is calculated as: <major>*10000+<minor>*100+<release>
# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401, for gcc 3.3.5 - 30305
- maj_ver=`gcc -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
- min_ver=`gcc -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
- rel_ver=`gcc -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
+ maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
+ min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
+ rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver
if [ $gcc_ver -ge 30305 ] ; then
tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";