3 # This file provides a set of autoconf macros to help TEA-enable
6 # Copyright (c) 1999-2000 Ajuba Solutions.
7 # Copyright (c) 2002-2005 ActiveState Corporation.
9 # See the file "license.terms" for information on usage and redistribution
10 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 # RCS: @(#) $Id: tcl.m4,v 1.135 2009/04/28 00:40:24 hobbs Exp $
16 dnl TEA extensions pass us the version of TEA they think they
17 dnl are compatible with (must be set in TEA_INIT below)
20 # Possible values for key variables defined:
22 # TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
23 # TEA_PLATFORM - windows unix
26 #------------------------------------------------------------------------
27 # TEA_PATH_TCLCONFIG --
29 # Locate the tclConfig.sh file and perform a sanity check on
30 # the Tcl compile flags
37 # Adds the following arguments to configure:
40 # Defines the following vars:
41 # TCL_BIN_DIR Full path to the directory containing
42 # the tclConfig.sh file
43 #------------------------------------------------------------------------
45 AC_DEFUN([TEA_PATH_TCLCONFIG], [
46 dnl TEA specific: Make sure we are initialized
47 AC_REQUIRE([TEA_INIT])
49 # Ok, lets find the tcl configuration
50 # First, look for one uninstalled.
51 # the alternative search directory is invoked by --with-tcl
54 if test x"${no_tcl}" = x ; then
55 # we reset no_tcl in case something fails here
58 AC_HELP_STRING([--with-tcl],
59 [directory containing tcl configuration (tclConfig.sh)]),
60 with_tclconfig=${withval})
61 AC_MSG_CHECKING([for Tcl configuration])
62 AC_CACHE_VAL(ac_cv_c_tclconfig,[
64 # First check to see if --with-tcl was specified.
65 if test x"${with_tclconfig}" != x ; then
66 case ${with_tclconfig} in
68 if test -f ${with_tclconfig}; then
69 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
70 with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'`
73 if test -f "${with_tclconfig}/tclConfig.sh" ; then
74 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
76 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
80 # then check for a private Tcl installation
81 if test x"${ac_cv_c_tclconfig}" = x ; then
84 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
85 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
86 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
88 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
89 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
90 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
92 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
93 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
94 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
95 if test "${TEA_PLATFORM}" = "windows" \
96 -a -f "$i/win/tclConfig.sh" ; then
97 ac_cv_c_tclconfig=`(cd $i/win; pwd)`
100 if test -f "$i/unix/tclConfig.sh" ; then
101 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
107 # on Darwin, check in Framework installation locations
108 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
109 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
110 `ls -d /Library/Frameworks 2>/dev/null` \
111 `ls -d /Network/Library/Frameworks 2>/dev/null` \
112 `ls -d /System/Library/Frameworks 2>/dev/null` \
114 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
115 ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
121 # TEA specific: on Windows, check in common installation locations
122 if test "${TEA_PLATFORM}" = "windows" \
123 -a x"${ac_cv_c_tclconfig}" = x ; then
124 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
125 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
127 if test -f "$i/tclConfig.sh" ; then
128 ac_cv_c_tclconfig=`(cd $i; pwd)`
134 # check in a few common install locations
135 if test x"${ac_cv_c_tclconfig}" = x ; then
136 for i in `ls -d ${libdir} 2>/dev/null` \
137 `ls -d ${exec_prefix}/lib 2>/dev/null` \
138 `ls -d ${prefix}/lib 2>/dev/null` \
139 `ls -d /usr/local/lib 2>/dev/null` \
140 `ls -d /usr/contrib/lib 2>/dev/null` \
141 `ls -d /usr/lib 2>/dev/null` \
143 if test -f "$i/tclConfig.sh" ; then
144 ac_cv_c_tclconfig=`(cd $i; pwd)`
150 # check in a few other private locations
151 if test x"${ac_cv_c_tclconfig}" = x ; then
154 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
155 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
156 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
157 if test "${TEA_PLATFORM}" = "windows" \
158 -a -f "$i/win/tclConfig.sh" ; then
159 ac_cv_c_tclconfig=`(cd $i/win; pwd)`
162 if test -f "$i/unix/tclConfig.sh" ; then
163 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
170 if test x"${ac_cv_c_tclconfig}" = x ; then
171 TCL_BIN_DIR="# no Tcl configs found"
172 AC_MSG_ERROR([Can't find Tcl configuration definitions])
175 TCL_BIN_DIR=${ac_cv_c_tclconfig}
176 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
181 #------------------------------------------------------------------------
182 # TEA_PATH_TKCONFIG --
184 # Locate the tkConfig.sh file
191 # Adds the following arguments to configure:
194 # Defines the following vars:
195 # TK_BIN_DIR Full path to the directory containing
196 # the tkConfig.sh file
197 #------------------------------------------------------------------------
199 AC_DEFUN([TEA_PATH_TKCONFIG], [
201 # Ok, lets find the tk configuration
202 # First, look for one uninstalled.
203 # the alternative search directory is invoked by --with-tk
206 if test x"${no_tk}" = x ; then
207 # we reset no_tk in case something fails here
210 AC_HELP_STRING([--with-tk],
211 [directory containing tk configuration (tkConfig.sh)]),
212 with_tkconfig=${withval})
213 AC_MSG_CHECKING([for Tk configuration])
214 AC_CACHE_VAL(ac_cv_c_tkconfig,[
216 # First check to see if --with-tkconfig was specified.
217 if test x"${with_tkconfig}" != x ; then
218 case ${with_tkconfig} in
220 if test -f ${with_tkconfig}; then
221 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
222 with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'`
225 if test -f "${with_tkconfig}/tkConfig.sh" ; then
226 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
228 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
232 # then check for a private Tk library
233 if test x"${ac_cv_c_tkconfig}" = x ; then
236 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
237 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
238 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
240 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
241 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
242 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
244 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
245 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
246 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
247 if test "${TEA_PLATFORM}" = "windows" \
248 -a -f "$i/win/tkConfig.sh" ; then
249 ac_cv_c_tkconfig=`(cd $i/win; pwd)`
252 if test -f "$i/unix/tkConfig.sh" ; then
253 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
259 # on Darwin, check in Framework installation locations
260 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
261 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
262 `ls -d /Library/Frameworks 2>/dev/null` \
263 `ls -d /Network/Library/Frameworks 2>/dev/null` \
264 `ls -d /System/Library/Frameworks 2>/dev/null` \
266 if test -f "$i/Tk.framework/tkConfig.sh" ; then
267 ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)`
273 # check in a few common install locations
274 if test x"${ac_cv_c_tkconfig}" = x ; then
275 for i in `ls -d ${libdir} 2>/dev/null` \
276 `ls -d ${exec_prefix}/lib 2>/dev/null` \
277 `ls -d ${prefix}/lib 2>/dev/null` \
278 `ls -d /usr/local/lib 2>/dev/null` \
279 `ls -d /usr/contrib/lib 2>/dev/null` \
280 `ls -d /usr/lib 2>/dev/null` \
282 if test -f "$i/tkConfig.sh" ; then
283 ac_cv_c_tkconfig=`(cd $i; pwd)`
289 # TEA specific: on Windows, check in common installation locations
290 if test "${TEA_PLATFORM}" = "windows" \
291 -a x"${ac_cv_c_tkconfig}" = x ; then
292 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
293 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
295 if test -f "$i/tkConfig.sh" ; then
296 ac_cv_c_tkconfig=`(cd $i; pwd)`
302 # check in a few other private locations
303 if test x"${ac_cv_c_tkconfig}" = x ; then
306 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
307 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
308 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
309 if test "${TEA_PLATFORM}" = "windows" \
310 -a -f "$i/win/tkConfig.sh" ; then
311 ac_cv_c_tkconfig=`(cd $i/win; pwd)`
314 if test -f "$i/unix/tkConfig.sh" ; then
315 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
322 if test x"${ac_cv_c_tkconfig}" = x ; then
323 TK_BIN_DIR="# no Tk configs found"
324 AC_MSG_ERROR([Can't find Tk configuration definitions])
327 TK_BIN_DIR=${ac_cv_c_tkconfig}
328 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
333 #------------------------------------------------------------------------
334 # TEA_LOAD_TCLCONFIG --
336 # Load the tclConfig.sh file
340 # Requires the following vars to be set:
345 # Subst the following vars:
350 #------------------------------------------------------------------------
352 AC_DEFUN([TEA_LOAD_TCLCONFIG], [
353 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
355 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
356 AC_MSG_RESULT([loading])
357 . "${TCL_BIN_DIR}/tclConfig.sh"
359 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
362 # eval is required to do the TCL_DBGX substitution
363 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
364 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
366 # If the TCL_BIN_DIR is the build directory (not the install directory),
367 # then set the common variable name to the value of the build variables.
368 # For example, the variable TCL_LIB_SPEC will be set to the value
369 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
370 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
371 # installed and uninstalled version of Tcl.
372 if test -f "${TCL_BIN_DIR}/Makefile" ; then
373 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
374 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
375 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
376 elif test "`uname -s`" = "Darwin"; then
377 # If Tcl was built as a framework, attempt to use the libraries
378 # from the framework at the given location so that linking works
379 # against Tcl.framework installed in an arbitrary location.
382 if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
383 for i in "`cd ${TCL_BIN_DIR}; pwd`" \
384 "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
385 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
386 TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
391 if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
392 TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
393 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
399 # eval is required to do the TCL_DBGX substitution
400 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
401 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
402 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
403 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
405 AC_SUBST(TCL_VERSION)
406 AC_SUBST(TCL_BIN_DIR)
407 AC_SUBST(TCL_SRC_DIR)
409 AC_SUBST(TCL_LIB_FILE)
410 AC_SUBST(TCL_LIB_FLAG)
411 AC_SUBST(TCL_LIB_SPEC)
413 AC_SUBST(TCL_STUB_LIB_FILE)
414 AC_SUBST(TCL_STUB_LIB_FLAG)
415 AC_SUBST(TCL_STUB_LIB_SPEC)
420 AC_SUBST(TCL_EXTRA_CFLAGS)
421 AC_SUBST(TCL_LD_FLAGS)
422 AC_SUBST(TCL_SHLIB_LD_LIBS)
425 #------------------------------------------------------------------------
426 # TEA_LOAD_TKCONFIG --
428 # Load the tkConfig.sh file
432 # Requires the following vars to be set:
437 # Sets the following vars that should be in tkConfig.sh:
439 #------------------------------------------------------------------------
441 AC_DEFUN([TEA_LOAD_TKCONFIG], [
442 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
444 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
445 AC_MSG_RESULT([loading])
446 . "${TK_BIN_DIR}/tkConfig.sh"
448 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
451 # eval is required to do the TK_DBGX substitution
452 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
453 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
455 # If the TK_BIN_DIR is the build directory (not the install directory),
456 # then set the common variable name to the value of the build variables.
457 # For example, the variable TK_LIB_SPEC will be set to the value
458 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
459 # instead of TK_BUILD_LIB_SPEC since it will work with both an
460 # installed and uninstalled version of Tcl.
461 if test -f "${TK_BIN_DIR}/Makefile" ; then
462 TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
463 TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
464 TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
465 elif test "`uname -s`" = "Darwin"; then
466 # If Tk was built as a framework, attempt to use the libraries
467 # from the framework at the given location so that linking works
468 # against Tk.framework installed in an arbitrary location.
471 if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
472 for i in "`cd ${TK_BIN_DIR}; pwd`" \
473 "`cd ${TK_BIN_DIR}/../..; pwd`"; do
474 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
475 TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}"
480 if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
481 TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
482 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
488 # eval is required to do the TK_DBGX substitution
489 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
490 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
491 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
492 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
494 # TEA specific: Ensure windowingsystem is defined
495 if test "${TEA_PLATFORM}" = "unix" ; then
498 AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
499 TEA_WINDOWINGSYSTEM="aqua"
502 TEA_WINDOWINGSYSTEM="x11"
505 elif test "${TEA_PLATFORM}" = "windows" ; then
506 TEA_WINDOWINGSYSTEM="win32"
513 AC_SUBST(TK_LIB_FILE)
514 AC_SUBST(TK_LIB_FLAG)
515 AC_SUBST(TK_LIB_SPEC)
517 AC_SUBST(TK_STUB_LIB_FILE)
518 AC_SUBST(TK_STUB_LIB_FLAG)
519 AC_SUBST(TK_STUB_LIB_SPEC)
523 AC_SUBST(TK_XINCLUDES)
526 #------------------------------------------------------------------------
528 # Determine the fully qualified path name of the tclsh executable
529 # in the Tcl build directory or the tclsh installed in a bin
530 # directory. This macro will correctly determine the name
531 # of the tclsh executable even if tclsh has not yet been
532 # built in the build directory. The tclsh found is always
533 # associated with a tclConfig.sh file. This tclsh should be used
534 # only for running extension test cases. It should never be
535 # or generation of files (like pkgIndex.tcl) at build time.
541 # Subst's the following values:
543 #------------------------------------------------------------------------
545 AC_DEFUN([TEA_PROG_TCLSH], [
546 AC_MSG_CHECKING([for tclsh])
547 if test -f "${TCL_BIN_DIR}/Makefile" ; then
548 # tclConfig.sh is in Tcl build directory
549 if test "${TEA_PLATFORM}" = "windows"; then
550 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
552 TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
555 # tclConfig.sh is in install location
556 if test "${TEA_PLATFORM}" = "windows"; then
557 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
559 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
561 list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
562 `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
563 `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
565 if test -f "$i/${TCLSH_PROG}" ; then
566 REAL_TCL_BIN_DIR="`cd "$i"; pwd`/"
570 TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}"
572 AC_MSG_RESULT([${TCLSH_PROG}])
576 #------------------------------------------------------------------------
578 # Determine the fully qualified path name of the wish executable
579 # in the Tk build directory or the wish installed in a bin
580 # directory. This macro will correctly determine the name
581 # of the wish executable even if wish has not yet been
582 # built in the build directory. The wish found is always
583 # associated with a tkConfig.sh file. This wish should be used
584 # only for running extension test cases. It should never be
585 # or generation of files (like pkgIndex.tcl) at build time.
591 # Subst's the following values:
593 #------------------------------------------------------------------------
595 AC_DEFUN([TEA_PROG_WISH], [
596 AC_MSG_CHECKING([for wish])
597 if test -f "${TK_BIN_DIR}/Makefile" ; then
598 # tkConfig.sh is in Tk build directory
599 if test "${TEA_PLATFORM}" = "windows"; then
600 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
602 WISH_PROG="${TK_BIN_DIR}/wish"
605 # tkConfig.sh is in install location
606 if test "${TEA_PLATFORM}" = "windows"; then
607 WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
609 WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}"
611 list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
612 `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
613 `ls -d ${TK_PREFIX}/bin 2>/dev/null`"
615 if test -f "$i/${WISH_PROG}" ; then
616 REAL_TK_BIN_DIR="`cd "$i"; pwd`/"
620 WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}"
622 AC_MSG_RESULT([${WISH_PROG}])
626 #------------------------------------------------------------------------
627 # TEA_ENABLE_SHARED --
629 # Allows the building of shared libraries
636 # Adds the following arguments to configure:
637 # --enable-shared=yes|no
639 # Defines the following vars:
640 # STATIC_BUILD Used for building import/export libraries
643 # Sets the following vars:
644 # SHARED_BUILD Value of 1 or 0
645 #------------------------------------------------------------------------
647 AC_DEFUN([TEA_ENABLE_SHARED], [
648 AC_MSG_CHECKING([how to build libraries])
649 AC_ARG_ENABLE(shared,
650 AC_HELP_STRING([--enable-shared],
651 [build and link with shared libraries (default: on)]),
652 [tcl_ok=$enableval], [tcl_ok=yes])
654 if test "${enable_shared+set}" = set; then
655 enableval="$enable_shared"
661 if test "$tcl_ok" = "yes" ; then
662 AC_MSG_RESULT([shared])
665 AC_MSG_RESULT([static])
667 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
669 AC_SUBST(SHARED_BUILD)
672 #------------------------------------------------------------------------
673 # TEA_ENABLE_THREADS --
675 # Specify if thread support should be enabled. If "yes" is specified
676 # as an arg (optional), threads are enabled by default, "no" means
677 # threads are disabled. "yes" is the default.
679 # TCL_THREADS is checked so that if you are compiling an extension
680 # against a threaded core, your extension must be compiled threaded
683 # Note that it is legal to have a thread enabled extension run in a
684 # threaded or non-threaded Tcl core, but a non-threaded extension may
685 # only run in a non-threaded Tcl core.
692 # Adds the following arguments to configure:
695 # Sets the following vars:
696 # THREADS_LIBS Thread library(s)
698 # Defines the following vars:
703 #------------------------------------------------------------------------
705 AC_DEFUN([TEA_ENABLE_THREADS], [
706 AC_ARG_ENABLE(threads,
707 AC_HELP_STRING([--enable-threads],
708 [build with threads]),
709 [tcl_ok=$enableval], [tcl_ok=yes])
711 if test "${enable_threads+set}" = set; then
712 enableval="$enable_threads"
718 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
721 if test "${TEA_PLATFORM}" != "windows" ; then
722 # We are always OK on Windows, so check what this platform wants:
724 # USE_THREAD_ALLOC tells us to try the special thread-based
725 # allocator that significantly reduces lock contention
726 AC_DEFINE(USE_THREAD_ALLOC, 1,
727 [Do we want to use the threaded memory allocator?])
728 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
729 if test "`uname -s`" = "SunOS" ; then
730 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
731 [Do we really want to follow the standard? Yes we do!])
733 AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
734 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
735 if test "$tcl_ok" = "no"; then
736 # Check a little harder for __pthread_mutex_init in the same
737 # library, as some systems hide it there until pthread.h is
738 # defined. We could alternatively do an AC_TRY_COMPILE with
739 # pthread.h, but that will work with libpthread really doesn't
740 # exist, like AIX 4.2. [Bug: 4359]
741 AC_CHECK_LIB(pthread, __pthread_mutex_init,
742 tcl_ok=yes, tcl_ok=no)
745 if test "$tcl_ok" = "yes"; then
746 # The space is needed
747 THREADS_LIBS=" -lpthread"
749 AC_CHECK_LIB(pthreads, pthread_mutex_init,
750 tcl_ok=yes, tcl_ok=no)
751 if test "$tcl_ok" = "yes"; then
752 # The space is needed
753 THREADS_LIBS=" -lpthreads"
755 AC_CHECK_LIB(c, pthread_mutex_init,
756 tcl_ok=yes, tcl_ok=no)
757 if test "$tcl_ok" = "no"; then
758 AC_CHECK_LIB(c_r, pthread_mutex_init,
759 tcl_ok=yes, tcl_ok=no)
760 if test "$tcl_ok" = "yes"; then
761 # The space is needed
762 THREADS_LIBS=" -pthread"
765 AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
774 # Do checking message here to not mess up interleaved configure output
775 AC_MSG_CHECKING([for building with threads])
776 if test "${TCL_THREADS}" = 1; then
777 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
778 AC_MSG_RESULT([yes (default)])
782 # TCL_THREADS sanity checking. See if our request for building with
783 # threads is the same as the way Tcl was built. If not, warn the user.
786 if test "${TCL_THREADS}" = "0"; then
788 Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
789 that IS thread-enabled. It is recommended to use --enable-threads.])
793 if test "${TCL_THREADS}" = "1"; then
795 --enable-threads requested, but building against a Tcl that is NOT
796 thread-enabled. This is an OK configuration that will also run in
797 a thread-enabled core.])
801 AC_SUBST(TCL_THREADS)
804 #------------------------------------------------------------------------
805 # TEA_ENABLE_SYMBOLS --
807 # Specify if debugging symbols should be used.
808 # Memory (TCL_MEM_DEBUG) debugging can also be enabled.
813 # TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
814 # the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
815 # Requires the following vars to be set in the Makefile:
821 # Adds the following arguments to configure:
824 # Defines the following vars:
825 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
826 # Sets to $(CFLAGS_OPTIMIZE) if false
827 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
828 # Sets to $(LDFLAGS_OPTIMIZE) if false
829 # DBGX Formerly used as debug library extension;
832 #------------------------------------------------------------------------
834 AC_DEFUN([TEA_ENABLE_SYMBOLS], [
835 dnl TEA specific: Make sure we are initialized
836 AC_REQUIRE([TEA_CONFIG_CFLAGS])
837 AC_MSG_CHECKING([for build with symbols])
838 AC_ARG_ENABLE(symbols,
839 AC_HELP_STRING([--enable-symbols],
840 [build with debugging symbols (default: off)]),
841 [tcl_ok=$enableval], [tcl_ok=no])
843 if test "$tcl_ok" = "no"; then
844 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
845 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
848 CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
849 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
850 if test "$tcl_ok" = "yes"; then
851 AC_MSG_RESULT([yes (standard debugging)])
855 if test "${TEA_PLATFORM}" != "windows" ; then
856 LDFLAGS_DEFAULT="${LDFLAGS}"
858 AC_SUBST(CFLAGS_DEFAULT)
859 AC_SUBST(LDFLAGS_DEFAULT)
862 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
863 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
866 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
867 if test "$tcl_ok" = "all"; then
868 AC_MSG_RESULT([enabled symbols mem debugging])
870 AC_MSG_RESULT([enabled $tcl_ok debugging])
875 #------------------------------------------------------------------------
876 # TEA_ENABLE_LANGINFO --
878 # Allows use of modern nl_langinfo check for better l10n.
879 # This is only relevant for Unix.
886 # Adds the following arguments to configure:
887 # --enable-langinfo=yes|no (default is yes)
889 # Defines the following vars:
890 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
892 #------------------------------------------------------------------------
894 AC_DEFUN([TEA_ENABLE_LANGINFO], [
895 AC_ARG_ENABLE(langinfo,
896 AC_HELP_STRING([--enable-langinfo],
897 [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
898 [langinfo_ok=$enableval], [langinfo_ok=yes])
901 if test "$langinfo_ok" = "yes"; then
902 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
904 AC_MSG_CHECKING([whether to use nl_langinfo])
905 if test "$langinfo_ok" = "yes"; then
906 AC_CACHE_VAL(tcl_cv_langinfo_h, [
907 AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
908 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
909 AC_MSG_RESULT([$tcl_cv_langinfo_h])
910 if test $tcl_cv_langinfo_h = yes; then
911 AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
914 AC_MSG_RESULT([$langinfo_ok])
918 #--------------------------------------------------------------------
921 # Determine what the system is (some things cannot be easily checked
922 # on a feature-driven basis, alas). This can usually be done via the
923 # "uname" command, but there are a few systems, like Next, where
930 # Defines the following var:
932 # system - System/platform/version identification code.
934 #--------------------------------------------------------------------
936 AC_DEFUN([TEA_CONFIG_SYSTEM], [
937 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
939 if test "${TEA_PLATFORM}" = "windows" ; then
940 tcl_cv_sys_version=windows
941 elif test -f /usr/lib/NextStep/software_version; then
942 tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
944 tcl_cv_sys_version=`uname -s`-`uname -r`
945 if test "$?" -ne 0 ; then
946 AC_MSG_WARN([can't find uname command])
947 tcl_cv_sys_version=unknown
949 # Special check for weird MP-RAS system (uname returns weird
950 # results, and the version is kept in special file).
952 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
953 tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
955 if test "`uname -s`" = "AIX" ; then
956 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
961 system=$tcl_cv_sys_version
964 #--------------------------------------------------------------------
967 # Try to determine the proper flags to pass to the compiler
968 # for building shared libraries and other such nonsense.
975 # Defines and substitutes the following vars:
977 # DL_OBJS - Name of the object file that implements dynamic
978 # loading for Tcl on this system.
979 # DL_LIBS - Library file(s) to include in tclsh and other base
980 # applications in order for the "load" command to work.
981 # LDFLAGS - Flags to pass to the compiler when linking object
982 # files into an executable application binary such
984 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
985 # that tell the run-time dynamic linker where to look
986 # for shared libraries such as libtcl.so. Depends on
987 # the variable LIB_RUNTIME_DIR in the Makefile. Could
988 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
989 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
990 # that tell the run-time dynamic linker where to look
991 # for shared libraries such as libtcl.so. Depends on
992 # the variable LIB_RUNTIME_DIR in the Makefile.
993 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
994 # of a shared library (may request position-independent
995 # code, among other things).
996 # SHLIB_LD - Base command to use for combining object files
997 # into a shared library.
998 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
999 # creating shared libraries. This symbol typically
1000 # goes at the end of the "ld" commands that build
1001 # shared libraries. The value of the symbol is
1002 # "${LIBS}" if all of the dependent libraries should
1003 # be specified when creating a shared library. If
1004 # dependent libraries should not be specified (as on
1005 # SunOS 4.x, where they cause the link to fail, or in
1006 # general if Tcl and Tk aren't themselves shared
1007 # libraries), then this symbol has an empty string
1009 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
1010 # extensions. An empty string means we don't know how
1011 # to use shared libraries on this platform.
1012 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
1013 # in a static or shared library name, using the $VERSION variable
1014 # to put the version in the right place. This is used
1015 # by platforms that need non-standard library names.
1016 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
1017 # to have a version after the .so, and ${VERSION}.a
1018 # on AIX, since a shared library needs to have
1019 # a .a extension whereas shared objects for loadable
1020 # extensions have a .so extension. Defaults to
1021 # ${VERSION}${SHLIB_SUFFIX}.
1022 # TCL_NEEDS_EXP_FILE -
1023 # 1 means that an export file is needed to link to a
1025 # TCL_EXP_FILE - The name of the installed export / import file which
1026 # should be used to link to the Tcl shared library.
1027 # Empty if Tcl is unshared.
1028 # TCL_BUILD_EXP_FILE -
1029 # The name of the built export / import file which
1030 # should be used to link to the Tcl shared library.
1031 # Empty if Tcl is unshared.
1033 # Flags used when running the compiler in debug mode
1035 # Flags used when running the compiler in optimize mode
1036 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
1038 #--------------------------------------------------------------------
1040 AC_DEFUN([TEA_CONFIG_CFLAGS], [
1041 dnl TEA specific: Make sure we are initialized
1042 AC_REQUIRE([TEA_INIT])
1044 # Step 0.a: Enable 64 bit support?
1046 AC_MSG_CHECKING([if 64bit support is requested])
1047 AC_ARG_ENABLE(64bit,
1048 AC_HELP_STRING([--enable-64bit],
1049 [enable 64bit support (default: off)]),
1050 [do64bit=$enableval], [do64bit=no])
1051 AC_MSG_RESULT([$do64bit])
1053 # Step 0.b: Enable Solaris 64 bit VIS support?
1055 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1056 AC_ARG_ENABLE(64bit-vis,
1057 AC_HELP_STRING([--enable-64bit-vis],
1058 [enable 64bit Sparc VIS support (default: off)]),
1059 [do64bitVIS=$enableval], [do64bitVIS=no])
1060 AC_MSG_RESULT([$do64bitVIS])
1061 # Force 64bit on with VIS
1062 AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
1064 # Step 0.c: Check if visibility support is available. Do this here so
1065 # that platform specific alternatives can be used below if this fails.
1067 AC_CACHE_CHECK([if compiler supports visibility "hidden"],
1068 tcl_cv_cc_visibility_hidden, [
1069 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
1071 extern __attribute__((__visibility__("hidden"))) void f(void);
1072 void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes,
1073 tcl_cv_cc_visibility_hidden=no)
1074 CFLAGS=$hold_cflags])
1075 AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
1076 AC_DEFINE(MODULE_SCOPE,
1077 [extern __attribute__((__visibility__("hidden")))],
1078 [Compiler support for module scope symbols])
1081 # Step 0.d: Disable -rpath support?
1083 AC_MSG_CHECKING([if rpath support is requested])
1084 AC_ARG_ENABLE(rpath,
1085 AC_HELP_STRING([--disable-rpath],
1086 [disable rpath support (default: on)]),
1087 [doRpath=$enableval], [doRpath=yes])
1088 AC_MSG_RESULT([$doRpath])
1090 # TEA specific: Cross-compiling options for Windows/CE builds?
1092 AS_IF([test "${TEA_PLATFORM}" = windows], [
1093 AC_MSG_CHECKING([if Windows/CE build is requested])
1094 AC_ARG_ENABLE(wince,
1095 AC_HELP_STRING([--enable-wince],
1096 [enable Win/CE support (where applicable)]),
1097 [doWince=$enableval], [doWince=no])
1098 AC_MSG_RESULT([$doWince])
1101 # Step 1: set the variable "system" to hold the name and version number
1106 # Step 2: check for existence of -ldl library. This is needed because
1107 # Linux can use either -ldl or -ldld for dynamic loading.
1109 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
1111 # Require ranlib early so we can override it in special cases below.
1113 AC_REQUIRE([AC_PROG_RANLIB])
1115 # Step 3: set configuration options based on system name and version.
1116 # This is similar to Tcl's unix/tcl.m4 except that we've added a
1120 LDFLAGS_ORIG="$LDFLAGS"
1121 # When ld needs options to work in 64-bit mode, put them in
1122 # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
1123 # is disabled by the user. [Bug 1016796]
1125 TCL_EXPORT_FILE_SUFFIX=""
1126 UNSHARED_LIB_SUFFIX=""
1127 # TEA specific: use PACKAGE_VERSION instead of VERSION
1128 TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
1129 ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
1130 TCL_LIB_VERSIONS_OK=ok
1133 AS_IF([test "$GCC" = yes], [
1136 CFLAGS_WARNING="-Wall"
1137 ], [CFLAGS_WARNING=""])
1138 TCL_NEEDS_EXP_FILE=0
1139 TCL_BUILD_EXP_FILE=""
1141 dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
1142 dnl AC_CHECK_TOOL(AR, ar)
1143 AC_CHECK_PROG(AR, ar, ar)
1145 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1146 AS_IF([test "x$SHLIB_VERSION" = x],[SHLIB_VERSION="1.0"])
1150 # This is a 2-stage check to make sure we have the 64-bit SDK
1151 # We have to know where the SDK is installed.
1152 # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
1153 # MACHINE is IX86 for LINK, but this is used by the manifest,
1154 # which requires x86|amd64|ia64.
1156 if test "$do64bit" != "no" ; then
1157 if test "x${MSSDK}x" = "xx" ; then
1158 MSSDK="C:/Progra~1/Microsoft Platform SDK"
1160 MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
1164 MACHINE="AMD64" ; # default to AMD64 64-bit build
1165 PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
1169 PATH64="${MSSDK}/Bin/Win64"
1172 if test ! -d "${PATH64}" ; then
1173 AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode])
1174 AC_MSG_WARN([Ensure latest Platform SDK is installed])
1177 AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
1182 if test "$doWince" != "no" ; then
1183 if test "$do64bit" != "no" ; then
1184 AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible])
1186 if test "$GCC" = "yes" ; then
1187 AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
1190 # Set defaults for common evc4/PPC2003 setup
1191 # Currently Tcl requires 300+, possibly 420+ for sockets
1192 CEVERSION=420; # could be 211 300 301 400 420 ...
1193 TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
1194 ARCH=ARM; # could be ARM MIPS X86EM ...
1195 PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
1196 if test "$doWince" != "yes"; then
1197 # If !yes then the user specified something
1198 # Reset ARCH to allow user to skip specifying it
1200 eval `echo $doWince | awk -F, '{ \
1201 if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
1202 if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
1203 if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
1204 if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
1205 if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
1207 if test "x${ARCH}" = "x" ; then
1211 OSVERSION=WCE$CEVERSION;
1212 if test "x${WCEROOT}" = "x" ; then
1213 WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
1214 if test ! -d "${WCEROOT}" ; then
1215 WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
1218 if test "x${SDKROOT}" = "x" ; then
1219 SDKROOT="C:/Program Files/Windows CE Tools"
1220 if test ! -d "${SDKROOT}" ; then
1221 SDKROOT="C:/Windows CE Tools"
1224 WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
1225 SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
1226 if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
1227 -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
1228 AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
1231 # We could PATH_NOSPACE these, but that's not important,
1232 # as long as we quote them when used.
1233 CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
1234 if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
1235 CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
1237 CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
1241 if test "$GCC" != "yes" ; then
1242 if test "${SHARED_BUILD}" = "0" ; then
1248 if test "$do64bit" != "no" ; then
1249 # All this magic is necessary for the Win64 SDK RC1 - hobbs
1250 CC="\"${PATH64}/cl.exe\""
1251 CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
1252 RC="\"${MSSDK}/bin/rc.exe\""
1253 lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
1254 LINKBIN="\"${PATH64}/link.exe\""
1255 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
1256 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1257 # Avoid 'unresolved external symbol __security_cookie'
1258 # errors, c.f. http://support.microsoft.com/?id=894573
1259 TEA_ADD_LIBS([bufferoverflowU.lib])
1260 elif test "$doWince" != "no" ; then
1261 CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
1262 if test "${TARGETCPU}" = "X86"; then
1263 CC="\"${CEBINROOT}/cl.exe\""
1265 CC="\"${CEBINROOT}/cl${ARCH}.exe\""
1267 CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
1268 RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
1269 arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
1270 defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
1271 if test "${SHARED_BUILD}" = "1" ; then
1272 # Static CE builds require static celib as well
1276 AC_DEFINE_UNQUOTED($i, 1, [WinCE def ]$i)
1278 AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION, [_WIN32_WCE version])
1279 AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION, [UNDER_CE version])
1280 CFLAGS_DEBUG="-nologo -Zi -Od"
1281 CFLAGS_OPTIMIZE="-nologo -Ox"
1282 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
1283 lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
1284 LINKBIN="\"${CEBINROOT}/link.exe\""
1290 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
1291 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1295 if test "$GCC" = "yes"; then
1299 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1300 SHLIB_LD="$CC -shared"
1301 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1302 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
1303 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
1305 SHLIB_LD="${LINKBIN} -dll ${lflags}"
1306 # link -lib only works when -lib is the first arg
1307 STLIB_LD="${LINKBIN} -lib ${lflags}"
1308 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
1310 # For information on what debugtype is most useful, see:
1311 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
1313 # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx
1314 # This essentially turns it all on.
1315 LDFLAGS_DEBUG="-debug -debugtype:cv"
1316 LDFLAGS_OPTIMIZE="-release"
1317 if test "$doWince" != "no" ; then
1318 LDFLAGS_CONSOLE="-link ${lflags}"
1319 LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
1321 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
1322 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
1326 SHLIB_LD_LIBS='${LIBS}'
1328 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
1330 TCL_LIB_VERSIONS_OK=nodots
1331 # Bogus to avoid getting this turned off
1332 DL_OBJS="tclLoadNone.obj"
1335 AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
1336 # AIX requires the _r compiler when gcc isn't being used
1342 # Make sure only first arg gets _r
1343 CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
1346 AC_MSG_RESULT([Using $CC for compiling with threads])
1350 SHLIB_LD_LIBS='${LIBS}'
1353 DL_OBJS="tclLoadDl.o"
1354 LD_LIBRARY_PATH_VAR="LIBPATH"
1356 # Check to enable 64-bit flags for compiler/linker on AIX 4+
1357 AS_IF([test "$do64bit" = yes -a "`uname -v`" -gt 3], [
1358 AS_IF([test "$GCC" = yes], [
1359 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1362 CFLAGS="$CFLAGS -q64"
1364 RANLIB="${RANLIB} -X64"
1366 SHLIB_LD_FLAGS="-b64"
1370 AS_IF([test "`uname -m`" = ia64], [
1371 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1372 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1373 # AIX-5 has dl* in libc.so
1375 AS_IF([test "$GCC" = yes], [
1376 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1378 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1380 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1382 AS_IF([test "$GCC" = yes], [SHLIB_LD='${CC} -shared'], [
1383 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
1385 SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1387 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1388 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1389 TCL_NEEDS_EXP_FILE=1
1390 # TEA specific: use PACKAGE_VERSION instead of VERSION
1391 TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp'
1394 # AIX v<=4.1 has some different flags than 4.2+
1395 AS_IF([test "$system" = "AIX-4.1" -o "`uname -v`" -lt 4], [
1396 AC_LIBOBJ([tclLoadAix])
1400 # On AIX <=v4 systems, libbsd.a has to be linked in to support
1401 # non-blocking file IO. This library has to be linked in after
1402 # the MATH_LIBS or it breaks the pow() function. The way to
1403 # insure proper sequencing, is to add it to the tail of MATH_LIBS.
1404 # This library also supplies gettimeofday.
1406 # AIX does not have a timezone field in struct tm. When the AIX
1407 # bsd library is used, the timezone global and the gettimeofday
1408 # methods are to be avoided for timezone deduction instead, we
1409 # deduce the timezone by comparing the localtime result on a
1412 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
1413 AS_IF([test $libbsd = yes], [
1414 MATH_LIBS="$MATH_LIBS -lbsd"
1415 AC_DEFINE(USE_DELTA_FOR_TZ, 1, [Do we need a special AIX hack for timezones?])
1419 SHLIB_CFLAGS="-fPIC"
1420 SHLIB_LD='${CC} -nostart'
1421 SHLIB_LD_LIBS='${LIBS}'
1423 DL_OBJS="tclLoadDl.o"
1426 #-----------------------------------------------------------
1427 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1428 # -lsocket, even if the network functions are in -lnet which
1429 # is always linked to, for compatibility.
1430 #-----------------------------------------------------------
1431 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1433 BSD/OS-2.1*|BSD/OS-3*)
1435 SHLIB_LD="shlicc -r"
1436 SHLIB_LD_LIBS='${LIBS}'
1438 DL_OBJS="tclLoadDl.o"
1444 SHLIB_CFLAGS="-export-dynamic -fPIC"
1445 SHLIB_LD='${CC} -shared'
1446 SHLIB_LD_LIBS='${LIBS}'
1448 DL_OBJS="tclLoadDl.o"
1450 LDFLAGS="$LDFLAGS -export-dynamic"
1455 SHLIB_CFLAGS="-K PIC"
1459 DL_OBJS="tclLoadDl.o"
1465 # Use updated header definitions where possible
1466 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1467 # TEA specific: Needed by Tcl, but not most extensions
1468 #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1469 #LIBS="$LIBS -lxnet" # Use the XOPEN network library
1471 AS_IF([test "`uname -m`" = ia64], [
1473 # Use newer C++ library for C++ extensions
1474 #if test "$GCC" != "yes" ; then
1480 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1481 AS_IF([test "$tcl_ok" = yes], [
1482 SHLIB_LD_LIBS='${LIBS}'
1483 DL_OBJS="tclLoadShl.o"
1485 LDFLAGS="$LDFLAGS -E"
1486 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1487 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1488 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1490 AS_IF([test "$GCC" = yes], [
1491 SHLIB_LD='${CC} -shared'
1492 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1495 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1496 #CFLAGS="$CFLAGS +DAportable"
1501 # Check to enable 64-bit flags for compiler/linker
1502 AS_IF([test "$do64bit" = "yes"], [
1503 AS_IF([test "$GCC" = yes], [
1504 case `${CC} -dumpmachine` in
1506 # 64-bit gcc in use. Fix flags for GNU ld.
1508 SHLIB_LD='${CC} -shared'
1509 SHLIB_LD_LIBS='${LIBS}'
1510 AS_IF([test $doRpath = yes], [
1511 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1512 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1515 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1520 CFLAGS="$CFLAGS +DD64"
1521 LDFLAGS_ARCH="+DD64"
1524 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1526 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1527 AS_IF([test "$tcl_ok" = yes], [
1531 DL_OBJS="tclLoadShl.o"
1533 LDFLAGS="$LDFLAGS -Wl,-E"
1534 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1535 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1536 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1540 SHLIB_LD="ld -shared -rdata_shared"
1541 SHLIB_LD_LIBS='${LIBS}'
1543 DL_OBJS="tclLoadDl.o"
1545 AS_IF([test $doRpath = yes], [
1546 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1547 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1551 SHLIB_LD="ld -n32 -shared -rdata_shared"
1552 SHLIB_LD_LIBS='${LIBS}'
1554 DL_OBJS="tclLoadDl.o"
1556 AS_IF([test $doRpath = yes], [
1557 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1558 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1559 AS_IF([test "$GCC" = yes], [
1560 CFLAGS="$CFLAGS -mabi=n32"
1561 LDFLAGS="$LDFLAGS -mabi=n32"
1565 # Use to build 6.2 compatible binaries on 6.3.
1566 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1569 CFLAGS="$CFLAGS -n32"
1572 LDFLAGS="$LDFLAGS -n32"
1577 SHLIB_LD="ld -n32 -shared -rdata_shared"
1578 SHLIB_LD_LIBS='${LIBS}'
1580 DL_OBJS="tclLoadDl.o"
1582 AS_IF([test $doRpath = yes], [
1583 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1584 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1586 # Check to enable 64-bit flags for compiler/linker
1588 AS_IF([test "$do64bit" = yes], [
1589 AS_IF([test "$GCC" = yes], [
1590 AC_MSG_WARN([64bit mode not supported by gcc])
1593 SHLIB_LD="ld -64 -shared -rdata_shared"
1594 CFLAGS="$CFLAGS -64"
1600 SHLIB_CFLAGS="-fPIC"
1601 SHLIB_LD_LIBS='${LIBS}'
1605 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1606 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1607 # when you inline the string and math operations. Turn this off to
1608 # get rid of the warnings.
1609 #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1611 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1612 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}'
1613 DL_OBJS="tclLoadDl.o"
1615 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1616 AS_IF([test $doRpath = yes], [
1617 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1618 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1619 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1620 AS_IF([test $do64bit = yes], [
1621 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1623 CFLAGS="$CFLAGS -m64"
1624 AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
1625 CFLAGS=$hold_cflags])
1626 AS_IF([test $tcl_cv_cc_m64 = yes], [
1627 CFLAGS="$CFLAGS -m64"
1632 # The combo of gcc + glibc has a bug related to inlining of
1633 # functions like strtod(). The -fno-builtin flag should address
1634 # this problem but it does not work. The -fno-inline flag is kind
1635 # of overkill but it works. Disable inlining only when one of the
1636 # files in compat/*.c is being linked in.
1638 AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1642 SHLIB_CFLAGS="-fPIC"
1643 SHLIB_LD_LIBS='${LIBS}'
1646 SHLIB_LD='${CC} -shared'
1649 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1652 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1655 SHLIB_CFLAGS="-fPIC"
1656 SHLIB_LD_LIBS='${LIBS}'
1659 SHLIB_LD='${CC} -shared'
1660 DL_OBJS="tclLoadDl.o"
1661 DL_LIBS="-mshared -ldl"
1662 LD_FLAGS="-Wl,--export-dynamic"
1663 AS_IF([test $doRpath = yes], [
1664 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1665 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1668 SHLIB_CFLAGS="-K PIC"
1672 DL_OBJS="tclLoadDl.o"
1678 SHLIB_CFLAGS="-K PIC"
1682 DL_OBJS="tclLoadDl.o"
1684 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1688 NetBSD-1.*|FreeBSD-[[1-2]].*)
1689 SHLIB_CFLAGS="-fPIC"
1690 SHLIB_LD="ld -Bshareable -x"
1691 SHLIB_LD_LIBS='${LIBS}'
1693 DL_OBJS="tclLoadDl.o"
1695 AS_IF([test $doRpath = yes], [
1696 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1697 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1698 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1703 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1704 AS_IF([test $tcl_cv_ld_elf = yes], [
1705 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1707 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
1710 # Ancient FreeBSD doesn't handle version numbers with dots.
1712 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1713 TCL_LIB_VERSIONS_OK=nodots
1716 SHLIB_CFLAGS="-fPIC"
1717 SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1718 SHLIB_LD_LIBS='${LIBS}'
1720 DL_OBJS="tclLoadDl.o"
1722 AS_IF([test $doRpath = yes], [
1723 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1724 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1725 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
1726 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1731 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1732 AS_IF([test $tcl_cv_ld_elf = yes], [
1733 LDFLAGS=-Wl,-export-dynamic
1736 # OpenBSD doesn't do version numbers with dots.
1737 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1738 TCL_LIB_VERSIONS_OK=nodots
1741 # FreeBSD 3.* and greater have ELF.
1742 # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs
1743 SHLIB_CFLAGS="-fPIC"
1744 SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1745 SHLIB_LD_LIBS='${LIBS}'
1747 DL_OBJS="tclLoadDl.o"
1749 LDFLAGS="$LDFLAGS -export-dynamic"
1750 AS_IF([test $doRpath = yes], [
1751 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1752 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1753 AS_IF([test "${TCL_THREADS}" = "1"], [
1754 # The -pthread needs to go in the CFLAGS, not LIBS
1755 LIBS=`echo $LIBS | sed s/-pthread//`
1756 CFLAGS="$CFLAGS -pthread"
1757 LDFLAGS="$LDFLAGS -pthread"
1761 # FreeBSD-3 doesn't handle version numbers with dots.
1762 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1763 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1764 TCL_LIB_VERSIONS_OK=nodots
1769 CFLAGS_OPTIMIZE="-Os"
1770 SHLIB_CFLAGS="-fno-common"
1771 # To avoid discrepancies between what headers configure sees during
1772 # preprocessing tests and compiling tests, move any -isysroot and
1773 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1774 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1775 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1776 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1777 CFLAGS="`echo " ${CFLAGS}" | \
1778 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1779 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1780 AS_IF([test $do64bit = yes], [
1783 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1784 tcl_cv_cc_arch_ppc64, [
1786 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1787 AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
1788 tcl_cv_cc_arch_ppc64=no)
1789 CFLAGS=$hold_cflags])
1790 AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1791 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1795 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1796 tcl_cv_cc_arch_x86_64, [
1798 CFLAGS="$CFLAGS -arch x86_64"
1799 AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
1800 tcl_cv_cc_arch_x86_64=no)
1801 CFLAGS=$hold_cflags])
1802 AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1803 CFLAGS="$CFLAGS -arch x86_64"
1807 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1810 # Check for combined 32-bit and 64-bit fat build
1811 AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
1812 && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1815 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1816 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
1817 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1818 hold_ldflags=$LDFLAGS
1819 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1820 AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
1821 LDFLAGS=$hold_ldflags])
1822 AS_IF([test $tcl_cv_ld_single_module = yes], [
1823 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1825 # TEA specific: link shlib with current and compatiblity version flags
1826 vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
1827 SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
1828 SHLIB_LD_LIBS='${LIBS}'
1829 SHLIB_SUFFIX=".dylib"
1830 DL_OBJS="tclLoadDyld.o"
1832 # Don't use -prebind when building for Mac OS X 10.4 or later only:
1833 AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
1834 "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
1835 LDFLAGS="$LDFLAGS -prebind"])
1836 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1837 AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1838 tcl_cv_ld_search_paths_first, [
1839 hold_ldflags=$LDFLAGS
1840 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1841 AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes,
1842 tcl_cv_ld_search_paths_first=no)
1843 LDFLAGS=$hold_ldflags])
1844 AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1845 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1847 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1848 AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1849 [Compiler support for module scope symbols])
1853 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1854 # TEA specific: for combined 32 & 64 bit fat builds of Tk
1855 # extensions, verify that 64-bit build is possible.
1856 AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [
1857 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [
1858 AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
1859 for v in CFLAGS CPPFLAGS LDFLAGS; do
1860 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1862 CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
1863 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
1864 AC_TRY_LINK([#include <X11/Xlib.h>], [XrmInitialize();],
1865 tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no)
1866 for v in CFLAGS CPPFLAGS LDFLAGS; do
1867 eval $v'="$hold_'$v'"'
1870 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua], [
1871 AC_CACHE_CHECK([for 64-bit Tk], tcl_cv_lib_tk_64, [
1872 for v in CFLAGS CPPFLAGS LDFLAGS; do
1873 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1875 CPPFLAGS="$CPPFLAGS -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}"
1876 LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
1877 AC_TRY_LINK([#include <tk.h>], [Tk_InitStubs(NULL, "", 0);],
1878 tcl_cv_lib_tk_64=yes, tcl_cv_lib_tk_64=no)
1879 for v in CFLAGS CPPFLAGS LDFLAGS; do
1880 eval $v'="$hold_'$v'"'
1883 # remove 64-bit arch flags from CFLAGS et al. if configuration
1884 # does not support 64-bit.
1885 AS_IF([test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no], [
1886 AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
1887 for v in CFLAGS CPPFLAGS LDFLAGS; do
1888 eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1894 SHLIB_LD='${CC} -nostdlib -r'
1897 DL_OBJS="tclLoadNext.o"
1903 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1904 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1905 [Should OS/390 do the right thing with sockets?])
1907 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1908 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1910 # Hack: make package name same as library name
1911 SHLIB_LD='ld -R -export $@:'
1914 DL_OBJS="tclLoadOSF.o"
1920 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1921 SHLIB_CFLAGS="-fPIC"
1922 AS_IF([test "$SHARED_BUILD" = 1], [SHLIB_LD="ld -shared"], [
1923 SHLIB_LD="ld -non_shared"
1927 DL_OBJS="tclLoadDl.o"
1935 AS_IF([test "$SHARED_BUILD" = 1], [
1936 SHLIB_LD='ld -shared -expect_unresolved "*"'
1938 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1942 DL_OBJS="tclLoadDl.o"
1944 AS_IF([test $doRpath = yes], [
1945 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1946 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1947 AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1948 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1949 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1950 AS_IF([test "${TCL_THREADS}" = 1], [
1951 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1952 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1953 LIBS=`echo $LIBS | sed s/-lpthreads//`
1954 AS_IF([test "$GCC" = yes], [
1955 LIBS="$LIBS -lpthread -lmach -lexc"
1957 CFLAGS="$CFLAGS -pthread"
1958 LDFLAGS="$LDFLAGS -pthread"
1964 # This may work for all QNX, but it was only reported for v6.
1965 SHLIB_CFLAGS="-fPIC"
1966 SHLIB_LD="ld -Bshareable -x"
1969 DL_OBJS="tclLoadDl.o"
1970 # dlopen is in -lc on QNX
1976 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1977 # this test works, since "uname -s" was non-standard in 3.2.4 and
1979 AS_IF([test "$GCC" = yes], [
1980 SHLIB_CFLAGS="-fPIC -melf"
1981 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1983 SHLIB_CFLAGS="-Kpic -belf"
1984 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1989 DL_OBJS="tclLoadDl.o"
1995 SHLIB_CFLAGS="-K PIC"
1999 DL_OBJS="tclLoadDl.o"
2009 DL_OBJS="tclLoadDl.o"
2011 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
2012 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
2014 # SunOS can't handle version numbers with dots in them in library
2015 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
2016 # requires an extra version number at the end of .so file names.
2017 # So, the library has to have a name like libtcl75.so.1.0
2019 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
2020 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
2021 TCL_LIB_VERSIONS_OK=nodots
2024 # Careful to not let 5.10+ fall into this case
2026 # Note: If _REENTRANT isn't defined, then Solaris
2027 # won't define thread-safe library routines.
2029 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
2030 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
2031 [Do we really want to follow the standard? Yes we do!])
2033 SHLIB_CFLAGS="-KPIC"
2035 # Note: need the LIBS below, otherwise Tk won't find Tcl's
2036 # symbols when dynamically loaded into tclsh.
2038 SHLIB_LD_LIBS='${LIBS}'
2040 DL_OBJS="tclLoadDl.o"
2042 AS_IF([test "$GCC" = yes], [
2043 SHLIB_LD='${CC} -shared'
2044 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
2045 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
2047 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
2048 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
2049 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
2053 # Note: If _REENTRANT isn't defined, then Solaris
2054 # won't define thread-safe library routines.
2056 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
2057 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
2058 [Do we really want to follow the standard? Yes we do!])
2060 SHLIB_CFLAGS="-KPIC"
2062 # Check to enable 64-bit flags for compiler/linker
2063 AS_IF([test "$do64bit" = yes], [
2065 AS_IF([test "$arch" = "sparcv9 sparc"], [
2066 AS_IF([test "$GCC" = yes], [
2067 AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
2068 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
2071 CFLAGS="$CFLAGS -m64 -mcpu=v9"
2072 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
2073 SHLIB_CFLAGS="-fPIC"
2077 AS_IF([test "$do64bitVIS" = yes], [
2078 CFLAGS="$CFLAGS -xarch=v9a"
2079 LDFLAGS_ARCH="-xarch=v9a"
2081 CFLAGS="$CFLAGS -xarch=v9"
2082 LDFLAGS_ARCH="-xarch=v9"
2084 # Solaris 64 uses this as well
2085 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
2087 ], [AS_IF([test "$arch" = "amd64 i386"], [
2088 AS_IF([test "$GCC" = yes], [
2090 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
2092 CFLAGS="$CFLAGS -m64"
2093 LDFLAGS="$LDFLAGS -m64";;
2095 AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
2100 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
2101 CFLAGS="$CFLAGS -m64"
2102 LDFLAGS="$LDFLAGS -m64";;
2104 CFLAGS="$CFLAGS -xarch=amd64"
2105 LDFLAGS="$LDFLAGS -xarch=amd64";;
2108 ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
2111 # Note: need the LIBS below, otherwise Tk won't find Tcl's
2112 # symbols when dynamically loaded into tclsh.
2114 SHLIB_LD_LIBS='${LIBS}'
2116 DL_OBJS="tclLoadDl.o"
2118 AS_IF([test "$GCC" = yes], [
2119 SHLIB_LD='${CC} -shared'
2120 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
2121 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
2122 AS_IF([test "$do64bit_ok" = yes], [
2123 AS_IF([test "$arch" = "sparcv9 sparc"], [
2124 # We need to specify -static-libgcc or we need to
2125 # add the path to the sparv9 libgcc.
2126 # JH: static-libgcc is necessary for core Tcl, but may
2127 # not be necessary for extensions.
2128 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
2129 # for finding sparcv9 libgcc, get the regular libgcc
2130 # path, remove so name and append 'sparcv9'
2131 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
2132 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
2133 ], [AS_IF([test "$arch" = "amd64 i386"], [
2134 # JH: static-libgcc is necessary for core Tcl, but may
2135 # not be necessary for extensions.
2136 SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
2141 SunOS-5.[[1-9]][[0-9]]*)
2142 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
2143 SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';;
2145 SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
2147 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
2148 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
2151 UNIX_SV* | UnixWare-5*)
2152 SHLIB_CFLAGS="-KPIC"
2156 DL_OBJS="tclLoadDl.o"
2158 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
2159 # that don't grok the -Bexport option. Test that it does.
2160 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
2161 hold_ldflags=$LDFLAGS
2162 LDFLAGS="$LDFLAGS -Wl,-Bexport"
2163 AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
2164 LDFLAGS=$hold_ldflags])
2165 AS_IF([test $tcl_cv_ld_Bexport = yes], [
2166 LDFLAGS="$LDFLAGS -Wl,-Bexport"
2173 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
2174 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
2177 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
2178 dnl # until the end of configure, as configure's compile and link tests use
2179 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
2180 dnl # preprocessing tests use only CPPFLAGS.
2181 AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
2183 # Step 4: disable dynamic loading if requested via a command-line switch.
2186 AC_HELP_STRING([--enable-load],
2187 [allow dynamic loading and "load" command (default: on)]),
2188 [tcl_ok=$enableval], [tcl_ok=yes])
2189 AS_IF([test "$tcl_ok" = no], [DL_OBJS=""])
2191 AS_IF([test "x$DL_OBJS" != x], [BUILD_DLTEST="\$(DLTEST_TARGETS)"], [
2192 AC_MSG_WARN([Can't figure out how to do dynamic loading or shared libraries on this system.])
2196 DL_OBJS="tclLoadNone.o"
2198 LDFLAGS="$LDFLAGS_ORIG"
2203 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
2205 # If we're running gcc, then change the C flags for compiling shared
2206 # libraries to the right flags for gcc, instead of those for the
2207 # standard manufacturer compiler.
2209 AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [
2214 NetBSD-*|FreeBSD-*) ;;
2218 *) SHLIB_CFLAGS="-fPIC" ;;
2221 AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
2222 # TEA specific: use PACKAGE_VERSION instead of VERSION
2223 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'])
2224 AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
2225 # TEA specific: use PACKAGE_VERSION instead of VERSION
2226 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'])
2230 AC_SUBST(CFLAGS_DEBUG)
2231 AC_SUBST(CFLAGS_OPTIMIZE)
2232 AC_SUBST(CFLAGS_WARNING)
2237 AC_SUBST(SHLIB_LD_LIBS)
2238 AC_SUBST(SHLIB_CFLAGS)
2240 AC_SUBST(LD_LIBRARY_PATH_VAR)
2242 # These must be called after we do the basic CFLAGS checks and
2243 # verify any possible 64-bit or similar switches are necessary
2248 #--------------------------------------------------------------------
2251 # Determine which interface to use to talk to the serial port.
2252 # Note that #include lines must begin in leftmost column for
2253 # some compilers to recognize them as preprocessor directives,
2254 # and some build environments have stdin not pointing at a
2255 # pseudo-terminal (usually /dev/null instead.)
2262 # Defines only one of the following vars:
2268 #--------------------------------------------------------------------
2270 AC_DEFUN([TEA_SERIAL_PORT], [
2271 AC_CHECK_HEADERS(sys/modem.h)
2272 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2274 #include <termios.h>
2278 if (tcgetattr(0, &t) == 0) {
2280 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2284 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2285 if test $tcl_cv_api_serial = no ; then
2291 if (ioctl(0, TCGETA, &t) == 0) {
2292 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2296 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2298 if test $tcl_cv_api_serial = no ; then
2304 if (ioctl(0, TIOCGETP, &t) == 0) {
2306 t.sg_flags |= ODDP | EVENP | RAW;
2310 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2312 if test $tcl_cv_api_serial = no ; then
2314 #include <termios.h>
2319 if (tcgetattr(0, &t) == 0
2320 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2322 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2326 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2328 if test $tcl_cv_api_serial = no; then
2335 if (ioctl(0, TCGETA, &t) == 0
2336 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2337 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2341 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2343 if test $tcl_cv_api_serial = no; then
2350 if (ioctl(0, TIOCGETP, &t) == 0
2351 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2353 t.sg_flags |= ODDP | EVENP | RAW;
2357 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2359 case $tcl_cv_api_serial in
2360 termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
2361 termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
2362 sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
2366 #--------------------------------------------------------------------
2367 # TEA_MISSING_POSIX_HEADERS
2369 # Supply substitutes for missing POSIX header files. Special
2371 # - stdlib.h doesn't define strtol, strtoul, or
2372 # strtod in some versions of SunOS
2373 # - some versions of string.h don't declare procedures such
2381 # Defines some of the following vars:
2385 # HAVE_LIMITS_H or NO_LIMITS_H
2394 # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and
2396 #--------------------------------------------------------------------
2398 AC_DEFUN([TEA_MISSING_POSIX_HEADERS], [
2399 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2400 AC_TRY_LINK([#include <sys/types.h>
2401 #include <dirent.h>], [
2402 #ifndef _POSIX_SOURCE
2405 * Generate compilation error to make the test fail: Lynx headers
2406 * are only valid if really in the POSIX environment.
2409 missing_procedure();
2413 struct dirent *entryPtr;
2415 d = opendir("foobar");
2416 entryPtr = readdir(d);
2417 p = entryPtr->d_name;
2419 ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
2421 if test $tcl_cv_dirent_h = no; then
2422 AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
2426 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
2427 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
2428 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
2429 AC_CHECK_HEADER(limits.h,
2430 [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
2431 [AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
2432 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2433 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2434 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2435 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2436 if test $tcl_ok = 0; then
2437 AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
2439 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2440 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2441 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2443 # See also memmove check below for a place where NO_STRING_H can be
2446 if test $tcl_ok = 0; then
2447 AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
2450 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
2451 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
2453 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2454 AC_HAVE_HEADERS(sys/param.h)
2457 #--------------------------------------------------------------------
2460 # Locate the X11 header files and the X11 library archive. Try
2461 # the ac_path_x macro first, but if it doesn't find the X stuff
2462 # (e.g. because there's no xmkmf program) then check through
2463 # a list of possible directories. Under some conditions the
2464 # autoconf macro will return an include directory that contains
2465 # no include files, so double-check its result just to be safe.
2467 # This should be called after TEA_CONFIG_CFLAGS as setting the
2468 # LIBS line can confuse some configure macro magic.
2475 # Sets the following vars:
2478 # PKG_LIBS (appends to)
2480 #--------------------------------------------------------------------
2482 AC_DEFUN([TEA_PATH_X], [
2483 if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
2488 AC_DEFUN([TEA_PATH_UNIX_X], [
2491 if test "$no_x" = ""; then
2492 if test "$x_includes" = ""; then
2493 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2495 if test ! -r $x_includes/X11/Intrinsic.h; then
2496 not_really_there="yes"
2500 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2501 AC_MSG_CHECKING([for X11 header files])
2502 found_xincludes="no"
2503 AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2504 if test "$found_xincludes" = "no"; then
2505 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"
2507 if test -r $i/X11/Intrinsic.h; then
2510 found_xincludes="yes"
2516 if test "$x_includes" != ""; then
2517 XINCLUDES="-I$x_includes"
2518 found_xincludes="yes"
2521 if test found_xincludes = "no"; then
2522 AC_MSG_RESULT([couldn't find any!])
2525 if test "$no_x" = yes; then
2526 AC_MSG_CHECKING([for X11 libraries])
2528 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"
2530 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2538 if test "$x_libraries" = ""; then
2541 XLIBSW="-L$x_libraries -lX11"
2544 if test "$XLIBSW" = nope ; then
2545 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2547 if test "$XLIBSW" = nope ; then
2548 AC_MSG_RESULT([could not find any! Using -lX11.])
2552 if test x"${XLIBSW}" != x ; then
2553 PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
2557 #--------------------------------------------------------------------
2558 # TEA_BLOCKING_STYLE
2560 # The statements below check for systems where POSIX-style
2561 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2562 # On these systems (mostly older ones), use the old BSD-style
2563 # FIONBIO approach instead.
2570 # Defines some of the following vars:
2576 #--------------------------------------------------------------------
2578 AC_DEFUN([TEA_BLOCKING_STYLE], [
2579 AC_CHECK_HEADERS(sys/ioctl.h)
2580 AC_CHECK_HEADERS(sys/filio.h)
2582 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2584 # There used to be code here to use FIONBIO under AIX. However, it
2585 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
2586 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
2587 # code (JO, 5/31/97).
2590 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2591 AC_MSG_RESULT([FIONBIO])
2594 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2595 AC_MSG_RESULT([FIONBIO])
2598 AC_MSG_RESULT([O_NONBLOCK])
2603 #--------------------------------------------------------------------
2606 # Checks how the system deals with time.h, what time structures
2607 # are used on the system, and what fields the structures have.
2614 # Defines some of the following vars:
2620 #--------------------------------------------------------------------
2622 AC_DEFUN([TEA_TIME_HANDLER], [
2623 AC_CHECK_HEADERS(sys/time.h)
2627 AC_CHECK_FUNCS(gmtime_r localtime_r)
2629 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2630 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2631 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
2632 if test $tcl_cv_member_tm_tzadj = yes ; then
2633 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2636 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2637 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2638 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
2639 if test $tcl_cv_member_tm_gmtoff = yes ; then
2640 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2644 # Its important to include time.h in this check, as some systems
2645 # (like convex) have timezone functions, etc.
2647 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2648 AC_TRY_COMPILE([#include <time.h>],
2649 [extern long timezone;
2652 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
2653 if test $tcl_cv_timezone_long = yes ; then
2654 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2657 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2659 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2660 AC_TRY_COMPILE([#include <time.h>],
2661 [extern time_t timezone;
2664 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
2665 if test $tcl_cv_timezone_time = yes ; then
2666 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2671 #--------------------------------------------------------------------
2674 # Under Solaris 2.4, strtod returns the wrong value for the
2675 # terminating character under some conditions. Check for this
2676 # and if the problem exists use a substitute procedure
2677 # "fixstrtod" (provided by Tcl) that corrects the error.
2678 # Also, on Compaq's Tru64 Unix 5.0,
2679 # strtod(" ") returns 0.0 instead of a failure to convert.
2686 # Might defines some of the following vars:
2687 # strtod (=fixstrtod)
2689 #--------------------------------------------------------------------
2691 AC_DEFUN([TEA_BUGGY_STRTOD], [
2692 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2693 if test "$tcl_strtod" = 1; then
2694 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2696 extern double strtod();
2698 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2701 value = strtod(infString, &term);
2702 if ((term != infString) && (term[-1] == 0)) {
2705 value = strtod(nanString, &term);
2706 if ((term != nanString) && (term[-1] == 0)) {
2709 value = strtod(spaceString, &term);
2710 if (term == (spaceString+1)) {
2714 }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2715 tcl_cv_strtod_buggy=buggy)])
2716 if test "$tcl_cv_strtod_buggy" = buggy; then
2717 AC_LIBOBJ([fixstrtod])
2719 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
2724 #--------------------------------------------------------------------
2727 # Search for the libraries needed to link the Tcl shell.
2728 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2729 # -lnsl) are dealt with here.
2732 # Requires the following vars to be set in the Makefile:
2739 # Subst's the following var:
2743 # Might append to the following vars:
2746 # Might define the following vars:
2749 #--------------------------------------------------------------------
2751 AC_DEFUN([TEA_TCL_LINK_LIBS], [
2752 #--------------------------------------------------------------------
2753 # On a few very rare systems, all of the libm.a stuff is
2754 # already in libc.a. Set compiler flags accordingly.
2755 # Also, Linux requires the "ieee" library for math to work
2756 # right (and it must appear before "-lm").
2757 #--------------------------------------------------------------------
2759 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2760 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2762 #--------------------------------------------------------------------
2763 # Interactive UNIX requires -linet instead of -lsocket, plus it
2764 # needs net/errno.h to define the socket-related error codes.
2765 #--------------------------------------------------------------------
2767 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2768 AC_CHECK_HEADER(net/errno.h, [
2769 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2771 #--------------------------------------------------------------------
2772 # Check for the existence of the -lsocket and -lnsl libraries.
2773 # The order here is important, so that they end up in the right
2774 # order in the command line generated by make. Here are some
2775 # special considerations:
2776 # 1. Use "connect" and "accept" to check for -lsocket, and
2777 # "gethostbyname" to check for -lnsl.
2778 # 2. Use each function name only once: can't redo a check because
2779 # autoconf caches the results of the last check and won't redo it.
2780 # 3. Use -lnsl and -lsocket only if they supply procedures that
2781 # aren't already present in the normal libraries. This is because
2782 # IRIX 5.2 has libraries, but they aren't needed and they're
2783 # bogus: they goof up name resolution if used.
2784 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2785 # To get around this problem, check for both libraries together
2786 # if -lsocket doesn't work by itself.
2787 #--------------------------------------------------------------------
2790 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2791 if test "$tcl_checkSocket" = 1; then
2792 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2793 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2795 if test "$tcl_checkBoth" = 1; then
2797 LIBS="$LIBS -lsocket -lnsl"
2798 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2800 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2801 [LIBS="$LIBS -lnsl"])])
2803 # TEA specific: Don't perform the eval of the libraries here because
2804 # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS
2806 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2811 #--------------------------------------------------------------------
2812 # TEA_TCL_EARLY_FLAGS
2814 # Check for what flags are needed to be passed so the correct OS
2815 # features are available.
2822 # Might define the following vars:
2824 # _LARGEFILE64_SOURCE
2825 # _LARGEFILE_SOURCE64
2827 #--------------------------------------------------------------------
2829 AC_DEFUN([TEA_TCL_EARLY_FLAG],[
2830 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2831 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2832 AC_TRY_COMPILE([[#define ]$1[ 1
2834 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2835 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2836 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2837 AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
2838 tcl_flags="$tcl_flags $1"
2842 AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
2843 AC_MSG_CHECKING([for required early compiler flags])
2845 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2846 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2847 TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2848 [struct stat64 buf; int i = stat64("/", &buf);])
2849 TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2850 [char *p = (char *)open64;])
2851 if test "x${tcl_flags}" = "x" ; then
2852 AC_MSG_RESULT([none])
2854 AC_MSG_RESULT([${tcl_flags}])
2858 #--------------------------------------------------------------------
2859 # TEA_TCL_64BIT_FLAGS
2861 # Check for what is defined in the way of 64-bit features.
2868 # Might define the following vars:
2869 # TCL_WIDE_INT_IS_LONG
2871 # HAVE_STRUCT_DIRENT64
2872 # HAVE_STRUCT_STAT64
2875 #--------------------------------------------------------------------
2877 AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
2878 AC_MSG_CHECKING([for 64-bit integer type])
2879 AC_CACHE_VAL(tcl_cv_type_64bit,[
2880 tcl_cv_type_64bit=none
2881 # See if the compiler knows natively about __int64
2882 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2883 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2884 # See if we should use long anyway Note that we substitute in the
2885 # type that is our current guess for a 64-bit type inside this check
2886 # program, so it should be modified only carefully...
2887 AC_TRY_COMPILE(,[switch (0) {
2888 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2889 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2890 if test "${tcl_cv_type_64bit}" = none ; then
2891 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
2892 AC_MSG_RESULT([using long])
2893 elif test "${tcl_cv_type_64bit}" = "__int64" \
2894 -a "${TEA_PLATFORM}" = "windows" ; then
2895 # TEA specific: We actually want to use the default tcl.h checks in
2896 # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
2897 AC_MSG_RESULT([using Tcl header defaults])
2899 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2900 [What type should be used to define wide integers?])
2901 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2903 # Now check for auxiliary declarations
2904 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2905 AC_TRY_COMPILE([#include <sys/types.h>
2906 #include <sys/dirent.h>],[struct dirent64 p;],
2907 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2908 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2909 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2912 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2913 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2915 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2916 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2917 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2920 AC_CHECK_FUNCS(open64 lseek64)
2921 AC_MSG_CHECKING([for off64_t])
2922 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2923 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2925 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2926 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2927 dnl functions lseek64 and open64 are defined.
2928 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2929 test "x${ac_cv_func_lseek64}" = "xyes" && \
2930 test "x${ac_cv_func_open64}" = "xyes" ; then
2931 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2932 AC_MSG_RESULT([yes])
2940 ## Here ends the standard Tcl configuration bits and starts the
2941 ## TEA specific functions
2944 #------------------------------------------------------------------------
2947 # Init various Tcl Extension Architecture (TEA) variables.
2948 # This should be the first called TEA_* macro.
2955 # Defines and substs the following vars:
2961 # TEA_PLATFORM (windows or unix)
2963 # "cygpath" is used on windows to generate native path names for include
2964 # files. These variables should only be used with the compiler and linker
2965 # since they generate native path names.
2968 # Select the executable extension based on the host type. This
2969 # is a lightweight replacement for AC_EXEEXT that doesn't require
2971 #------------------------------------------------------------------------
2973 AC_DEFUN([TEA_INIT], [
2974 # TEA extensions pass this us the version of TEA they think they
2975 # are compatible with.
2978 AC_MSG_CHECKING([for correct TEA configuration])
2979 if test x"${PACKAGE_NAME}" = x ; then
2981 The PACKAGE_NAME variable must be defined by your TEA configure.in])
2983 if test x"$1" = x ; then
2985 TEA version not specified.])
2986 elif test "$1" != "${TEA_VERSION}" ; then
2987 AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"])
2989 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
2991 case "`uname -s`" in
2992 *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*)
2993 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
2995 TEA_PLATFORM="windows"
3004 # Check if exec_prefix is set. If not use fall back to prefix.
3005 # Note when adjusted, so that TEA_PREFIX can correct for this.
3006 # This is needed for recursive configures, since autoconf propagates
3007 # $prefix, but not $exec_prefix (doh!).
3008 if test x$exec_prefix = xNONE ; then
3009 exec_prefix_default=yes
3016 # This package name must be replaced statically for AC_SUBST to work
3017 AC_SUBST(PKG_LIB_FILE)
3018 # Substitute STUB_LIB_FILE in case package creates a stub library too.
3019 AC_SUBST(PKG_STUB_LIB_FILE)
3021 # We AC_SUBST these here to ensure they are subst'ed,
3022 # in case the user doesn't call TEA_ADD_...
3023 AC_SUBST(PKG_STUB_SOURCES)
3024 AC_SUBST(PKG_STUB_OBJECTS)
3025 AC_SUBST(PKG_TCL_SOURCES)
3026 AC_SUBST(PKG_HEADERS)
3027 AC_SUBST(PKG_INCLUDES)
3029 AC_SUBST(PKG_CFLAGS)
3032 #------------------------------------------------------------------------
3033 # TEA_ADD_SOURCES --
3035 # Specify one or more source files. Users should check for
3036 # the right platform before adding to their list.
3037 # It is not important to specify the directory, as long as it is
3038 # in the generic, win or unix subdirectory of $(srcdir).
3041 # one or more file names
3045 # Defines and substs the following vars:
3048 #------------------------------------------------------------------------
3049 AC_DEFUN([TEA_ADD_SOURCES], [
3055 PKG_SOURCES="$PKG_SOURCES $i"
3056 PKG_OBJECTS="$PKG_OBJECTS $i"
3059 # check for existence - allows for generic/win/unix VPATH
3060 # To add more dirs here (like 'src'), you have to update VPATH
3061 # in Makefile.in as well
3062 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
3063 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
3065 AC_MSG_ERROR([could not find source file '$i'])
3067 PKG_SOURCES="$PKG_SOURCES $i"
3068 # this assumes it is in a VPATH dir
3070 # handle user calling this before or after TEA_SETUP_COMPILER
3071 if test x"${OBJEXT}" != x ; then
3072 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
3074 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
3076 PKG_OBJECTS="$PKG_OBJECTS $j"
3080 AC_SUBST(PKG_SOURCES)
3081 AC_SUBST(PKG_OBJECTS)
3084 #------------------------------------------------------------------------
3085 # TEA_ADD_STUB_SOURCES --
3087 # Specify one or more source files. Users should check for
3088 # the right platform before adding to their list.
3089 # It is not important to specify the directory, as long as it is
3090 # in the generic, win or unix subdirectory of $(srcdir).
3093 # one or more file names
3097 # Defines and substs the following vars:
3100 #------------------------------------------------------------------------
3101 AC_DEFUN([TEA_ADD_STUB_SOURCES], [
3104 # check for existence - allows for generic/win/unix VPATH
3105 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
3106 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
3108 AC_MSG_ERROR([could not find stub source file '$i'])
3110 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
3111 # this assumes it is in a VPATH dir
3113 # handle user calling this before or after TEA_SETUP_COMPILER
3114 if test x"${OBJEXT}" != x ; then
3115 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
3117 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
3119 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
3121 AC_SUBST(PKG_STUB_SOURCES)
3122 AC_SUBST(PKG_STUB_OBJECTS)
3125 #------------------------------------------------------------------------
3126 # TEA_ADD_TCL_SOURCES --
3128 # Specify one or more Tcl source files. These should be platform
3129 # independent runtime files.
3132 # one or more file names
3136 # Defines and substs the following vars:
3138 #------------------------------------------------------------------------
3139 AC_DEFUN([TEA_ADD_TCL_SOURCES], [
3142 # check for existence, be strict because it is installed
3143 if test ! -f "${srcdir}/$i" ; then
3144 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
3146 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
3148 AC_SUBST(PKG_TCL_SOURCES)
3151 #------------------------------------------------------------------------
3152 # TEA_ADD_HEADERS --
3154 # Specify one or more source headers. Users should check for
3155 # the right platform before adding to their list.
3158 # one or more file names
3162 # Defines and substs the following vars:
3164 #------------------------------------------------------------------------
3165 AC_DEFUN([TEA_ADD_HEADERS], [
3168 # check for existence, be strict because it is installed
3169 if test ! -f "${srcdir}/$i" ; then
3170 AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
3172 PKG_HEADERS="$PKG_HEADERS $i"
3174 AC_SUBST(PKG_HEADERS)
3177 #------------------------------------------------------------------------
3178 # TEA_ADD_INCLUDES --
3180 # Specify one or more include dirs. Users should check for
3181 # the right platform before adding to their list.
3184 # one or more file names
3188 # Defines and substs the following vars:
3190 #------------------------------------------------------------------------
3191 AC_DEFUN([TEA_ADD_INCLUDES], [
3194 PKG_INCLUDES="$PKG_INCLUDES $i"
3196 AC_SUBST(PKG_INCLUDES)
3199 #------------------------------------------------------------------------
3202 # Specify one or more libraries. Users should check for
3203 # the right platform before adding to their list. For Windows,
3204 # libraries provided in "foo.lib" format will be converted to
3205 # "-lfoo" when using GCC (mingw).
3208 # one or more file names
3212 # Defines and substs the following vars:
3214 #------------------------------------------------------------------------
3215 AC_DEFUN([TEA_ADD_LIBS], [
3218 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
3219 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
3220 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'`
3222 PKG_LIBS="$PKG_LIBS $i"
3227 #------------------------------------------------------------------------
3230 # Specify one or more CFLAGS. Users should check for
3231 # the right platform before adding to their list.
3234 # one or more file names
3238 # Defines and substs the following vars:
3240 #------------------------------------------------------------------------
3241 AC_DEFUN([TEA_ADD_CFLAGS], [
3242 PKG_CFLAGS="$PKG_CFLAGS $@"
3243 AC_SUBST(PKG_CFLAGS)
3246 #------------------------------------------------------------------------
3249 # Handle the --prefix=... option by defaulting to what Tcl gave
3256 # If --prefix or --exec-prefix was not specified, $prefix and
3257 # $exec_prefix will be set to the values given to Tcl when it was
3259 #------------------------------------------------------------------------
3260 AC_DEFUN([TEA_PREFIX], [
3261 if test "${prefix}" = "NONE"; then
3263 if test x"${TCL_PREFIX}" != x; then
3264 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
3265 prefix=${TCL_PREFIX}
3267 AC_MSG_NOTICE([--prefix defaulting to /usr/local])
3271 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
3272 -o x"${exec_prefix_default}" = x"yes" ; then
3273 if test x"${TCL_EXEC_PREFIX}" != x; then
3274 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
3275 exec_prefix=${TCL_EXEC_PREFIX}
3277 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
3283 #------------------------------------------------------------------------
3284 # TEA_SETUP_COMPILER_CC --
3286 # Do compiler checks the way we want. This is just a replacement
3287 # for AC_PROG_CC in TEA configure.in files to make them cleaner.
3294 # Sets up CC var and other standard bits we need to make executables.
3295 #------------------------------------------------------------------------
3296 AC_DEFUN([TEA_SETUP_COMPILER_CC], [
3297 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
3298 # in this macro, they need to go into TEA_SETUP_COMPILER instead.
3300 # If the user did not set CFLAGS, set it now to keep
3301 # the AC_PROG_CC macro from adding "-g -O2".
3302 if test "${CFLAGS+set}" != "set" ; then
3311 #--------------------------------------------------------------------
3312 # Checks to see if the make program sets the $MAKE variable.
3313 #--------------------------------------------------------------------
3317 #--------------------------------------------------------------------
3319 #--------------------------------------------------------------------
3323 #--------------------------------------------------------------------
3324 # Determines the correct binary file extension (.o, .obj, .exe etc.)
3325 #--------------------------------------------------------------------
3331 #------------------------------------------------------------------------
3332 # TEA_SETUP_COMPILER --
3334 # Do compiler checks that use the compiler. This must go after
3335 # TEA_SETUP_COMPILER_CC, which does the actual compiler check.
3342 # Sets up CC var and other standard bits we need to make executables.
3343 #------------------------------------------------------------------------
3344 AC_DEFUN([TEA_SETUP_COMPILER], [
3345 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
3346 AC_REQUIRE([TEA_SETUP_COMPILER_CC])
3348 #------------------------------------------------------------------------
3349 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
3350 # It makes compiling go faster. (This is only a performance feature.)
3351 #------------------------------------------------------------------------
3353 if test -z "$no_pipe" -a -n "$GCC"; then
3354 AC_CACHE_CHECK([if the compiler understands -pipe],
3356 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
3357 AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
3358 CFLAGS=$hold_cflags])
3359 if test $tcl_cv_cc_pipe = yes; then
3360 CFLAGS="$CFLAGS -pipe"
3364 #--------------------------------------------------------------------
3365 # Common compiler flag setup
3366 #--------------------------------------------------------------------
3369 if test "${TEA_PLATFORM}" = "unix" ; then
3371 TEA_MISSING_POSIX_HEADERS
3372 # Let the user call this, because if it triggers, they will
3373 # need a compat/strtod.c that is correct. Users can also
3374 # use Tcl_GetDouble(FromObj) instead.
3379 #------------------------------------------------------------------------
3382 # Generate a line that can be used to build a shared/unshared library
3383 # in a platform independent manner.
3392 # Defines the following vars:
3393 # CFLAGS - Done late here to note disturb other AC macros
3394 # MAKE_LIB - Command to execute to build the Tcl library;
3395 # differs depending on whether or not Tcl is being
3396 # compiled as a shared library.
3397 # MAKE_SHARED_LIB Makefile rule for building a shared library
3398 # MAKE_STATIC_LIB Makefile rule for building a static library
3399 # MAKE_STUB_LIB Makefile rule for building a stub library
3400 #------------------------------------------------------------------------
3402 AC_DEFUN([TEA_MAKE_LIB], [
3403 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
3404 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
3405 MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
3406 MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)"
3408 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
3409 MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3410 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
3413 if test "${SHARED_BUILD}" = "1" ; then
3414 MAKE_LIB="${MAKE_SHARED_LIB} "
3416 MAKE_LIB="${MAKE_STATIC_LIB} "
3419 #--------------------------------------------------------------------
3420 # Shared libraries and static libraries have different names.
3421 # Use the double eval to make sure any variables in the suffix is
3422 # substituted. (@@@ Might not be necessary anymore)
3423 #--------------------------------------------------------------------
3425 if test "${TEA_PLATFORM}" = "windows" ; then
3426 if test "${SHARED_BUILD}" = "1" ; then
3427 # We force the unresolved linking of symbols that are really in
3428 # the private libraries of Tcl and Tk.
3429 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
3430 if test x"${TK_BIN_DIR}" != x ; then
3431 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
3433 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3435 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3437 # Some packages build their own stubs libraries
3438 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3439 if test "$GCC" = "yes"; then
3440 PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
3442 # These aren't needed on Windows (either MSVC or gcc)
3446 RANLIB_STUB="${RANLIB}"
3447 if test "${SHARED_BUILD}" = "1" ; then
3448 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
3449 if test x"${TK_BIN_DIR}" != x ; then
3450 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
3452 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3455 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3457 # Some packages build their own stubs libraries
3458 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3461 # These are escaped so that only CFLAGS is picked up at configure time.
3462 # The other values will be substituted at make time.
3463 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
3464 if test "${SHARED_BUILD}" = "1" ; then
3465 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
3469 AC_SUBST(MAKE_SHARED_LIB)
3470 AC_SUBST(MAKE_STATIC_LIB)
3471 AC_SUBST(MAKE_STUB_LIB)
3472 AC_SUBST(RANLIB_STUB)
3475 #------------------------------------------------------------------------
3478 # Compute the name of an existing object library located in libdir
3479 # from the given base name and produce the appropriate linker flags.
3482 # basename The base name of the library without version
3483 # numbers, extensions, or "lib" prefixes.
3484 # extra_dir Extra directory in which to search for the
3485 # library. This location is used first, then
3486 # $prefix/$exec-prefix, then some defaults.
3489 # TEA_INIT and TEA_PREFIX must be called first.
3493 # Defines the following vars:
3494 # ${basename}_LIB_NAME The computed library name.
3495 # ${basename}_LIB_SPEC The computed linker flags.
3496 #------------------------------------------------------------------------
3498 AC_DEFUN([TEA_LIB_SPEC], [
3499 AC_MSG_CHECKING([for $1 library])
3501 # Look in exec-prefix for the library (defined by TEA_PREFIX).
3503 tea_lib_name_dir="${exec_prefix}/lib"
3505 # Or in a user-specified location.
3507 if test x"$2" != x ; then
3508 tea_extra_lib_dir=$2
3510 tea_extra_lib_dir=NONE
3514 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3515 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3516 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3517 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3518 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3519 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
3520 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3521 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
3522 if test -f "$i" ; then
3523 tea_lib_name_dir=`dirname $i`
3524 $1_LIB_NAME=`basename $i`
3530 if test "${TEA_PLATFORM}" = "windows"; then
3531 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
3533 # Strip off the leading "lib" and trailing ".a" or ".so"
3535 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
3536 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
3539 if test "x${$1_LIB_NAME}" = x ; then
3540 AC_MSG_ERROR([not found])
3542 AC_MSG_RESULT([${$1_LIB_SPEC}])
3546 #------------------------------------------------------------------------
3547 # TEA_PRIVATE_TCL_HEADERS --
3549 # Locate the private Tcl include files
3554 # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
3555 # already been called.
3559 # Substs the following vars:
3560 # TCL_TOP_DIR_NATIVE
3562 #------------------------------------------------------------------------
3564 AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
3565 # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh}
3566 AC_REQUIRE([TEA_PUBLIC_TCL_HEADERS])
3567 AC_MSG_CHECKING([for Tcl private include files])
3569 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
3570 TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
3572 # Check to see if tcl<Plat>Port.h isn't already with the public headers
3573 # Don't look for tclInt.h because that resides with tcl.h in the core
3574 # sources, but the <plat>Port headers are in a different directory
3575 if test "${TEA_PLATFORM}" = "windows" -a \
3576 -f "${ac_cv_c_tclh}/tclWinPort.h"; then
3577 result="private headers found with public headers"
3578 elif test "${TEA_PLATFORM}" = "unix" -a \
3579 -f "${ac_cv_c_tclh}/tclUnixPort.h"; then
3580 result="private headers found with public headers"
3582 TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
3583 if test "${TEA_PLATFORM}" = "windows"; then
3584 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
3586 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
3588 # Overwrite the previous TCL_INCLUDES as this should capture both
3589 # public and private headers in the same set.
3590 # We want to ensure these are substituted so as not to require
3591 # any *_NATIVE vars be defined in the Makefile
3592 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
3593 if test "`uname -s`" = "Darwin"; then
3594 # If Tcl was built as a framework, attempt to use
3595 # the framework's Headers and PrivateHeaders directories
3598 if test -d "${TCL_BIN_DIR}/Headers" -a \
3599 -d "${TCL_BIN_DIR}/PrivateHeaders"; then
3600 TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
3602 TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3606 result="Using ${TCL_INCLUDES}"
3608 if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
3609 AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
3611 result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}"
3615 AC_SUBST(TCL_TOP_DIR_NATIVE)
3617 AC_SUBST(TCL_INCLUDES)
3618 AC_MSG_RESULT([${result}])
3621 #------------------------------------------------------------------------
3622 # TEA_PUBLIC_TCL_HEADERS --
3624 # Locate the installed public Tcl header files
3630 # CYGPATH must be set
3634 # Adds a --with-tclinclude switch to configure.
3637 # Substs the following vars:
3639 #------------------------------------------------------------------------
3641 AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
3642 AC_MSG_CHECKING([for Tcl public headers])
3644 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
3646 AC_CACHE_VAL(ac_cv_c_tclh, [
3647 # Use the value from --with-tclinclude, if it was given
3649 if test x"${with_tclinclude}" != x ; then
3650 if test -f "${with_tclinclude}/tcl.h" ; then
3651 ac_cv_c_tclh=${with_tclinclude}
3653 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
3657 if test "`uname -s`" = "Darwin"; then
3658 # If Tcl was built as a framework, attempt to use
3659 # the framework's Headers directory
3662 list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
3667 # Look in the source dir only if Tcl is not installed,
3668 # and in that situation, look there before installed locations.
3669 if test -f "${TCL_BIN_DIR}/Makefile" ; then
3670 list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
3673 # Check order: pkg --prefix location, Tcl's --prefix location,
3674 # relative to directory of tclConfig.sh.
3676 eval "temp_includedir=${includedir}"
3678 `ls -d ${temp_includedir} 2>/dev/null` \
3679 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3680 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3681 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3682 list="$list /usr/local/include /usr/include"
3683 if test x"${TCL_INCLUDE_SPEC}" != x ; then
3684 d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3685 list="$list `ls -d ${d} 2>/dev/null`"
3689 if test -f "$i/tcl.h" ; then
3697 # Print a message based on how we determined the include path
3699 if test x"${ac_cv_c_tclh}" = x ; then
3700 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
3702 AC_MSG_RESULT([${ac_cv_c_tclh}])
3705 # Convert to a native path and substitute into the output files.
3707 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
3709 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3711 AC_SUBST(TCL_INCLUDES)
3714 #------------------------------------------------------------------------
3715 # TEA_PRIVATE_TK_HEADERS --
3717 # Locate the private Tk include files
3722 # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
3723 # already been called.
3727 # Substs the following vars:
3729 #------------------------------------------------------------------------
3731 AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
3732 # Allow for --with-tkinclude to take effect and define ${ac_cv_c_tkh}
3733 AC_REQUIRE([TEA_PUBLIC_TK_HEADERS])
3734 AC_MSG_CHECKING([for Tk private include files])
3736 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
3737 TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
3739 # Check to see if tk<Plat>Port.h isn't already with the public headers
3740 # Don't look for tkInt.h because that resides with tk.h in the core
3741 # sources, but the <plat>Port headers are in a different directory
3742 if test "${TEA_PLATFORM}" = "windows" -a \
3743 -f "${ac_cv_c_tkh}/tkWinPort.h"; then
3744 result="private headers found with public headers"
3745 elif test "${TEA_PLATFORM}" = "unix" -a \
3746 -f "${ac_cv_c_tkh}/tkUnixPort.h"; then
3747 result="private headers found with public headers"
3749 TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
3750 TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
3751 if test "${TEA_PLATFORM}" = "windows"; then
3752 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
3754 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
3756 # Overwrite the previous TK_INCLUDES as this should capture both
3757 # public and private headers in the same set.
3758 # We want to ensure these are substituted so as not to require
3759 # any *_NATIVE vars be defined in the Makefile
3760 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
3761 # Detect and add ttk subdir
3762 if test -d "${TK_SRC_DIR}/generic/ttk"; then
3763 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\""
3765 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3766 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_XLIB_DIR_NATIVE}\""
3768 if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3769 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/macosx\""
3771 if test "`uname -s`" = "Darwin"; then
3772 # If Tk was built as a framework, attempt to use
3773 # the framework's Headers and PrivateHeaders directories
3776 if test -d "${TK_BIN_DIR}/Headers" -a \
3777 -d "${TK_BIN_DIR}/PrivateHeaders"; then
3778 TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"
3780 TK_INCLUDES="${TK_INCLUDES} ${TK_INCLUDE_SPEC} `echo "${TK_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3784 result="Using ${TK_INCLUDES}"
3786 if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
3787 AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
3789 result="Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}"
3793 AC_SUBST(TK_TOP_DIR_NATIVE)
3794 AC_SUBST(TK_XLIB_DIR_NATIVE)
3796 AC_SUBST(TK_INCLUDES)
3797 AC_MSG_RESULT([${result}])
3800 #------------------------------------------------------------------------
3801 # TEA_PUBLIC_TK_HEADERS --
3803 # Locate the installed public Tk header files
3809 # CYGPATH must be set
3813 # Adds a --with-tkinclude switch to configure.
3816 # Substs the following vars:
3818 #------------------------------------------------------------------------
3820 AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
3821 AC_MSG_CHECKING([for Tk public headers])
3823 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files], with_tkinclude=${withval})
3825 AC_CACHE_VAL(ac_cv_c_tkh, [
3826 # Use the value from --with-tkinclude, if it was given
3828 if test x"${with_tkinclude}" != x ; then
3829 if test -f "${with_tkinclude}/tk.h" ; then
3830 ac_cv_c_tkh=${with_tkinclude}
3832 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
3836 if test "`uname -s`" = "Darwin"; then
3837 # If Tk was built as a framework, attempt to use
3838 # the framework's Headers directory.
3841 list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
3846 # Look in the source dir only if Tk is not installed,
3847 # and in that situation, look there before installed locations.
3848 if test -f "${TK_BIN_DIR}/Makefile" ; then
3849 list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
3852 # Check order: pkg --prefix location, Tk's --prefix location,
3853 # relative to directory of tkConfig.sh, Tcl's --prefix location,
3854 # relative to directory of tclConfig.sh.
3856 eval "temp_includedir=${includedir}"
3858 `ls -d ${temp_includedir} 2>/dev/null` \
3859 `ls -d ${TK_PREFIX}/include 2>/dev/null` \
3860 `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
3861 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3862 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3863 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3864 list="$list /usr/local/include /usr/include"
3865 if test x"${TK_INCLUDE_SPEC}" != x ; then
3866 d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3867 list="$list `ls -d ${d} 2>/dev/null`"
3871 if test -f "$i/tk.h" ; then
3879 # Print a message based on how we determined the include path
3881 if test x"${ac_cv_c_tkh}" = x ; then
3882 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
3884 AC_MSG_RESULT([${ac_cv_c_tkh}])
3887 # Convert to a native path and substitute into the output files.
3889 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
3891 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3893 AC_SUBST(TK_INCLUDES)
3895 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3896 # On Windows and Aqua, we need the X compat headers
3897 AC_MSG_CHECKING([for X11 header files])
3898 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
3899 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
3900 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3901 AC_SUBST(TK_XINCLUDES)
3903 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
3907 #------------------------------------------------------------------------
3908 # TEA_PATH_CONFIG --
3910 # Locate the ${1}Config.sh file and perform a sanity check on
3911 # the ${1} compile flags. These are used by packages like
3912 # [incr Tk] that load *Config.sh files from more than Tcl and Tk.
3919 # Adds the following arguments to configure:
3922 # Defines the following vars:
3923 # $1_BIN_DIR Full path to the directory containing
3924 # the $1Config.sh file
3925 #------------------------------------------------------------------------
3927 AC_DEFUN([TEA_PATH_CONFIG], [
3929 # Ok, lets find the $1 configuration
3930 # First, look for one uninstalled.
3931 # the alternative search directory is invoked by --with-$1
3934 if test x"${no_$1}" = x ; then
3935 # we reset no_$1 in case something fails here
3937 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
3938 AC_MSG_CHECKING([for $1 configuration])
3939 AC_CACHE_VAL(ac_cv_c_$1config,[
3941 # First check to see if --with-$1 was specified.
3942 if test x"${with_$1config}" != x ; then
3943 case ${with_$1config} in
3945 if test -f ${with_$1config}; then
3946 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
3947 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
3950 if test -f "${with_$1config}/$1Config.sh" ; then
3951 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
3953 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
3957 # then check for a private $1 installation
3958 if test x"${ac_cv_c_$1config}" = x ; then
3961 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3962 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3963 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3964 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3966 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3967 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3968 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3969 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3971 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3972 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3973 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3974 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3976 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3977 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3978 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3979 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3981 if test -f "$i/$1Config.sh" ; then
3982 ac_cv_c_$1config=`(cd $i; pwd)`
3985 if test -f "$i/unix/$1Config.sh" ; then
3986 ac_cv_c_$1config=`(cd $i/unix; pwd)`
3992 # check in a few common install locations
3993 if test x"${ac_cv_c_$1config}" = x ; then
3994 for i in `ls -d ${libdir} 2>/dev/null` \
3995 `ls -d ${exec_prefix}/lib 2>/dev/null` \
3996 `ls -d ${prefix}/lib 2>/dev/null` \
3997 `ls -d /usr/local/lib 2>/dev/null` \
3998 `ls -d /usr/contrib/lib 2>/dev/null` \
3999 `ls -d /usr/lib 2>/dev/null` \
4001 if test -f "$i/$1Config.sh" ; then
4002 ac_cv_c_$1config=`(cd $i; pwd)`
4009 if test x"${ac_cv_c_$1config}" = x ; then
4010 $1_BIN_DIR="# no $1 configs found"
4011 AC_MSG_WARN([Cannot find $1 configuration definitions])
4015 $1_BIN_DIR=${ac_cv_c_$1config}
4016 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
4021 #------------------------------------------------------------------------
4022 # TEA_LOAD_CONFIG --
4024 # Load the $1Config.sh file
4028 # Requires the following vars to be set:
4033 # Subst the following vars:
4038 #------------------------------------------------------------------------
4040 AC_DEFUN([TEA_LOAD_CONFIG], [
4041 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
4043 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
4044 AC_MSG_RESULT([loading])
4045 . "${$1_BIN_DIR}/$1Config.sh"
4047 AC_MSG_RESULT([file not found])
4051 # If the $1_BIN_DIR is the build directory (not the install directory),
4052 # then set the common variable name to the value of the build variables.
4053 # For example, the variable $1_LIB_SPEC will be set to the value
4054 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
4055 # instead of $1_BUILD_LIB_SPEC since it will work with both an
4056 # installed and uninstalled version of Tcl.
4059 if test -f "${$1_BIN_DIR}/Makefile" ; then
4060 AC_MSG_WARN([Found Makefile - using build library specs for $1])
4061 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
4062 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
4063 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
4066 AC_SUBST($1_VERSION)
4067 AC_SUBST($1_BIN_DIR)
4068 AC_SUBST($1_SRC_DIR)
4070 AC_SUBST($1_LIB_FILE)
4071 AC_SUBST($1_LIB_SPEC)
4073 AC_SUBST($1_STUB_LIB_FILE)
4074 AC_SUBST($1_STUB_LIB_SPEC)
4075 AC_SUBST($1_STUB_LIB_PATH)
4078 #------------------------------------------------------------------------
4081 # Locate Keuchel's celib emulation layer for targeting Win/CE
4088 # Adds the following arguments to configure:
4091 # Defines the following vars:
4092 # CELIB_DIR Full path to the directory containing
4093 # the include and platform lib files
4094 #------------------------------------------------------------------------
4096 AC_DEFUN([TEA_PATH_CELIB], [
4097 # First, look for one uninstalled.
4098 # the alternative search directory is invoked by --with-celib
4100 if test x"${no_celib}" = x ; then
4101 # we reset no_celib in case something fails here
4103 AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval})
4104 AC_MSG_CHECKING([for Windows/CE celib directory])
4105 AC_CACHE_VAL(ac_cv_c_celibconfig,[
4106 # First check to see if --with-celibconfig was specified.
4107 if test x"${with_celibconfig}" != x ; then
4108 if test -d "${with_celibconfig}/inc" ; then
4109 ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)`
4111 AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory])
4115 # then check for a celib library
4116 if test x"${ac_cv_c_celibconfig}" = x ; then
4120 ../../celib-palm-3.0 \
4122 `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \
4123 ${srcdir}/../celib-palm-3.0 \
4124 ${srcdir}/../celib \
4125 `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \
4127 if test -d "$i/inc" ; then
4128 ac_cv_c_celibconfig=`(cd $i; pwd)`
4134 if test x"${ac_cv_c_celibconfig}" = x ; then
4135 AC_MSG_ERROR([Cannot find celib support library directory])
4138 CELIB_DIR=${ac_cv_c_celibconfig}
4139 CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
4140 AC_MSG_RESULT([found $CELIB_DIR])