actcltk.m4
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:10k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. dnl Locate the Tcl/Tk include files
  2. dnl A hybrid of BLT's approach of looking in lots of places and, if
  3. dnl that fails, just believing what "echo [info library] | tclsh" says.
  4. dnl We play a bit of a trick here piping commands into tclsh
  5. dnl Extra set of brackets hides the Tcl brackets from autoconf m4.
  6. dnl
  7. dnl First, if tclsh is around execute it to make a guess as to where Tcl
  8. dnl is installed, and also to find out if we're using tcl > 7.3.
  9. AC_DEFUN([md_FIND_TCL],dnl
  10. [lastPATH=$PATH
  11. if test -n "$with_tcldir" ; then               
  12.   PATH=${with_tcldir}/bin:$PATH
  13. fi
  14. AC_CHECK_PROG(tclsh84_found, tclsh8.4, yes, no)
  15. if test $tclsh84_found = no ; then
  16.     AC_CHECK_PROG(tclsh83_found, tclsh8.3, yes, no)
  17.     if test $tclsh83_found = no ; then
  18.         AC_CHECK_PROG(tclsh82_found, tclsh8.2, yes, no)
  19.         if test $tclsh82_found = no ; then
  20.             AC_CHECK_PROG(tclsh81_found, tclsh8.1, yes, no)
  21.             if test $tclsh81_found = no ; then
  22.                 AC_CHECK_PROG(tclsh80_found, tclsh8.0, yes, no)
  23.                 if test $tclsh80_found = no ; then
  24.                     AC_CHECK_PROG(tclsh_found, tclsh, yes, no)
  25.                 fi
  26.             fi
  27.         fi
  28.     fi
  29. fi
  30. changequote(<,>)dnl
  31. tclLibrary=''
  32. if test $tclsh84_found = yes; then
  33.   tclLibrary=`echo "puts [info library]" | tclsh8.4`
  34. elif test $tclsh83_found = yes; then
  35.   tclLibrary=`echo "puts [info library]" | tclsh8.3`
  36. elif test $tclsh82_found = yes; then
  37.   tclLibrary=`echo "puts [info library]" | tclsh8.2`
  38. elif test $tclsh81_found = yes; then
  39.   tclLibrary=`echo "puts [info library]" | tclsh8.1`
  40. elif test $tclsh80_found = yes; then
  41.     tclLibrary=`echo "puts [info library]" | tclsh8.0`
  42. else
  43.   if test $tclsh_found = yes; then
  44.     tclLibrary=`echo "puts [info library]" | tclsh`
  45.   fi
  46. fi
  47. PATH=$lastPATH
  48. changequote([,])dnl
  49. if test -n "$tclLibrary"; then
  50.   tclInstalledDir=`dirname "$tclLibrary"`
  51.   tclInstalledDir=`dirname "$tclInstalledDir"`
  52. fi
  53. # Second, if TCL_LIBRARY or TK_LIBRARY are set, work from there.
  54. if test -n "$TCL_LIBRARY"; then
  55.   USER_TCL_INCLUDE=`dirname $TCL_LIBRARY`
  56.   USER_TCL_INCLUDE=`dirname $USER_TCL_INCLUDE`/include
  57.   USER_TCL_LIB=`dirname $TCL_LIBRARY`
  58. else
  59.   USER_TCL_INCLUDE=""
  60.   USER_TCL_LIB=""
  61. fi
  62. if test -n "$TK_LIBRARY"; then
  63.   USER_TK_INCLUDE=`dirname $TK_LIBRARY`
  64.   USER_TK_INCLUDE=`dirname $USER_TK_INCLUDE`/include
  65.   USER_TK_LIB=`dirname $TK_LIBRARY`
  66. else
  67.   USER_TK_INCLUDE=""
  68.   USER_TK_LIB=""
  69. fi
  70. ])
  71. AC_DEFUN([md_FIND_TCL_HEADERS],dnl
  72. [
  73. # define INCPLACES to be those directories where tcl.h and tk.h could be.
  74. # We look in lots of "standard" places as well as where [info version]
  75. # tells us to look. Note that this list is both for tcl.h and tk.h: they
  76. # are often installed in the same directory.
  77. INCPLACES=" 
  78.         $defaultdir/include $defaultdir/include/tcl $defaultdir/include/tk 
  79.         ${CYGFS}include /Cygnus/cygwin-b20/include 
  80.         /usr/local/include /usr/local/include/tcl /usr/local/include/tk 
  81.         /usr/include /usr/include/tcl /usr/include/tk 
  82.         $x_includes $x_includes/tcl $x_includes/tk 
  83.         ../tcl8.4 ../tcl8.3 ../tcl8.2 ../tcl8.1 ../tcl8.0 ../tcl7.6 ../tcl7.5 ../tcl7.4 
  84.         ../tk8.3 ../tk8.2 ../tk8.1 ../tk8.0 ../tk4.2 ../tk4.1 ../tk4.0"
  85. if test -n "$tclInstalledDir"; then
  86.   INCPLACES="$tclInstalledDir/include $INCPLACES"
  87. fi
  88. INCPLACES="$USER_TCL_INCLUDE $USER_TK_INCLUDE $INCPLACES"
  89. AC_MSG_CHECKING(directory of tcl.h)
  90. for dir in $tclincludedir "$TCL_INCLUDE_DIR" $INCPLACES; do
  91.   expand_dir=`eval echo $dir`
  92.   if test -r $expand_dir/tcl.h; then
  93.     tclincludedir=$dir
  94.     break
  95.   fi
  96. done
  97. if test -n "$tclincludedir"; then
  98.   AC_MSG_RESULT($tclincludedir)
  99.   if test "$tclincludedir" = "/usr/include" ; then
  100.     TCLINCLUDES=""
  101.   else
  102.     TCLINCLUDES='-I${tclincludedir}'
  103.   fi
  104. else
  105.   AC_MSG_RESULT(no)
  106. fi
  107. AC_SUBST(tclincludedir)
  108. AC_SUBST(TCLINCLUDES)
  109. ])dnl
  110. AC_DEFUN([md_FIND_TCL_LIBRARIES],dnl
  111. [LIBPLACES="$defaultdir/lib $defaultdir/lib/tcl $defaultdir/lib/tk 
  112.         /usr/lib64 
  113.         ${CYGFS}H-i586-cygwin32/lib 
  114.         /Cygnus/cygwin-b20/H-i586-cygwin32/lib 
  115. /usr/local/lib /usr/local/lib/tcl /usr/local/lib/tk 
  116. /usr/lib /usr/lib/tcl /usr/lib/tk 
  117. $x_libraries $x_libraries/tcl $x_libraries/tk 
  118. ../tcl8.1 ../tcl8.0 ../tcl7.6 ../tcl7.5 ../tcl7.4 
  119. ../tk8.1 ../tk8.0 ../tk4.2 ../tk4.1 ../tk4.0"
  120. if test -n "$tclInstalledDir"; then
  121.   LIBPLACES="$tclInstalledDir/lib $LIBPLACES"
  122. fi
  123. LIBPLACES="$USER_TCL_LIB $USER_TK_LIB $LIBPLACES"
  124. LIBPLACES="`dirname $tclincludedir`/lib $LIBPLACES"
  125. AC_MSG_CHECKING(directory and version of libtcl)
  126. for dir in $tcllibdir "$TCL_LIB_DIR" $LIBPLACES; do
  127.   tcllibdir=''
  128.   expand_dir=`eval echo $dir`
  129.   for debug in '' g; do
  130.   for suffix in .dylib .so .sl .a; do
  131. if test -n "$tcllibname"; then
  132.   if test -r $expand_dir/lib${tcllibname}${debug}${suffix} ; then
  133. tcllibdir=$dir
  134. break
  135.   fi
  136. else
  137.   for version in 84 8.4 83 8.3 82 8.2 81 8.1 80 8.0 76 7.6 7.5 7.4 ''; do
  138. if test -r $expand_dir/libtcl${version}${debug}${suffix}; then
  139.   tcllibdir=$dir  
  140.   tcllibname=tcl${version}${debug}
  141.   break
  142. fi        
  143.   done
  144. fi
  145. test -z "$tcllibdir" || break
  146.   done
  147.   done
  148.   test -z "$tcllibdir" || break
  149. done
  150. if test -n "$tcllibdir" ; then
  151.   AC_MSG_RESULT([$tcllibdir, $tcllibname])
  152.   if test "$tcllibdir" = "/usr/lib" ; then
  153.     TCLLDFLAGS=''
  154.     TCLLIB="-l$tcllibname"
  155.   else
  156.     if test $suffix = .so || test $suffix = .sl; then
  157.       TCLLDFLAGS="-L${tcllibdir} -R ${tcllibdir}"
  158.     else
  159.       TCLLDFLAGS='-L${tcllibdir}'
  160.     fi
  161.     TCLLIB=-l$tcllibname
  162.   fi
  163. else
  164.   AC_MSG_RESULT(no)
  165. fi
  166. AC_SUBST(TCLLIB)
  167. AC_SUBST(TCLLDFLAGS)
  168. AC_SUBST(tcllibdir)
  169. ])dnl
  170. AC_DEFUN([md_FIND_TK_HEADERS],
  171. [POTENTIALINCDIR=`dirname $tclincludedir`
  172. POTENTIALINCDIR=`dirname $POTENTIALINCDIR`
  173. INCPLACES="$INCPLACES 
  174. $tclincludedir 
  175.     $POTENTIALINCDIR/tk8.4/include 
  176.     $POTENTIALINCDIR/tk8.3/include 
  177.     $POTENTIALINCDIR/tk8.2/include 
  178.     $POTENTIALINCDIR/tk8.1/include 
  179. $POTENTIALINCDIR/tk8.0/include 
  180. $POTENTIALINCDIR/tk4.2/include 
  181. $POTENTIALINCDIR/tk4.1/include 
  182. $POTENTIALINCDIR/tk4.0/include 
  183. $POTENTIALINCDIR/tk/include"
  184. if test -n "$tclInstalledDir"; then
  185.   INCPLACES="$tclInstalledDir/include $INCPLACES"
  186. fi
  187. AC_MSG_CHECKING(directory of tk.h)
  188. for dir in $tkincludedir "$TK_INCLUDE_DIR" $INCPLACES; do
  189.   expand_dir=`eval echo $dir`
  190.   if test -r $expand_dir/tk.h; then
  191.     tkincludedir=$dir
  192.     break
  193.   fi
  194. done
  195. if test -n "$tkincludedir"; then
  196.   AC_MSG_RESULT($tkincludedir)
  197.   if test "$tkincludedir" = "/usr/include" ; then
  198.     TKINCLUDES=""
  199.   else
  200.     TKINCLUDES='-I${tkincludedir}'
  201.   fi
  202. else
  203.   AC_MSG_RESULT(no)
  204. fi
  205. AC_SUBST(tkincludedir)
  206. AC_SUBST(TKINCLUDES)
  207. ])
  208. AC_DEFUN([md_FIND_TK_LIBRARIES],
  209. [POTENTIALLIBDIR=`dirname $tcllibdir`
  210. POTENTIALLIBDIR=`dirname $POTENTIALLIBDIR`
  211. LIBPLACES="`dirname $tkincludedir`/lib $tcllibdir $POTENTIALLIBDIR/tk/lib 
  212.         $POTENTIALLIBDIR/tk8.1/lib 
  213. $POTENTIALLIBDIR/tk8.0/lib 
  214. $POTENTIALLIBDIR/tk4.2/lib 
  215. $POTENTIALLIBDIR/tk4.1/lib 
  216. $POTENTIALLIBDIR/tk4.0/lib 
  217. $LIBPLACES"
  218. if test -n "$tclInstalledDir"; then
  219.   LIBPLACES="$tclInstalledDir/lib $LIBPLACES"
  220. fi
  221. AC_MSG_CHECKING(directory and version of libtk)
  222. for dir in $tklibdir "$TK_LIB_DIR" $LIBPLACES; do
  223.   tklibdir=''
  224.   expand_dir=`eval echo $dir`
  225.   for debug in '' g; do
  226.   for suffix in .dylib .so .sl .a; do
  227. if test -n "$tklibname" ; then
  228.   if test -r $expand_dir/lib${tklibname}${debug}${suffix} ; then
  229. tklibdir=$dir
  230. break
  231.   fi
  232. else
  233.   for version in 84 8.4 83 8.3 82 8.2 81 8.1 80 8.0 42 4.2 4.1 4.0 ''; do
  234. if test -r $expand_dir/libtk${version}${debug}${suffix}; then
  235.   tklibdir=$dir
  236.   tklibname=tk${version}${debug}
  237.   break
  238. fi
  239.   done
  240. fi
  241. test -z "$tklibdir" || break
  242.   done
  243.   done
  244.   test -z "$tklibdir" || break
  245. done
  246. if test -n "$tklibdir" ; then
  247.   AC_MSG_RESULT([$tklibdir, $tklibname])
  248.   if test "$tklibdir" = "/usr/lib" ; then
  249.     TKLDFLAGS=''
  250.     TKLIB=-l$tklibname
  251.   else
  252.     if test $suffix = .so || test $suffix = .sl ; then
  253.       TKLDFLAGS="-L${tklibdir} -R ${tklibdir}"
  254.     else
  255.       TKLDFLAGS='-L${tklibdir}'
  256.     fi
  257.     TKLIB=-l$tklibname
  258.   fi
  259. else
  260.   AC_MSG_RESULT(no)
  261. fi
  262. AC_SUBST(TKLDFLAGS)
  263. AC_SUBST(TKLIB)
  264. AC_SUBST(tklibdir)
  265. ])
  266. AC_DEFUN([md_FIND_TCLTK_SCRIPTS],
  267. [_configfile=`eval echo "$$1libdir/$1Config.sh"`
  268. if test -z "$$1scriptdir" ; then
  269.   _version=`sed -n "s/^translit($1,a-z,A-Z)_VERSION='(.*)'/1/p" $_configfile 2>/dev/null`
  270.   _prefix=`sed -n "s/^translit($1,a-z,A-Z)_PREFIX='(.*)'/1/p" $_configfile 2>/dev/null`
  271.   $1scriptdir=$_prefix/lib/$1$_version
  272.   if test ! -d "$$1scriptdir" ; then
  273.     $1scriptdir=$_prefix/share/$1$_version
  274.   fi
  275. fi
  276. ])
  277. AC_DEFUN([md_FIND_TCL_SCRIPTS],
  278. [md_FIND_TCLTK_SCRIPTS(tcl)
  279. if test ! -r $tclscriptdir/init.tcl ; then
  280.   AC_MSG_ERROR(Please use --with-tclscriptdir to specify location of init.tcl)
  281. fi
  282. ])
  283. AC_DEFUN([md_FIND_TK_SCRIPTS],
  284. [md_FIND_TCLTK_SCRIPTS(tk)
  285. if test ! -r $tkscriptdir/tk.tcl ; then
  286.   AC_MSG_ERROR(Please use --with-tkscriptdir to specify location of tk.tcl)
  287. fi
  288. ])
  289. AC_DEFUN([md_FIND_BLT],
  290. [test -z "$bltdir" && bltdir=$defaultdir
  291. found=no
  292. for name in $bltlibname BLT30 BLT24 BLT8.0 BLT80 BLT; do
  293.    for _libdir in "$bltdir/lib/shared" "$bltdir/lib" ; do
  294.   md_FIND_LIB(blt,$name,$_libdir,1)
  295.   if test -n "$bltlibdir" ; then
  296. bltlibname=$name
  297. bltlibdir=$_libdir
  298. found=yes
  299. break
  300.   fi
  301.    done
  302.    if test $found = yes; then
  303.      break
  304.    fi
  305. done
  306. if test $found = no; then
  307.   AC_MSG_ERROR(Please use --with-bltdir to specify location of BLT.)
  308. fi
  309. BLTLDFLAGS=$_ldflags
  310. BLTLIB=-l$bltlibname
  311. AC_SUBST(bltlibdir)
  312. AC_SUBST(bltdir)
  313. AC_SUBST(BLTLDFLAGS)
  314. AC_SUBST(BLTLIB)
  315. ])
  316. AC_DEFUN([md_CHECK_TCLTK_LIBINC_VERSION_MATCH],
  317. [_configfile=`eval echo "$$1libdir/$1Config.sh"`
  318. _upper=translit($1,a-z,A-Z)
  319. _version=`sed -n "s/^${_upper}_VERSION='(.*)'/1/p" $_configfile 2>/dev/null`
  320. _patchlevel=`sed -n "s/^${_upper}_PATCH_LEVEL='(.*)'/1/p" $_configfile 2>/dev/null`
  321. _lversionpl=${_version}${_patchlevel}
  322. path=`eval echo $$1includedir/$1.h`
  323. _iversionpl=`sed -n "s/#define ${_upper}_PATCH_LEVEL.*"(.*)"/1/p" < $path`
  324. if test "$_lversionpl" != "$_iversionpl" || test -z "$_lversionpl" || test -z "$_iversionpl"; then
  325.   AC_MSG_WARN($1 include and $1Config.sh file version mismatch "$_lversionpl" != "$_iversionpl")
  326. fi
  327. ])