| Reid Spencer | 105d415 | 2004-11-30 08:11:54 +0000 | [diff] [blame^] | 1 | dnl This macro checks for tclsh which is required to run dejagnu. On some |
| 2 | dnl platforms (notably FreeBSD), tclsh is named tclshX.Y - this handles |
| 3 | dnl that for us so we can get the latest installed tclsh version. |
| 4 | dnl |
| 5 | AC_DEFUN([DJ_AC_PATH_TCLSH], [ |
| 6 | dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../ |
| 7 | ../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../.. |
| 8 | /../../../../../.." |
| 9 | no_itcl=true |
| 10 | AC_MSG_CHECKING(for the tclsh program) |
| 11 | AC_ARG_WITH(tclinclude, [ --with-tclinclude directory where tcl headers are], with_tclinclude=${withval}) |
| 12 | AC_CACHE_VAL(ac_cv_path_tclsh,[ |
| 13 | dnl first check to see if --with-itclinclude was specified |
| 14 | if test x"${with_tclinclude}" != x ; then |
| 15 | if test -f ${with_tclinclude}/tclsh ; then |
| 16 | ac_cv_path_tclsh=`(cd ${with_tclinclude}; pwd)` |
| 17 | elif test -f ${with_tclinclude}/src/tclsh ; then |
| 18 | ac_cv_path_tclsh=`(cd ${with_tclinclude}/src; pwd)` |
| 19 | else |
| 20 | AC_MSG_ERROR([${with_tclinclude} directory doesn't contain tclsh]) |
| 21 | fi |
| 22 | fi |
| 23 | ]) |
| 24 | |
| 25 | dnl next check in private source directory |
| 26 | dnl since ls returns lowest version numbers first, reverse its output |
| 27 | if test x"${ac_cv_path_tclsh}" = x ; then |
| 28 | dnl find the top level Itcl source directory |
| 29 | for i in $dirlist; do |
| 30 | if test -n "`ls -dr $srcdir/$i/tcl* 2>/dev/null`" ; then |
| 31 | tclpath=$srcdir/$i |
| 32 | break |
| 33 | fi |
| 34 | done |
| 35 | |
| 36 | dnl find the exact Itcl source dir. We do it this way, cause there |
| 37 | dnl might be multiple version of Itcl, and we want the most recent one. |
| 38 | for i in `ls -dr $tclpath/tcl* 2>/dev/null ` ; do |
| 39 | if test -f $i/src/tclsh ; then |
| 40 | ac_cv_path_tclsh=`(cd $i/src; pwd)`/tclsh |
| 41 | break |
| 42 | fi |
| 43 | done |
| 44 | fi |
| 45 | |
| 46 | dnl see if one is installed |
| 47 | if test x"${ac_cv_path_tclsh}" = x ; then |
| 48 | AC_MSG_RESULT(none) |
| 49 | AC_PATH_PROG(tclsh, tclsh) |
| 50 | else |
| 51 | AC_MSG_RESULT(${ac_cv_path_tclsh}) |
| 52 | fi |
| 53 | TCLSH="${ac_cv_path_tclsh}" |
| 54 | AC_SUBST(TCLSH) |
| 55 | ]) |
| 56 | |