Debian Codegraph @

lib/tcl.m4

raw
1 # tcl.m4 --
2 #
3 # This file provides a set of autoconf macros to help TEA-enable
4 # a Tcl extension.
5 #
6 # Copyright (c) 1999-2000 Ajuba Solutions.
7 # Copyright (c) 2002-2005 ActiveState Corporation.
8 #
9 # See the file "license.terms" for information on usage and redistribution
10 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11
12 AC_PREREQ([2.69])
13
14 # Possible values for key variables defined:
15 #
16 # TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
17 # TEA_PLATFORM - windows unix
18 # TEA_TK_EXTENSION - True if this is a Tk extension
19 #
20
21 #------------------------------------------------------------------------
22 # TEA_PATH_TCLCONFIG --
23 #
24 # Locate the tclConfig.sh file and perform a sanity check on
25 # the Tcl compile flags
26 #
27 # Arguments:
28 # none
29 #
30 # Results:
31 #
32 # Adds the following arguments to configure:
33 # --with-tcl=...
34 #
35 # Defines the following vars:
36 # TCL_BIN_DIR Full path to the directory containing
37 # the tclConfig.sh file
38 #------------------------------------------------------------------------
39
40 AC_DEFUN([TEA_PATH_TCLCONFIG], [
41 dnl TEA specific: Make sure we are initialized
42 AC_REQUIRE([TEA_INIT])
43 #
44 # Ok, lets find the tcl configuration
45 # First, look for one uninstalled.
46 # the alternative search directory is invoked by --with-tcl
47 #
48
49 if test x"${no_tcl}" = x ; then
50 # we reset no_tcl in case something fails here
51 no_tcl=true
52 AC_ARG_WITH(tcl,
53 AS_HELP_STRING([--with-tcl],
54 [directory containing tcl configuration (tclConfig.sh)]),
55 [with_tclconfig="${withval}"])
56 AC_ARG_WITH(tcl8,
57 AS_HELP_STRING([--with-tcl8],
58 [Compile for Tcl8 in Tcl9 environment]),
59 [with_tcl8="${withval}"])
60 AC_MSG_CHECKING([for Tcl configuration])
61 AC_CACHE_VAL(ac_cv_c_tclconfig,[
62
63 # First check to see if --with-tcl was specified.
64 if test x"${with_tclconfig}" != x ; then
65 case "${with_tclconfig}" in
66 */tclConfig.sh )
67 if test -f "${with_tclconfig}"; then
68 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
69 with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
70 fi ;;
71 esac
72 if test -f "${with_tclconfig}/tclConfig.sh" ; then
73 ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
74 else
75 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
76 fi
77 fi
78
79 # then check for a private Tcl installation
80 if test x"${ac_cv_c_tclconfig}" = x ; then
81 for i in \
82 ../tcl \
83 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
84 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
85 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
86 ../../tcl \
87 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
88 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
89 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
90 ../../../tcl \
91 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
92 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
93 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
94 if test "${TEA_PLATFORM}" = "windows" \
95 -a -f "$i/win/tclConfig.sh" ; then
96 ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
97 break
98 fi
99 if test -f "$i/unix/tclConfig.sh" ; then
100 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
101 break
102 fi
103 done
104 fi
105
106 # on Darwin, check in Framework installation locations
107 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
108 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
109 `ls -d /Library/Frameworks 2>/dev/null` \
110 `ls -d /Network/Library/Frameworks 2>/dev/null` \
111 `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks/Tcl.framework 2>/dev/null` \
112 `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Network/Library/Frameworks/Tcl.framework 2>/dev/null` \
113 `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework 2>/dev/null` \
114 ; do
115 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
116 ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
117 break
118 fi
119 done
120 fi
121
122 # TEA specific: on Windows, check in common installation locations
123 if test "${TEA_PLATFORM}" = "windows" \
124 -a x"${ac_cv_c_tclconfig}" = x ; then
125 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
126 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
127 ; do
128 if test -f "$i/tclConfig.sh" ; then
129 ac_cv_c_tclconfig="`(cd $i; pwd)`"
130 break
131 fi
132 done
133 fi
134
135 # check in a few common install locations
136 if test x"${ac_cv_c_tclconfig}" = x ; then
137 for i in `ls -d ${libdir} 2>/dev/null` \
138 `ls -d ${exec_prefix}/lib 2>/dev/null` \
139 `ls -d ${prefix}/lib 2>/dev/null` \
140 `ls -d /usr/local/lib 2>/dev/null` \
141 `ls -d /usr/contrib/lib 2>/dev/null` \
142 `ls -d /usr/pkg/lib 2>/dev/null` \
143 `ls -d /usr/lib 2>/dev/null` \
144 `ls -d /usr/lib64 2>/dev/null` \
145 `ls -d /usr/lib/tcl9.1 2>/dev/null` \
146 `ls -d /usr/lib/tcl9.0 2>/dev/null` \
147 `ls -d /usr/lib/tcl8.6 2>/dev/null` \
148 `ls -d /usr/lib/tcl8.5 2>/dev/null` \
149 `ls -d /usr/local/lib/tcl9.1 2>/dev/null` \
150 `ls -d /usr/local/lib/tcl9.0 2>/dev/null` \
151 `ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
152 `ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
153 `ls -d /usr/local/lib/tcl/tcl9.1 2>/dev/null` \
154 `ls -d /usr/local/lib/tcl/tcl9.0 2>/dev/null` \
155 `ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \
156 `ls -d /usr/local/lib/tcl/tcl8.5 2>/dev/null` \
157 ; do
158 if test -f "$i/tclConfig.sh" ; then
159 ac_cv_c_tclconfig="`(cd $i; pwd)`"
160 break
161 fi
162 done
163 fi
164
165 # check in a few other private locations
166 if test x"${ac_cv_c_tclconfig}" = x ; then
167 for i in \
168 ${srcdir}/../tcl \
169 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
170 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
171 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
172 if test "${TEA_PLATFORM}" = "windows" \
173 -a -f "$i/win/tclConfig.sh" ; then
174 ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
175 break
176 fi
177 if test -f "$i/unix/tclConfig.sh" ; then
178 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
179 break
180 fi
181 done
182 fi
183 ])
184
185 if test x"${ac_cv_c_tclconfig}" = x ; then
186 TCL_BIN_DIR="# no Tcl configs found"
187 AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh])
188 else
189 no_tcl=
190 TCL_BIN_DIR="${ac_cv_c_tclconfig}"
191 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
192 fi
193 fi
194 ])
195
196 #------------------------------------------------------------------------
197 # TEA_PATH_TKCONFIG --
198 #
199 # Locate the tkConfig.sh file
200 #
201 # Arguments:
202 # none
203 #
204 # Results:
205 #
206 # Adds the following arguments to configure:
207 # --with-tk=...
208 #
209 # Defines the following vars:
210 # TK_BIN_DIR Full path to the directory containing
211 # the tkConfig.sh file
212 #------------------------------------------------------------------------
213
214 AC_DEFUN([TEA_PATH_TKCONFIG], [
215 #
216 # Ok, lets find the tk configuration
217 # First, look for one uninstalled.
218 # the alternative search directory is invoked by --with-tk
219 #
220
221 if test x"${no_tk}" = x ; then
222 # we reset no_tk in case something fails here
223 no_tk=true
224 AC_ARG_WITH(tk,
225 AS_HELP_STRING([--with-tk],
226 [directory containing tk configuration (tkConfig.sh)]),
227 [with_tkconfig="${withval}"])
228 AC_MSG_CHECKING([for Tk configuration])
229 AC_CACHE_VAL(ac_cv_c_tkconfig,[
230
231 # First check to see if --with-tkconfig was specified.
232 if test x"${with_tkconfig}" != x ; then
233 case "${with_tkconfig}" in
234 */tkConfig.sh )
235 if test -f "${with_tkconfig}"; then
236 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
237 with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
238 fi ;;
239 esac
240 if test -f "${with_tkconfig}/tkConfig.sh" ; then
241 ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
242 else
243 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
244 fi
245 fi
246
247 # then check for a private Tk library
248 if test x"${ac_cv_c_tkconfig}" = x ; then
249 for i in \
250 ../tk \
251 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
252 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
253 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
254 ../../tk \
255 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
256 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
257 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
258 ../../../tk \
259 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
260 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
261 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
262 if test "${TEA_PLATFORM}" = "windows" \
263 -a -f "$i/win/tkConfig.sh" ; then
264 ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
265 break
266 fi
267 if test -f "$i/unix/tkConfig.sh" ; then
268 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
269 break
270 fi
271 done
272 fi
273
274 # on Darwin, check in Framework installation locations
275 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
276 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
277 `ls -d /Library/Frameworks 2>/dev/null` \
278 `ls -d /Network/Library/Frameworks 2>/dev/null` \
279 ; do
280 if test -f "$i/Tk.framework/tkConfig.sh" ; then
281 ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
282 break
283 fi
284 done
285 fi
286
287 # check in a few common install locations
288 if test x"${ac_cv_c_tkconfig}" = x ; then
289 for i in `ls -d ${libdir} 2>/dev/null` \
290 `ls -d ${exec_prefix}/lib 2>/dev/null` \
291 `ls -d ${prefix}/lib 2>/dev/null` \
292 `ls -d /usr/local/lib 2>/dev/null` \
293 `ls -d /usr/contrib/lib 2>/dev/null` \
294 `ls -d /usr/pkg/lib 2>/dev/null` \
295 `ls -d /usr/lib/tk9.1 2>/dev/null` \
296 `ls -d /usr/lib/tk9.0 2>/dev/null` \
297 `ls -d /usr/lib/tk8.6 2>/dev/null` \
298 `ls -d /usr/lib/tk8.5 2>/dev/null` \
299 `ls -d /usr/lib 2>/dev/null` \
300 `ls -d /usr/lib64 2>/dev/null` \
301 `ls -d /usr/local/lib/tk9.1 2>/dev/null` \
302 `ls -d /usr/local/lib/tk9.0 2>/dev/null` \
303 `ls -d /usr/local/lib/tk8.6 2>/dev/null` \
304 `ls -d /usr/local/lib/tk8.5 2>/dev/null` \
305 `ls -d /usr/local/lib/tcl/tk9.1 2>/dev/null` \
306 `ls -d /usr/local/lib/tcl/tk9.0 2>/dev/null` \
307 `ls -d /usr/local/lib/tcl/tk8.6 2>/dev/null` \
308 `ls -d /usr/local/lib/tcl/tk8.5 2>/dev/null` \
309 ; do
310 if test -f "$i/tkConfig.sh" ; then
311 ac_cv_c_tkconfig="`(cd $i; pwd)`"
312 break
313 fi
314 done
315 fi
316
317 # TEA specific: on Windows, check in common installation locations
318 if test "${TEA_PLATFORM}" = "windows" \
319 -a x"${ac_cv_c_tkconfig}" = x ; then
320 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
321 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
322 ; do
323 if test -f "$i/tkConfig.sh" ; then
324 ac_cv_c_tkconfig="`(cd $i; pwd)`"
325 break
326 fi
327 done
328 fi
329
330 # check in a few other private locations
331 if test x"${ac_cv_c_tkconfig}" = x ; then
332 for i in \
333 ${srcdir}/../tk \
334 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
335 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
336 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
337 if test "${TEA_PLATFORM}" = "windows" \
338 -a -f "$i/win/tkConfig.sh" ; then
339 ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
340 break
341 fi
342 if test -f "$i/unix/tkConfig.sh" ; then
343 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
344 break
345 fi
346 done
347 fi
348 ])
349
350 if test x"${ac_cv_c_tkconfig}" = x ; then
351 TK_BIN_DIR="# no Tk configs found"
352 AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh])
353 else
354 no_tk=
355 TK_BIN_DIR="${ac_cv_c_tkconfig}"
356 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
357 fi
358 fi
359 ])
360
361 #------------------------------------------------------------------------
362 # TEA_LOAD_TCLCONFIG --
363 #
364 # Load the tclConfig.sh file
365 #
366 # Arguments:
367 #
368 # Requires the following vars to be set:
369 # TCL_BIN_DIR
370 #
371 # Results:
372 #
373 # Substitutes the following vars:
374 # TCL_BIN_DIR
375 # TCL_SRC_DIR
376 # TCL_LIB_FILE
377 # TCL_ZIP_FILE
378 # TCL_ZIPFS_SUPPORT
379 #------------------------------------------------------------------------
380
381 AC_DEFUN([TEA_LOAD_TCLCONFIG], [
382 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
383
384 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
385 AC_MSG_RESULT([loading])
386 . "${TCL_BIN_DIR}/tclConfig.sh"
387 else
388 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
389 fi
390
391 # If the TCL_BIN_DIR is the build directory (not the install directory),
392 # then set the common variable name to the value of the build variables.
393 # For example, the variable TCL_LIB_SPEC will be set to the value
394 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
395 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
396 # installed and uninstalled version of Tcl.
397 if test -f "${TCL_BIN_DIR}/Makefile" ; then
398 TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
399 TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
400 TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
401 elif test "`uname -s`" = "Darwin"; then
402 # If Tcl was built as a framework, attempt to use the libraries
403 # from the framework at the given location so that linking works
404 # against Tcl.framework installed in an arbitrary location.
405 case ${TCL_DEFS} in
406 *TCL_FRAMEWORK*)
407 if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
408 for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
409 "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
410 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
411 TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
412 break
413 fi
414 done
415 fi
416 if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
417 TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
418 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
419 fi
420 ;;
421 esac
422 fi
423
424 AC_SUBST(TCL_VERSION)
425 AC_SUBST(TCL_PATCH_LEVEL)
426 AC_SUBST(TCL_BIN_DIR)
427 AC_SUBST(TCL_SRC_DIR)
428
429 AC_SUBST(TCL_LIB_FILE)
430 AC_SUBST(TCL_LIB_FLAG)
431 AC_SUBST(TCL_LIB_SPEC)
432
433 AC_SUBST(TCL_STUB_LIB_FILE)
434 AC_SUBST(TCL_STUB_LIB_FLAG)
435 AC_SUBST(TCL_STUB_LIB_SPEC)
436
437 AC_MSG_CHECKING([platform])
438 hold_cc=$CC; CC="$TCL_CC"
439 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
440 #ifdef _WIN32
441 #error win32
442 #endif
443 ]])],[
444 # first test we've already retrieved platform (cross-compile), fallback to unix otherwise:
445 TEA_PLATFORM="${TEA_PLATFORM-unix}"
446 CYGPATH=echo
447 ],[
448 TEA_PLATFORM="windows"
449 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
450 ])
451 CC=$hold_cc
452 AC_MSG_RESULT($TEA_PLATFORM)
453
454 # The BUILD_$pkg is to define the correct extern storage class
455 # handling when making this package
456 # To be able to sefely use the package name in a #define, it must not
457 # contain anything other than alphanumeric characters and underscores
458 SAFE_PKG_NAME=patsubst(AC_PACKAGE_NAME, [[^A-Za-z0-9_]], [_])
459 AC_DEFINE_UNQUOTED(BUILD_${SAFE_PKG_NAME}, [],
460 [Building extension source?])
461 # Do this here as we have fully defined TEA_PLATFORM now
462 if test "${TEA_PLATFORM}" = "windows" ; then
463 EXEEXT=".exe"
464 CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp"
465 fi
466
467 # TEA specific:
468 AC_SUBST(CLEANFILES)
469 AC_SUBST(TCL_LIBS)
470 AC_SUBST(TCL_DEFS)
471 AC_SUBST(TCL_EXTRA_CFLAGS)
472 AC_SUBST(TCL_LD_FLAGS)
473 AC_SUBST(TCL_SHLIB_LD_LIBS)
474 ])
475
476 #------------------------------------------------------------------------
477 # TEA_LOAD_TKCONFIG --
478 #
479 # Load the tkConfig.sh file
480 #
481 # Arguments:
482 #
483 # Requires the following vars to be set:
484 # TK_BIN_DIR
485 #
486 # Results:
487 #
488 # Sets the following vars that should be in tkConfig.sh:
489 # TK_BIN_DIR
490 #------------------------------------------------------------------------
491
492 AC_DEFUN([TEA_LOAD_TKCONFIG], [
493 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
494
495 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
496 AC_MSG_RESULT([loading])
497 . "${TK_BIN_DIR}/tkConfig.sh"
498 else
499 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
500 fi
501
502 # If the TK_BIN_DIR is the build directory (not the install directory),
503 # then set the common variable name to the value of the build variables.
504 # For example, the variable TK_LIB_SPEC will be set to the value
505 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
506 # instead of TK_BUILD_LIB_SPEC since it will work with both an
507 # installed and uninstalled version of Tcl.
508 if test -f "${TK_BIN_DIR}/Makefile" ; then
509 TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
510 TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
511 TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
512 elif test "`uname -s`" = "Darwin"; then
513 # If Tk was built as a framework, attempt to use the libraries
514 # from the framework at the given location so that linking works
515 # against Tk.framework installed in an arbitrary location.
516 case ${TK_DEFS} in
517 *TK_FRAMEWORK*)
518 if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
519 for i in "`cd "${TK_BIN_DIR}"; pwd`" \
520 "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
521 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
522 TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
523 break
524 fi
525 done
526 fi
527 if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
528 TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
529 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
530 fi
531 ;;
532 esac
533 fi
534
535 # TEA specific: Ensure windowingsystem is defined
536 if test "${TEA_PLATFORM}" = "unix" ; then
537 case ${TK_DEFS} in
538 *MAC_OSX_TK*)
539 AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
540 TEA_WINDOWINGSYSTEM="aqua"
541 ;;
542 *)
543 TEA_WINDOWINGSYSTEM="x11"
544 ;;
545 esac
546 elif test "${TEA_PLATFORM}" = "windows" ; then
547 TEA_WINDOWINGSYSTEM="win32"
548 fi
549
550 AC_SUBST(TK_VERSION)
551 AC_SUBST(TK_BIN_DIR)
552 AC_SUBST(TK_SRC_DIR)
553
554 AC_SUBST(TK_LIB_FILE)
555 AC_SUBST(TK_LIB_FLAG)
556 AC_SUBST(TK_LIB_SPEC)
557
558 AC_SUBST(TK_STUB_LIB_FILE)
559 AC_SUBST(TK_STUB_LIB_FLAG)
560 AC_SUBST(TK_STUB_LIB_SPEC)
561
562 # TEA specific:
563 AC_SUBST(TK_LIBS)
564 AC_SUBST(TK_XINCLUDES)
565 ])
566
567 #------------------------------------------------------------------------
568 # TEA_PROG_TCLSH
569 # Determine the fully qualified path name of the tclsh executable
570 # in the Tcl build directory or the tclsh installed in a bin
571 # directory. This macro will correctly determine the name
572 # of the tclsh executable even if tclsh has not yet been
573 # built in the build directory. The tclsh found is always
574 # associated with a tclConfig.sh file. This tclsh should be used
575 # only for running extension test cases. It should never be
576 # or generation of files (like pkgIndex.tcl) at build time.
577 #
578 # Arguments:
579 # none
580 #
581 # Results:
582 # Substitutes the following vars:
583 # TCLSH_PROG
584 #------------------------------------------------------------------------
585
586 AC_DEFUN([TEA_PROG_TCLSH], [
587 AC_MSG_CHECKING([for tclsh])
588 if test -f "${TCL_BIN_DIR}/Makefile" ; then
589 # tclConfig.sh is in Tcl build directory
590 if test "${TEA_PLATFORM}" = "windows"; then
591 if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}" ; then
592 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}"
593 elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}s${EXEEXT}" ; then
594 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}s${EXEEXT}"
595 elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}t${EXEEXT}" ; then
596 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}t${EXEEXT}"
597 elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}st${EXEEXT}" ; then
598 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}st${EXEEXT}"
599 fi
600 else
601 TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
602 fi
603 else
604 # tclConfig.sh is in install location
605 if test "${TEA_PLATFORM}" = "windows"; then
606 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}"
607 else
608 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}"
609 fi
610 list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
611 `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
612 `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
613 for i in $list ; do
614 if test -f "$i/${TCLSH_PROG}" ; then
615 REAL_TCL_BIN_DIR="`cd "$i"; pwd`/"
616 break
617 fi
618 done
619 TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}"
620 fi
621 AC_MSG_RESULT([${TCLSH_PROG}])
622 AC_SUBST(TCLSH_PROG)
623 ])
624
625 #------------------------------------------------------------------------
626 # TEA_PROG_WISH
627 # Determine the fully qualified path name of the wish executable
628 # in the Tk build directory or the wish installed in a bin
629 # directory. This macro will correctly determine the name
630 # of the wish executable even if wish has not yet been
631 # built in the build directory. The wish found is always
632 # associated with a tkConfig.sh file. This wish should be used
633 # only for running extension test cases. It should never be
634 # or generation of files (like pkgIndex.tcl) at build time.
635 #
636 # Arguments:
637 # none
638 #
639 # Results:
640 # Substitutes the following vars:
641 # WISH_PROG
642 #------------------------------------------------------------------------
643
644 AC_DEFUN([TEA_PROG_WISH], [
645 AC_MSG_CHECKING([for wish])
646 if test -f "${TK_BIN_DIR}/Makefile" ; then
647 # tkConfig.sh is in Tk build directory
648 if test "${TEA_PLATFORM}" = "windows"; then
649 if test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}" ; then
650 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}"
651 elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}s${EXEEXT}" ; then
652 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}$s{EXEEXT}"
653 elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}t${EXEEXT}" ; then
654 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}t${EXEEXT}"
655 elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}st${EXEEXT}" ; then
656 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}st${EXEEXT}"
657 fi
658 else
659 WISH_PROG="${TK_BIN_DIR}/wish"
660 fi
661 else
662 # tkConfig.sh is in install location
663 if test "${TEA_PLATFORM}" = "windows"; then
664 WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}"
665 else
666 WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}"
667 fi
668 list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
669 `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
670 `ls -d ${TK_PREFIX}/bin 2>/dev/null`"
671 for i in $list ; do
672 if test -f "$i/${WISH_PROG}" ; then
673 REAL_TK_BIN_DIR="`cd "$i"; pwd`/"
674 break
675 fi
676 done
677 WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}"
678 fi
679 AC_MSG_RESULT([${WISH_PROG}])
680 AC_SUBST(WISH_PROG)
681 ])
682
683 #------------------------------------------------------------------------
684 # TEA_ENABLE_SHARED --
685 #
686 # Allows the building of shared libraries
687 #
688 # Arguments:
689 # none
690 #
691 # Results:
692 #
693 # Adds the following arguments to configure:
694 # --enable-shared=yes|no
695 # --enable-stubs=yes|no
696 #
697 # Defines the following vars:
698 # STATIC_BUILD Used for building import/export libraries
699 # on Windows.
700 #
701 # Sets the following vars:
702 # SHARED_BUILD Value of 1 or 0
703 # STUBS_BUILD Value if 1 or 0
704 # USE_TCL_STUBS Value true: if SHARED_BUILD or --enable-stubs
705 # USE_TCLOO_STUBS Value true: if SHARED_BUILD or --enable-stubs
706 # USE_TK_STUBS Value true: if SHARED_BUILD or --enable-stubs
707 # AND TEA_WINDOWING_SYSTEM != ""
708 #------------------------------------------------------------------------
709 AC_DEFUN([TEA_ENABLE_SHARED], [
710 AC_MSG_CHECKING([how to build libraries])
711 AC_ARG_ENABLE(shared,
712 AS_HELP_STRING([--enable-shared],
713 [build and link with shared libraries (default: on)]),
714 [shared_ok=$enableval], [shared_ok=yes])
715
716 if test "${enable_shared+set}" = set; then
717 enableval="$enable_shared"
718 shared_ok=$enableval
719 else
720 shared_ok=yes
721 fi
722
723 AC_ARG_ENABLE(stubs,
724 AS_HELP_STRING([--enable-stubs],
725 [build and link with stub libraries. Always true for shared builds (default: on)]),
726 [stubs_ok=$enableval], [stubs_ok=yes])
727
728 if test "${enable_stubs+set}" = set; then
729 enableval="$enable_stubs"
730 stubs_ok=$enableval
731 else
732 stubs_ok=yes
733 fi
734
735 # Stubs are always enabled for shared builds
736 if test "$shared_ok" = "yes" ; then
737 AC_MSG_RESULT([shared])
738 SHARED_BUILD=1
739 STUBS_BUILD=1
740 else
741 AC_MSG_RESULT([static])
742 SHARED_BUILD=0
743 AC_DEFINE(STATIC_BUILD, 1, [This a static build])
744 if test "$stubs_ok" = "yes" ; then
745 STUBS_BUILD=1
746 else
747 STUBS_BUILD=0
748 fi
749 fi
750 if test "${STUBS_BUILD}" = "1" ; then
751 AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs])
752 AC_DEFINE(USE_TCLOO_STUBS, 1, [Use TclOO stubs])
753 if test "${TEA_WINDOWINGSYSTEM}" != ""; then
754 AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs])
755 fi
756 fi
757
758 AC_SUBST(SHARED_BUILD)
759 AC_SUBST(STUBS_BUILD)
760 ])
761
762 #------------------------------------------------------------------------
763 # TEA_ENABLE_THREADS --
764 #
765 # Specify if thread support should be enabled. If "yes" is specified
766 # as an arg (optional), threads are enabled by default, "no" means
767 # threads are disabled. "yes" is the default.
768 #
769 # TCL_THREADS is checked so that if you are compiling an extension
770 # against a threaded core, your extension must be compiled threaded
771 # as well.
772 #
773 # Note that it is legal to have a thread enabled extension run in a
774 # threaded or non-threaded Tcl core, but a non-threaded extension may
775 # only run in a non-threaded Tcl core.
776 #
777 # Arguments:
778 # none
779 #
780 # Results:
781 #
782 # Adds the following arguments to configure:
783 # --enable-threads
784 #
785 # Sets the following vars:
786 # THREADS_LIBS Thread library(s)
787 #
788 # Defines the following vars:
789 # TCL_THREADS
790 # _REENTRANT
791 # _THREAD_SAFE
792 #------------------------------------------------------------------------
793
794 AC_DEFUN([TEA_ENABLE_THREADS], [
795 AC_ARG_ENABLE(threads,
796 AS_HELP_STRING([--enable-threads],
797 [build with threads (default: on)]),
798 [tcl_ok=$enableval], [tcl_ok=yes])
799
800 if test "${enable_threads+set}" = set; then
801 enableval="$enable_threads"
802 tcl_ok=$enableval
803 else
804 tcl_ok=yes
805 fi
806
807 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
808 TCL_THREADS=1
809
810 if test "${TEA_PLATFORM}" != "windows" ; then
811 # We are always OK on Windows, so check what this platform wants:
812
813 # USE_THREAD_ALLOC tells us to try the special thread-based
814 # allocator that significantly reduces lock contention
815 AC_DEFINE(USE_THREAD_ALLOC, 1,
816 [Do we want to use the threaded memory allocator?])
817 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
818 if test "`uname -s`" = "SunOS" ; then
819 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
820 [Do we really want to follow the standard? Yes we do!])
821 fi
822 AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
823 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
824 if test "$tcl_ok" = "no"; then
825 # Check a little harder for __pthread_mutex_init in the same
826 # library, as some systems hide it there until pthread.h is
827 # defined. We could alternatively do an AC_TRY_COMPILE with
828 # pthread.h, but that will work with libpthread really doesn't
829 # exist, like AIX 4.2. [Bug: 4359]
830 AC_CHECK_LIB(pthread, __pthread_mutex_init,
831 tcl_ok=yes, tcl_ok=no)
832 fi
833
834 if test "$tcl_ok" = "yes"; then
835 # The space is needed
836 THREADS_LIBS=" -lpthread"
837 else
838 AC_CHECK_LIB(pthreads, pthread_mutex_init,
839 tcl_ok=yes, tcl_ok=no)
840 if test "$tcl_ok" = "yes"; then
841 # The space is needed
842 THREADS_LIBS=" -lpthreads"
843 else
844 AC_CHECK_LIB(c, pthread_mutex_init,
845 tcl_ok=yes, tcl_ok=no)
846 if test "$tcl_ok" = "no"; then
847 AC_CHECK_LIB(c_r, pthread_mutex_init,
848 tcl_ok=yes, tcl_ok=no)
849 if test "$tcl_ok" = "yes"; then
850 # The space is needed
851 THREADS_LIBS=" -pthread"
852 else
853 TCL_THREADS=0
854 AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
855 fi
856 fi
857 fi
858 fi
859 fi
860 else
861 TCL_THREADS=0
862 fi
863 # Do checking message here to not mess up interleaved configure output
864 AC_MSG_CHECKING([for building with threads])
865 if test "${TCL_THREADS}" = 1; then
866 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
867 AC_MSG_RESULT([yes (default)])
868 else
869 AC_MSG_RESULT([no])
870 fi
871 # TCL_THREADS sanity checking. See if our request for building with
872 # threads is the same as the way Tcl was built. If not, warn the user.
873 case ${TCL_DEFS} in
874 *THREADS=1*)
875 if test "${TCL_THREADS}" = "0"; then
876 AC_MSG_WARN([
877 Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
878 that IS thread-enabled. It is recommended to use --enable-threads.])
879 fi
880 ;;
881 esac
882 AC_SUBST(TCL_THREADS)
883 ])
884
885 #------------------------------------------------------------------------
886 # TEA_ENABLE_SYMBOLS --
887 #
888 # Specify if debugging symbols should be used.
889 # Memory (TCL_MEM_DEBUG) debugging can also be enabled.
890 #
891 # Arguments:
892 # none
893 #
894 # TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
895 # the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
896 # Requires the following vars to be set in the Makefile:
897 # CFLAGS_DEFAULT
898 # LDFLAGS_DEFAULT
899 #
900 # Results:
901 #
902 # Adds the following arguments to configure:
903 # --enable-symbols
904 #
905 # Defines the following vars:
906 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
907 # Sets to "$(CFLAGS_OPTIMIZE) -DNDEBUG" if false
908 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
909 # Sets to $(LDFLAGS_OPTIMIZE) if false
910 #------------------------------------------------------------------------
911
912 AC_DEFUN([TEA_ENABLE_SYMBOLS], [
913 dnl TEA specific: Make sure we are initialized
914 AC_REQUIRE([TEA_CONFIG_CFLAGS])
915 AC_MSG_CHECKING([for build with symbols])
916 AC_ARG_ENABLE(symbols,
917 AS_HELP_STRING([--enable-symbols],
918 [build with debugging symbols (default: off)]),
919 [tcl_ok=$enableval], [tcl_ok=no])
920 if test "$tcl_ok" = "no"; then
921 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE} -DNDEBUG"
922 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
923 AC_MSG_RESULT([no])
924 AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
925 else
926 CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
927 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
928 if test "$tcl_ok" = "yes"; then
929 AC_MSG_RESULT([yes (standard debugging)])
930 fi
931 fi
932 AC_SUBST(CFLAGS_DEFAULT)
933 AC_SUBST(LDFLAGS_DEFAULT)
934
935 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
936 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
937 fi
938
939 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
940 if test "$tcl_ok" = "all"; then
941 AC_MSG_RESULT([enabled symbols mem debugging])
942 else
943 AC_MSG_RESULT([enabled $tcl_ok debugging])
944 fi
945 fi
946 ])
947
948 #------------------------------------------------------------------------
949 # TEA_ENABLE_LANGINFO --
950 #
951 # Allows use of modern nl_langinfo check for better l10n.
952 # This is only relevant for Unix.
953 #
954 # Arguments:
955 # none
956 #
957 # Results:
958 #
959 # Adds the following arguments to configure:
960 # --enable-langinfo=yes|no (default is yes)
961 #
962 # Defines the following vars:
963 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
964 #------------------------------------------------------------------------
965
966 AC_DEFUN([TEA_ENABLE_LANGINFO], [
967 AC_ARG_ENABLE(langinfo,
968 AS_HELP_STRING([--enable-langinfo],
969 [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
970 [langinfo_ok=$enableval], [langinfo_ok=yes])
971
972 HAVE_LANGINFO=0
973 if test "$langinfo_ok" = "yes"; then
974 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
975 fi
976 AC_MSG_CHECKING([whether to use nl_langinfo])
977 if test "$langinfo_ok" = "yes"; then
978 AC_CACHE_VAL(tcl_cv_langinfo_h, [
979 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(CODESET);]])],
980 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
981 AC_MSG_RESULT([$tcl_cv_langinfo_h])
982 if test $tcl_cv_langinfo_h = yes; then
983 AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
984 fi
985 else
986 AC_MSG_RESULT([$langinfo_ok])
987 fi
988 ])
989
990 #--------------------------------------------------------------------
991 # TEA_CONFIG_SYSTEM
992 #
993 # Determine what the system is (some things cannot be easily checked
994 # on a feature-driven basis, alas). This can usually be done via the
995 # "uname" command.
996 #
997 # Arguments:
998 # none
999 #
1000 # Results:
1001 # Defines the following var:
1002 #
1003 # system - System/platform/version identification code.
1004 #
1005 #--------------------------------------------------------------------
1006
1007 AC_DEFUN([TEA_CONFIG_SYSTEM], [
1008 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
1009 # TEA specific:
1010 if test "${TEA_PLATFORM}" = "windows" ; then
1011 tcl_cv_sys_version=windows
1012 else
1013 tcl_cv_sys_version=`uname -s`-`uname -r`
1014 if test "$?" -ne 0 ; then
1015 AC_MSG_WARN([can't find uname command])
1016 tcl_cv_sys_version=unknown
1017 else
1018 if test "`uname -s`" = "AIX" ; then
1019 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
1020 fi
1021 if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
1022 tcl_cv_sys_version=NetBSD-Debian
1023 fi
1024 fi
1025 fi
1026 ])
1027 system=$tcl_cv_sys_version
1028 ])
1029
1030 #--------------------------------------------------------------------
1031 # TEA_CONFIG_CFLAGS
1032 #
1033 # Try to determine the proper flags to pass to the compiler
1034 # for building shared libraries and other such nonsense.
1035 #
1036 # Arguments:
1037 # none
1038 #
1039 # Results:
1040 #
1041 # Defines and substitutes the following vars:
1042 #
1043 # DL_OBJS, DL_LIBS - removed for TEA, only needed by core.
1044 # LDFLAGS - Flags to pass to the compiler when linking object
1045 # files into an executable application binary such
1046 # as tclsh.
1047 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
1048 # that tell the run-time dynamic linker where to look
1049 # for shared libraries such as libtcl.so. Depends on
1050 # the variable LIB_RUNTIME_DIR in the Makefile. Could
1051 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
1052 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
1053 # that tell the run-time dynamic linker where to look
1054 # for shared libraries such as libtcl.so. Depends on
1055 # the variable LIB_RUNTIME_DIR in the Makefile.
1056 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
1057 # of a shared library (may request position-independent
1058 # code, among other things).
1059 # SHLIB_LD - Base command to use for combining object files
1060 # into a shared library.
1061 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
1062 # creating shared libraries. This symbol typically
1063 # goes at the end of the "ld" commands that build
1064 # shared libraries. The value of the symbol defaults to
1065 # "${LIBS}" if all of the dependent libraries should
1066 # be specified when creating a shared library. If
1067 # dependent libraries should not be specified (as on
1068 # SunOS 4.x, where they cause the link to fail, or in
1069 # general if Tcl and Tk aren't themselves shared
1070 # libraries), then this symbol has an empty string
1071 # as its value.
1072 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
1073 # extensions. An empty string means we don't know how
1074 # to use shared libraries on this platform.
1075 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
1076 # in a static or shared library name, using the $PACKAGE_VERSION variable
1077 # to put the version in the right place. This is used
1078 # by platforms that need non-standard library names.
1079 # Examples: ${PACKAGE_VERSION}.so.1.1 on NetBSD, since it needs
1080 # to have a version after the .so, and ${PACKAGE_VERSION}.a
1081 # on AIX, since a shared library needs to have
1082 # a .a extension whereas shared objects for loadable
1083 # extensions have a .so extension. Defaults to
1084 # ${PACKAGE_VERSION}${SHLIB_SUFFIX}.
1085 # CFLAGS_DEBUG -
1086 # Flags used when running the compiler in debug mode
1087 # CFLAGS_OPTIMIZE -
1088 # Flags used when running the compiler in optimize mode
1089 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
1090 #--------------------------------------------------------------------
1091
1092 AC_DEFUN([TEA_CONFIG_CFLAGS], [
1093 dnl TEA specific: Make sure we are initialized
1094 AC_REQUIRE([TEA_INIT])
1095
1096 # Step 0.a: Enable 64 bit support?
1097
1098 AC_MSG_CHECKING([if 64bit support is requested])
1099 AC_ARG_ENABLE(64bit,
1100 AS_HELP_STRING([--enable-64bit],
1101 [enable 64bit support (default: off)]),
1102 [do64bit=$enableval], [do64bit=no])
1103 AC_MSG_RESULT([$do64bit])
1104
1105 # Step 0.b: Enable Solaris 64 bit VIS support?
1106
1107 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1108 AC_ARG_ENABLE(64bit-vis,
1109 AS_HELP_STRING([--enable-64bit-vis],
1110 [enable 64bit Sparc VIS support (default: off)]),
1111 [do64bitVIS=$enableval], [do64bitVIS=no])
1112 AC_MSG_RESULT([$do64bitVIS])
1113 # Force 64bit on with VIS
1114 AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
1115
1116 # Step 0.c: Check if visibility support is available. Do this here so
1117 # that platform specific alternatives can be used below if this fails.
1118
1119 AC_CACHE_CHECK([if compiler supports visibility "hidden"],
1120 tcl_cv_cc_visibility_hidden, [
1121 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
1122 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1123 extern __attribute__((__visibility__("hidden"))) void f(void);
1124 void f(void) {}]], [[f();]])],[tcl_cv_cc_visibility_hidden=yes],
1125 [tcl_cv_cc_visibility_hidden=no])
1126 CFLAGS=$hold_cflags])
1127 AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
1128 AC_DEFINE(MODULE_SCOPE,
1129 [extern __attribute__((__visibility__("hidden")))],
1130 [Compiler support for module scope symbols])
1131 AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols])
1132 ])
1133
1134 # Step 0.d: Disable -rpath support?
1135
1136 AC_MSG_CHECKING([if rpath support is requested])
1137 AC_ARG_ENABLE(rpath,
1138 AS_HELP_STRING([--disable-rpath],
1139 [disable rpath support (default: on)]),
1140 [doRpath=$enableval], [doRpath=yes])
1141 AC_MSG_RESULT([$doRpath])
1142
1143 # Set the variable "system" to hold the name and version number
1144 # for the system.
1145
1146 TEA_CONFIG_SYSTEM
1147
1148 # Require ranlib early so we can override it in special cases below.
1149
1150 AC_REQUIRE([AC_PROG_RANLIB])
1151
1152 # Set configuration options based on system name and version.
1153 # This is similar to Tcl's unix/tcl.m4 except that we've added a
1154 # "windows" case and removed some core-only vars.
1155
1156 do64bit_ok=no
1157 # default to '{$LIBS}' and set to "" on per-platform necessary basis
1158 SHLIB_LD_LIBS='${LIBS}'
1159 # When ld needs options to work in 64-bit mode, put them in
1160 # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
1161 # is disabled by the user. [Bug 1016796]
1162 LDFLAGS_ARCH=""
1163 UNSHARED_LIB_SUFFIX=""
1164 # TEA specific: use PACKAGE_VERSION instead of VERSION
1165 TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
1166 ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
1167 TCL_LIB_VERSIONS_OK=ok
1168 CFLAGS_DEBUG=-g
1169 AS_IF([test "$GCC" = yes], [
1170 CFLAGS_OPTIMIZE=-O2
1171 CFLAGS_WARNING="-Wall"
1172 ], [
1173 CFLAGS_OPTIMIZE=-O
1174 CFLAGS_WARNING=""
1175 ])
1176 AC_CHECK_TOOL(AR, ar)
1177 STLIB_LD='${AR} cr'
1178 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1179 AS_IF([test "x$SHLIB_VERSION" = x],[SHLIB_VERSION=""],[SHLIB_VERSION=".$SHLIB_VERSION"])
1180 case $system in
1181 # TEA specific:
1182 windows)
1183 MACHINE="X86"
1184 if test "$do64bit" != "no" ; then
1185 case "$do64bit" in
1186 amd64|x64|yes)
1187 MACHINE="AMD64" ; # default to AMD64 64-bit build
1188 ;;
1189 arm64|aarch64)
1190 MACHINE="ARM64"
1191 ;;
1192 ia64)
1193 MACHINE="IA64"
1194 ;;
1195 esac
1196 do64bit_ok=yes
1197 fi
1198
1199 if test "$GCC" != "yes" ; then
1200 if test "${SHARED_BUILD}" = "0" ; then
1201 runtime=-MT
1202 else
1203 runtime=-MD
1204 fi
1205 case "x`echo \${VisualStudioVersion}`" in
1206 x1[[4-9]]*)
1207 lflags="${lflags} -nodefaultlib:ucrt.lib"
1208 TEA_ADD_LIBS([ucrt.lib])
1209 ;;
1210 *)
1211 ;;
1212 esac
1213
1214 if test "$do64bit" != "no" ; then
1215 CC="cl.exe"
1216 RC="rc.exe"
1217 lflags="${lflags} -nologo -MACHINE:${MACHINE} "
1218 LINKBIN="link.exe"
1219 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
1220 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1221 # Avoid 'unresolved external symbol __security_cookie'
1222 # errors, c.f. http://support.microsoft.com/?id=894573
1223 TEA_ADD_LIBS([bufferoverflowU.lib])
1224 else
1225 RC="rc"
1226 lflags="${lflags} -nologo"
1227 LINKBIN="link"
1228 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
1229 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1230 fi
1231 fi
1232
1233 if test "$GCC" = "yes"; then
1234 # mingw gcc mode
1235 AC_CHECK_TOOL(RC, windres)
1236 CFLAGS_DEBUG="-g"
1237 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1238 SHLIB_LD='${CC} -shared'
1239 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1240 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
1241 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
1242
1243 AC_CACHE_CHECK(for cross-compile version of gcc,
1244 ac_cv_cross,
1245 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1246 #ifdef _WIN32
1247 #error cross-compiler
1248 #endif
1249 ]], [[]])],
1250 [ac_cv_cross=yes],
1251 [ac_cv_cross=no])
1252 )
1253 if test "$ac_cv_cross" = "yes"; then
1254 case "$do64bit" in
1255 amd64|x64|yes)
1256 CC="x86_64-w64-mingw32-${CC}"
1257 LD="x86_64-w64-mingw32-ld"
1258 AR="x86_64-w64-mingw32-ar"
1259 RANLIB="x86_64-w64-mingw32-ranlib"
1260 RC="x86_64-w64-mingw32-windres"
1261 ;;
1262 arm64|aarch64)
1263 CC="aarch64-w64-mingw32-clang"
1264 LD="aarch64-w64-mingw32-ld"
1265 AR="aarch64-w64-mingw32-ar"
1266 RANLIB="aarch64-w64-mingw32-ranlib"
1267 RC="aarch64-w64-mingw32-windres"
1268 ;;
1269 *)
1270 CC="i686-w64-mingw32-${CC}"
1271 LD="i686-w64-mingw32-ld"
1272 AR="i686-w64-mingw32-ar"
1273 RANLIB="i686-w64-mingw32-ranlib"
1274 RC="i686-w64-mingw32-windres"
1275 ;;
1276 esac
1277 fi
1278
1279 else
1280 SHLIB_LD="${LINKBIN} -dll ${lflags}"
1281 # link -lib only works when -lib is the first arg
1282 STLIB_LD="${LINKBIN} -lib ${lflags}"
1283 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
1284 PATHTYPE=-w
1285 # For information on what debugtype is most useful, see:
1286 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
1287 # and also
1288 # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx
1289 # This essentially turns it all on.
1290 LDFLAGS_DEBUG="-debug -debugtype:cv"
1291 LDFLAGS_OPTIMIZE="-release"
1292 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
1293 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
1294 fi
1295
1296 SHLIB_SUFFIX=".dll"
1297 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
1298
1299 TCL_LIB_VERSIONS_OK=nodots
1300 ;;
1301 AIX-*)
1302 AS_IF([test "$GCC" != "yes"], [
1303 # AIX requires the _r compiler when gcc isn't being used
1304 case "${CC}" in
1305 *_r|*_r\ *)
1306 # ok ...
1307 ;;
1308 *)
1309 # Make sure only first arg gets _r
1310 CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
1311 ;;
1312 esac
1313 AC_MSG_RESULT([Using $CC for compiling with threads])
1314 ])
1315 LIBS="$LIBS -lc"
1316 SHLIB_CFLAGS=""
1317 SHLIB_SUFFIX=".so"
1318
1319 LD_LIBRARY_PATH_VAR="LIBPATH"
1320
1321 # Check to enable 64-bit flags for compiler/linker
1322 AS_IF([test "$do64bit" = yes], [
1323 AS_IF([test "$GCC" = yes], [
1324 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1325 ], [
1326 do64bit_ok=yes
1327 CFLAGS="$CFLAGS -q64"
1328 LDFLAGS_ARCH="-q64"
1329 RANLIB="${RANLIB} -X64"
1330 AR="${AR} -X64"
1331 SHLIB_LD_FLAGS="-b64"
1332 ])
1333 ])
1334
1335 AS_IF([test "`uname -m`" = ia64], [
1336 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1337 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1338 AS_IF([test "$GCC" = yes], [
1339 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1340 ], [
1341 CC_SEARCH_FLAGS='"-R${LIB_RUNTIME_DIR}"'
1342 ])
1343 LD_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
1344 ], [
1345 AS_IF([test "$GCC" = yes], [
1346 SHLIB_LD='${CC} -shared -Wl,-bexpall'
1347 ], [
1348 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
1349 LDFLAGS="$LDFLAGS -brtl"
1350 ])
1351 SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1352 CC_SEARCH_FLAGS='"-L${LIB_RUNTIME_DIR}"'
1353 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1354 ])
1355 ;;
1356 BeOS*)
1357 SHLIB_CFLAGS="-fPIC"
1358 SHLIB_LD='${CC} -nostart'
1359 SHLIB_SUFFIX=".so"
1360
1361 #-----------------------------------------------------------
1362 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1363 # -lsocket, even if the network functions are in -lnet which
1364 # is always linked to, for compatibility.
1365 #-----------------------------------------------------------
1366 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1367 ;;
1368 BSD/OS-2.1*|BSD/OS-3*)
1369 SHLIB_CFLAGS=""
1370 SHLIB_LD="shlicc -r"
1371 SHLIB_SUFFIX=".so"
1372 CC_SEARCH_FLAGS=""
1373 LD_SEARCH_FLAGS=""
1374 ;;
1375 BSD/OS-4.*)
1376 SHLIB_CFLAGS="-export-dynamic -fPIC"
1377 SHLIB_LD='${CC} -shared'
1378 SHLIB_SUFFIX=".so"
1379 LDFLAGS="$LDFLAGS -export-dynamic"
1380 CC_SEARCH_FLAGS=""
1381 LD_SEARCH_FLAGS=""
1382 ;;
1383 CYGWIN_*|MINGW32_*|MINGW64_*|MSYS_*)
1384 SHLIB_CFLAGS=""
1385 SHLIB_LD='${CC} -shared'
1386 SHLIB_SUFFIX=".dll"
1387 if test "${TEA_PLATFORM}" = "unix" -a "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" = x; then
1388 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$(patsubst cyg%.dll,lib%.dll,\$[@]).a"
1389 else
1390 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$[@].a"
1391 fi
1392 EXEEXT=".exe"
1393 do64bit_ok=yes
1394 CC_SEARCH_FLAGS=""
1395 LD_SEARCH_FLAGS=""
1396 ;;
1397 dgux*)
1398 SHLIB_CFLAGS="-K PIC"
1399 SHLIB_LD='${CC} -G'
1400 SHLIB_LD_LIBS=""
1401 SHLIB_SUFFIX=".so"
1402 CC_SEARCH_FLAGS=""
1403 LD_SEARCH_FLAGS=""
1404 ;;
1405 Haiku*)
1406 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1407 SHLIB_CFLAGS="-fPIC"
1408 SHLIB_SUFFIX=".so"
1409 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
1410 AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
1411 ;;
1412 HP-UX-*.11.*)
1413 # Use updated header definitions where possible
1414 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1415 # TEA specific: Needed by Tcl, but not most extensions
1416 #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1417 #LIBS="$LIBS -lxnet" # Use the XOPEN network library
1418
1419 AS_IF([test "`uname -m`" = ia64], [
1420 SHLIB_SUFFIX=".so"
1421 ], [
1422 SHLIB_SUFFIX=".sl"
1423 ])
1424 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1425 AS_IF([test "$tcl_ok" = yes], [
1426 SHLIB_CFLAGS="+z"
1427 SHLIB_LD="ld -b"
1428 LDFLAGS="$LDFLAGS -Wl,-E"
1429 CC_SEARCH_FLAGS='"-Wl,+s,+b,${LIB_RUNTIME_DIR}:."'
1430 LD_SEARCH_FLAGS='+s +b "${LIB_RUNTIME_DIR}:."'
1431 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1432 ])
1433 AS_IF([test "$GCC" = yes], [
1434 SHLIB_LD='${CC} -shared'
1435 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1436 ], [
1437 CFLAGS="$CFLAGS -z"
1438 ])
1439
1440 # Check to enable 64-bit flags for compiler/linker
1441 AS_IF([test "$do64bit" = "yes"], [
1442 AS_IF([test "$GCC" = yes], [
1443 case `${CC} -dumpmachine` in
1444 hppa64*)
1445 # 64-bit gcc in use. Fix flags for GNU ld.
1446 do64bit_ok=yes
1447 SHLIB_LD='${CC} -shared'
1448 AS_IF([test $doRpath = yes], [
1449 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1450 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1451 ;;
1452 *)
1453 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1454 ;;
1455 esac
1456 ], [
1457 do64bit_ok=yes
1458 CFLAGS="$CFLAGS +DD64"
1459 LDFLAGS_ARCH="+DD64"
1460 ])
1461 ]) ;;
1462 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1463 SHLIB_SUFFIX=".sl"
1464 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1465 AS_IF([test "$tcl_ok" = yes], [
1466 SHLIB_CFLAGS="+z"
1467 SHLIB_LD="ld -b"
1468 SHLIB_LD_LIBS=""
1469 LDFLAGS="$LDFLAGS -Wl,-E"
1470 CC_SEARCH_FLAGS='"-Wl,+s,+b,${LIB_RUNTIME_DIR}:."'
1471 LD_SEARCH_FLAGS='+s +b "${LIB_RUNTIME_DIR}:."'
1472 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1473 ]) ;;
1474 IRIX-5.*)
1475 SHLIB_CFLAGS=""
1476 SHLIB_LD="ld -shared -rdata_shared"
1477 SHLIB_SUFFIX=".so"
1478 AC_LIBOBJ(mkstemp)
1479 AS_IF([test $doRpath = yes], [
1480 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1481 LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
1482 ;;
1483 IRIX-6.*)
1484 SHLIB_CFLAGS=""
1485 SHLIB_LD="ld -n32 -shared -rdata_shared"
1486 SHLIB_SUFFIX=".so"
1487 AS_IF([test $doRpath = yes], [
1488 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1489 LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
1490 AS_IF([test "$GCC" = yes], [
1491 CFLAGS="$CFLAGS -mabi=n32"
1492 LDFLAGS="$LDFLAGS -mabi=n32"
1493 ], [
1494 case $system in
1495 IRIX-6.3)
1496 # Use to build 6.2 compatible binaries on 6.3.
1497 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1498 ;;
1499 *)
1500 CFLAGS="$CFLAGS -n32"
1501 ;;
1502 esac
1503 LDFLAGS="$LDFLAGS -n32"
1504 ])
1505 ;;
1506 IRIX64-6.*)
1507 SHLIB_CFLAGS=""
1508 SHLIB_LD="ld -n32 -shared -rdata_shared"
1509 SHLIB_SUFFIX=".so"
1510 AS_IF([test $doRpath = yes], [
1511 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1512 LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
1513
1514 # Check to enable 64-bit flags for compiler/linker
1515
1516 AS_IF([test "$do64bit" = yes], [
1517 AS_IF([test "$GCC" = yes], [
1518 AC_MSG_WARN([64bit mode not supported by gcc])
1519 ], [
1520 do64bit_ok=yes
1521 SHLIB_LD="ld -64 -shared -rdata_shared"
1522 CFLAGS="$CFLAGS -64"
1523 LDFLAGS_ARCH="-64"
1524 ])
1525 ])
1526 ;;
1527 Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
1528 SHLIB_CFLAGS="-fPIC"
1529 SHLIB_SUFFIX=".so"
1530
1531 # TEA specific:
1532 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1533
1534 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1535 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS_DEFAULT} -shared'
1536 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1537
1538 case $system in
1539 DragonFly-*|FreeBSD-*)
1540 AS_IF([test "${TCL_THREADS}" = "1"], [
1541 # The -pthread needs to go in the LDFLAGS, not LIBS
1542 LIBS=`echo $LIBS | sed s/-pthread//`
1543 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1544 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
1545 ;;
1546 esac
1547
1548 AS_IF([test $doRpath = yes], [
1549 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1550 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1551 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1552 AS_IF([test $do64bit = yes], [
1553 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1554 hold_cflags=$CFLAGS
1555 CFLAGS="$CFLAGS -m64"
1556 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1557 [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
1558 CFLAGS=$hold_cflags])
1559 AS_IF([test $tcl_cv_cc_m64 = yes], [
1560 CFLAGS="$CFLAGS -m64"
1561 do64bit_ok=yes
1562 ])
1563 ])
1564
1565 # The combo of gcc + glibc has a bug related to inlining of
1566 # functions like strtod(). The -fno-builtin flag should address
1567 # this problem but it does not work. The -fno-inline flag is kind
1568 # of overkill but it works. Disable inlining only when one of the
1569 # files in compat/*.c is being linked in.
1570
1571 AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1572 ;;
1573 Lynx*)
1574 SHLIB_CFLAGS="-fPIC"
1575 SHLIB_SUFFIX=".so"
1576 CFLAGS_OPTIMIZE=-02
1577 SHLIB_LD='${CC} -shared'
1578 LD_FLAGS="-Wl,--export-dynamic"
1579 AS_IF([test $doRpath = yes], [
1580 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1581 LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1582 ;;
1583 OpenBSD-*)
1584 arch=`arch -s`
1585 case "$arch" in
1586 alpha|sparc64)
1587 SHLIB_CFLAGS="-fPIC"
1588 ;;
1589 *)
1590 SHLIB_CFLAGS="-fpic"
1591 ;;
1592 esac
1593 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1594 SHLIB_SUFFIX=".so"
1595 AS_IF([test $doRpath = yes], [
1596 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1597 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1598 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
1599 LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
1600 CFLAGS_OPTIMIZE="-O2"
1601 # On OpenBSD: Compile with -pthread
1602 # Don't link with -lpthread
1603 LIBS=`echo $LIBS | sed s/-lpthread//`
1604 CFLAGS="$CFLAGS -pthread"
1605 # OpenBSD doesn't do version numbers with dots.
1606 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1607 TCL_LIB_VERSIONS_OK=nodots
1608 ;;
1609 NetBSD-*)
1610 # NetBSD has ELF and can use 'cc -shared' to build shared libs
1611 SHLIB_CFLAGS="-fPIC"
1612 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1613 SHLIB_SUFFIX=".so"
1614 LDFLAGS="$LDFLAGS -export-dynamic"
1615 AS_IF([test $doRpath = yes], [
1616 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1617 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1618 # The -pthread needs to go in the CFLAGS, not LIBS
1619 LIBS=`echo $LIBS | sed s/-pthread//`
1620 CFLAGS="$CFLAGS -pthread"
1621 LDFLAGS="$LDFLAGS -pthread"
1622 ;;
1623 Darwin-*)
1624 CFLAGS_OPTIMIZE="-Os"
1625 SHLIB_CFLAGS="-fno-common"
1626 # To avoid discrepancies between what headers configure sees during
1627 # preprocessing tests and compiling tests, move any -isysroot and
1628 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1629 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1630 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1631 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1632 CFLAGS="`echo " ${CFLAGS}" | \
1633 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1634 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1635 AS_IF([test $do64bit = yes], [
1636 case `arch` in
1637 ppc)
1638 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1639 tcl_cv_cc_arch_ppc64, [
1640 hold_cflags=$CFLAGS
1641 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1642 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1643 [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no])
1644 CFLAGS=$hold_cflags])
1645 AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1646 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1647 do64bit_ok=yes
1648 ]);;
1649 i386)
1650 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1651 tcl_cv_cc_arch_x86_64, [
1652 hold_cflags=$CFLAGS
1653 CFLAGS="$CFLAGS -arch x86_64"
1654 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1655 [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no])
1656 CFLAGS=$hold_cflags])
1657 AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1658 CFLAGS="$CFLAGS -arch x86_64"
1659 do64bit_ok=yes
1660 ]);;
1661 *)
1662 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1663 esac
1664 ], [
1665 # Check for combined 32-bit and 64-bit fat build
1666 AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
1667 && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1668 fat_32_64=yes])
1669 ])
1670 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1671 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
1672 # TEA specific: link shlib with current and compatibility version flags
1673 vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
1674 SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
1675 SHLIB_SUFFIX=".dylib"
1676 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1677 AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1678 tcl_cv_ld_search_paths_first, [
1679 hold_ldflags=$LDFLAGS
1680 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1681 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
1682 [tcl_cv_ld_search_paths_first=yes],[tcl_cv_ld_search_paths_first=no])
1683 LDFLAGS=$hold_ldflags])
1684 AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1685 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1686 ])
1687 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1688 AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1689 [Compiler support for module scope symbols])
1690 tcl_cv_cc_visibility_hidden=yes
1691 ])
1692 CC_SEARCH_FLAGS=""
1693 LD_SEARCH_FLAGS=""
1694 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1695 # TEA specific: for combined 32 & 64 bit fat builds of Tk
1696 # extensions, verify that 64-bit build is possible.
1697 AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [
1698 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [
1699 AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
1700 for v in CFLAGS CPPFLAGS LDFLAGS; do
1701 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1702 done
1703 CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
1704 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
1705 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize();]])],
1706 [tcl_cv_lib_x11_64=yes],[tcl_cv_lib_x11_64=no])
1707 for v in CFLAGS CPPFLAGS LDFLAGS; do
1708 eval $v'="$hold_'$v'"'
1709 done])
1710 ])
1711 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua], [
1712 AC_CACHE_CHECK([for 64-bit Tk], tcl_cv_lib_tk_64, [
1713 for v in CFLAGS CPPFLAGS LDFLAGS; do
1714 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1715 done
1716 CPPFLAGS="$CPPFLAGS -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}"
1717 LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
1718 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <tk.h>]], [[Tk_InitStubs(NULL, "", 0);]])],
1719 [tcl_cv_lib_tk_64=yes],[tcl_cv_lib_tk_64=no])
1720 for v in CFLAGS CPPFLAGS LDFLAGS; do
1721 eval $v'="$hold_'$v'"'
1722 done])
1723 ])
1724 # remove 64-bit arch flags from CFLAGS et al. if configuration
1725 # does not support 64-bit.
1726 AS_IF([test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no], [
1727 AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
1728 for v in CFLAGS CPPFLAGS LDFLAGS; do
1729 eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1730 done])
1731 ])
1732 ;;
1733 OS/390-*)
1734 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1735 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1736 [Should OS/390 do the right thing with sockets?])
1737 ;;
1738 OSF1-V*)
1739 # Digital OSF/1
1740 SHLIB_CFLAGS=""
1741 AS_IF([test "$SHARED_BUILD" = 1], [
1742 SHLIB_LD='ld -shared -expect_unresolved "*"'
1743 ], [
1744 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1745 ])
1746 SHLIB_SUFFIX=".so"
1747 AS_IF([test $doRpath = yes], [
1748 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1749 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1750 AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1751 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1752 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1753 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1754 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1755 LIBS=`echo $LIBS | sed s/-lpthreads//`
1756 AS_IF([test "$GCC" = yes], [
1757 LIBS="$LIBS -lpthread -lmach -lexc"
1758 ], [
1759 CFLAGS="$CFLAGS -pthread"
1760 LDFLAGS="$LDFLAGS -pthread"
1761 ])
1762 ;;
1763 QNX-6*)
1764 # QNX RTP
1765 # This may work for all QNX, but it was only reported for v6.
1766 SHLIB_CFLAGS="-fPIC"
1767 SHLIB_LD="ld -Bshareable -x"
1768 SHLIB_LD_LIBS=""
1769 SHLIB_SUFFIX=".so"
1770 CC_SEARCH_FLAGS=""
1771 LD_SEARCH_FLAGS=""
1772 ;;
1773 SCO_SV-3.2*)
1774 AS_IF([test "$GCC" = yes], [
1775 SHLIB_CFLAGS="-fPIC -melf"
1776 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1777 ], [
1778 SHLIB_CFLAGS="-Kpic -belf"
1779 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1780 ])
1781 SHLIB_LD="ld -G"
1782 SHLIB_LD_LIBS=""
1783 SHLIB_SUFFIX=".so"
1784 CC_SEARCH_FLAGS=""
1785 LD_SEARCH_FLAGS=""
1786 ;;
1787 SunOS-5.[[0-6]])
1788 # Careful to not let 5.10+ fall into this case
1789
1790 # Note: If _REENTRANT isn't defined, then Solaris
1791 # won't define thread-safe library routines.
1792
1793 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1794 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1795 [Do we really want to follow the standard? Yes we do!])
1796
1797 SHLIB_CFLAGS="-KPIC"
1798 SHLIB_SUFFIX=".so"
1799 AS_IF([test "$GCC" = yes], [
1800 SHLIB_LD='${CC} -shared'
1801 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1802 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1803 ], [
1804 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1805 CC_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
1806 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1807 ])
1808 ;;
1809 SunOS-5*)
1810 # Note: If _REENTRANT isn't defined, then Solaris
1811 # won't define thread-safe library routines.
1812
1813 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1814 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1815 [Do we really want to follow the standard? Yes we do!])
1816
1817 SHLIB_CFLAGS="-KPIC"
1818
1819 # Check to enable 64-bit flags for compiler/linker
1820 AS_IF([test "$do64bit" = yes], [
1821 arch=`isainfo`
1822 AS_IF([test "$arch" = "sparcv9 sparc"], [
1823 AS_IF([test "$GCC" = yes], [
1824 AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
1825 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1826 ], [
1827 do64bit_ok=yes
1828 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1829 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1830 SHLIB_CFLAGS="-fPIC"
1831 ])
1832 ], [
1833 do64bit_ok=yes
1834 AS_IF([test "$do64bitVIS" = yes], [
1835 CFLAGS="$CFLAGS -xarch=v9a"
1836 LDFLAGS_ARCH="-xarch=v9a"
1837 ], [
1838 CFLAGS="$CFLAGS -xarch=v9"
1839 LDFLAGS_ARCH="-xarch=v9"
1840 ])
1841 # Solaris 64 uses this as well
1842 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1843 ])
1844 ], [AS_IF([test "$arch" = "amd64 i386"], [
1845 AS_IF([test "$GCC" = yes], [
1846 case $system in
1847 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1848 do64bit_ok=yes
1849 CFLAGS="$CFLAGS -m64"
1850 LDFLAGS="$LDFLAGS -m64";;
1851 *)
1852 AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
1853 esac
1854 ], [
1855 do64bit_ok=yes
1856 case $system in
1857 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1858 CFLAGS="$CFLAGS -m64"
1859 LDFLAGS="$LDFLAGS -m64";;
1860 *)
1861 CFLAGS="$CFLAGS -xarch=amd64"
1862 LDFLAGS="$LDFLAGS -xarch=amd64";;
1863 esac
1864 ])
1865 ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
1866 ])
1867
1868 SHLIB_SUFFIX=".so"
1869 AS_IF([test "$GCC" = yes], [
1870 SHLIB_LD='${CC} -shared'
1871 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1872 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1873 AS_IF([test "$do64bit_ok" = yes], [
1874 AS_IF([test "$arch" = "sparcv9 sparc"], [
1875 # We need to specify -static-libgcc or we need to
1876 # add the path to the sparv9 libgcc.
1877 # JH: static-libgcc is necessary for core Tcl, but may
1878 # not be necessary for extensions.
1879 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1880 # for finding sparcv9 libgcc, get the regular libgcc
1881 # path, remove so name and append 'sparcv9'
1882 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1883 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1884 ], [AS_IF([test "$arch" = "amd64 i386"], [
1885 # JH: static-libgcc is necessary for core Tcl, but may
1886 # not be necessary for extensions.
1887 SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
1888 ])])
1889 ])
1890 ], [
1891 case $system in
1892 SunOS-5.[[1-9]][[0-9]]*)
1893 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1894 SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';;
1895 *)
1896 SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
1897 esac
1898 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1899 LD_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
1900 ])
1901 ;;
1902 UNIX_SV* | UnixWare-5*)
1903 SHLIB_CFLAGS="-KPIC"
1904 SHLIB_LD='${CC} -G'
1905 SHLIB_LD_LIBS=""
1906 SHLIB_SUFFIX=".so"
1907 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1908 # that don't grok the -Bexport option. Test that it does.
1909 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1910 hold_ldflags=$LDFLAGS
1911 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1912 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
1913 [tcl_cv_ld_Bexport=yes],[tcl_cv_ld_Bexport=no])
1914 LDFLAGS=$hold_ldflags])
1915 AS_IF([test $tcl_cv_ld_Bexport = yes], [
1916 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1917 ])
1918 CC_SEARCH_FLAGS=""
1919 LD_SEARCH_FLAGS=""
1920 ;;
1921 esac
1922
1923 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
1924 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1925 ])
1926
1927 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1928 dnl # until the end of configure, as configure's compile and link tests use
1929 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1930 dnl # preprocessing tests use only CPPFLAGS.
1931 AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1932
1933 # Add in the arch flags late to ensure it wasn't removed.
1934 # Not necessary in TEA, but this is aligned with core
1935 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
1936
1937 # If we're running gcc, then change the C flags for compiling shared
1938 # libraries to the right flags for gcc, instead of those for the
1939 # standard manufacturer compiler.
1940
1941 AS_IF([test "$GCC" = yes], [
1942 case $system in
1943 AIX-*) ;;
1944 BSD/OS*) ;;
1945 CYGWIN_*|MINGW32_*|MINGW64_*|MSYS_*) ;;
1946 IRIX*) ;;
1947 NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;;
1948 Darwin-*) ;;
1949 SCO_SV-3.2*) ;;
1950 windows) ;;
1951 *) SHLIB_CFLAGS="-fPIC" ;;
1952 esac])
1953
1954 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1955 AC_DEFINE(MODULE_SCOPE, [extern],
1956 [No Compiler support for module scope symbols])
1957 ])
1958
1959 AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
1960 # TEA specific: use PACKAGE_VERSION instead of VERSION
1961 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'])
1962 AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
1963 # TEA specific: use PACKAGE_VERSION instead of VERSION
1964 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'])
1965
1966 if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then
1967 AC_CACHE_CHECK(for SEH support in compiler,
1968 tcl_cv_seh,
1969 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1970 #define WIN32_LEAN_AND_MEAN
1971 #include <windows.h>
1972 #undef WIN32_LEAN_AND_MEAN
1973
1974 int main(int argc, char** argv) {
1975 int a, b = 0;
1976 __try {
1977 a = 666 / b;
1978 }
1979 __except (EXCEPTION_EXECUTE_HANDLER) {
1980 return 0;
1981 }
1982 return 1;
1983 }
1984 ]])],
1985 [tcl_cv_seh=yes],
1986 [tcl_cv_seh=no],
1987 [tcl_cv_seh=no])
1988 )
1989 if test "$tcl_cv_seh" = "no" ; then
1990 AC_DEFINE(HAVE_NO_SEH, 1,
1991 [Defined when mingw does not support SEH])
1992 fi
1993
1994 #
1995 # Check to see if the excpt.h include file provided contains the
1996 # definition for EXCEPTION_DISPOSITION; if not, which is the case
1997 # with Cygwin's version as of 2002-04-10, define it to be int,
1998 # sufficient for getting the current code to work.
1999 #
2000 AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files,
2001 tcl_cv_eh_disposition,
2002 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2003 # define WIN32_LEAN_AND_MEAN
2004 # include <windows.h>
2005 # undef WIN32_LEAN_AND_MEAN
2006 ]], [[
2007 EXCEPTION_DISPOSITION x;
2008 ]])],
2009 [tcl_cv_eh_disposition=yes],
2010 [tcl_cv_eh_disposition=no])
2011 )
2012 if test "$tcl_cv_eh_disposition" = "no" ; then
2013 AC_DEFINE(EXCEPTION_DISPOSITION, int,
2014 [Defined when cygwin/mingw does not support EXCEPTION DISPOSITION])
2015 fi
2016
2017 # Check to see if winnt.h defines CHAR, SHORT, and LONG
2018 # even if VOID has already been #defined. The win32api
2019 # used by mingw and cygwin is known to do this.
2020
2021 AC_CACHE_CHECK(for winnt.h that ignores VOID define,
2022 tcl_cv_winnt_ignore_void,
2023 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2024 #define VOID void
2025 #define WIN32_LEAN_AND_MEAN
2026 #include <windows.h>
2027 #undef WIN32_LEAN_AND_MEAN
2028 ]], [[
2029 CHAR c;
2030 SHORT s;
2031 LONG l;
2032 ]])],
2033 [tcl_cv_winnt_ignore_void=yes],
2034 [tcl_cv_winnt_ignore_void=no])
2035 )
2036 if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
2037 AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1,
2038 [Defined when cygwin/mingw ignores VOID define in winnt.h])
2039 fi
2040 fi
2041
2042 # See if the compiler supports casting to a union type.
2043 # This is used to stop gcc from printing a compiler
2044 # warning when initializing a union member.
2045
2046 AC_CACHE_CHECK(for cast to union support,
2047 tcl_cv_cast_to_union,
2048 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2049 union foo { int i; double d; };
2050 union foo f = (union foo) (int) 0;
2051 ]])],
2052 [tcl_cv_cast_to_union=yes],
2053 [tcl_cv_cast_to_union=no])
2054 )
2055 if test "$tcl_cv_cast_to_union" = "yes"; then
2056 AC_DEFINE(HAVE_CAST_TO_UNION, 1,
2057 [Defined when compiler supports casting to union type.])
2058 fi
2059
2060 AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],)
2061
2062 AC_SUBST(CFLAGS_DEBUG)
2063 AC_SUBST(CFLAGS_OPTIMIZE)
2064 AC_SUBST(CFLAGS_WARNING)
2065 AC_SUBST(LDFLAGS_DEBUG)
2066 AC_SUBST(LDFLAGS_OPTIMIZE)
2067
2068 AC_SUBST(STLIB_LD)
2069 AC_SUBST(SHLIB_LD)
2070
2071 AC_SUBST(SHLIB_LD_LIBS)
2072 AC_SUBST(SHLIB_CFLAGS)
2073
2074 AC_SUBST(LD_LIBRARY_PATH_VAR)
2075
2076 # These must be called after we do the basic CFLAGS checks and
2077 # verify any possible 64-bit or similar switches are necessary
2078 TEA_TCL_EARLY_FLAGS
2079 TEA_TCL_64BIT_FLAGS
2080 ])
2081
2082 #--------------------------------------------------------------------
2083 # TEA_SERIAL_PORT
2084 #
2085 # Determine which interface to use to talk to the serial port.
2086 # Note that #include lines must begin in leftmost column for
2087 # some compilers to recognize them as preprocessor directives,
2088 # and some build environments have stdin not pointing at a
2089 # pseudo-terminal (usually /dev/null instead.)
2090 #
2091 # Arguments:
2092 # none
2093 #
2094 # Results:
2095 #
2096 # Defines only one of the following vars:
2097 # HAVE_SYS_MODEM_H
2098 # USE_TERMIOS
2099 # USE_TERMIO
2100 # USE_SGTTY
2101 #--------------------------------------------------------------------
2102
2103 AC_DEFUN([TEA_SERIAL_PORT], [
2104 AC_CHECK_HEADERS(sys/modem.h)
2105 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2106 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2107 #include <termios.h>
2108
2109 int main() {
2110 struct termios t;
2111 if (tcgetattr(0, &t) == 0) {
2112 cfsetospeed(&t, 0);
2113 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2114 return 0;
2115 }
2116 return 1;
2117 }]])],[tcl_cv_api_serial=termios],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2118 if test $tcl_cv_api_serial = no ; then
2119 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2120 #include <termio.h>
2121
2122 int main() {
2123 struct termio t;
2124 if (ioctl(0, TCGETA, &t) == 0) {
2125 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2126 return 0;
2127 }
2128 return 1;
2129 }]])],[tcl_cv_api_serial=termio],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2130 fi
2131 if test $tcl_cv_api_serial = no ; then
2132 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2133 #include <sgtty.h>
2134
2135 int main() {
2136 struct sgttyb t;
2137 if (ioctl(0, TIOCGETP, &t) == 0) {
2138 t.sg_ospeed = 0;
2139 t.sg_flags |= ODDP | EVENP | RAW;
2140 return 0;
2141 }
2142 return 1;
2143 }]])],[tcl_cv_api_serial=sgtty],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2144 fi
2145 if test $tcl_cv_api_serial = no ; then
2146 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2147 #include <termios.h>
2148 #include <errno.h>
2149
2150 int main() {
2151 struct termios t;
2152 if (tcgetattr(0, &t) == 0
2153 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2154 cfsetospeed(&t, 0);
2155 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2156 return 0;
2157 }
2158 return 1;
2159 }]])],[tcl_cv_api_serial=termios],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2160 fi
2161 if test $tcl_cv_api_serial = no; then
2162 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2163 #include <termio.h>
2164 #include <errno.h>
2165
2166 int main() {
2167 struct termio t;
2168 if (ioctl(0, TCGETA, &t) == 0
2169 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2170 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2171 return 0;
2172 }
2173 return 1;
2174 }]])],[tcl_cv_api_serial=termio],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2175 fi
2176 if test $tcl_cv_api_serial = no; then
2177 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2178 #include <sgtty.h>
2179 #include <errno.h>
2180
2181 int main() {
2182 struct sgttyb t;
2183 if (ioctl(0, TIOCGETP, &t) == 0
2184 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2185 t.sg_ospeed = 0;
2186 t.sg_flags |= ODDP | EVENP | RAW;
2187 return 0;
2188 }
2189 return 1;
2190 }]])],[tcl_cv_api_serial=sgtty],[tcl_cv_api_serial=none],[tcl_cv_api_serial=none])
2191 fi])
2192 case $tcl_cv_api_serial in
2193 termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
2194 termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
2195 sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
2196 esac
2197 ])
2198
2199 #--------------------------------------------------------------------
2200 # TEA_PATH_X
2201 #
2202 # Locate the X11 header files and the X11 library archive. Try
2203 # the ac_path_x macro first, but if it doesn't find the X stuff
2204 # (e.g. because there's no xmkmf program) then check through
2205 # a list of possible directories. Under some conditions the
2206 # autoconf macro will return an include directory that contains
2207 # no include files, so double-check its result just to be safe.
2208 #
2209 # This should be called after TEA_CONFIG_CFLAGS as setting the
2210 # LIBS line can confuse some configure macro magic.
2211 #
2212 # Arguments:
2213 # none
2214 #
2215 # Results:
2216 #
2217 # Sets the following vars:
2218 # XINCLUDES
2219 # XLIBSW
2220 # PKG_LIBS (appends to)
2221 #--------------------------------------------------------------------
2222
2223 AC_DEFUN([TEA_PATH_X], [
2224 if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
2225 TEA_PATH_UNIX_X
2226 fi
2227 ])
2228
2229 AC_DEFUN([TEA_PATH_UNIX_X], [
2230 AC_PATH_X
2231 not_really_there=""
2232 if test "$no_x" = ""; then
2233 if test "$x_includes" = ""; then
2234 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[],[not_really_there="yes"])
2235 else
2236 if test ! -r $x_includes/X11/Xlib.h; then
2237 not_really_there="yes"
2238 fi
2239 fi
2240 fi
2241 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2242 AC_MSG_CHECKING([for X11 header files])
2243 found_xincludes="no"
2244 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[found_xincludes="yes"],[found_xincludes="no"])
2245 if test "$found_xincludes" = "no"; then
2246 dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
2247 for i in $dirs ; do
2248 if test -r $i/X11/Xlib.h; then
2249 AC_MSG_RESULT([$i])
2250 XINCLUDES=" -I$i"
2251 found_xincludes="yes"
2252 break
2253 fi
2254 done
2255 fi
2256 else
2257 if test "$x_includes" != ""; then
2258 XINCLUDES="-I$x_includes"
2259 found_xincludes="yes"
2260 fi
2261 fi
2262 if test "$found_xincludes" = "no"; then
2263 AC_MSG_RESULT([couldn't find any!])
2264 fi
2265
2266 if test "$no_x" = yes; then
2267 AC_MSG_CHECKING([for X11 libraries])
2268 XLIBSW=nope
2269 dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
2270 for i in $dirs ; do
2271 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2272 AC_MSG_RESULT([$i])
2273 XLIBSW="-L$i -lX11"
2274 x_libraries="$i"
2275 break
2276 fi
2277 done
2278 else
2279 if test "$x_libraries" = ""; then
2280 XLIBSW=-lX11
2281 else
2282 XLIBSW="-L$x_libraries -lX11"
2283 fi
2284 fi
2285 if test "$XLIBSW" = nope ; then
2286 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2287 fi
2288 if test "$XLIBSW" = nope ; then
2289 AC_MSG_RESULT([could not find any! Using -lX11.])
2290 XLIBSW=-lX11
2291 fi
2292 # TEA specific:
2293 if test x"${XLIBSW}" != x ; then
2294 PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
2295 fi
2296 ])
2297
2298 #--------------------------------------------------------------------
2299 # TEA_BLOCKING_STYLE
2300 #
2301 # The statements below check for systems where POSIX-style
2302 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2303 # On these systems (mostly older ones), use the old BSD-style
2304 # FIONBIO approach instead.
2305 #
2306 # Arguments:
2307 # none
2308 #
2309 # Results:
2310 #
2311 # Defines some of the following vars:
2312 # HAVE_SYS_IOCTL_H
2313 # HAVE_SYS_FILIO_H
2314 # USE_FIONBIO
2315 # O_NONBLOCK
2316 #--------------------------------------------------------------------
2317
2318 AC_DEFUN([TEA_BLOCKING_STYLE], [
2319 AC_CHECK_HEADERS(sys/ioctl.h)
2320 AC_CHECK_HEADERS(sys/filio.h)
2321 TEA_CONFIG_SYSTEM
2322 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2323 case $system in
2324 OSF*)
2325 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2326 AC_MSG_RESULT([FIONBIO])
2327 ;;
2328 *)
2329 AC_MSG_RESULT([O_NONBLOCK])
2330 ;;
2331 esac
2332 ])
2333
2334 #--------------------------------------------------------------------
2335 # TEA_TIME_HANDLER
2336 #
2337 # Checks how the system deals with time.h, what time structures
2338 # are used on the system, and what fields the structures have.
2339 #
2340 # Arguments:
2341 # none
2342 #
2343 # Results:
2344 #
2345 # Defines some of the following vars:
2346 # USE_DELTA_FOR_TZ
2347 # HAVE_TM_GMTOFF
2348 # HAVE_TM_TZADJ
2349 # HAVE_TIMEZONE_VAR
2350 #
2351 #--------------------------------------------------------------------
2352
2353 AC_DEFUN([TEA_TIME_HANDLER], [
2354 AC_CHECK_HEADERS(sys/time.h)
2355 AC_HEADER_TIME
2356 AC_STRUCT_TIMEZONE
2357
2358 AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
2359
2360 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2361 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_tzadj;]])],
2362 [tcl_cv_member_tm_tzadj=yes],
2363 [tcl_cv_member_tm_tzadj=no])])
2364 if test $tcl_cv_member_tm_tzadj = yes ; then
2365 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2366 fi
2367
2368 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2369 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_gmtoff;]])],
2370 [tcl_cv_member_tm_gmtoff=yes],
2371 [tcl_cv_member_tm_gmtoff=no])])
2372 if test $tcl_cv_member_tm_gmtoff = yes ; then
2373 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2374 fi
2375
2376 #
2377 # Its important to include time.h in this check, as some systems
2378 # (like convex) have timezone functions, etc.
2379 #
2380 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2381 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
2382 #include <stdlib.h>]],
2383 [[extern long timezone;
2384 timezone += 1;
2385 exit (0);]])],
2386 [tcl_cv_timezone_long=yes], [tcl_cv_timezone_long=no])])
2387 if test $tcl_cv_timezone_long = yes ; then
2388 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2389 else
2390 #
2391 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2392 #
2393 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2394 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
2395 #include <stdlib.h>]],
2396 [[extern time_t timezone;
2397 timezone += 1;
2398 exit (0);]])],
2399 [tcl_cv_timezone_time=yes], [tcl_cv_timezone_time=no])])
2400 if test $tcl_cv_timezone_time = yes ; then
2401 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2402 fi
2403 fi
2404 ])
2405
2406 #--------------------------------------------------------------------
2407 # TEA_BUGGY_STRTOD
2408 #
2409 # Under Solaris 2.4, strtod returns the wrong value for the
2410 # terminating character under some conditions. Check for this
2411 # and if the problem exists use a substitute procedure
2412 # "fixstrtod" (provided by Tcl) that corrects the error.
2413 # Also, on Compaq's Tru64 Unix 5.0,
2414 # strtod(" ") returns 0.0 instead of a failure to convert.
2415 #
2416 # Arguments:
2417 # none
2418 #
2419 # Results:
2420 #
2421 # Might defines some of the following vars:
2422 # strtod (=fixstrtod)
2423 #--------------------------------------------------------------------
2424
2425 AC_DEFUN([TEA_BUGGY_STRTOD], [
2426 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2427 if test "$tcl_strtod" = 1; then
2428 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2429 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2430 #include <stdlib.h>
2431 extern double strtod();
2432 int main() {
2433 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2434 char *term;
2435 double value;
2436 value = strtod(infString, &term);
2437 if ((term != infString) && (term[-1] == 0)) {
2438 exit(1);
2439 }
2440 value = strtod(nanString, &term);
2441 if ((term != nanString) && (term[-1] == 0)) {
2442 exit(1);
2443 }
2444 value = strtod(spaceString, &term);
2445 if (term == (spaceString+1)) {
2446 exit(1);
2447 }
2448 exit(0);
2449 }]])], [tcl_cv_strtod_buggy=ok], [tcl_cv_strtod_buggy=buggy],
2450 [tcl_cv_strtod_buggy=buggy])])
2451 if test "$tcl_cv_strtod_buggy" = buggy; then
2452 AC_LIBOBJ([fixstrtod])
2453 USE_COMPAT=1
2454 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
2455 fi
2456 fi
2457 ])
2458
2459 #--------------------------------------------------------------------
2460 # TEA_TCL_LINK_LIBS
2461 #
2462 # Search for the libraries needed to link the Tcl shell.
2463 # Things like the math library (-lm), socket stuff (-lsocket vs.
2464 # -lnsl), zlib (-lz) and libtommath (-ltommath) are dealt with here.
2465 #
2466 # Arguments:
2467 # None.
2468 #
2469 # Results:
2470 #
2471 # Might append to the following vars:
2472 # LIBS
2473 # MATH_LIBS
2474 #
2475 # Might define the following vars:
2476 # HAVE_NET_ERRNO_H
2477 #
2478 #--------------------------------------------------------------------
2479
2480 AC_DEFUN([TEA_TCL_LINK_LIBS], [
2481 #--------------------------------------------------------------------
2482 # On a few very rare systems, all of the libm.a stuff is
2483 # already in libc.a. Set compiler flags accordingly.
2484 #--------------------------------------------------------------------
2485
2486 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2487
2488 #--------------------------------------------------------------------
2489 # Interactive UNIX requires -linet instead of -lsocket, plus it
2490 # needs net/errno.h to define the socket-related error codes.
2491 #--------------------------------------------------------------------
2492
2493 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2494 AC_CHECK_HEADER(net/errno.h, [
2495 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2496
2497 #--------------------------------------------------------------------
2498 # Check for the existence of the -lsocket and -lnsl libraries.
2499 # The order here is important, so that they end up in the right
2500 # order in the command line generated by make. Here are some
2501 # special considerations:
2502 # 1. Use "connect" and "accept" to check for -lsocket, and
2503 # "gethostbyname" to check for -lnsl.
2504 # 2. Use each function name only once: can't redo a check because
2505 # autoconf caches the results of the last check and won't redo it.
2506 # 3. Use -lnsl and -lsocket only if they supply procedures that
2507 # aren't already present in the normal libraries. This is because
2508 # IRIX 5.2 has libraries, but they aren't needed and they're
2509 # bogus: they goof up name resolution if used.
2510 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2511 # To get around this problem, check for both libraries together
2512 # if -lsocket doesn't work by itself.
2513 #--------------------------------------------------------------------
2514
2515 tcl_checkBoth=0
2516 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2517 if test "$tcl_checkSocket" = 1; then
2518 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2519 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2520 fi
2521 if test "$tcl_checkBoth" = 1; then
2522 tk_oldLibs=$LIBS
2523 LIBS="$LIBS -lsocket -lnsl"
2524 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2525 fi
2526 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2527 [LIBS="$LIBS -lnsl"])])
2528 AC_CHECK_FUNC(mp_log_u32, , [AC_CHECK_LIB(tommath, mp_log_u32,
2529 [LIBS="$LIBS -ltommath"])])
2530 AC_CHECK_FUNC(deflateSetHeader, , [AC_CHECK_LIB(z, deflateSetHeader,
2531 [LIBS="$LIBS -lz"])])
2532 ])
2533
2534 #--------------------------------------------------------------------
2535 # TEA_TCL_EARLY_FLAGS
2536 #
2537 # Check for what flags are needed to be passed so the correct OS
2538 # features are available.
2539 #
2540 # Arguments:
2541 # None
2542 #
2543 # Results:
2544 #
2545 # Might define the following vars:
2546 # _ISOC99_SOURCE
2547 # _FILE_OFFSET_BITS
2548 #
2549 #--------------------------------------------------------------------
2550
2551 AC_DEFUN([TEA_TCL_EARLY_FLAG],[
2552 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2553 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])],
2554 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[[#define ]$1[ ]m4_default([$4],[1])[
2555 ]$2]], [[$3]])],
2556 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2557 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)]))
2558 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2559 AC_DEFINE($1, m4_default([$4],[1]), [Add the ]$1[ flag when building])
2560 tcl_flags="$tcl_flags $1"
2561 fi
2562 ])
2563
2564 AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
2565 AC_MSG_CHECKING([for required early compiler flags])
2566 tcl_flags=""
2567 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2568 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2569 if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
2570 TEA_TCL_EARLY_FLAG(_FILE_OFFSET_BITS,[#include <sys/stat.h>],
2571 [switch (0) { case 0: case (sizeof(off_t)==sizeof(long long)): ; }],64)
2572 fi
2573 if test "x${tcl_flags}" = "x" ; then
2574 AC_MSG_RESULT([none])
2575 else
2576 AC_MSG_RESULT([${tcl_flags}])
2577 fi
2578 ])
2579
2580 #--------------------------------------------------------------------
2581 # TEA_TCL_64BIT_FLAGS
2582 #
2583 # Check for what is defined in the way of 64-bit features.
2584 #
2585 # Arguments:
2586 # None
2587 #
2588 # Results:
2589 #
2590 # Might define the following vars:
2591 # TCL_WIDE_INT_IS_LONG
2592 # TCL_WIDE_INT_TYPE
2593 # HAVE_STRUCT_DIRENT64, HAVE_DIR64
2594 # HAVE_STRUCT_STAT64
2595 # HAVE_TYPE_OFF64_T
2596 # _TIME_BITS
2597 #
2598 #--------------------------------------------------------------------
2599
2600 AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
2601 AC_MSG_CHECKING([for 64-bit integer type])
2602 AC_CACHE_VAL(tcl_cv_type_64bit,[
2603 tcl_cv_type_64bit=none
2604 # See if the compiler knows natively about __int64
2605 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__int64 value = (__int64) 0;]])],
2606 [tcl_type_64bit=__int64],[tcl_type_64bit="long long"])
2607 # See if we could use long anyway Note that we substitute in the
2608 # type that is our current guess for a 64-bit type inside this check
2609 # program, so it should be modified only carefully...
2610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) {
2611 case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
2612 }]])],[tcl_cv_type_64bit=${tcl_type_64bit}],[])])
2613 if test "${tcl_cv_type_64bit}" = none ; then
2614 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?])
2615 AC_MSG_RESULT([yes])
2616 elif test "${tcl_cv_type_64bit}" = "__int64" \
2617 -a "${TEA_PLATFORM}" = "windows" ; then
2618 # TEA specific: We actually want to use the default tcl.h checks in
2619 # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
2620 AC_MSG_RESULT([using Tcl header defaults])
2621 else
2622 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2623 [What type should be used to define wide integers?])
2624 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2625
2626 # Now check for auxiliary declarations
2627 if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
2628 AC_CACHE_CHECK([for 64-bit time_t], tcl_cv_time_t_64,[
2629 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
2630 [[switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;}]])],
2631 [tcl_cv_time_t_64=yes],[tcl_cv_time_t_64=no])])
2632 if test "x${tcl_cv_time_t_64}" = "xno" ; then
2633 # Note that _TIME_BITS=64 requires _FILE_OFFSET_BITS=64
2634 # which SC_TCL_EARLY_FLAGS has defined if necessary.
2635 AC_CACHE_CHECK([if _TIME_BITS=64 enables 64-bit time_t], tcl_cv__time_bits,[
2636 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _TIME_BITS 64
2637 #include <sys/types.h>]],
2638 [[switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;}]])],
2639 [tcl_cv__time_bits=yes],[tcl_cv__time_bits=no])])
2640 if test "x${tcl_cv__time_bits}" = "xyes" ; then
2641 AC_DEFINE(_TIME_BITS, 64, [_TIME_BITS=64 enables 64-bit time_t.])
2642 fi
2643 fi
2644 fi
2645
2646 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2647 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2648 #include <dirent.h>]], [[struct dirent64 p;]])],
2649 [tcl_cv_struct_dirent64=yes],[tcl_cv_struct_dirent64=no])])
2650 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2651 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2652 fi
2653
2654 AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[
2655 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2656 #include <dirent.h>]], [[struct dirent64 *p; DIR64 d = opendir64(".");
2657 p = readdir64(d); rewinddir64(d); closedir64(d);]])],
2658 [tcl_cv_DIR64=yes], [tcl_cv_DIR64=no])])
2659 if test "x${tcl_cv_DIR64}" = "xyes" ; then
2660 AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?])
2661 fi
2662
2663 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2664 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat64 p;
2665 ]])],
2666 [tcl_cv_struct_stat64=yes], [tcl_cv_struct_stat64=no])])
2667 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2668 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2669 fi
2670
2671 AC_CHECK_FUNCS(open64 lseek64)
2672 AC_MSG_CHECKING([for off64_t])
2673 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2674 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[off64_t offset;
2675 ]])],
2676 [tcl_cv_type_off64_t=yes], [tcl_cv_type_off64_t=no])])
2677 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2678 dnl functions lseek64 and open64 are defined.
2679 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2680 test "x${ac_cv_func_lseek64}" = "xyes" && \
2681 test "x${ac_cv_func_open64}" = "xyes" ; then
2682 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2683 AC_MSG_RESULT([yes])
2684 else
2685 AC_MSG_RESULT([no])
2686 fi
2687 fi
2688 ])
2689
2690 ##
2691 ## Here ends the standard Tcl configuration bits and starts the
2692 ## TEA specific functions
2693 ##
2694
2695 #------------------------------------------------------------------------
2696 # TEA_INIT --
2697 #
2698 # Init various Tcl Extension Architecture (TEA) variables.
2699 # This should be the first called TEA_* macro.
2700 #
2701 # Arguments:
2702 # none
2703 #
2704 # Results:
2705 #
2706 # Defines and substs the following vars:
2707 # CYGPATH
2708 # EXEEXT
2709 # Defines only:
2710 # TEA_VERSION
2711 # TEA_INITED
2712 # TEA_PLATFORM (windows or unix)
2713 #
2714 # "cygpath" is used on windows to generate native path names for include
2715 # files. These variables should only be used with the compiler and linker
2716 # since they generate native path names.
2717 #
2718 # EXEEXT
2719 # Select the executable extension based on the host type. This
2720 # is a lightweight replacement for AC_EXEEXT that doesn't require
2721 # a compiler.
2722 #------------------------------------------------------------------------
2723
2724 AC_DEFUN([TEA_INIT], [
2725 TEA_VERSION="3.13"
2726
2727 AC_MSG_CHECKING([TEA configuration])
2728 if test x"${PACKAGE_NAME}" = x ; then
2729 AC_MSG_ERROR([
2730 The PACKAGE_NAME variable must be defined by your TEA configure.ac])
2731 fi
2732 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
2733
2734 # If the user did not set CFLAGS, set it now to keep macros
2735 # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
2736 if test "${CFLAGS+set}" != "set" ; then
2737 CFLAGS=""
2738 fi
2739
2740 case "`uname -s`" in
2741 *win32*|*WIN32*|*MINGW32_*|*MINGW64_*|*MSYS_*)
2742 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
2743 EXEEXT=".exe"
2744 TEA_PLATFORM="windows"
2745 ;;
2746 *CYGWIN_*)
2747 EXEEXT=".exe"
2748 # CYGPATH and TEA_PLATFORM are determined later in LOAD_TCLCONFIG
2749 ;;
2750 *)
2751 CYGPATH=echo
2752 # Maybe we are cross-compiling....
2753 case ${host_alias} in
2754 *mingw32*)
2755 EXEEXT=".exe"
2756 TEA_PLATFORM="windows"
2757 ;;
2758 *)
2759 EXEEXT=""
2760 TEA_PLATFORM="unix"
2761 ;;
2762 esac
2763 ;;
2764 esac
2765
2766 # Check if exec_prefix is set. If not use fall back to prefix.
2767 # Note when adjusted, so that TEA_PREFIX can correct for this.
2768 # This is needed for recursive configures, since autoconf propagates
2769 # $prefix, but not $exec_prefix (doh!).
2770 if test x$exec_prefix = xNONE ; then
2771 exec_prefix_default=yes
2772 exec_prefix=$prefix
2773 fi
2774
2775 AC_MSG_NOTICE([configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}])
2776
2777 AC_SUBST(EXEEXT)
2778 AC_SUBST(CYGPATH)
2779
2780 # This package name must be replaced statically for AC_SUBST to work
2781 AC_SUBST(PKG_LIB_FILE)
2782 AC_SUBST(PKG_LIB_FILE8)
2783 AC_SUBST(PKG_LIB_FILE9)
2784
2785 # We AC_SUBST these here to ensure they are subst'ed,
2786 # in case the user doesn't call TEA_ADD_...
2787 AC_SUBST(PKG_STUB_SOURCES)
2788 AC_SUBST(PKG_STUB_OBJECTS)
2789 AC_SUBST(PKG_TCL_SOURCES)
2790 AC_SUBST(PKG_HEADERS)
2791 AC_SUBST(PKG_INCLUDES)
2792 AC_SUBST(PKG_LIBS)
2793 AC_SUBST(PKG_CFLAGS)
2794
2795 # Configure the installer.
2796 TEA_INSTALLER
2797 ])
2798
2799 #------------------------------------------------------------------------
2800 # TEA_ADD_SOURCES --
2801 #
2802 # Specify one or more source files. Users should check for
2803 # the right platform before adding to their list.
2804 # It is not important to specify the directory, as long as it is
2805 # in the generic, win or unix subdirectory of $(srcdir).
2806 #
2807 # Arguments:
2808 # one or more file names
2809 #
2810 # Results:
2811 #
2812 # Defines and substs the following vars:
2813 # PKG_SOURCES
2814 # PKG_OBJECTS
2815 #------------------------------------------------------------------------
2816 AC_DEFUN([TEA_ADD_SOURCES], [
2817 vars="$@"
2818 for i in $vars; do
2819 case $i in
2820 [\$]*)
2821 # allow $-var names
2822 PKG_SOURCES="$PKG_SOURCES $i"
2823 PKG_OBJECTS="$PKG_OBJECTS $i"
2824 ;;
2825 *)
2826 # check for existence - allows for generic/win/unix VPATH
2827 # To add more dirs here (like 'src'), you have to update VPATH
2828 # in Makefile.in as well
2829 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2830 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2831 -a ! -f "${srcdir}/macosx/$i" \
2832 ; then
2833 AC_MSG_ERROR([could not find source file '$i'])
2834 fi
2835 PKG_SOURCES="$PKG_SOURCES $i"
2836 # this assumes it is in a VPATH dir
2837 i=`basename $i`
2838 # handle user calling this before or after TEA_SETUP_COMPILER
2839 if test x"${OBJEXT}" != x ; then
2840 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2841 else
2842 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2843 fi
2844 PKG_OBJECTS="$PKG_OBJECTS $j"
2845 ;;
2846 esac
2847 done
2848 AC_SUBST(PKG_SOURCES)
2849 AC_SUBST(PKG_OBJECTS)
2850 ])
2851
2852 #------------------------------------------------------------------------
2853 # TEA_ADD_STUB_SOURCES --
2854 #
2855 # Specify one or more source files. Users should check for
2856 # the right platform before adding to their list.
2857 # It is not important to specify the directory, as long as it is
2858 # in the generic, win or unix subdirectory of $(srcdir).
2859 #
2860 # Arguments:
2861 # one or more file names
2862 #
2863 # Results:
2864 #
2865 # Defines and substs the following vars:
2866 # PKG_STUB_SOURCES
2867 # PKG_STUB_OBJECTS
2868 #------------------------------------------------------------------------
2869 AC_DEFUN([TEA_ADD_STUB_SOURCES], [
2870 vars="$@"
2871 for i in $vars; do
2872 # check for existence - allows for generic/win/unix VPATH
2873 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2874 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2875 -a ! -f "${srcdir}/macosx/$i" \
2876 ; then
2877 AC_MSG_ERROR([could not find stub source file '$i'])
2878 fi
2879 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
2880 # this assumes it is in a VPATH dir
2881 i=`basename $i`
2882 # handle user calling this before or after TEA_SETUP_COMPILER
2883 if test x"${OBJEXT}" != x ; then
2884 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2885 else
2886 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2887 fi
2888 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
2889 done
2890 AC_SUBST(PKG_STUB_SOURCES)
2891 AC_SUBST(PKG_STUB_OBJECTS)
2892 ])
2893
2894 #------------------------------------------------------------------------
2895 # TEA_ADD_TCL_SOURCES --
2896 #
2897 # Specify one or more Tcl source files. These should be platform
2898 # independent runtime files.
2899 #
2900 # Arguments:
2901 # one or more file names
2902 #
2903 # Results:
2904 #
2905 # Defines and substs the following vars:
2906 # PKG_TCL_SOURCES
2907 #------------------------------------------------------------------------
2908 AC_DEFUN([TEA_ADD_TCL_SOURCES], [
2909 vars="$@"
2910 for i in $vars; do
2911 # check for existence, be strict because it is installed
2912 if test ! -f "${srcdir}/$i" ; then
2913 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
2914 fi
2915 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
2916 done
2917 AC_SUBST(PKG_TCL_SOURCES)
2918 ])
2919
2920 #------------------------------------------------------------------------
2921 # TEA_ADD_HEADERS --
2922 #
2923 # Specify one or more source headers. Users should check for
2924 # the right platform before adding to their list.
2925 #
2926 # Arguments:
2927 # one or more file names
2928 #
2929 # Results:
2930 #
2931 # Defines and substs the following vars:
2932 # PKG_HEADERS
2933 #------------------------------------------------------------------------
2934 AC_DEFUN([TEA_ADD_HEADERS], [
2935 vars="$@"
2936 for i in $vars; do
2937 # check for existence, be strict because it is installed
2938 if test ! -f "${srcdir}/$i" ; then
2939 AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
2940 fi
2941 PKG_HEADERS="$PKG_HEADERS $i"
2942 done
2943 AC_SUBST(PKG_HEADERS)
2944 ])
2945
2946 #------------------------------------------------------------------------
2947 # TEA_ADD_INCLUDES --
2948 #
2949 # Specify one or more include dirs. Users should check for
2950 # the right platform before adding to their list.
2951 #
2952 # Arguments:
2953 # one or more file names
2954 #
2955 # Results:
2956 #
2957 # Defines and substs the following vars:
2958 # PKG_INCLUDES
2959 #------------------------------------------------------------------------
2960 AC_DEFUN([TEA_ADD_INCLUDES], [
2961 vars="$@"
2962 for i in $vars; do
2963 PKG_INCLUDES="$PKG_INCLUDES $i"
2964 done
2965 AC_SUBST(PKG_INCLUDES)
2966 ])
2967
2968 #------------------------------------------------------------------------
2969 # TEA_ADD_LIBS --
2970 #
2971 # Specify one or more libraries. Users should check for
2972 # the right platform before adding to their list. For Windows,
2973 # libraries provided in "foo.lib" format will be converted to
2974 # "-lfoo" when using GCC (mingw).
2975 #
2976 # Arguments:
2977 # one or more file names
2978 #
2979 # Results:
2980 #
2981 # Defines and substs the following vars:
2982 # PKG_LIBS
2983 #------------------------------------------------------------------------
2984 AC_DEFUN([TEA_ADD_LIBS], [
2985 vars="$@"
2986 for i in $vars; do
2987 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
2988 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
2989 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.[[lL]][[iI]][[bB]][$]/-l\1/'`
2990 fi
2991 PKG_LIBS="$PKG_LIBS $i"
2992 done
2993 AC_SUBST(PKG_LIBS)
2994 ])
2995
2996 #------------------------------------------------------------------------
2997 # TEA_ADD_CFLAGS --
2998 #
2999 # Specify one or more CFLAGS. Users should check for
3000 # the right platform before adding to their list.
3001 #
3002 # Arguments:
3003 # one or more file names
3004 #
3005 # Results:
3006 #
3007 # Defines and substs the following vars:
3008 # PKG_CFLAGS
3009 #------------------------------------------------------------------------
3010 AC_DEFUN([TEA_ADD_CFLAGS], [
3011 PKG_CFLAGS="$PKG_CFLAGS $@"
3012 AC_SUBST(PKG_CFLAGS)
3013 ])
3014
3015 #------------------------------------------------------------------------
3016 # TEA_ADD_CLEANFILES --
3017 #
3018 # Specify one or more CLEANFILES.
3019 #
3020 # Arguments:
3021 # one or more file names to clean target
3022 #
3023 # Results:
3024 #
3025 # Appends to CLEANFILES, already defined for subst in LOAD_TCLCONFIG
3026 #------------------------------------------------------------------------
3027 AC_DEFUN([TEA_ADD_CLEANFILES], [
3028 CLEANFILES="$CLEANFILES $@"
3029 ])
3030
3031 #------------------------------------------------------------------------
3032 # TEA_PREFIX --
3033 #
3034 # Handle the --prefix=... option by defaulting to what Tcl gave
3035 #
3036 # Arguments:
3037 # none
3038 #
3039 # Results:
3040 #
3041 # If --prefix or --exec-prefix was not specified, $prefix and
3042 # $exec_prefix will be set to the values given to Tcl when it was
3043 # configured.
3044 #------------------------------------------------------------------------
3045 AC_DEFUN([TEA_PREFIX], [
3046 if test "${prefix}" = "NONE"; then
3047 prefix_default=yes
3048 if test x"${TCL_PREFIX}" != x; then
3049 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
3050 prefix=${TCL_PREFIX}
3051 else
3052 AC_MSG_NOTICE([--prefix defaulting to /usr/local])
3053 prefix=/usr/local
3054 fi
3055 fi
3056 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
3057 -o x"${exec_prefix_default}" = x"yes" ; then
3058 if test x"${TCL_EXEC_PREFIX}" != x; then
3059 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
3060 exec_prefix=${TCL_EXEC_PREFIX}
3061 else
3062 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
3063 exec_prefix=$prefix
3064 fi
3065 fi
3066 ])
3067
3068 #------------------------------------------------------------------------
3069 # TEA_SETUP_COMPILER_CC --
3070 #
3071 # Do compiler checks the way we want. This is just a replacement
3072 # for AC_PROG_CC in TEA configure.ac files to make them cleaner.
3073 #
3074 # Arguments:
3075 # none
3076 #
3077 # Results:
3078 #
3079 # Sets up CC var and other standard bits we need to make executables.
3080 #------------------------------------------------------------------------
3081 AC_DEFUN([TEA_SETUP_COMPILER_CC], [
3082 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
3083 # in this macro, they need to go into TEA_SETUP_COMPILER instead.
3084
3085 AC_PROG_CC
3086 AC_PROG_CPP
3087
3088 #--------------------------------------------------------------------
3089 # Checks to see if the make program sets the $MAKE variable.
3090 #--------------------------------------------------------------------
3091
3092 AC_PROG_MAKE_SET
3093
3094 #--------------------------------------------------------------------
3095 # Find ranlib
3096 #--------------------------------------------------------------------
3097
3098 AC_CHECK_TOOL(RANLIB, ranlib)
3099
3100 #--------------------------------------------------------------------
3101 # Determines the correct binary file extension (.o, .obj, .exe etc.)
3102 #--------------------------------------------------------------------
3103
3104 AC_OBJEXT
3105 AC_EXEEXT
3106 ])
3107
3108 #------------------------------------------------------------------------
3109 # TEA_SETUP_COMPILER --
3110 #
3111 # Do compiler checks that use the compiler. This must go after
3112 # TEA_SETUP_COMPILER_CC, which does the actual compiler check.
3113 #
3114 # Arguments:
3115 # none
3116 #
3117 # Results:
3118 #
3119 # Sets up CC var and other standard bits we need to make executables.
3120 #------------------------------------------------------------------------
3121 AC_DEFUN([TEA_SETUP_COMPILER], [
3122 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
3123 AC_REQUIRE([TEA_SETUP_COMPILER_CC])
3124
3125 #------------------------------------------------------------------------
3126 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
3127 # It makes compiling go faster. (This is only a performance feature.)
3128 #------------------------------------------------------------------------
3129
3130 if test -z "$no_pipe" -a -n "$GCC"; then
3131 AC_CACHE_CHECK([if the compiler understands -pipe],
3132 tcl_cv_cc_pipe, [
3133 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
3134 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_pipe=yes],[tcl_cv_cc_pipe=no])
3135 CFLAGS=$hold_cflags])
3136 if test $tcl_cv_cc_pipe = yes; then
3137 CFLAGS="$CFLAGS -pipe"
3138 fi
3139 fi
3140
3141 if test "${TCL_MAJOR_VERSION}" -lt 9 -a "${TCL_MINOR_VERSION}" -lt 7; then
3142 AC_DEFINE(Tcl_Size, int, [Is 'Tcl_Size' in <tcl.h>?])
3143 fi
3144
3145 #--------------------------------------------------------------------
3146 # Common compiler flag setup
3147 #--------------------------------------------------------------------
3148
3149 AC_C_BIGENDIAN(,,,[#])
3150 ])
3151
3152 #------------------------------------------------------------------------
3153 # TEA_MAKE_LIB --
3154 #
3155 # Generate a line that can be used to build a shared/unshared library
3156 # in a platform independent manner.
3157 #
3158 # Arguments:
3159 # none
3160 #
3161 # Requires:
3162 #
3163 # Results:
3164 #
3165 # Defines the following vars:
3166 # CFLAGS - Done late here to note disturb other AC macros
3167 # MAKE_LIB - Command to execute to build the Tcl library;
3168 # differs depending on whether or not Tcl is being
3169 # compiled as a shared library.
3170 # MAKE_SHARED_LIB Makefile rule for building a shared library
3171 # MAKE_STATIC_LIB Makefile rule for building a static library
3172 # MAKE_STUB_LIB Makefile rule for building a stub library
3173 # VC_MANIFEST_EMBED_DLL Makefile rule for embedded VC manifest in DLL
3174 # VC_MANIFEST_EMBED_EXE Makefile rule for embedded VC manifest in EXE
3175 #------------------------------------------------------------------------
3176
3177 AC_DEFUN([TEA_MAKE_LIB], [
3178 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
3179 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
3180 MAKE_SHARED_LIB="\${SHLIB_LD} \${LDFLAGS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3181 AC_EGREP_CPP([manifest needed], [
3182 #if defined(_MSC_VER) && _MSC_VER >= 1400
3183 print("manifest needed")
3184 #endif
3185 ], [
3186 # Could do a CHECK_PROG for mt, but should always be with MSVC8+
3187 VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;2 ; fi"
3188 VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;1 ; fi"
3189 MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
3190 TEA_ADD_CLEANFILES([*.manifest])
3191 ])
3192 MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[$]@ \$(PKG_STUB_OBJECTS)"
3193 else
3194 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
3195 MAKE_SHARED_LIB="\${SHLIB_LD} \${LDFLAGS} \${LDFLAGS_DEFAULT} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3196 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
3197 fi
3198
3199 if test "${SHARED_BUILD}" = "1" ; then
3200 MAKE_LIB="${MAKE_SHARED_LIB} "
3201 else
3202 MAKE_LIB="${MAKE_STATIC_LIB} "
3203 fi
3204
3205 #--------------------------------------------------------------------
3206 # Shared libraries and static libraries have different names.
3207 # Use the double eval to make sure any variables in the suffix is
3208 # substituted. (@@@ Might not be necessary anymore)
3209 #--------------------------------------------------------------------
3210
3211 if test "$TEA_PLATFORM" = "unix"; then
3212 PACKAGE_LIB_PREFIX8="lib"
3213 if test "$EXEEXT" = ".exe" -a "$SHARED_BUILD" != "0"; then
3214 PACKAGE_LIB_PREFIX9="cygtcl9"
3215 else
3216 PACKAGE_LIB_PREFIX9="libtcl9"
3217 fi
3218 else
3219 PACKAGE_LIB_PREFIX8=""
3220 PACKAGE_LIB_PREFIX9="tcl9"
3221 fi
3222 if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" = x; then
3223 PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX9}"
3224 else
3225 PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX8}"
3226 AC_DEFINE(TCL_MAJOR_VERSION, 8, [Compile for Tcl8?])
3227 AC_DEFINE(TK_MAJOR_VERSION, 8, [Compile for Tk8?])
3228 fi
3229 if test "${TEA_PLATFORM}" = "windows" ; then
3230 if test "${SHARED_BUILD}" = "1" ; then
3231 # We force the unresolved linking of symbols that are really in
3232 # the private libraries of Tcl and Tk.
3233 if test x"${TK_BIN_DIR}" != x ; then
3234 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
3235 fi
3236 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
3237 if test "$GCC" = "yes"; then
3238 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
3239 fi
3240 AC_CACHE_CHECK([if the linker understands --disable-high-entropy-va],
3241 tcl_cv_ld_high_entropy, [
3242 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Wl,--disable-high-entropy-va"
3243 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_ld_high_entropy=yes],[tcl_cv_ld_high_entropy=no])
3244 CFLAGS=$hold_cflags])
3245 if test $tcl_cv_ld_high_entropy = yes; then
3246 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--disable-high-entropy-va"
3247 fi
3248 eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3249 eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3250 eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3251 else
3252 if test "$GCC" = "yes"; then
3253 PACKAGE_LIB_PREFIX=lib${PACKAGE_LIB_PREFIX}
3254 fi
3255 eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3256 eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3257 eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3258 fi
3259 # Some packages build their own stubs libraries
3260 if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" = x; then
3261 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub.a"
3262 else
3263 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3264 fi
3265 if test "$GCC" = "yes"; then
3266 PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
3267 fi
3268 # These aren't needed on Windows (either MSVC or gcc)
3269 RANLIB=:
3270 RANLIB_STUB=:
3271 else
3272 RANLIB_STUB="${RANLIB}"
3273 if test "${SHARED_BUILD}" = "1" ; then
3274 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
3275 if test x"${TK_BIN_DIR}" != x ; then
3276 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
3277 fi
3278 eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3279 eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3280 eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3281 RANLIB=:
3282 else
3283 eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3284 eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3285 eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3286 fi
3287 # Some packages build their own stubs libraries
3288 if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" = x; then
3289 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub.a"
3290 else
3291 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3292 fi
3293 fi
3294
3295 # These are escaped so that only CFLAGS is picked up at configure time.
3296 # The other values will be substituted at make time.
3297 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
3298 if test "${SHARED_BUILD}" = "1" ; then
3299 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
3300 fi
3301
3302 AC_SUBST(MAKE_LIB)
3303 AC_SUBST(MAKE_SHARED_LIB)
3304 AC_SUBST(MAKE_STATIC_LIB)
3305 AC_SUBST(MAKE_STUB_LIB)
3306 # Substitute STUB_LIB_FILE in case package creates a stub library too.
3307 AC_SUBST(PKG_STUB_LIB_FILE)
3308 AC_SUBST(RANLIB_STUB)
3309 AC_SUBST(VC_MANIFEST_EMBED_DLL)
3310 AC_SUBST(VC_MANIFEST_EMBED_EXE)
3311 ])
3312
3313 #------------------------------------------------------------------------
3314 # TEA_LIB_SPEC --
3315 #
3316 # Compute the name of an existing object library located in libdir
3317 # from the given base name and produce the appropriate linker flags.
3318 #
3319 # Arguments:
3320 # basename The base name of the library without version
3321 # numbers, extensions, or "lib" prefixes.
3322 # extra_dir Extra directory in which to search for the
3323 # library. This location is used first, then
3324 # $prefix/$exec-prefix, then some defaults.
3325 #
3326 # Requires:
3327 # TEA_INIT and TEA_PREFIX must be called first.
3328 #
3329 # Results:
3330 #
3331 # Defines the following vars:
3332 # ${basename}_LIB_NAME The computed library name.
3333 # ${basename}_LIB_SPEC The computed linker flags.
3334 #------------------------------------------------------------------------
3335
3336 AC_DEFUN([TEA_LIB_SPEC], [
3337 AC_MSG_CHECKING([for $1 library])
3338
3339 # Look in exec-prefix for the library (defined by TEA_PREFIX).
3340
3341 tea_lib_name_dir="${exec_prefix}/lib"
3342
3343 # Or in a user-specified location.
3344
3345 if test x"$2" != x ; then
3346 tea_extra_lib_dir=$2
3347 else
3348 tea_extra_lib_dir=NONE
3349 fi
3350
3351 for i in \
3352 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3353 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3354 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3355 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3356 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3357 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
3358 `ls -dr /usr/lib64/$1[[0-9]]*.lib 2>/dev/null ` \
3359 `ls -dr /usr/lib64/lib$1[[0-9]]* 2>/dev/null ` \
3360 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3361 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
3362 if test -f "$i" ; then
3363 tea_lib_name_dir=`dirname $i`
3364 $1_LIB_NAME=`basename $i`
3365 $1_LIB_PATH_NAME=$i
3366 break
3367 fi
3368 done
3369
3370 if test "${TEA_PLATFORM}" = "windows"; then
3371 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
3372 else
3373 # Strip off the leading "lib" and trailing ".a" or ".so"
3374
3375 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
3376 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
3377 fi
3378
3379 if test "x${$1_LIB_NAME}" = x ; then
3380 AC_MSG_ERROR([not found])
3381 else
3382 AC_MSG_RESULT([${$1_LIB_SPEC}])
3383 fi
3384 ])
3385
3386 #------------------------------------------------------------------------
3387 # TEA_PRIVATE_TCL_HEADERS --
3388 #
3389 # Locate the private Tcl include files
3390 #
3391 # Arguments:
3392 #
3393 # Requires:
3394 # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
3395 # already been called.
3396 #
3397 # Results:
3398 #
3399 # Substitutes the following vars:
3400 # TCL_TOP_DIR_NATIVE
3401 # TCL_INCLUDES
3402 #------------------------------------------------------------------------
3403
3404 AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
3405 # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh}
3406 AC_REQUIRE([TEA_PUBLIC_TCL_HEADERS])
3407 AC_MSG_CHECKING([for Tcl private include files])
3408
3409 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
3410 TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
3411
3412 # Check to see if tcl<Plat>Port.h isn't already with the public headers
3413 # Don't look for tclInt.h because that resides with tcl.h in the core
3414 # sources, but the <plat>Port headers are in a different directory
3415 if test "${TEA_PLATFORM}" = "windows" -a \
3416 -f "${ac_cv_c_tclh}/tclWinPort.h"; then
3417 result="private headers found with public headers"
3418 elif test "${TEA_PLATFORM}" = "unix" -a \
3419 -f "${ac_cv_c_tclh}/tclUnixPort.h"; then
3420 result="private headers found with public headers"
3421 else
3422 TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
3423 if test "${TEA_PLATFORM}" = "windows"; then
3424 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
3425 else
3426 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
3427 fi
3428 # Overwrite the previous TCL_INCLUDES as this should capture both
3429 # public and private headers in the same set.
3430 # We want to ensure these are substituted so as not to require
3431 # any *_NATIVE vars be defined in the Makefile
3432 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
3433 if test "`uname -s`" = "Darwin"; then
3434 # If Tcl was built as a framework, attempt to use
3435 # the framework's Headers and PrivateHeaders directories
3436 case ${TCL_DEFS} in
3437 *TCL_FRAMEWORK*)
3438 if test -d "${TCL_BIN_DIR}/Headers" -a \
3439 -d "${TCL_BIN_DIR}/PrivateHeaders"; then
3440 TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
3441 else
3442 TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3443 fi
3444 ;;
3445 esac
3446 result="Using ${TCL_INCLUDES}"
3447 else
3448 if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
3449 AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
3450 fi
3451 result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}"
3452 fi
3453 fi
3454
3455 AC_SUBST(TCL_TOP_DIR_NATIVE)
3456
3457 AC_SUBST(TCL_INCLUDES)
3458 AC_MSG_RESULT([${result}])
3459 ])
3460
3461 #------------------------------------------------------------------------
3462 # TEA_PUBLIC_TCL_HEADERS --
3463 #
3464 # Locate the installed public Tcl header files
3465 #
3466 # Arguments:
3467 # None.
3468 #
3469 # Requires:
3470 # CYGPATH must be set
3471 #
3472 # Results:
3473 #
3474 # Adds a --with-tclinclude switch to configure.
3475 # Result is cached.
3476 #
3477 # Substitutes the following vars:
3478 # TCL_INCLUDES
3479 #------------------------------------------------------------------------
3480
3481 AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
3482 AC_MSG_CHECKING([for Tcl public headers])
3483
3484 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
3485
3486 AC_CACHE_VAL(ac_cv_c_tclh, [
3487 # Use the value from --with-tclinclude, if it was given
3488
3489 if test x"${with_tclinclude}" != x ; then
3490 if test -f "${with_tclinclude}/tcl.h" ; then
3491 ac_cv_c_tclh=${with_tclinclude}
3492 else
3493 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
3494 fi
3495 else
3496 list=""
3497 if test "`uname -s`" = "Darwin"; then
3498 # If Tcl was built as a framework, attempt to use
3499 # the framework's Headers directory
3500 case ${TCL_DEFS} in
3501 *TCL_FRAMEWORK*)
3502 list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
3503 ;;
3504 esac
3505 fi
3506
3507 # Look in the source dir only if Tcl is not installed,
3508 # and in that situation, look there before installed locations.
3509 if test -f "${TCL_BIN_DIR}/Makefile" ; then
3510 list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
3511 fi
3512
3513 # Check order: pkg --prefix location, Tcl's --prefix location,
3514 # relative to directory of tclConfig.sh.
3515
3516 eval "temp_includedir=${includedir}"
3517 list="$list \
3518 `ls -d ${temp_includedir} 2>/dev/null` \
3519 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3520 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3521 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3522 list="$list /usr/local/include /usr/include"
3523 if test x"${TCL_INCLUDE_SPEC}" != x ; then
3524 d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3525 list="$list `ls -d ${d} 2>/dev/null`"
3526 fi
3527 fi
3528 for i in $list ; do
3529 if test -f "$i/tcl.h" ; then
3530 ac_cv_c_tclh=$i
3531 break
3532 fi
3533 done
3534 fi
3535 ])
3536
3537 # Print a message based on how we determined the include path
3538
3539 if test x"${ac_cv_c_tclh}" = x ; then
3540 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
3541 else
3542 AC_MSG_RESULT([${ac_cv_c_tclh}])
3543 fi
3544
3545 # Convert to a native path and substitute into the output files.
3546
3547 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
3548
3549 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3550
3551 AC_SUBST(TCL_INCLUDES)
3552 ])
3553
3554 #------------------------------------------------------------------------
3555 # TEA_PRIVATE_TK_HEADERS --
3556 #
3557 # Locate the private Tk include files
3558 #
3559 # Arguments:
3560 #
3561 # Requires:
3562 # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
3563 # already been called.
3564 #
3565 # Results:
3566 #
3567 # Substitutes the following vars:
3568 # TK_INCLUDES
3569 #------------------------------------------------------------------------
3570
3571 AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
3572 # Allow for --with-tkinclude to take effect and define ${ac_cv_c_tkh}
3573 AC_REQUIRE([TEA_PUBLIC_TK_HEADERS])
3574 AC_MSG_CHECKING([for Tk private include files])
3575
3576 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
3577 TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
3578
3579 # Check to see if tk<Plat>Port.h isn't already with the public headers
3580 # Don't look for tkInt.h because that resides with tk.h in the core
3581 # sources, but the <plat>Port headers are in a different directory
3582 if test "${TEA_PLATFORM}" = "windows" -a \
3583 -f "${ac_cv_c_tkh}/tkWinPort.h"; then
3584 result="private headers found with public headers"
3585 elif test "${TEA_PLATFORM}" = "unix" -a \
3586 -f "${ac_cv_c_tkh}/tkUnixPort.h"; then
3587 result="private headers found with public headers"
3588 else
3589 TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
3590 TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
3591 if test "${TEA_PLATFORM}" = "windows"; then
3592 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
3593 else
3594 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
3595 fi
3596 # Overwrite the previous TK_INCLUDES as this should capture both
3597 # public and private headers in the same set.
3598 # We want to ensure these are substituted so as not to require
3599 # any *_NATIVE vars be defined in the Makefile
3600 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
3601 # Detect and add ttk subdir
3602 if test -d "${TK_SRC_DIR}/generic/ttk"; then
3603 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\""
3604 fi
3605 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3606 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_XLIB_DIR_NATIVE}\""
3607 fi
3608 if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3609 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/macosx\""
3610 fi
3611 if test "`uname -s`" = "Darwin"; then
3612 # If Tk was built as a framework, attempt to use
3613 # the framework's Headers and PrivateHeaders directories
3614 case ${TK_DEFS} in
3615 *TK_FRAMEWORK*)
3616 if test -d "${TK_BIN_DIR}/Headers" -a \
3617 -d "${TK_BIN_DIR}/PrivateHeaders"; then
3618 TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"
3619 else
3620 TK_INCLUDES="${TK_INCLUDES} ${TK_INCLUDE_SPEC} `echo "${TK_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3621 fi
3622 ;;
3623 esac
3624 result="Using ${TK_INCLUDES}"
3625 else
3626 if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
3627 AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
3628 fi
3629 result="Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}"
3630 fi
3631 fi
3632
3633 AC_SUBST(TK_TOP_DIR_NATIVE)
3634 AC_SUBST(TK_XLIB_DIR_NATIVE)
3635
3636 AC_SUBST(TK_INCLUDES)
3637 AC_MSG_RESULT([${result}])
3638 ])
3639
3640 #------------------------------------------------------------------------
3641 # TEA_PUBLIC_TK_HEADERS --
3642 #
3643 # Locate the installed public Tk header files
3644 #
3645 # Arguments:
3646 # None.
3647 #
3648 # Requires:
3649 # CYGPATH must be set
3650 #
3651 # Results:
3652 #
3653 # Adds a --with-tkinclude switch to configure.
3654 # Result is cached.
3655 #
3656 # Substitutes the following vars:
3657 # TK_INCLUDES
3658 #------------------------------------------------------------------------
3659
3660 AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
3661 AC_MSG_CHECKING([for Tk public headers])
3662
3663 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files], with_tkinclude=${withval})
3664
3665 AC_CACHE_VAL(ac_cv_c_tkh, [
3666 # Use the value from --with-tkinclude, if it was given
3667
3668 if test x"${with_tkinclude}" != x ; then
3669 if test -f "${with_tkinclude}/tk.h" ; then
3670 ac_cv_c_tkh=${with_tkinclude}
3671 else
3672 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
3673 fi
3674 else
3675 list=""
3676 if test "`uname -s`" = "Darwin"; then
3677 # If Tk was built as a framework, attempt to use
3678 # the framework's Headers directory.
3679 case ${TK_DEFS} in
3680 *TK_FRAMEWORK*)
3681 list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
3682 ;;
3683 esac
3684 fi
3685
3686 # Look in the source dir only if Tk is not installed,
3687 # and in that situation, look there before installed locations.
3688 if test -f "${TK_BIN_DIR}/Makefile" ; then
3689 list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
3690 fi
3691
3692 # Check order: pkg --prefix location, Tk's --prefix location,
3693 # relative to directory of tkConfig.sh, Tcl's --prefix location,
3694 # relative to directory of tclConfig.sh.
3695
3696 eval "temp_includedir=${includedir}"
3697 list="$list \
3698 `ls -d ${temp_includedir} 2>/dev/null` \
3699 `ls -d ${TK_PREFIX}/include 2>/dev/null` \
3700 `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
3701 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3702 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3703 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3704 list="$list /usr/local/include /usr/include"
3705 if test x"${TK_INCLUDE_SPEC}" != x ; then
3706 d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3707 list="$list `ls -d ${d} 2>/dev/null`"
3708 fi
3709 fi
3710 for i in $list ; do
3711 if test -f "$i/tk.h" ; then
3712 ac_cv_c_tkh=$i
3713 break
3714 fi
3715 done
3716 fi
3717 ])
3718
3719 # Print a message based on how we determined the include path
3720
3721 if test x"${ac_cv_c_tkh}" = x ; then
3722 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
3723 else
3724 AC_MSG_RESULT([${ac_cv_c_tkh}])
3725 fi
3726
3727 # Convert to a native path and substitute into the output files.
3728
3729 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
3730
3731 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3732
3733 AC_SUBST(TK_INCLUDES)
3734
3735 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3736 # On Windows and Aqua, we need the X compat headers
3737 AC_MSG_CHECKING([for X11 header files])
3738 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
3739 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
3740 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3741 AC_SUBST(TK_XINCLUDES)
3742 fi
3743 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
3744 fi
3745 ])
3746
3747 #------------------------------------------------------------------------
3748 # TEA_PATH_CONFIG --
3749 #
3750 # Locate the ${1}Config.sh file and perform a sanity check on
3751 # the ${1} compile flags. These are used by packages like
3752 # [incr Tk] that load *Config.sh files from more than Tcl and Tk.
3753 #
3754 # Arguments:
3755 # none
3756 #
3757 # Results:
3758 #
3759 # Adds the following arguments to configure:
3760 # --with-$1=...
3761 #
3762 # Defines the following vars:
3763 # $1_BIN_DIR Full path to the directory containing
3764 # the $1Config.sh file
3765 #------------------------------------------------------------------------
3766
3767 AC_DEFUN([TEA_PATH_CONFIG], [
3768 #
3769 # Ok, lets find the $1 configuration
3770 # First, look for one uninstalled.
3771 # the alternative search directory is invoked by --with-$1
3772 #
3773
3774 if test x"${no_$1}" = x ; then
3775 # we reset no_$1 in case something fails here
3776 no_$1=true
3777 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
3778 AC_MSG_CHECKING([for $1 configuration])
3779 AC_CACHE_VAL(ac_cv_c_$1config,[
3780
3781 # First check to see if --with-$1 was specified.
3782 if test x"${with_$1config}" != x ; then
3783 case ${with_$1config} in
3784 */$1Config.sh )
3785 if test -f ${with_$1config}; then
3786 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
3787 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
3788 fi;;
3789 esac
3790 if test -f "${with_$1config}/$1Config.sh" ; then
3791 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
3792 else
3793 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
3794 fi
3795 fi
3796
3797 # then check for a private $1 installation
3798 if test x"${ac_cv_c_$1config}" = x ; then
3799 for i in \
3800 ../$1 \
3801 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3802 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3803 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3804 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3805 ../../$1 \
3806 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3807 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3808 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3809 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3810 ../../../$1 \
3811 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3812 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3813 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3814 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3815 ${srcdir}/../$1 \
3816 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3817 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3818 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3819 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3820 ; do
3821 if test -f "$i/$1Config.sh" ; then
3822 ac_cv_c_$1config=`(cd $i; pwd)`
3823 break
3824 fi
3825 if test -f "$i/unix/$1Config.sh" ; then
3826 ac_cv_c_$1config=`(cd $i/unix; pwd)`
3827 break
3828 fi
3829 done
3830 fi
3831
3832 # check in a few common install locations
3833 if test x"${ac_cv_c_$1config}" = x ; then
3834 for i in `ls -d ${libdir} 2>/dev/null` \
3835 `ls -d ${exec_prefix}/lib 2>/dev/null` \
3836 `ls -d ${prefix}/lib 2>/dev/null` \
3837 `ls -d /usr/local/lib 2>/dev/null` \
3838 `ls -d /usr/contrib/lib 2>/dev/null` \
3839 `ls -d /usr/pkg/lib 2>/dev/null` \
3840 `ls -d /usr/lib 2>/dev/null` \
3841 `ls -d /usr/lib64 2>/dev/null` \
3842 ; do
3843 if test -f "$i/$1Config.sh" ; then
3844 ac_cv_c_$1config=`(cd $i; pwd)`
3845 break
3846 fi
3847 done
3848 fi
3849 ])
3850
3851 if test x"${ac_cv_c_$1config}" = x ; then
3852 $1_BIN_DIR="# no $1 configs found"
3853 AC_MSG_WARN([Cannot find $1 configuration definitions])
3854 exit 0
3855 else
3856 no_$1=
3857 $1_BIN_DIR=${ac_cv_c_$1config}
3858 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
3859 fi
3860 fi
3861 ])
3862
3863 #------------------------------------------------------------------------
3864 # TEA_LOAD_CONFIG --
3865 #
3866 # Load the $1Config.sh file
3867 #
3868 # Arguments:
3869 #
3870 # Requires the following vars to be set:
3871 # $1_BIN_DIR
3872 #
3873 # Results:
3874 #
3875 # Substitutes the following vars:
3876 # $1_SRC_DIR
3877 # $1_LIB_FILE
3878 # $1_LIB_SPEC
3879 #------------------------------------------------------------------------
3880
3881 AC_DEFUN([TEA_LOAD_CONFIG], [
3882 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
3883
3884 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
3885 AC_MSG_RESULT([loading])
3886 . "${$1_BIN_DIR}/$1Config.sh"
3887 else
3888 AC_MSG_RESULT([file not found])
3889 fi
3890
3891 #
3892 # If the $1_BIN_DIR is the build directory (not the install directory),
3893 # then set the common variable name to the value of the build variables.
3894 # For example, the variable $1_LIB_SPEC will be set to the value
3895 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
3896 # instead of $1_BUILD_LIB_SPEC since it will work with both an
3897 # installed and uninstalled version of Tcl.
3898 #
3899
3900 if test -f "${$1_BIN_DIR}/Makefile" ; then
3901 AC_MSG_WARN([Found Makefile - using build library specs for $1])
3902 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
3903 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
3904 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
3905 $1_INCLUDE_SPEC=${$1_BUILD_INCLUDE_SPEC}
3906 $1_LIBRARY_PATH=${$1_LIBRARY_PATH}
3907 fi
3908
3909 AC_SUBST($1_VERSION)
3910 AC_SUBST($1_BIN_DIR)
3911 AC_SUBST($1_SRC_DIR)
3912
3913 AC_SUBST($1_LIB_FILE)
3914 AC_SUBST($1_LIB_SPEC)
3915
3916 AC_SUBST($1_STUB_LIB_FILE)
3917 AC_SUBST($1_STUB_LIB_SPEC)
3918 AC_SUBST($1_STUB_LIB_PATH)
3919
3920 # Allow the caller to prevent this auto-check by specifying any 2nd arg
3921 AS_IF([test "x$2" = x], [
3922 # Check both upper and lower-case variants
3923 # If a dev wanted non-stubs libs, this function could take an option
3924 # to not use _STUB in the paths below
3925 AS_IF([test "x${$1_STUB_LIB_SPEC}" = x],
3926 [TEA_LOAD_CONFIG_LIB(translit($1,[a-z],[A-Z])_STUB)],
3927 [TEA_LOAD_CONFIG_LIB($1_STUB)])
3928 ])
3929 ])
3930
3931 #------------------------------------------------------------------------
3932 # TEA_LOAD_CONFIG_LIB --
3933 #
3934 # Helper function to load correct library from another extension's
3935 # ${PACKAGE}Config.sh.
3936 #
3937 # Results:
3938 # Adds to LIBS the appropriate extension library
3939 #------------------------------------------------------------------------
3940 AC_DEFUN([TEA_LOAD_CONFIG_LIB], [
3941 AC_MSG_CHECKING([For $1 library for LIBS])
3942 # This simplifies the use of stub libraries by automatically adding
3943 # the stub lib to your path. Normally this would add to SHLIB_LD_LIBS,
3944 # but this is called before CONFIG_CFLAGS. More importantly, this adds
3945 # to PKG_LIBS, which becomes LIBS, and that is only used by SHLIB_LD.
3946 if test "x${$1_LIB_SPEC}" != "x" ; then
3947 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
3948 TEA_ADD_LIBS([\"`${CYGPATH} ${$1_LIB_PATH}`\"])
3949 AC_MSG_RESULT([using $1_LIB_PATH ${$1_LIB_PATH}])
3950 else
3951 TEA_ADD_LIBS([${$1_LIB_SPEC}])
3952 AC_MSG_RESULT([using $1_LIB_SPEC ${$1_LIB_SPEC}])
3953 fi
3954 else
3955 AC_MSG_RESULT([file not found])
3956 fi
3957 ])
3958
3959 #------------------------------------------------------------------------
3960 # TEA_EXPORT_CONFIG --
3961 #
3962 # Define the data to insert into the ${PACKAGE}Config.sh file
3963 #
3964 # Arguments:
3965 #
3966 # Requires the following vars to be set:
3967 # $1
3968 #
3969 # Results:
3970 # Substitutes the following vars:
3971 #------------------------------------------------------------------------
3972
3973 AC_DEFUN([TEA_EXPORT_CONFIG], [
3974 #--------------------------------------------------------------------
3975 # These are for $1Config.sh
3976 #--------------------------------------------------------------------
3977
3978 # pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
3979 eval pkglibdir="[$]{libdir}/$1${PACKAGE_VERSION}"
3980 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
3981 eval $1_LIB_FLAG="-l$1${PACKAGE_VERSION}"
3982 eval $1_STUB_LIB_FLAG="-l$1stub${PACKAGE_VERSION}"
3983 else
3984 eval $1_LIB_FLAG="-l$1`echo ${PACKAGE_VERSION} | tr -d .`"
3985 eval $1_STUB_LIB_FLAG="-l$1stub`echo ${PACKAGE_VERSION} | tr -d .`"
3986 fi
3987 if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" = x; then
3988 eval $1_STUB_LIB_FLAG="-l$1stub"
3989 fi
3990
3991 $1_BUILD_LIB_SPEC="-L`$CYGPATH $(pwd)` ${$1_LIB_FLAG}"
3992 $1_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` ${$1_LIB_FLAG}"
3993 $1_BUILD_STUB_LIB_SPEC="-L`$CYGPATH $(pwd)` [$]{$1_STUB_LIB_FLAG}"
3994 $1_STUB_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` [$]{$1_STUB_LIB_FLAG}"
3995 $1_BUILD_STUB_LIB_PATH="`$CYGPATH $(pwd)`/[$]{PKG_STUB_LIB_FILE}"
3996 $1_STUB_LIB_PATH="`$CYGPATH ${pkglibdir}`/[$]{PKG_STUB_LIB_FILE}"
3997
3998 AC_SUBST($1_BUILD_LIB_SPEC)
3999 AC_SUBST($1_LIB_SPEC)
4000 AC_SUBST($1_BUILD_STUB_LIB_SPEC)
4001 AC_SUBST($1_STUB_LIB_SPEC)
4002 AC_SUBST($1_BUILD_STUB_LIB_PATH)
4003 AC_SUBST($1_STUB_LIB_PATH)
4004
4005 AC_SUBST(MAJOR_VERSION)
4006 AC_SUBST(MINOR_VERSION)
4007 AC_SUBST(PATCHLEVEL)
4008 ])
4009
4010
4011 #------------------------------------------------------------------------
4012 # TEA_INSTALLER --
4013 #
4014 # Configure the installer.
4015 #
4016 # Arguments:
4017 # none
4018 #
4019 # Results:
4020 # Substitutes the following vars:
4021 # INSTALL
4022 # INSTALL_DATA_DIR
4023 # INSTALL_DATA
4024 # INSTALL_PROGRAM
4025 # INSTALL_SCRIPT
4026 # INSTALL_LIBRARY
4027 #------------------------------------------------------------------------
4028
4029 AC_DEFUN([TEA_INSTALLER], [
4030 INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c'
4031 INSTALL_DATA_DIR='${INSTALL} -d -m 755'
4032 INSTALL_DATA='${INSTALL} -m 644'
4033 INSTALL_PROGRAM='${INSTALL} -m 755'
4034 INSTALL_SCRIPT='${INSTALL} -m 755'
4035
4036 TEA_CONFIG_SYSTEM
4037 case $system in
4038 HP-UX-*) INSTALL_LIBRARY='${INSTALL} -m 755' ;;
4039 *) INSTALL_LIBRARY='${INSTALL} -m 644' ;;
4040 esac
4041
4042 AC_SUBST(INSTALL)
4043 AC_SUBST(INSTALL_DATA_DIR)
4044 AC_SUBST(INSTALL_DATA)
4045 AC_SUBST(INSTALL_PROGRAM)
4046 AC_SUBST(INSTALL_SCRIPT)
4047 AC_SUBST(INSTALL_LIBRARY)
4048 ])
4049
4050 ###
4051 # Tip 430 - ZipFS Modifications
4052 ###
4053 #------------------------------------------------------------------------
4054 # TEA_ZIPFS_SUPPORT
4055 # Locate a zip encoder installed on the system path, or none.
4056 #
4057 # Arguments:
4058 # none
4059 #
4060 # Results:
4061 # Substitutes the following vars:
4062 # MACHER_PROG
4063 # ZIP_PROG
4064 # ZIP_PROG_OPTIONS
4065 # ZIP_PROG_VFSSEARCH
4066 # ZIP_INSTALL_OBJS
4067 #------------------------------------------------------------------------
4068
4069 AC_DEFUN([TEA_ZIPFS_SUPPORT], [
4070 MACHER_PROG=""
4071 ZIP_PROG=""
4072 ZIP_PROG_OPTIONS=""
4073 ZIP_PROG_VFSSEARCH=""
4074 ZIP_INSTALL_OBJS=""
4075
4076 AC_MSG_CHECKING([for macher])
4077 AC_CACHE_VAL(ac_cv_path_macher, [
4078 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
4079 for dir in $search_path ; do
4080 for j in `ls -r $dir/macher 2> /dev/null` \
4081 `ls -r $dir/macher 2> /dev/null` ; do
4082 if test x"$ac_cv_path_macher" = x ; then
4083 if test -f "$j" ; then
4084 ac_cv_path_macher=$j
4085 break
4086 fi
4087 fi
4088 done
4089 done
4090 ])
4091 if test -f "$ac_cv_path_macher" ; then
4092 MACHER_PROG="$ac_cv_path_macher"
4093 AC_MSG_RESULT([$MACHER_PROG])
4094 AC_MSG_RESULT([Found macher in environment])
4095 fi
4096 AC_MSG_CHECKING([for zip])
4097 AC_CACHE_VAL(ac_cv_path_zip, [
4098 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
4099 for dir in $search_path ; do
4100 for j in `ls -r $dir/zip 2> /dev/null` \
4101 `ls -r $dir/zip 2> /dev/null` ; do
4102 if test x"$ac_cv_path_zip" = x ; then
4103 if test -f "$j" ; then
4104 ac_cv_path_zip=$j
4105 break
4106 fi
4107 fi
4108 done
4109 done
4110 ])
4111 if test -f "$ac_cv_path_zip" ; then
4112 ZIP_PROG="$ac_cv_path_zip"
4113 AC_MSG_RESULT([$ZIP_PROG])
4114 ZIP_PROG_OPTIONS="-rq"
4115 ZIP_PROG_VFSSEARCH="*"
4116 AC_MSG_RESULT([Found INFO Zip in environment])
4117 # Use standard arguments for zip
4118 else
4119 # It is not an error if an installed version of Zip can't be located.
4120 # We can use the locally distributed minizip instead
4121 ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
4122 ZIP_PROG_OPTIONS="-o -r"
4123 ZIP_PROG_VFSSEARCH="*"
4124 ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
4125 AC_MSG_RESULT([No zip found on PATH. Building minizip])
4126 fi
4127 AC_SUBST(MACHER_PROG)
4128 AC_SUBST(ZIP_PROG)
4129 AC_SUBST(ZIP_PROG_OPTIONS)
4130 AC_SUBST(ZIP_PROG_VFSSEARCH)
4131 AC_SUBST(ZIP_INSTALL_OBJS)
4132 ])
4133
4134 # Local Variables:
4135 # mode: autoconf
4136 # End: