blob: 4fb00290fed7ab21a1a810291b372da25d4a1052 [file] [log] [blame]
Reid Spencer105d4152004-11-30 08:11:54 +00001dnl This macro checks for tclsh which is required to run dejagnu. On some
2dnl platforms (notably FreeBSD), tclsh is named tclshX.Y - this handles
3dnl that for us so we can get the latest installed tclsh version.
4dnl
5AC_DEFUN([DJ_AC_PATH_TCLSH], [
6dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
7../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../..
8/../../../../../.."
9no_itcl=true
10AC_MSG_CHECKING(for the tclsh program)
11AC_ARG_WITH(tclinclude, [ --with-tclinclude directory where tcl headers are], with_tclinclude=${withval})
12AC_CACHE_VAL(ac_cv_path_tclsh,[
13dnl first check to see if --with-itclinclude was specified
14if 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
22fi
23])
24
25dnl next check in private source directory
26dnl since ls returns lowest version numbers first, reverse its output
27if 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
44fi
45
46dnl see if one is installed
47if test x"${ac_cv_path_tclsh}" = x ; then
48 AC_MSG_RESULT(none)
49 AC_PATH_PROG(tclsh, tclsh)
50else
51 AC_MSG_RESULT(${ac_cv_path_tclsh})
52fi
53TCLSH="${ac_cv_path_tclsh}"
54AC_SUBST(TCLSH)
55])
56