配置expect时,找到源tcl目录而不是其安装位置

问题描述 投票:1回答:1

我从源头建立gcc。我打算进行测试,这需要dejagnuexpecttcl

我首先使用configured tcl(使用dir1代替实际的dir以简洁),

$ cd dir1/unix
$ ./configure --prefix="$HOME/usr/local"

并建成。然后我configured expect

$ ./configure --prefix="$HOME/usr/local"

那时,在dir1发现了tcl,即

$ grep tcl config.log
configure:2650: result: found dir1/unix/tclConfig.sh
configure:2656: checking for existence of dir1/unix/tclConfig.sh
configure:5078: result: dir1/generic
...

我的环境产生(为了简洁起见使用$HOME

LIBRARY_PATH=$HOME/usr/local/lib:...
LD_LIBRARY_PATH=$HOME/usr/local/lib:...
CPATH=$HOME/usr/local/include:...
PATH=$HOME/usr/local/bin:...

如何找到tcl的源目录?我预计在tcl发现了$HOME/usr/local。也许expect以某种方式阅读tcl的配置,这看起来很奇怪。

build tcl expect configure
1个回答
1
投票

如果未指定--with-tcl,它将首先尝试查看是否在同一dir级别中还存在Tcl的构建目录(实际上它还会尝试更高的2 dir级别)。例如,如果你有

/src/dir/of/expect-5.xx

然后它会看到是否还有

/src/dir/of/tcl-8.xx
# and 
/src/dir/of/tcl-8.xx/unix/tclConfig.sh

Expect的作者可能认为人们可能会先同时编译Tcl然后编译Expect。 :)

请参阅Expect源代码中的文件tclconfig/tcl.m4,第80~105行:

 63
 64  # First check to see if --with-tcl was specified.
 65  if test x"${with_tclconfig}" != x ; then
 66      case "${with_tclconfig}" in
 67          */tclConfig.sh )
 68              if test -f "${with_tclconfig}"; then
 69                  AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
 70                  with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
 71              fi ;;
 72      esac
 73      if test -f "${with_tclconfig}/tclConfig.sh" ; then
 74          ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
 75      else
 76          AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
 77      fi
 78  fi
 79
 80  # then check for a private Tcl installation
 81  if test x"${ac_cv_c_tclconfig}" = x ; then
 82      for i in \
 83              ../tcl \
 84              `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
 85              `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
 86              `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
 87              ../../tcl \
 88              `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
 89              `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
 90              `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
 91              ../../../tcl \
 92              `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
 93              `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
 94              `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
 95          if test "${TEA_PLATFORM}" = "windows" \
 96                  -a -f "$i/win/tclConfig.sh" ; then
 97              ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
 98              break
 99          fi
100          if test -f "$i/unix/tclConfig.sh" ; then
101              ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
102              break
103          fi
104      done
105  fi
106
© www.soinside.com 2019 - 2024. All rights reserved.