]>
Commit | Line | Data |
---|---|---|
eafb8416 | 1 | diff -urN aaa/pilot-link-0.11.8/tcl.m4 pilot-link-0.11.8/tcl.m4 |
2 | --- aaa/pilot-link-0.11.8/tcl.m4 1970-01-01 01:00:00.000000000 +0100 | |
3 | +++ pilot-link-0.11.8/tcl.m4 2003-07-21 22:25:22.000000000 +0200 | |
4 | @@ -0,0 +1,704 @@ | |
5 | +# tcl.m4 -- | |
6 | +# | |
7 | +# This file provides a set of autoconf macros to help | |
8 | +# pilot-link find Tcl support (borrowed from PILOT_LINK) | |
9 | +# | |
10 | +# Copyright (c) 1999-2000 Ajuba Solutions. | |
11 | +# Copyright (c) 2002-2003 ActiveState Corporation. | |
12 | +# | |
13 | +# See the file "license.terms" for information on usage and redistribution | |
14 | +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
15 | + | |
16 | +#------------------------------------------------------------------------ | |
17 | +# PILOT_LINK_PATH_TCLCONFIG -- | |
18 | +# | |
19 | +# Locate the tclConfig.sh file and perform a sanity check on | |
20 | +# the Tcl compile flags | |
21 | +# | |
22 | +# Arguments: | |
23 | +# none | |
24 | +# | |
25 | +# Results: | |
26 | +# | |
27 | +# Adds the following arguments to configure: | |
28 | +# --with-tcl=... | |
29 | +# | |
30 | +# Defines the following vars: | |
31 | +# TCL_BIN_DIR Full path to the directory containing | |
32 | +# the tclConfig.sh file | |
33 | +#------------------------------------------------------------------------ | |
34 | + | |
35 | +AC_DEFUN(PILOT_LINK_PATH_TCLCONFIG, [ | |
36 | + # Ok, lets find the tcl configuration | |
37 | + # First, look for one uninstalled. | |
38 | + # the alternative search directory is invoked by --with-tcl | |
39 | + # | |
40 | + | |
41 | + use_tcl=false | |
42 | + | |
43 | + AC_ARG_WITH(tcl, [ --with-tcl=tclconfig use TCL], with_tclconfig=${withval}, with_tclconfig=no) | |
44 | + | |
45 | + if test x"${with_tclconfig}" != xno ; then | |
46 | + AC_MSG_CHECKING([for Tcl configuration]) | |
47 | + AC_CACHE_VAL(ac_cv_c_tclconfig,[ | |
48 | + | |
49 | + # First check to see if --with-tcl was specified. | |
50 | + if test x"${with_tclconfig}" != x ; then | |
51 | + if test -f "${with_tclconfig}/tclConfig.sh" ; then | |
52 | + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` | |
53 | + else | |
54 | + AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) | |
55 | + fi | |
56 | + fi | |
57 | + | |
58 | + # then check for a private Tcl installation | |
59 | + if test x"${ac_cv_c_tclconfig}" = x ; then | |
60 | + for i in \ | |
61 | + ../tcl \ | |
62 | + `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ | |
63 | + ../../tcl \ | |
64 | + `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ | |
65 | + ../../../tcl \ | |
66 | + `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do | |
67 | + if test -f "$i/unix/tclConfig.sh" ; then | |
68 | + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` | |
69 | + break | |
70 | + fi | |
71 | + done | |
72 | + fi | |
73 | + | |
74 | + # check in a few common install locations | |
75 | + if test x"${ac_cv_c_tclconfig}" = x ; then | |
76 | + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ | |
77 | + `ls -d ${prefix}/lib 2>/dev/null` \ | |
78 | + `ls -d /usr/local/lib 2>/dev/null` \ | |
79 | + `ls -d /usr/contrib/lib 2>/dev/null` \ | |
80 | + `ls -d /usr/lib 2>/dev/null` \ | |
81 | + ; do | |
82 | + if test -f "$i/tclConfig.sh" ; then | |
83 | + ac_cv_c_tclconfig=`(cd $i; pwd)` | |
84 | + break | |
85 | + fi | |
86 | + done | |
87 | + fi | |
88 | + | |
89 | + # check in a few other private locations | |
90 | + if test x"${ac_cv_c_tclconfig}" = x ; then | |
91 | + for i in \ | |
92 | + ${srcdir}/../tcl \ | |
93 | + `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do | |
94 | + if test -f "$i/unix/tclConfig.sh" ; then | |
95 | + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` | |
96 | + break | |
97 | + fi | |
98 | + done | |
99 | + fi | |
100 | + ]) | |
101 | + | |
102 | + if test x"${ac_cv_c_tclconfig}" = x ; then | |
103 | + TCL_BIN_DIR="# no Tcl configs found" | |
104 | + AC_MSG_WARN("Cannot find Tcl configuration definitions") | |
105 | + exit 0 | |
106 | + else | |
107 | + use_tcl=true | |
108 | + TCL_BIN_DIR=${ac_cv_c_tclconfig} | |
109 | + AC_MSG_RESULT([found $TCL_BIN_DIR/tclConfig.sh]) | |
110 | + fi | |
111 | + fi | |
112 | +]) | |
113 | + | |
114 | + | |
115 | +#------------------------------------------------------------------------ | |
116 | +# PILOT_LINK_LOAD_TCLCONFIG -- | |
117 | +# | |
118 | +# Load the tclConfig.sh file | |
119 | +# | |
120 | +# Arguments: | |
121 | +# | |
122 | +# Requires the following vars to be set: | |
123 | +# TCL_BIN_DIR | |
124 | +# | |
125 | +# Results: | |
126 | +# | |
127 | +# Subst the following vars: | |
128 | +# TCL_BIN_DIR | |
129 | +# TCL_SRC_DIR | |
130 | +# TCL_LIB_FILE | |
131 | +# | |
132 | +#------------------------------------------------------------------------ | |
133 | + | |
134 | +AC_DEFUN(PILOT_LINK_LOAD_TCLCONFIG, [ | |
135 | + AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) | |
136 | + | |
137 | + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then | |
138 | + AC_MSG_RESULT([loading]) | |
139 | + . $TCL_BIN_DIR/tclConfig.sh | |
140 | + else | |
141 | + AC_MSG_RESULT([file not found]) | |
142 | + fi | |
143 | + | |
144 | + # | |
145 | + # If the TCL_BIN_DIR is the build directory (not the install directory), | |
146 | + # then set the common variable name to the value of the build variables. | |
147 | + # For example, the variable TCL_LIB_SPEC will be set to the value | |
148 | + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC | |
149 | + # instead of TCL_BUILD_LIB_SPEC since it will work with both an | |
150 | + # installed and uninstalled version of Tcl. | |
151 | + # | |
152 | + | |
153 | + if test -f $TCL_BIN_DIR/Makefile ; then | |
154 | + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} | |
155 | + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} | |
156 | + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} | |
157 | + fi | |
158 | + | |
159 | + # | |
160 | + # eval is required to do the TCL_DBGX substitution | |
161 | + # | |
162 | + | |
163 | + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" | |
164 | + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" | |
165 | + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" | |
166 | + | |
167 | + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" | |
168 | + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" | |
169 | + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" | |
170 | + | |
171 | + AC_SUBST(TCL_VERSION) | |
172 | + AC_SUBST(TCL_BIN_DIR) | |
173 | + AC_SUBST(TCL_SRC_DIR) | |
174 | + | |
175 | + AC_SUBST(TCL_LIB_FILE) | |
176 | + AC_SUBST(TCL_LIB_FLAG) | |
177 | + AC_SUBST(TCL_LIB_SPEC) | |
178 | + | |
179 | + AC_SUBST(TCL_STUB_LIB_FILE) | |
180 | + AC_SUBST(TCL_STUB_LIB_FLAG) | |
181 | + AC_SUBST(TCL_STUB_LIB_SPEC) | |
182 | + | |
183 | + #AC_SUBST(TCL_DBGX) | |
184 | + AC_SUBST(TCL_LIBS) | |
185 | + AC_SUBST(TCL_DEFS) | |
186 | + AC_SUBST(TCL_EXTRA_CFLAGS) | |
187 | + AC_SUBST(TCL_LD_FLAGS) | |
188 | + AC_SUBST(TCL_SHLIB_LD_LIBS) | |
189 | + #AC_SUBST(TCL_BUILD_LIB_SPEC) | |
190 | + #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) | |
191 | +]) | |
192 | + | |
193 | + | |
194 | +#-------------------------------------------------------------------- | |
195 | +# PILOT_LINK_TCL_LINK_LIBS | |
196 | +# | |
197 | +# Search for the libraries needed to link the Tcl shell. | |
198 | +# Things like the math library (-lm) and socket stuff (-lsocket vs. | |
199 | +# -lnsl) are dealt with here. | |
200 | +# | |
201 | +# Arguments: | |
202 | +# Requires the following vars to be set in the Makefile: | |
203 | +# DL_LIBS | |
204 | +# LIBS | |
205 | +# MATH_LIBS | |
206 | +# | |
207 | +# Results: | |
208 | +# | |
209 | +# Subst's the following var: | |
210 | +# TCL_LIBS | |
211 | +# MATH_LIBS | |
212 | +# | |
213 | +# Might append to the following vars: | |
214 | +# LIBS | |
215 | +# | |
216 | +# Might define the following vars: | |
217 | +# HAVE_NET_ERRNO_H | |
218 | +# | |
219 | +#-------------------------------------------------------------------- | |
220 | + | |
221 | +AC_DEFUN(PILOT_LINK_TCL_LINK_LIBS, [ | |
222 | + #-------------------------------------------------------------------- | |
223 | + # On a few very rare systems, all of the libm.a stuff is | |
224 | + # already in libc.a. Set compiler flags accordingly. | |
225 | + # Also, Linux requires the "ieee" library for math to work | |
226 | + # right (and it must appear before "-lm"). | |
227 | + #-------------------------------------------------------------------- | |
228 | + | |
229 | + AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm") | |
230 | + AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) | |
231 | + | |
232 | + #-------------------------------------------------------------------- | |
233 | + # Interactive UNIX requires -linet instead of -lsocket, plus it | |
234 | + # needs net/errno.h to define the socket-related error codes. | |
235 | + #-------------------------------------------------------------------- | |
236 | + | |
237 | + AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) | |
238 | + AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H)) | |
239 | + | |
240 | + #-------------------------------------------------------------------- | |
241 | + # Check for the existence of the -lsocket and -lnsl libraries. | |
242 | + # The order here is important, so that they end up in the right | |
243 | + # order in the command line generated by make. Here are some | |
244 | + # special considerations: | |
245 | + # 1. Use "connect" and "accept" to check for -lsocket, and | |
246 | + # "gethostbyname" to check for -lnsl. | |
247 | + # 2. Use each function name only once: can't redo a check because | |
248 | + # autoconf caches the results of the last check and won't redo it. | |
249 | + # 3. Use -lnsl and -lsocket only if they supply procedures that | |
250 | + # aren't already present in the normal libraries. This is because | |
251 | + # IRIX 5.2 has libraries, but they aren't needed and they're | |
252 | + # bogus: they goof up name resolution if used. | |
253 | + # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. | |
254 | + # To get around this problem, check for both libraries together | |
255 | + # if -lsocket doesn't work by itself. | |
256 | + #-------------------------------------------------------------------- | |
257 | + | |
258 | + tcl_checkBoth=0 | |
259 | + AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) | |
260 | + if test "$tcl_checkSocket" = 1; then | |
261 | + AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt, | |
262 | + LIBS="$LIBS -lsocket", tcl_checkBoth=1)]) | |
263 | + fi | |
264 | + if test "$tcl_checkBoth" = 1; then | |
265 | + tk_oldLibs=$LIBS | |
266 | + LIBS="$LIBS -lsocket -lnsl" | |
267 | + AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) | |
268 | + fi | |
269 | + AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, | |
270 | + [LIBS="$LIBS -lnsl"])]) | |
271 | + | |
272 | + # Don't perform the eval of the libraries here because DL_LIBS | |
273 | + # won't be set until we call PILOT_LINK_CONFIG_CFLAGS | |
274 | + | |
275 | + TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' | |
276 | + AC_SUBST(TCL_LIBS) | |
277 | + AC_SUBST(MATH_LIBS) | |
278 | +]) | |
279 | + | |
280 | +#-------------------------------------------------------------------- | |
281 | +# PILOT_LINK_TCL_EARLY_FLAGS | |
282 | +# | |
283 | +# Check for what flags are needed to be passed so the correct OS | |
284 | +# features are available. | |
285 | +# | |
286 | +# Arguments: | |
287 | +# None | |
288 | +# | |
289 | +# Results: | |
290 | +# | |
291 | +# Might define the following vars: | |
292 | +# _ISOC99_SOURCE | |
293 | +# _LARGEFILE64_SOURCE | |
294 | +# | |
295 | +#-------------------------------------------------------------------- | |
296 | + | |
297 | +AC_DEFUN(PILOT_LINK_TCL_EARLY_FLAG,[ | |
298 | + AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), | |
299 | + AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no, | |
300 | + AC_TRY_COMPILE([[#define ]$1[ 1 | |
301 | +]$2], $3, | |
302 | + [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes, | |
303 | + [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no))) | |
304 | + if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then | |
305 | + AC_DEFINE($1) | |
306 | + tcl_flags="$tcl_flags $1" | |
307 | + fi | |
308 | +]) | |
309 | + | |
310 | +AC_DEFUN(PILOT_LINK_TCL_EARLY_FLAGS,[ | |
311 | + AC_MSG_CHECKING([for required early compiler flags]) | |
312 | + tcl_flags="" | |
313 | + PILOT_LINK_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>], | |
314 | + [char *p = (char *)strtoll; char *q = (char *)strtoull;]) | |
315 | + PILOT_LINK_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>], | |
316 | + [struct stat64 buf; int i = stat64("/", &buf);]) | |
317 | + if test "x${tcl_flags}" = "x" ; then | |
318 | + AC_MSG_RESULT([none]) | |
319 | + else | |
320 | + AC_MSG_RESULT([${tcl_flags}]) | |
321 | + fi | |
322 | +]) | |
323 | + | |
324 | +#-------------------------------------------------------------------- | |
325 | +# PILOT_LINK_TCL_64BIT_FLAGS | |
326 | +# | |
327 | +# Check for what is defined in the way of 64-bit features. | |
328 | +# | |
329 | +# Arguments: | |
330 | +# None | |
331 | +# | |
332 | +# Results: | |
333 | +# | |
334 | +# Might define the following vars: | |
335 | +# TCL_WIDE_INT_IS_LONG | |
336 | +# TCL_WIDE_INT_TYPE | |
337 | +# HAVE_STRUCT_DIRENT64 | |
338 | +# HAVE_STRUCT_STAT64 | |
339 | +# HAVE_TYPE_OFF64_T | |
340 | +# | |
341 | +#-------------------------------------------------------------------- | |
342 | + | |
343 | +AC_DEFUN(PILOT_LINK_TCL_64BIT_FLAGS, [ | |
344 | + AC_MSG_CHECKING([for 64-bit integer type]) | |
345 | + AC_CACHE_VAL(tcl_cv_type_64bit,[ | |
346 | + AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], | |
347 | + tcl_cv_type_64bit=__int64,tcl_cv_type_64bit=none | |
348 | + AC_TRY_RUN([#include <unistd.h> | |
349 | + int main() {exit(!(sizeof(long long) > sizeof(long)));} | |
350 | + ], tcl_cv_type_64bit="long long"))]) | |
351 | + if test "${tcl_cv_type_64bit}" = none ; then | |
352 | + AC_MSG_RESULT([using long]) | |
353 | + else | |
354 | + AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}) | |
355 | + AC_MSG_RESULT([${tcl_cv_type_64bit}]) | |
356 | + | |
357 | + # Now check for auxiliary declarations | |
358 | + AC_MSG_CHECKING([for struct dirent64]) | |
359 | + AC_CACHE_VAL(tcl_cv_struct_dirent64,[ | |
360 | + AC_TRY_COMPILE([#include <sys/types.h> | |
361 | +#include <sys/dirent.h>],[struct dirent64 p;], | |
362 | + tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) | |
363 | + if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then | |
364 | + AC_DEFINE(HAVE_STRUCT_DIRENT64) | |
365 | + fi | |
366 | + AC_MSG_RESULT([${tcl_cv_struct_dirent64}]) | |
367 | + | |
368 | + AC_MSG_CHECKING([for struct stat64]) | |
369 | + AC_CACHE_VAL(tcl_cv_struct_stat64,[ | |
370 | + AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p; | |
371 | +], | |
372 | + tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)]) | |
373 | + if test "x${tcl_cv_struct_stat64}" = "xyes" ; then | |
374 | + AC_DEFINE(HAVE_STRUCT_STAT64) | |
375 | + fi | |
376 | + AC_MSG_RESULT([${tcl_cv_struct_stat64}]) | |
377 | + | |
378 | + AC_MSG_CHECKING([for off64_t]) | |
379 | + AC_CACHE_VAL(tcl_cv_type_off64_t,[ | |
380 | + AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset; | |
381 | +], | |
382 | + tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)]) | |
383 | + if test "x${tcl_cv_type_off64_t}" = "xyes" ; then | |
384 | + AC_DEFINE(HAVE_TYPE_OFF64_T) | |
385 | + fi | |
386 | + AC_MSG_RESULT([${tcl_cv_type_off64_t}]) | |
387 | + fi | |
388 | +]) | |
389 | + | |
390 | +## | |
391 | +## Here ends the standard Tcl configuration bits and starts the | |
392 | +## PILOT_LINK specific functions | |
393 | +## | |
394 | + | |
395 | +#------------------------------------------------------------------------ | |
396 | +# PILOT_LINK_PUBLIC_TCL_HEADERS -- | |
397 | +# | |
398 | +# Locate the installed public Tcl header files | |
399 | +# | |
400 | +# Arguments: | |
401 | +# None. | |
402 | +# | |
403 | +# Results: | |
404 | +# | |
405 | +# Adds a --with-tclinclude switch to configure. | |
406 | +# Result is cached. | |
407 | +# | |
408 | +# Substs the following vars: | |
409 | +# TCL_INCLUDES | |
410 | +#------------------------------------------------------------------------ | |
411 | + | |
412 | +AC_DEFUN(PILOT_LINK_PUBLIC_TCL_HEADERS, [ | |
413 | + AC_MSG_CHECKING([for Tcl public headers]) | |
414 | + | |
415 | + AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval}) | |
416 | + | |
417 | + AC_CACHE_VAL(ac_cv_c_tclh, [ | |
418 | + # Use the value from --with-tclinclude, if it was given | |
419 | + | |
420 | + if test x"${with_tclinclude}" != x ; then | |
421 | + if test -f "${with_tclinclude}/tcl.h" ; then | |
422 | + ac_cv_c_tclh=${with_tclinclude} | |
423 | + else | |
424 | + AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h]) | |
425 | + fi | |
426 | + else | |
427 | + # Check order: pkg --prefix location, Tcl's --prefix location, | |
428 | + # directory of tclConfig.sh, and Tcl source directory. | |
429 | + # Looking in the source dir is not ideal, but OK. | |
430 | + | |
431 | + eval "temp_includedir=${includedir}" | |
432 | + list="`ls -d ${temp_includedir} 2>/dev/null` \ | |
433 | + `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ | |
434 | + `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \ | |
435 | + `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`" | |
436 | + if test "${PILOT_LINK_PLATFORM}" != "windows" -o "$GCC" = "yes"; then | |
437 | + list="$list /usr/local/include /usr/include" | |
438 | + fi | |
439 | + for i in $list ; do | |
440 | + if test -f "$i/tcl.h" ; then | |
441 | + ac_cv_c_tclh=$i | |
442 | + break | |
443 | + fi | |
444 | + done | |
445 | + fi | |
446 | + ]) | |
447 | + | |
448 | + # Print a message based on how we determined the include path | |
449 | + | |
450 | + if test x"${ac_cv_c_tclh}" = x ; then | |
451 | + AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude]) | |
452 | + else | |
453 | + AC_MSG_RESULT([${ac_cv_c_tclh}]) | |
454 | + fi | |
455 | + | |
456 | + TCL_INCLUDES=-I\"${ac_cv_c_tclh}\" | |
457 | + | |
458 | + AC_SUBST(TCL_INCLUDES) | |
459 | +]) | |
460 | + | |
461 | + | |
462 | +#------------------------------------------------------------------------ | |
463 | +# PILOT_LINK_PROG_TCLSH | |
464 | +# Locate a tclsh shell in the following directories: | |
465 | +# ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin | |
466 | +# ${exec_prefix}/bin ${prefix}/bin | |
467 | +# ${PATH} | |
468 | +# | |
469 | +# Arguments | |
470 | +# none | |
471 | +# | |
472 | +# Results | |
473 | +# Subst's the following values: | |
474 | +# TCLSH_PROG | |
475 | +#------------------------------------------------------------------------ | |
476 | + | |
477 | +AC_DEFUN(PILOT_LINK_PROG_TCLSH, [ | |
478 | + AC_MSG_CHECKING([for tclsh]) | |
479 | + | |
480 | + AC_CACHE_VAL(ac_cv_path_tclsh, [ | |
481 | + if test "x${CELIB_DIR}" != "x" ; then | |
482 | + # If CELIB_DIR is defined, assume Windows/CE target is requested | |
483 | + # which means target tclsh cannot be run (cross-compile) | |
484 | + search_path=`echo ${PATH} | sed -e 's/:/ /g'` | |
485 | + else | |
486 | + search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` | |
487 | + fi | |
488 | + for dir in $search_path ; do | |
489 | + for j in `ls -r $dir/tclsh[[8-9]]*${EXEEXT} 2> /dev/null` \ | |
490 | + `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do | |
491 | + if test x"$ac_cv_path_tclsh" = x ; then | |
492 | + if test -f "$j" ; then | |
493 | + ac_cv_path_tclsh=$j | |
494 | + break | |
495 | + fi | |
496 | + fi | |
497 | + done | |
498 | + done | |
499 | + ]) | |
500 | + | |
501 | + if test -f "$ac_cv_path_tclsh" ; then | |
502 | + TCLSH_PROG=$ac_cv_path_tclsh | |
503 | + AC_MSG_RESULT([$TCLSH_PROG]) | |
504 | + else | |
505 | + AC_MSG_ERROR([No tclsh found in PATH: $search_path]) | |
506 | + fi | |
507 | + AC_SUBST(TCLSH_PROG) | |
508 | +]) | |
509 | + | |
510 | +#------------------------------------------------------------------------ | |
511 | +# PILOT_LINK_PROG_WISH | |
512 | +# Locate a wish shell in the following directories: | |
513 | +# ${TK_BIN_DIR} ${TK_BIN_DIR}/../bin | |
514 | +# ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin | |
515 | +# ${exec_prefix}/bin ${prefix}/bin | |
516 | +# ${PATH} | |
517 | +# | |
518 | +# Arguments | |
519 | +# none | |
520 | +# | |
521 | +# Results | |
522 | +# Subst's the following values: | |
523 | +# WISH_PROG | |
524 | +#------------------------------------------------------------------------ | |
525 | + | |
526 | +AC_DEFUN(PILOT_LINK_PROG_WISH, [ | |
527 | + AC_MSG_CHECKING([for wish]) | |
528 | + | |
529 | + AC_CACHE_VAL(ac_cv_path_wish, [ | |
530 | + if test "x${CELIB_DIR}" != "x" ; then | |
531 | + # If CELIB_DIR is defined, assume Windows/CE target is requested | |
532 | + # which means target wish cannot be run (cross-compile) | |
533 | + search_path=`echo ${PATH} | sed -e 's/:/ /g'` | |
534 | + else | |
535 | + search_path=`echo ${TK_BIN_DIR}:${TK_BIN_DIR}/../bin:${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` | |
536 | + fi | |
537 | + for dir in $search_path ; do | |
538 | + for j in `ls -r $dir/wish[[8-9]]*${EXEEXT} 2> /dev/null` \ | |
539 | + `ls -r $dir/wish*${EXEEXT} 2> /dev/null` ; do | |
540 | + if test x"$ac_cv_path_wish" = x ; then | |
541 | + if test -f "$j" ; then | |
542 | + ac_cv_path_wish=$j | |
543 | + break | |
544 | + fi | |
545 | + fi | |
546 | + done | |
547 | + done | |
548 | + ]) | |
549 | + | |
550 | + if test -f "$ac_cv_path_wish" ; then | |
551 | + WISH_PROG=$ac_cv_path_wish | |
552 | + AC_MSG_RESULT([$WISH_PROG]) | |
553 | + else | |
554 | + AC_MSG_ERROR([No wish found in PATH: $search_path]) | |
555 | + fi | |
556 | + AC_SUBST(WISH_PROG) | |
557 | +]) | |
558 | + | |
559 | +#------------------------------------------------------------------------ | |
560 | +# PILOT_LINK_PATH_CONFIG -- | |
561 | +# | |
562 | +# Locate the ${1}Config.sh file and perform a sanity check on | |
563 | +# the ${1} compile flags. These are used by packages like | |
564 | +# [incr Tk] that load *Config.sh files from more than Tcl and Tk. | |
565 | +# | |
566 | +# Arguments: | |
567 | +# none | |
568 | +# | |
569 | +# Results: | |
570 | +# | |
571 | +# Adds the following arguments to configure: | |
572 | +# --with-$1=... | |
573 | +# | |
574 | +# Defines the following vars: | |
575 | +# $1_BIN_DIR Full path to the directory containing | |
576 | +# the $1Config.sh file | |
577 | +#------------------------------------------------------------------------ | |
578 | + | |
579 | +AC_DEFUN(PILOT_LINK_PATH_CONFIG, [ | |
580 | + # | |
581 | + # Ok, lets find the $1 configuration | |
582 | + # First, look for one uninstalled. | |
583 | + # the alternative search directory is invoked by --with-$1 | |
584 | + # | |
585 | + | |
586 | + if test x"${no_$1}" = x ; then | |
587 | + # we reset no_$1 in case something fails here | |
588 | + no_$1=true | |
589 | + AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval}) | |
590 | + AC_MSG_CHECKING([for $1 configuration]) | |
591 | + AC_CACHE_VAL(ac_cv_c_$1config,[ | |
592 | + | |
593 | + # First check to see if --with-$1 was specified. | |
594 | + if test x"${with_$1config}" != x ; then | |
595 | + if test -f "${with_$1config}/$1Config.sh" ; then | |
596 | + ac_cv_c_$1config=`(cd ${with_$1config}; pwd)` | |
597 | + else | |
598 | + AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh]) | |
599 | + fi | |
600 | + fi | |
601 | + | |
602 | + # then check for a private $1 installation | |
603 | + if test x"${ac_cv_c_$1config}" = x ; then | |
604 | + for i in \ | |
605 | + ../$1 \ | |
606 | + `ls -dr ../$1[[8-9]].[[0-9]]* 2>/dev/null` \ | |
607 | + ../../$1 \ | |
608 | + `ls -dr ../../$1[[8-9]].[[0-9]]* 2>/dev/null` \ | |
609 | + ../../../$1 \ | |
610 | + `ls -dr ../../../$1[[8-9]].[[0-9]]* 2>/dev/null` \ | |
611 | + ${srcdir}/../$1 \ | |
612 | + `ls -dr ${srcdir}/../$1[[8-9]].[[0-9]]* 2>/dev/null` \ | |
613 | + ; do | |
614 | + if test -f "$i/$1Config.sh" ; then | |
615 | + ac_cv_c_$1config=`(cd $i; pwd)` | |
616 | + break | |
617 | + fi | |
618 | + if test -f "$i/unix/$1Config.sh" ; then | |
619 | + ac_cv_c_$1config=`(cd $i/unix; pwd)` | |
620 | + break | |
621 | + fi | |
622 | + done | |
623 | + fi | |
624 | + | |
625 | + # check in a few common install locations | |
626 | + if test x"${ac_cv_c_$1config}" = x ; then | |
627 | + for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ | |
628 | + `ls -d ${prefix}/lib 2>/dev/null` \ | |
629 | + `ls -d /usr/local/lib 2>/dev/null` \ | |
630 | + `ls -d /usr/contrib/lib 2>/dev/null` \ | |
631 | + `ls -d /usr/lib 2>/dev/null` \ | |
632 | + ; do | |
633 | + if test -f "$i/$1Config.sh" ; then | |
634 | + ac_cv_c_$1config=`(cd $i; pwd)` | |
635 | + break | |
636 | + fi | |
637 | + done | |
638 | + fi | |
639 | + ]) | |
640 | + | |
641 | + if test x"${ac_cv_c_$1config}" = x ; then | |
642 | + $1_BIN_DIR="# no $1 configs found" | |
643 | + AC_MSG_WARN("Cannot find $1 configuration definitions") | |
644 | + exit 0 | |
645 | + else | |
646 | + no_$1= | |
647 | + $1_BIN_DIR=${ac_cv_c_$1config} | |
648 | + AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh]) | |
649 | + fi | |
650 | + fi | |
651 | +]) | |
652 | + | |
653 | +#------------------------------------------------------------------------ | |
654 | +# PILOT_LINK_LOAD_CONFIG -- | |
655 | +# | |
656 | +# Load the $1Config.sh file | |
657 | +# | |
658 | +# Arguments: | |
659 | +# | |
660 | +# Requires the following vars to be set: | |
661 | +# $1_BIN_DIR | |
662 | +# | |
663 | +# Results: | |
664 | +# | |
665 | +# Subst the following vars: | |
666 | +# $1_SRC_DIR | |
667 | +# $1_LIB_FILE | |
668 | +# $1_LIB_SPEC | |
669 | +# | |
670 | +#------------------------------------------------------------------------ | |
671 | + | |
672 | +AC_DEFUN(PILOT_LINK_LOAD_CONFIG, [ | |
673 | + AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh]) | |
674 | + | |
675 | + if test -f "${$1_BIN_DIR}/$1Config.sh" ; then | |
676 | + AC_MSG_RESULT([loading]) | |
677 | + . ${$1_BIN_DIR}/$1Config.sh | |
678 | + else | |
679 | + AC_MSG_RESULT([file not found]) | |
680 | + fi | |
681 | + | |
682 | + # | |
683 | + # If the $1_BIN_DIR is the build directory (not the install directory), | |
684 | + # then set the common variable name to the value of the build variables. | |
685 | + # For example, the variable $1_LIB_SPEC will be set to the value | |
686 | + # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC | |
687 | + # instead of $1_BUILD_LIB_SPEC since it will work with both an | |
688 | + # installed and uninstalled version of Tcl. | |
689 | + # | |
690 | + | |
691 | + if test -f ${$1_BIN_DIR}/Makefile ; then | |
692 | + AC_MSG_WARN([Found Makefile - using build library specs for $1]) | |
693 | + $1_LIB_SPEC=${$1_BUILD_LIB_SPEC} | |
694 | + $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC} | |
695 | + $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH} | |
696 | + fi | |
697 | + | |
698 | + AC_SUBST($1_VERSION) | |
699 | + AC_SUBST($1_SRC_DIR) | |
700 | + | |
701 | + AC_SUBST($1_LIB_FILE) | |
702 | + AC_SUBST($1_LIB_SPEC) | |
703 | + | |
704 | + AC_SUBST($1_STUB_LIB_FILE) | |
705 | + AC_SUBST($1_STUB_LIB_SPEC) | |
706 | + AC_SUBST($1_STUB_LIB_PATH) | |
707 | +]) | |
708 | + |