1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
|
dnl
dnl Define the test to look for wish (the tcl/tk windowing shell)
dnl This is under development and is derived from the FINDX command
dnl FIND_WISH looks in the path and in places that we've found wish.
dnl It sets "wishloc" to the location that it found, or to the
dnl empty string if it can't find wish.
dnl Note that we need tk version 3.3 or later, so we don't check for the
dnl earlier versions
dnl
dnl Some systems are now (probably wisely, given the number of
dnl incompatibilities) using names like "wish4.2" or "wish-3.6" and the like.
define([PAC_FIND_WISH],[wishloc=""
AC_MSG_CHECKING([for wish])
# Look for wish in the path
if test -n "$TCL73TK36_DIR" ; then
if test -d $TCL73TK36_DIR/bin
wishalt_dir=$TCL73TK36_DIR
fi
fi
IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:"
for dir in $wishalt_dir $PATH ; do
if test -x $dir/wish ; then
wishloc=$dir/wish
break
elif test -x $dir/tcl7.3-tk3.6/bin/wish ; then
wishloc=$dir/tcl7.3-tk3.6/bin/wish
break
elif test -x $dir/tcl7.4-tk4.0/bin/wish ; then
wishloc=$dir/tcl7.4-tk4.0/bin/wish
break
else
for file in $dir/wish3.? $dir/wish-3.? $dir/wish4.? $dir/wish* ; do
if test -x $file ; then
wishloc=$file
break
fi
if test -n "$wishloc" ; then break ; fi
done
fi
done
IFS="$saveifs"
# Look for wish elsewhere
if test -z "$wishloc" ; then
for dir in \
/usr/local/bin \
/usr/local/tk-3.3/bin \
/usr/local/tcl7.3-tk3.6/bin \
/usr/local/tcl7.0/bin \
/usr/local/tcl7.0-tk3.3/bin \
/usr/contrib/bin \
/usr/contrib/tk3.6/bin \
/usr/contrib/tcl7.3-tk3.6/bin \
/usr/contrib/tk3.3/bin \
/usr/contrib/tcl7.0-tk3.3/bin \
$HOME/tcl/bin \
$HOME/tcl7.3/bin \
/opt/Tcl/bin \
/opt/bin \
/usr/unsupported \
/usr/unsupported/bin \
/usr/bin \
/bin \
/usr/sgitcl \
/usr/pkg \
/local/encap/tcl-7.1/bin ; do
if test -x $dir/wish ; then
wishloc=$dir/wish
break
fi
done
fi
if test -n "$wishloc" ; then
AC_MSG_RESULT(found $wishloc)
else
AC_MSG_RESULT(no)
fi])dnl
dnl
dnl We can use wish to find tcl and tk libraries with
dnl puts stdout $tk_library
dnl tclsh can be used with
dnl puts stdout $tcl_library
dnl
dnl Also sets FOUND_TK36 to 1 if found, sets FOUND_TK to version if a version
dnl after 3 is found
dnl
define([PAC_FIND_TCL],[
# Look for Tcl. Prefer the TCL73TK36_DIR version if it exists
if test -z "$TCL_DIR" ; then
# See if tclsh is in the path
# If there is a tclsh, it MAY provide tk.
PAC_PROGRAM_CHECK(TCLSH,tclsh,1,,tclshloc)
AC_MSG_CHECKING([for Tcl])
if test -n "$tclshloc" ; then
cat >conftest <<EOF
puts stdout [\$]tcl_library
EOF
tcllibloc=`$tclshloc conftest 2>/dev/null`
# The tcllibloc is the directory containing the .tcl files.
# The .a files may be one directory up
if test -n "$tcllibloc" ; then
tcllibloc=`dirname $tcllibloc`
# and the lib directory one above that
tcllibs="$tcllibloc `dirname $tcllibloc`"
fi
/bin/rm -f conftest
fi
foundversion=""
# At ANL, the software is in a common tree; we need to pick the
# correct architecture
# ? is host correct?
if test "$host" = "irix" ; then
archdir="irix-6"
elif test "$host" = "linux" ; then
archdir="linux"
elif test "$host" = "solaris" ; then
archdir="solaris-2"
elif test "$host" = "sun4" ; then
archdir="sun4"
else
archdir="."
fi
#
for dir in $TCL73TK36_DIR $tcllibs \
/usr \
/usr/local \
/usr/local/tcl7.5 \
/usr/local/tcl7.3 \
/usr/local/tcl7.3-tk3.6 \
/usr/local/tcl7.0 \
/usr/local/tcl7.0-tk3.3 \
/usr/local/tcl7.* \
/usr/contrib \
/usr/contrib/tk3.6 \
/usr/contrib/tcl7.3-tk3.6 \
/usr/contrib/tk3.3 \
/usr/contrib/tcl7.0-tk3.3 \
$HOME/tcl \
$HOME/tcl7.3 \
$HOME/tcl7.5 \
/opt/Tcl \
/opt/local \
/opt/local/tcl7.5 \
/opt/local/tcl7.* \
/usr/bin \
/Tools/tcl \
/usr/sgitcl \
/usr/pgk \
/software/$archdir/apps/packages/tcl-7* \
/local/encap/tcl-7.1 ; do
# In some cases, the tck/tk name comes *after* the include.
for fileloc in $dir/include $dir/include/tcl* ; do
if test -r $fileloc/tcl.h ; then
# Check for correct version
changequote(,)
tclversion=`grep 'TCL_MAJOR_VERSION' $fileloc/tcl.h | \
sed -e 's/^.*TCL_MAJOR_VERSION[^0-9]*\([0-9]*\).*$/\1/'`
changequote([,])
if test "$tclversion" != "7" ; then
# Skip if it is the wrong version
foundversion=$tclversion
continue
fi
if test -r $dir/lib/libtcl.a -o -r $dir/lib/libtcl.so ; then
TCL_DIR=$dir
break
fi
for libdir in $dir/lib $dir/lib/tcl* ; do
if test -r $libdir/libtcl.a -o -r $libdir/libtcl.so ; then
# Not used yet
TCL_LIB_DIR=$libdir
break
fi
done
for file in $dir/lib/libtcl*.a $dir/lib/tcl*/libtcl*.a ; do
if test -r $file ; then
TCL_DIR_W="$TCL_DIR_W $file"
fi
done
fi
if test -n "$TCL_DIR" ; then break ; fi
done
if test -n "$TCL_DIR" ; then break ; fi
done
fi
if test -n "$TCL_DIR" ; then
AC_MSG_RESULT(found $TCL_DIR/include/tcl.h and $TCL_DIR/lib/libtcl)
else
if test -n "$TCL_DIR_W" ; then
AC_MSG_RESULT(found $TCL_DIR_W but need libtcl.a)
else
if test -z "$foundversion" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(no: found version $foundversion but need version 7)
fi
fi
fi
# Look for Tk (look in tcl dir if the code is nowhere else)
if test -z "$TK_DIR" ; then
AC_MSG_CHECKING([for Tk])
if test -n "$wishloc" ; then
# Originally, we tried to run wish and get the tkversion from it
# unfortunately, this sometimes hung, probably waiting to get a display
# cat >conftest <<EOF
#puts stdout [\$]tk_library
#exit
#EOF
# tklibloc=`$wishloc -file conftest 2>/dev/null`
tklibloc=`strings $wishloc | grep 'lib/tk'`
# The tklibloc is the directory containing the .tclk files.
# The .a files may be one directory up
# There may be multiple lines in tklibloc now. Make sure that we only
# test actual directories
if test -n "$tklibloc" ; then
for tkdirname in $tklibloc ; do
if test -d $tkdirname ; then
tkdirname=`dirname $tkdirname`
# and the lib directory one above that
tklibs="$tkdirname `dirname $tkdirname`"
fi
done
fi
/bin/rm -f conftest
fi
foundversion=""
TK_UPDIR=""
TK_UPVERSION=""
for dir in $TCL73TK36_DIR $tklibs \
/usr \
/usr/local \
/usr/local/tk3.6 \
/usr/local/tcl7.3-tk3.6 \
/usr/local/tk3.3 \
/usr/local/tcl7.0-tk3.3 \
/usr/contrib \
/usr/contrib/tk3.6 \
/usr/contrib/tcl7.3-tk3.6 \
/usr/contrib/tk3.3 \
/usr/contrib/tcl7.0-tk3.3 \
$HOME/tcl \
$HOME/tcl7.3 \
/opt/Tcl \
/opt/local \
/opt/local/tk3.6 \
/usr/bin \
/Tools/tk \
/usr/sgitcl \
/usr/pkg \
/software/$archdir/apps/packages/tcl* \
/local/encap/tk-3.4 $TCL_DIR ; do
if test -r $dir/include/tk.h ; then
# Check for correct version
changequote(,)
tkversion=`grep 'TK_MAJOR_VERSION' $dir/include/tk.h | \
sed -e 's/^.*TK_MAJOR_VERSION[^0-9]*\([0-9]*\).*$/\1/'`
tk2version=`grep 'TK_MINOR_VERSION' $dir/include/tk.h | \
sed -e 's/^.*TK_MINOR_VERSION[^0-9]*\([0-9]*\).*$/\1/'`
changequote([,])
tkupversion="$tkversion.$tk2version"
if test "$tkversion" != "3" ; then
# Try for later versions for UPSHOT
if test -z "$TK_UPDIR" -a $tkversion -ge 3 ; then
TK_UPDIR=$dir
TK_UPVERSION=$tkversion
if test -r $TK_UPDIR/lib/libtk.a -o \
-r $TK_UPDIR/lib/libtk.so ; then
continue
elif test -r $TK_UPDIR/lib/libtk$tkupversion.a -o \
-r $TK_UPDIR/lib/libtk$tkupversion.so ; then
continue
else
TK_UPDIR=""
TK_UPVERSION=""
fi
fi
# Skip if it is the wrong version
foundversion=$tkversion
continue
fi
if test -r $dir/lib/libtk.a -o -r $dir/lib/libtk.so ; then
TK_DIR=$dir
break
fi
for file in $dir/lib/libtk*.a ; do
if test -r $file ; then
TK_DIR_W="$TK_DIR_W $file"
fi
done
fi
done
fi
if test -n "$TK_DIR" ; then
AC_MSG_RESULT(found $TK_DIR/include/tk.h and $TK_DIR/lib/libtk)
FOUND_TK36=1
else
FOUND_TK36=0
if test -n "$TK_DIR_W" ; then
AC_MSG_RESULT(found $TK_DIR_W but need libtk.a (and version 3.6) )
else
if test -z "$foundversion" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(no: found version $foundversion but need 3.6)
FOUND_TK=$TK_UPVERSION
fi
fi
fi
])dnl
|