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.89 2006/01/25 21:25:02 hobbs Exp $
16 dnl TEA extensions pass this 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 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 -f "$i/unix/tclConfig.sh" ; then
96 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
102 # on Darwin, check in Framework installation locations
103 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
104 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
105 `ls -d /Library/Frameworks 2>/dev/null` \
106 `ls -d /Network/Library/Frameworks 2>/dev/null` \
107 `ls -d /System/Library/Frameworks 2>/dev/null` \
109 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
110 ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
116 # on Windows, check in common installation locations
117 if test "${TEA_PLATFORM}" = "windows" \
118 -a x"${ac_cv_c_tclconfig}" = x ; then
119 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
120 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
122 if test -f "$i/tclConfig.sh" ; then
123 ac_cv_c_tclconfig=`(cd $i; pwd)`
129 # check in a few common install locations
130 if test x"${ac_cv_c_tclconfig}" = x ; then
131 for i in `ls -d ${libdir} 2>/dev/null` \
132 `ls -d ${exec_prefix}/lib 2>/dev/null` \
133 `ls -d ${prefix}/lib 2>/dev/null` \
134 `ls -d /usr/local/lib 2>/dev/null` \
135 `ls -d /usr/contrib/lib 2>/dev/null` \
136 `ls -d /usr/lib 2>/dev/null` \
138 if test -f "$i/tclConfig.sh" ; then
139 ac_cv_c_tclconfig=`(cd $i; pwd)`
145 # check in a few other private locations
146 if test x"${ac_cv_c_tclconfig}" = x ; then
149 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
150 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
151 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
152 if test -f "$i/unix/tclConfig.sh" ; then
153 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
160 if test x"${ac_cv_c_tclconfig}" = x ; then
161 TCL_BIN_DIR="# no Tcl configs found"
162 AC_MSG_WARN([Can't find Tcl configuration definitions])
166 TCL_BIN_DIR=${ac_cv_c_tclconfig}
167 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
172 #------------------------------------------------------------------------
173 # TEA_PATH_TKCONFIG --
175 # Locate the tkConfig.sh file
182 # Adds the following arguments to configure:
185 # Defines the following vars:
186 # TK_BIN_DIR Full path to the directory containing
187 # the tkConfig.sh file
188 #------------------------------------------------------------------------
190 AC_DEFUN(TEA_PATH_TKCONFIG, [
192 # Ok, lets find the tk configuration
193 # First, look for one uninstalled.
194 # the alternative search directory is invoked by --with-tk
197 if test x"${no_tk}" = x ; then
198 # we reset no_tk in case something fails here
201 AC_HELP_STRING([--with-tk],
202 [directory containing tk configuration (tkConfig.sh)]),
203 with_tkconfig=${withval})
204 AC_MSG_CHECKING([for Tk configuration])
205 AC_CACHE_VAL(ac_cv_c_tkconfig,[
207 # First check to see if --with-tkconfig was specified.
208 if test x"${with_tkconfig}" != x ; then
209 case ${with_tkconfig} in
211 if test -f ${with_tkconfig}; then
212 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
213 with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'`
216 if test -f "${with_tkconfig}/tkConfig.sh" ; then
217 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
219 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
223 # then check for a private Tk library
224 if test x"${ac_cv_c_tkconfig}" = x ; then
227 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
228 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
229 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
231 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
232 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
233 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
235 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
236 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
237 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
238 if test -f "$i/unix/tkConfig.sh" ; then
239 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
245 # on Darwin, check in Framework installation locations
246 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
247 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
248 `ls -d /Library/Frameworks 2>/dev/null` \
249 `ls -d /Network/Library/Frameworks 2>/dev/null` \
250 `ls -d /System/Library/Frameworks 2>/dev/null` \
252 if test -f "$i/Tk.framework/tkConfig.sh" ; then
253 ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)`
259 # check in a few common install locations
260 if test x"${ac_cv_c_tkconfig}" = x ; then
261 for i in `ls -d ${libdir} 2>/dev/null` \
262 `ls -d ${exec_prefix}/lib 2>/dev/null` \
263 `ls -d ${prefix}/lib 2>/dev/null` \
264 `ls -d /usr/local/lib 2>/dev/null` \
265 `ls -d /usr/contrib/lib 2>/dev/null` \
266 `ls -d /usr/lib 2>/dev/null` \
268 if test -f "$i/tkConfig.sh" ; then
269 ac_cv_c_tkconfig=`(cd $i; pwd)`
275 # on Windows, check in common installation locations
276 if test "${TEA_PLATFORM}" = "windows" \
277 -a x"${ac_cv_c_tclconfig}" = x ; then
278 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
279 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
281 if test -f "$i/tclConfig.sh" ; then
282 ac_cv_c_tclconfig=`(cd $i; pwd)`
288 # check in a few other private locations
289 if test x"${ac_cv_c_tkconfig}" = x ; then
292 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
293 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
294 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
295 if test -f "$i/unix/tkConfig.sh" ; then
296 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
303 if test x"${ac_cv_c_tkconfig}" = x ; then
304 TK_BIN_DIR="# no Tk configs found"
305 AC_MSG_WARN([Can't find Tk configuration definitions])
309 TK_BIN_DIR=${ac_cv_c_tkconfig}
310 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
315 #------------------------------------------------------------------------
316 # TEA_LOAD_TCLCONFIG --
318 # Load the tclConfig.sh file
322 # Requires the following vars to be set:
327 # Subst the following vars:
332 #------------------------------------------------------------------------
334 AC_DEFUN(TEA_LOAD_TCLCONFIG, [
335 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
337 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
338 AC_MSG_RESULT([loading])
339 . ${TCL_BIN_DIR}/tclConfig.sh
341 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
344 # eval is required to do the TCL_DBGX substitution
345 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
346 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
348 # If the TCL_BIN_DIR is the build directory (not the install directory),
349 # then set the common variable name to the value of the build variables.
350 # For example, the variable TCL_LIB_SPEC will be set to the value
351 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
352 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
353 # installed and uninstalled version of Tcl.
354 if test -f ${TCL_BIN_DIR}/Makefile ; then
355 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
356 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
357 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
358 elif test "`uname -s`" = "Darwin"; then
359 # If Tcl was built as a framework, attempt to use the libraries
360 # from the framework at the given location so that linking works
361 # against Tcl.framework installed in an arbitary location.
364 if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
365 for i in "`cd ${TCL_BIN_DIR}; pwd`" \
366 "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
367 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
368 TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
373 if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
374 TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
375 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
381 # eval is required to do the TCL_DBGX substitution
382 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
383 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
384 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
385 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
387 AC_SUBST(TCL_VERSION)
388 AC_SUBST(TCL_BIN_DIR)
389 AC_SUBST(TCL_SRC_DIR)
391 AC_SUBST(TCL_LIB_FILE)
392 AC_SUBST(TCL_LIB_FLAG)
393 AC_SUBST(TCL_LIB_SPEC)
395 AC_SUBST(TCL_STUB_LIB_FILE)
396 AC_SUBST(TCL_STUB_LIB_FLAG)
397 AC_SUBST(TCL_STUB_LIB_SPEC)
401 AC_SUBST(TCL_EXTRA_CFLAGS)
402 AC_SUBST(TCL_LD_FLAGS)
403 AC_SUBST(TCL_SHLIB_LD_LIBS)
406 #------------------------------------------------------------------------
407 # TEA_LOAD_TKCONFIG --
409 # Load the tkConfig.sh file
413 # Requires the following vars to be set:
418 # Sets the following vars that should be in tkConfig.sh:
420 #------------------------------------------------------------------------
422 AC_DEFUN(TEA_LOAD_TKCONFIG, [
423 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
425 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
426 AC_MSG_RESULT([loading])
427 . ${TK_BIN_DIR}/tkConfig.sh
429 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
432 # eval is required to do the TK_DBGX substitution
433 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
434 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
436 # If the TK_BIN_DIR is the build directory (not the install directory),
437 # then set the common variable name to the value of the build variables.
438 # For example, the variable TK_LIB_SPEC will be set to the value
439 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
440 # instead of TK_BUILD_LIB_SPEC since it will work with both an
441 # installed and uninstalled version of Tcl.
442 if test -f ${TK_BIN_DIR}/Makefile ; then
443 TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
444 TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
445 TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
446 elif test "`uname -s`" = "Darwin"; then
447 # If Tk was built as a framework, attempt to use the libraries
448 # from the framework at the given location so that linking works
449 # against Tk.framework installed in an arbitary location.
452 if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then
453 for i in "`cd ${TK_BIN_DIR}; pwd`" \
454 "`cd ${TK_BIN_DIR}/../..; pwd`"; do
455 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
456 TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}"
461 if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then
462 TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
463 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
469 # eval is required to do the TK_DBGX substitution
470 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
471 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
472 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
473 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
475 # Ensure windowingsystem is defined
476 if test "${TEA_PLATFORM}" = "unix" ; then
479 AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
480 TEA_WINDOWINGSYSTEM="aqua"
483 TEA_WINDOWINGSYSTEM="x11"
486 elif test "${TEA_PLATFORM}" = "windows" ; then
487 TEA_WINDOWINGSYSTEM="win32"
494 AC_SUBST(TK_LIB_FILE)
495 AC_SUBST(TK_LIB_FLAG)
496 AC_SUBST(TK_LIB_SPEC)
498 AC_SUBST(TK_STUB_LIB_FILE)
499 AC_SUBST(TK_STUB_LIB_FLAG)
500 AC_SUBST(TK_STUB_LIB_SPEC)
503 AC_SUBST(TK_XINCLUDES)
506 #------------------------------------------------------------------------
507 # TEA_ENABLE_SHARED --
509 # Allows the building of shared libraries
516 # Adds the following arguments to configure:
517 # --enable-shared=yes|no
519 # Defines the following vars:
520 # STATIC_BUILD Used for building import/export libraries
523 # Sets the following vars:
524 # SHARED_BUILD Value of 1 or 0
525 #------------------------------------------------------------------------
527 AC_DEFUN(TEA_ENABLE_SHARED, [
528 AC_MSG_CHECKING([how to build libraries])
529 AC_ARG_ENABLE(shared,
530 AC_HELP_STRING([--enable-shared],
531 [build and link with shared libraries (default: on)]),
532 [tcl_ok=$enableval], [tcl_ok=yes])
534 if test "${enable_shared+set}" = set; then
535 enableval="$enable_shared"
541 if test "$tcl_ok" = "yes" ; then
542 AC_MSG_RESULT([shared])
545 AC_MSG_RESULT([static])
547 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
549 AC_SUBST(SHARED_BUILD)
552 #------------------------------------------------------------------------
553 # TEA_ENABLE_THREADS --
555 # Specify if thread support should be enabled. If "yes" is specified
556 # as an arg (optional), threads are enabled by default, "no" means
557 # threads are disabled. "yes" is the default.
559 # TCL_THREADS is checked so that if you are compiling an extension
560 # against a threaded core, your extension must be compiled threaded
563 # Note that it is legal to have a thread enabled extension run in a
564 # threaded or non-threaded Tcl core, but a non-threaded extension may
565 # only run in a non-threaded Tcl core.
572 # Adds the following arguments to configure:
575 # Sets the following vars:
576 # THREADS_LIBS Thread library(s)
578 # Defines the following vars:
583 #------------------------------------------------------------------------
585 AC_DEFUN(TEA_ENABLE_THREADS, [
586 AC_ARG_ENABLE(threads,
587 AC_HELP_STRING([--enable-threads],
588 [build with threads]),
589 [tcl_ok=$enableval], [tcl_ok=yes])
591 if test "${enable_threads+set}" = set; then
592 enableval="$enable_threads"
598 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
601 if test "${TEA_PLATFORM}" != "windows" ; then
602 # We are always OK on Windows, so check what this platform wants:
604 # USE_THREAD_ALLOC tells us to try the special thread-based
605 # allocator that significantly reduces lock contention
606 AC_DEFINE(USE_THREAD_ALLOC, 1,
607 [Do we want to use the threaded memory allocator?])
608 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
609 if test "`uname -s`" = "SunOS" ; then
610 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
611 [Do we really want to follow the standard? Yes we do!])
613 AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
614 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
615 if test "$tcl_ok" = "no"; then
616 # Check a little harder for __pthread_mutex_init in the same
617 # library, as some systems hide it there until pthread.h is
618 # defined. We could alternatively do an AC_TRY_COMPILE with
619 # pthread.h, but that will work with libpthread really doesn't
620 # exist, like AIX 4.2. [Bug: 4359]
621 AC_CHECK_LIB(pthread, __pthread_mutex_init,
622 tcl_ok=yes, tcl_ok=no)
625 if test "$tcl_ok" = "yes"; then
626 # The space is needed
627 THREADS_LIBS=" -lpthread"
629 AC_CHECK_LIB(pthreads, pthread_mutex_init,
630 tcl_ok=yes, tcl_ok=no)
631 if test "$tcl_ok" = "yes"; then
632 # The space is needed
633 THREADS_LIBS=" -lpthreads"
635 AC_CHECK_LIB(c, pthread_mutex_init,
636 tcl_ok=yes, tcl_ok=no)
637 if test "$tcl_ok" = "no"; then
638 AC_CHECK_LIB(c_r, pthread_mutex_init,
639 tcl_ok=yes, tcl_ok=no)
640 if test "$tcl_ok" = "yes"; then
641 # The space is needed
642 THREADS_LIBS=" -pthread"
645 AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
654 # Do checking message here to not mess up interleaved configure output
655 AC_MSG_CHECKING([for building with threads])
656 if test "${TCL_THREADS}" = 1; then
657 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
658 AC_MSG_RESULT([yes (default)])
662 # TCL_THREADS sanity checking. See if our request for building with
663 # threads is the same as the way Tcl was built. If not, warn the user.
666 if test "${TCL_THREADS}" = "0"; then
668 Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
669 that IS thread-enabled. It is recommended to use --enable-threads.])
673 if test "${TCL_THREADS}" = "1"; then
675 --enable-threads requested, but building against a Tcl that is NOT
676 thread-enabled. This is an OK configuration that will also run in
677 a thread-enabled core.])
681 AC_SUBST(TCL_THREADS)
684 #------------------------------------------------------------------------
685 # TEA_ENABLE_SYMBOLS --
687 # Specify if debugging symbols should be used.
688 # Memory (TCL_MEM_DEBUG) debugging can also be enabled.
693 # TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
694 # the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
695 # Requires the following vars to be set in the Makefile:
701 # Adds the following arguments to configure:
704 # Defines the following vars:
705 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
706 # Sets to $(CFLAGS_OPTIMIZE) if false
707 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
708 # Sets to $(LDFLAGS_OPTIMIZE) if false
709 # DBGX Formerly used as debug library extension;
712 #------------------------------------------------------------------------
714 AC_DEFUN(TEA_ENABLE_SYMBOLS, [
715 dnl Make sure we are initialized
716 AC_REQUIRE([TEA_CONFIG_CFLAGS])
717 AC_MSG_CHECKING([for build with symbols])
718 AC_ARG_ENABLE(symbols,
719 AC_HELP_STRING([--enable-symbols],
720 [build with debugging symbols (default: off)]),
721 [tcl_ok=$enableval], [tcl_ok=no])
723 if test "$tcl_ok" = "no"; then
724 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
725 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
728 CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
729 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
730 if test "$tcl_ok" = "yes"; then
731 AC_MSG_RESULT([yes (standard debugging)])
734 if test "${TEA_PLATFORM}" != "windows" ; then
735 LDFLAGS_DEFAULT="${LDFLAGS}"
739 AC_SUBST(CFLAGS_DEFAULT)
740 AC_SUBST(LDFLAGS_DEFAULT)
742 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
743 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
746 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
747 if test "$tcl_ok" = "all"; then
748 AC_MSG_RESULT([enabled symbols mem debugging])
750 AC_MSG_RESULT([enabled $tcl_ok debugging])
755 #------------------------------------------------------------------------
756 # TEA_ENABLE_LANGINFO --
758 # Allows use of modern nl_langinfo check for better l10n.
759 # This is only relevant for Unix.
766 # Adds the following arguments to configure:
767 # --enable-langinfo=yes|no (default is yes)
769 # Defines the following vars:
770 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
772 #------------------------------------------------------------------------
774 AC_DEFUN(TEA_ENABLE_LANGINFO, [
775 AC_ARG_ENABLE(langinfo,
776 AC_HELP_STRING([--enable-langinfo],
777 [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
778 [langinfo_ok=$enableval], [langinfo_ok=yes])
781 if test "$langinfo_ok" = "yes"; then
782 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
784 AC_MSG_CHECKING([whether to use nl_langinfo])
785 if test "$langinfo_ok" = "yes"; then
786 AC_CACHE_VAL(tcl_cv_langinfo_h,
787 AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
788 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no]))
789 AC_MSG_RESULT([$tcl_cv_langinfo_h])
790 if test $tcl_cv_langinfo_h = yes; then
791 AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
794 AC_MSG_RESULT([$langinfo_ok])
798 #--------------------------------------------------------------------
801 # Determine what the system is (some things cannot be easily checked
802 # on a feature-driven basis, alas). This can usually be done via the
803 # "uname" command, but there are a few systems, like Next, where
810 # Defines the following var:
812 # system - System/platform/version identification code.
814 #--------------------------------------------------------------------
816 AC_DEFUN(TEA_CONFIG_SYSTEM, [
817 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
818 if test "${TEA_PLATFORM}" = "windows" ; then
819 tcl_cv_sys_version=windows
820 elif test -f /usr/lib/NextStep/software_version; then
821 tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
823 tcl_cv_sys_version=`uname -s`-`uname -r`
824 if test "$?" -ne 0 ; then
825 AC_MSG_WARN([can't find uname command])
826 tcl_cv_sys_version=unknown
828 # Special check for weird MP-RAS system (uname returns weird
829 # results, and the version is kept in special file).
831 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
832 tcl_cv_sys_version=MP-RAS-`awk '{print $3}' /etc/.relid`
834 if test "`uname -s`" = "AIX" ; then
835 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
840 system=$tcl_cv_sys_version
843 #--------------------------------------------------------------------
846 # Try to determine the proper flags to pass to the compiler
847 # for building shared libraries and other such nonsense.
854 # Defines and substitutes the following vars:
856 # DL_OBJS - Name of the object file that implements dynamic
857 # loading for Tcl on this system.
858 # DL_LIBS - Library file(s) to include in tclsh and other base
859 # applications in order for the "load" command to work.
860 # LDFLAGS - Flags to pass to the compiler when linking object
861 # files into an executable application binary such
863 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
864 # that tell the run-time dynamic linker where to look
865 # for shared libraries such as libtcl.so. Depends on
866 # the variable LIB_RUNTIME_DIR in the Makefile. Could
867 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
868 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
869 # that tell the run-time dynamic linker where to look
870 # for shared libraries such as libtcl.so. Depends on
871 # the variable LIB_RUNTIME_DIR in the Makefile.
872 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
873 # of a shared library (may request position-independent
874 # code, among other things).
875 # SHLIB_LD - Base command to use for combining object files
876 # into a shared library.
877 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
878 # creating shared libraries. This symbol typically
879 # goes at the end of the "ld" commands that build
880 # shared libraries. The value of the symbol is
881 # "${LIBS}" if all of the dependent libraries should
882 # be specified when creating a shared library. If
883 # dependent libraries should not be specified (as on
884 # SunOS 4.x, where they cause the link to fail, or in
885 # general if Tcl and Tk aren't themselves shared
886 # libraries), then this symbol has an empty string
888 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
889 # extensions. An empty string means we don't know how
890 # to use shared libraries on this platform.
891 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
892 # in a static or shared library name, using the $VERSION variable
893 # to put the version in the right place. This is used
894 # by platforms that need non-standard library names.
895 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
896 # to have a version after the .so, and ${VERSION}.a
897 # on AIX, since a shared library needs to have
898 # a .a extension whereas shared objects for loadable
899 # extensions have a .so extension. Defaults to
900 # ${VERSION}${SHLIB_SUFFIX}.
901 # TCL_NEEDS_EXP_FILE -
902 # 1 means that an export file is needed to link to a
904 # TCL_EXP_FILE - The name of the installed export / import file which
905 # should be used to link to the Tcl shared library.
906 # Empty if Tcl is unshared.
907 # TCL_BUILD_EXP_FILE -
908 # The name of the built export / import file which
909 # should be used to link to the Tcl shared library.
910 # Empty if Tcl is unshared.
912 # Flags used when running the compiler in debug mode
914 # Flags used when running the compiler in optimize mode
915 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
917 #--------------------------------------------------------------------
919 AC_DEFUN(TEA_CONFIG_CFLAGS, [
920 dnl Make sure we are initialized
921 AC_REQUIRE([TEA_INIT])
923 # Step 0.a: Enable 64 bit support?
925 AC_MSG_CHECKING([if 64bit support is requested])
927 AC_HELP_STRING([--enable-64bit],
928 [enable 64bit support (default: off)]),
929 [do64bit=$enableval], [do64bit=no])
930 AC_MSG_RESULT([$do64bit])
932 # Step 0.b: Enable Solaris 64 bit VIS support?
934 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
935 AC_ARG_ENABLE(64bit-vis,
936 AC_HELP_STRING([--enable-64bit-vis],
937 [enable 64bit Sparc VIS support (default: off)]),
938 [do64bitVIS=$enableval], [do64bitVIS=no])
939 AC_MSG_RESULT([$do64bitVIS])
941 if test "$do64bitVIS" = "yes"; then
942 # Force 64bit on with VIS
946 # Step 0.c: Cross-compiling options for Windows/CE builds?
948 if test "${TEA_PLATFORM}" = "windows" ; then
949 AC_MSG_CHECKING([if Windows/CE build is requested])
950 AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no])
951 AC_MSG_RESULT([$doWince])
954 # Step 1: set the variable "system" to hold the name and version number
959 # Step 2: check for existence of -ldl library. This is needed because
960 # Linux can use either -ldl or -ldld for dynamic loading.
962 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
964 # Require ranlib early so we can override it in special cases below.
966 AC_REQUIRE([AC_PROG_RANLIB])
968 # Step 3: set configuration options based on system name and version.
969 # This is similar to Tcl's unix/tcl.m4 except that we've added a
973 LDFLAGS_ORIG="$LDFLAGS"
974 # When ld needs options to work in 64-bit mode, put them in
975 # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
976 # is disabled by the user. [Bug 1016796]
978 TCL_EXPORT_FILE_SUFFIX=""
979 UNSHARED_LIB_SUFFIX=""
980 TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
981 ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
982 TCL_LIB_VERSIONS_OK=ok
985 if test "$GCC" = "yes" ; then
987 CFLAGS_WARNING="-Wall -Wno-implicit-int"
992 TCL_BUILD_EXP_FILE=""
994 dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
995 dnl AC_CHECK_TOOL(AR, ar)
996 AC_CHECK_PROG(AR, ar, ar)
998 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1001 # This is a 2-stage check to make sure we have the 64-bit SDK
1002 # We have to know where the SDK is installed.
1003 # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
1004 # MACHINE is IX86 for LINK, but this is used by the manifest,
1005 # which requires x86|amd64|ia64.
1007 if test "$do64bit" != "no" ; then
1008 if test "x${MSSDK}x" = "xx" ; then
1009 MSSDK="C:/Progra~1/Microsoft Platform SDK"
1011 MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
1015 MACHINE="AMD64" ; # default to AMD64 64-bit build
1016 PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
1020 PATH64="${MSSDK}/Bin/Win64"
1023 if test ! -d "${PATH64}" ; then
1024 AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode])
1025 AC_MSG_WARN([Ensure latest Platform SDK is installed])
1028 AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
1033 if test "$doWince" != "no" ; then
1034 if test "$do64bit" != "no" ; then
1035 AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible])
1037 if test "$GCC" = "yes" ; then
1038 AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
1041 # Set defaults for common evc4/PPC2003 setup
1042 # Currently Tcl requires 300+, possibly 420+ for sockets
1043 CEVERSION=420; # could be 211 300 301 400 420 ...
1044 TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
1045 ARCH=ARM; # could be ARM MIPS X86EM ...
1046 PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
1047 if test "$doWince" != "yes"; then
1048 # If !yes then the user specified something
1049 # Reset ARCH to allow user to skip specifying it
1051 eval `echo $doWince | awk -F, '{ \
1052 if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
1053 if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
1054 if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
1055 if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
1056 if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
1058 if test "x${ARCH}" = "x" ; then
1062 OSVERSION=WCE$CEVERSION;
1063 if test "x${WCEROOT}" = "x" ; then
1064 WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
1065 if test ! -d "${WCEROOT}" ; then
1066 WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
1069 if test "x${SDKROOT}" = "x" ; then
1070 SDKROOT="C:/Program Files/Windows CE Tools"
1071 if test ! -d "${SDKROOT}" ; then
1072 SDKROOT="C:/Windows CE Tools"
1075 WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
1076 SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
1077 if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
1078 -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
1079 AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
1082 # We could PATH_NOSPACE these, but that's not important,
1083 # as long as we quote them when used.
1084 CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
1085 if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
1086 CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
1088 CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
1092 if test "$GCC" != "yes" ; then
1093 if test "${SHARED_BUILD}" = "0" ; then
1099 if test "$do64bit" != "no" ; then
1100 # All this magic is necessary for the Win64 SDK RC1 - hobbs
1101 CC="\"${PATH64}/cl.exe\""
1102 CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
1103 RC="\"${MSSDK}/bin/rc.exe\""
1104 lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
1105 LINKBIN="\"${PATH64}/link.exe\""
1106 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
1107 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1108 # Avoid 'unresolved external symbol __security_cookie'
1109 # errors, c.f. http://support.microsoft.com/?id=894573
1110 TEA_ADD_LIBS([bufferoverflowU.lib])
1111 elif test "$doWince" != "no" ; then
1112 CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
1113 if test "${TARGETCPU}" = "X86"; then
1114 CC="\"${CEBINROOT}/cl.exe\""
1116 CC="\"${CEBINROOT}/cl${ARCH}.exe\""
1118 CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
1119 RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
1120 arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
1121 defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
1122 if test "${SHARED_BUILD}" = "1" ; then
1123 # Static CE builds require static celib as well
1127 AC_DEFINE_UNQUOTED($i, 1, [WinCE def ]$i)
1129 AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION, [_WIN32_WCE version])
1130 AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION, [UNDER_CE version])
1131 CFLAGS_DEBUG="-nologo -Zi -Od"
1132 CFLAGS_OPTIMIZE="-nologo -Ox"
1133 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
1134 lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
1135 LINKBIN="\"${CEBINROOT}/link.exe\""
1141 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
1142 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1146 if test "$GCC" = "yes"; then
1150 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1151 SHLIB_LD="$CC -shared"
1152 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1153 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
1154 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
1156 SHLIB_LD="${LINKBIN} -dll ${lflags}"
1157 # link -lib only works when -lib is the first arg
1158 STLIB_LD="${LINKBIN} -lib ${lflags}"
1159 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
1161 # For information on what debugtype is most useful, see:
1162 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
1163 # This essentially turns it all on.
1164 LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2"
1165 LDFLAGS_OPTIMIZE="-release"
1166 if test "$doWince" != "no" ; then
1167 LDFLAGS_CONSOLE="-link ${lflags}"
1168 LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
1170 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
1171 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
1175 SHLIB_LD_LIBS='${LIBS}'
1177 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
1179 TCL_LIB_VERSIONS_OK=nodots
1180 # Bogus to avoid getting this turned off
1181 DL_OBJS="tclLoadNone.obj"
1184 if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
1185 # AIX requires the _r compiler when gcc isn't being used
1194 AC_MSG_RESULT([Using $CC for compiling with threads])
1198 SHLIB_LD_LIBS='${LIBS}'
1201 DL_OBJS="tclLoadDl.o"
1202 LD_LIBRARY_PATH_VAR="LIBPATH"
1204 # Check to enable 64-bit flags for compiler/linker on AIX 4+
1205 if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
1206 if test "$GCC" = "yes" ; then
1207 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1210 CFLAGS="$CFLAGS -q64"
1212 RANLIB="${RANLIB} -X64"
1214 SHLIB_LD_FLAGS="-b64"
1218 if test "`uname -m`" = "ia64" ; then
1219 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1220 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1221 # AIX-5 has dl* in libc.so
1223 if test "$GCC" = "yes" ; then
1224 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1226 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1228 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1230 if test "$GCC" = "yes" ; then
1231 SHLIB_LD="gcc -shared"
1233 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
1235 SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1237 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1238 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1239 TCL_NEEDS_EXP_FILE=1
1240 TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp'
1243 # AIX v<=4.1 has some different flags than 4.2+
1244 if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
1245 AC_LIBOBJ([tclLoadAix])
1249 # On AIX <=v4 systems, libbsd.a has to be linked in to support
1250 # non-blocking file IO. This library has to be linked in after
1251 # the MATH_LIBS or it breaks the pow() function. The way to
1252 # insure proper sequencing, is to add it to the tail of MATH_LIBS.
1253 # This library also supplies gettimeofday.
1255 # AIX does not have a timezone field in struct tm. When the AIX
1256 # bsd library is used, the timezone global and the gettimeofday
1257 # methods are to be avoided for timezone deduction instead, we
1258 # deduce the timezone by comparing the localtime result on a
1261 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
1262 if test $libbsd = yes; then
1263 MATH_LIBS="$MATH_LIBS -lbsd"
1264 AC_DEFINE(USE_DELTA_FOR_TZ, 1, [Do we need a special AIX hack for timezones?])
1268 SHLIB_CFLAGS="-fPIC"
1269 SHLIB_LD="${CC} -nostart"
1270 SHLIB_LD_LIBS='${LIBS}'
1272 DL_OBJS="tclLoadDl.o"
1275 #-----------------------------------------------------------
1276 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1277 # -lsocket, even if the network functions are in -lnet which
1278 # is always linked to, for compatibility.
1279 #-----------------------------------------------------------
1280 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1282 BSD/OS-2.1*|BSD/OS-3*)
1284 SHLIB_LD="shlicc -r"
1285 SHLIB_LD_LIBS='${LIBS}'
1287 DL_OBJS="tclLoadDl.o"
1293 SHLIB_CFLAGS="-export-dynamic -fPIC"
1294 SHLIB_LD="cc -shared"
1295 SHLIB_LD_LIBS='${LIBS}'
1297 DL_OBJS="tclLoadDl.o"
1299 LDFLAGS="$LDFLAGS -export-dynamic"
1304 SHLIB_CFLAGS="-K PIC"
1308 DL_OBJS="tclLoadDl.o"
1314 # Use updated header definitions where possible
1315 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1316 # Needed by Tcl, but not most extensions
1317 #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1318 #LIBS="$LIBS -lxnet" # Use the XOPEN network library
1321 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1322 if test "$tcl_ok" = yes; then
1325 SHLIB_LD_LIBS='${LIBS}'
1326 DL_OBJS="tclLoadShl.o"
1328 LDFLAGS="$LDFLAGS -Wl,-E"
1329 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1330 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1331 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1333 if test "$GCC" = "yes" ; then
1334 SHLIB_LD="gcc -shared"
1335 SHLIB_LD_LIBS='${LIBS}'
1336 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1339 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1340 #CFLAGS="$CFLAGS +DAportable"
1342 # Check to enable 64-bit flags for compiler/linker
1343 if test "$do64bit" = "yes" ; then
1344 if test "$GCC" = "yes" ; then
1345 hpux_arch=`${CC} -dumpmachine`
1348 # 64-bit gcc in use. Fix flags for GNU ld.
1350 SHLIB_LD="${CC} -shared"
1351 SHLIB_LD_LIBS='${LIBS}'
1352 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1353 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1356 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1361 CFLAGS="$CFLAGS +DD64"
1362 LDFLAGS_ARCH="+DD64"
1366 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1368 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1369 if test "$tcl_ok" = yes; then
1373 DL_OBJS="tclLoadShl.o"
1375 LDFLAGS="$LDFLAGS -Wl,-E"
1376 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1377 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1378 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1383 SHLIB_LD="ld -shared -rdata_shared"
1384 SHLIB_LD_LIBS='${LIBS}'
1386 DL_OBJS="tclLoadDl.o"
1388 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1389 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1393 SHLIB_LD="ld -n32 -shared -rdata_shared"
1394 SHLIB_LD_LIBS='${LIBS}'
1396 DL_OBJS="tclLoadDl.o"
1398 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1399 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1400 if test "$GCC" = "yes" ; then
1401 CFLAGS="$CFLAGS -mabi=n32"
1402 LDFLAGS="$LDFLAGS -mabi=n32"
1406 # Use to build 6.2 compatible binaries on 6.3.
1407 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1410 CFLAGS="$CFLAGS -n32"
1413 LDFLAGS="$LDFLAGS -n32"
1418 SHLIB_LD="ld -n32 -shared -rdata_shared"
1419 SHLIB_LD_LIBS='${LIBS}'
1421 DL_OBJS="tclLoadDl.o"
1423 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1424 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1426 # Check to enable 64-bit flags for compiler/linker
1428 if test "$do64bit" = "yes" ; then
1429 if test "$GCC" = "yes" ; then
1430 AC_MSG_WARN([64bit mode not supported by gcc])
1433 SHLIB_LD="ld -64 -shared -rdata_shared"
1434 CFLAGS="$CFLAGS -64"
1440 SHLIB_CFLAGS="-fPIC"
1441 SHLIB_LD_LIBS='${LIBS}'
1444 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1445 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1446 # when you inline the string and math operations. Turn this off to
1447 # get rid of the warnings.
1448 #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1450 SHLIB_LD="${CC} -shared"
1451 DL_OBJS="tclLoadDl.o"
1453 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1454 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1455 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1456 if test "`uname -m`" = "alpha" ; then
1457 CFLAGS="$CFLAGS -mieee"
1460 # The combo of gcc + glibc has a bug related
1461 # to inlining of functions like strtod(). The
1462 # -fno-builtin flag should address this problem
1463 # but it does not work. The -fno-inline flag
1464 # is kind of overkill but it works.
1465 # Disable inlining only when one of the
1466 # files in compat/*.c is being linked in.
1467 if test x"${USE_COMPAT}" != x ; then
1468 CFLAGS="$CFLAGS -fno-inline"
1473 SHLIB_CFLAGS="-fPIC"
1474 SHLIB_LD_LIBS='${LIBS}'
1477 SHLIB_LD="${CC} -shared"
1480 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1483 if test "`uname -m`" = "alpha" ; then
1484 CFLAGS="$CFLAGS -mieee"
1488 SHLIB_CFLAGS="-fPIC"
1489 SHLIB_LD_LIBS='${LIBS}'
1492 SHLIB_LD="${CC} -shared "
1493 DL_OBJS="tclLoadDl.o"
1494 DL_LIBS="-mshared -ldl"
1495 LD_FLAGS="-Wl,--export-dynamic"
1496 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1497 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1500 SHLIB_CFLAGS="-K PIC"
1504 DL_OBJS="tclLoadDl.o"
1510 SHLIB_CFLAGS="-K PIC"
1514 DL_OBJS="tclLoadDl.o"
1516 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1520 NetBSD-*|FreeBSD-[[1-2]].*)
1521 # NetBSD/SPARC needs -fPIC, -fpic will not do.
1522 SHLIB_CFLAGS="-fPIC"
1523 SHLIB_LD="ld -Bshareable -x"
1526 DL_OBJS="tclLoadDl.o"
1528 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1529 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1530 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1535 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1536 if test $tcl_cv_ld_elf = yes; then
1537 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1539 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
1542 # Ancient FreeBSD doesn't handle version numbers with dots.
1544 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1545 TCL_LIB_VERSIONS_OK=nodots
1548 # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
1551 SHLIB_CFLAGS="-fPIC";;
1553 SHLIB_CFLAGS="-fpic";;
1555 SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
1556 SHLIB_LD_LIBS='${LIBS}'
1558 DL_OBJS="tclLoadDl.o"
1560 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1561 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1562 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
1563 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1568 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1569 if test $tcl_cv_ld_elf = yes; then
1570 LDFLAGS=-Wl,-export-dynamic
1575 # OpenBSD doesn't do version numbers with dots.
1576 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1577 TCL_LIB_VERSIONS_OK=nodots
1580 # FreeBSD 3.* and greater have ELF.
1581 SHLIB_CFLAGS="-fPIC"
1582 SHLIB_LD="ld -Bshareable -x"
1583 SHLIB_LD_LIBS='${LIBS}'
1585 DL_OBJS="tclLoadDl.o"
1587 LDFLAGS="$LDFLAGS -export-dynamic"
1588 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1589 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1590 if test "${TCL_THREADS}" = "1" ; then
1591 # The -pthread needs to go in the CFLAGS, not LIBS
1592 LIBS=`echo $LIBS | sed s/-pthread//`
1593 CFLAGS="$CFLAGS -pthread"
1594 LDFLAGS="$LDFLAGS -pthread"
1598 # FreeBSD-3 doesn't handle version numbers with dots.
1599 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1600 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1601 TCL_LIB_VERSIONS_OK=nodots
1606 CFLAGS_OPTIMIZE="-Os"
1607 SHLIB_CFLAGS="-fno-common"
1608 if test $do64bit = yes; then
1610 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1612 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS here:
1613 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
1614 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1615 hold_ldflags=$LDFLAGS
1616 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1617 AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
1618 LDFLAGS=$hold_ldflags])
1619 if test $tcl_cv_ld_single_module = yes; then
1620 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1622 SHLIB_LD_LIBS='${LIBS}'
1623 SHLIB_SUFFIX=".dylib"
1624 DL_OBJS="tclLoadDyld.o"
1626 # Don't use -prebind when building for Mac OS X 10.4 or later only:
1627 test -z "${MACOSX_DEPLOYMENT_TARGET}" || \
1628 test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F. '{print [$]2}'`" -lt 4 && \
1629 LDFLAGS="$LDFLAGS -prebind"
1630 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1631 AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
1632 hold_ldflags=$LDFLAGS
1633 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1634 AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
1635 LDFLAGS=$hold_ldflags])
1636 if test $tcl_cv_ld_search_paths_first = yes; then
1637 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1641 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1643 # TEA specific: for Tk extensions, remove -arch ppc64 from CFLAGS
1644 # for fat builds, as neither TkAqua nor TkX11 can be built for 64bit
1645 # at present (no 64bit GUI libraries).
1646 test $do64bit_ok = no && test -n "${TK_BIN_DIR}" && \
1647 CFLAGS="`echo "$CFLAGS" | sed -e 's/-arch ppc64/-arch ppc/g'`"
1651 SHLIB_LD="cc -nostdlib -r"
1654 DL_OBJS="tclLoadNext.o"
1660 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1661 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1662 [Should OS/390 do the right thing with sockets?])
1664 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1665 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1667 # Hack: make package name same as library name
1668 SHLIB_LD='ld -R -export $@:'
1671 DL_OBJS="tclLoadOSF.o"
1677 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1678 SHLIB_CFLAGS="-fPIC"
1679 if test "$SHARED_BUILD" = "1" ; then
1680 SHLIB_LD="ld -shared"
1682 SHLIB_LD="ld -non_shared"
1686 DL_OBJS="tclLoadDl.o"
1694 if test "$SHARED_BUILD" = "1" ; then
1695 SHLIB_LD='ld -shared -expect_unresolved "*"'
1697 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1701 DL_OBJS="tclLoadDl.o"
1703 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1704 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1705 if test "$GCC" = "yes" ; then
1706 CFLAGS="$CFLAGS -mieee"
1708 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
1710 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1711 if test "${TCL_THREADS}" = "1" ; then
1712 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1713 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1714 LIBS=`echo $LIBS | sed s/-lpthreads//`
1715 if test "$GCC" = "yes" ; then
1716 LIBS="$LIBS -lpthread -lmach -lexc"
1718 CFLAGS="$CFLAGS -pthread"
1719 LDFLAGS="$LDFLAGS -pthread"
1726 # This may work for all QNX, but it was only reported for v6.
1727 SHLIB_CFLAGS="-fPIC"
1728 SHLIB_LD="ld -Bshareable -x"
1731 DL_OBJS="tclLoadDl.o"
1732 # dlopen is in -lc on QNX
1738 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1739 # this test works, since "uname -s" was non-standard in 3.2.4 and
1741 if test "$GCC" = "yes" ; then
1742 SHLIB_CFLAGS="-fPIC -melf"
1743 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1745 SHLIB_CFLAGS="-Kpic -belf"
1746 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1751 DL_OBJS="tclLoadDl.o"
1757 SHLIB_CFLAGS="-K PIC"
1761 DL_OBJS="tclLoadDl.o"
1771 DL_OBJS="tclLoadDl.o"
1773 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1774 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1776 # SunOS can't handle version numbers with dots in them in library
1777 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1778 # requires an extra version number at the end of .so file names.
1779 # So, the library has to have a name like libtcl75.so.1.0
1781 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
1782 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1783 TCL_LIB_VERSIONS_OK=nodots
1786 # Careful to not let 5.10+ fall into this case
1788 # Note: If _REENTRANT isn't defined, then Solaris
1789 # won't define thread-safe library routines.
1791 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1792 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1793 [Do we really want to follow the standard? Yes we do!])
1795 SHLIB_CFLAGS="-KPIC"
1797 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1798 # symbols when dynamically loaded into tclsh.
1800 SHLIB_LD_LIBS='${LIBS}'
1802 DL_OBJS="tclLoadDl.o"
1804 if test "$GCC" = "yes" ; then
1805 SHLIB_LD="$CC -shared"
1806 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1807 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1809 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1810 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1811 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1815 # Note: If _REENTRANT isn't defined, then Solaris
1816 # won't define thread-safe library routines.
1818 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1819 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1820 [Do we really want to follow the standard? Yes we do!])
1822 SHLIB_CFLAGS="-KPIC"
1824 # Check to enable 64-bit flags for compiler/linker
1825 if test "$do64bit" = "yes" ; then
1827 if test "$arch" = "sparcv9 sparc" ; then
1828 if test "$GCC" = "yes" ; then
1829 if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
1830 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1833 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1834 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1835 SHLIB_CFLAGS="-fPIC"
1839 if test "$do64bitVIS" = "yes" ; then
1840 CFLAGS="$CFLAGS -xarch=v9a"
1841 LDFLAGS_ARCH="-xarch=v9a"
1843 CFLAGS="$CFLAGS -xarch=v9"
1844 LDFLAGS_ARCH="-xarch=v9"
1846 # Solaris 64 uses this as well
1847 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1849 elif test "$arch" = "amd64 i386" ; then
1850 if test "$GCC" = "yes" ; then
1851 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1854 CFLAGS="$CFLAGS -xarch=amd64"
1855 LDFLAGS="$LDFLAGS -xarch=amd64"
1858 AC_MSG_WARN([64bit mode not supported for $arch])
1862 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1863 # symbols when dynamically loaded into tclsh.
1865 SHLIB_LD_LIBS='${LIBS}'
1867 DL_OBJS="tclLoadDl.o"
1869 if test "$GCC" = "yes" ; then
1870 SHLIB_LD="$CC -shared"
1871 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1872 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1873 if test "$do64bit_ok" = "yes" ; then
1874 # We need to specify -static-libgcc or we need to
1875 # add the path to the sparv9 libgcc.
1876 # JH: static-libgcc is necessary for core Tcl, but may
1877 # not be necessary for extensions.
1878 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1879 # for finding sparcv9 libgcc, get the regular libgcc
1880 # path, remove so name and append 'sparcv9'
1881 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1882 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1885 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1886 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1887 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1890 UNIX_SV* | UnixWare-5*)
1891 SHLIB_CFLAGS="-KPIC"
1895 DL_OBJS="tclLoadDl.o"
1897 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1898 # that don't grok the -Bexport option. Test that it does.
1899 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1900 hold_ldflags=$LDFLAGS
1901 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1902 AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
1903 LDFLAGS=$hold_ldflags])
1904 if test $tcl_cv_ld_Bexport = yes; then
1905 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1912 if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
1913 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1916 # Step 4: disable dynamic loading if requested via a command-line switch.
1919 AC_HELP_STRING([--disable-load],
1920 [disallow dynamic loading and "load" command (default: enabled)]),
1921 [tcl_ok=$enableval], [tcl_ok=yes])
1922 if test "$tcl_ok" = "no"; then
1926 if test "x$DL_OBJS" != "x" ; then
1927 BUILD_DLTEST="\$(DLTEST_TARGETS)"
1929 echo "Can't figure out how to do dynamic loading or shared libraries"
1930 echo "on this system."
1934 DL_OBJS="tclLoadNone.o"
1936 LDFLAGS="$LDFLAGS_ORIG"
1941 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
1943 # If we're running gcc, then change the C flags for compiling shared
1944 # libraries to the right flags for gcc, instead of those for the
1945 # standard manufacturer compiler.
1947 if test "$DL_OBJS" != "tclLoadNone.o" ; then
1948 if test "$GCC" = "yes" ; then
1965 SHLIB_CFLAGS="-fPIC"
1971 if test "$SHARED_LIB_SUFFIX" = "" ; then
1972 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
1974 if test "$UNSHARED_LIB_SUFFIX" = "" ; then
1975 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
1980 AC_SUBST(CFLAGS_DEBUG)
1981 AC_SUBST(CFLAGS_OPTIMIZE)
1982 AC_SUBST(CFLAGS_WARNING)
1987 AC_SUBST(SHLIB_LD_LIBS)
1988 AC_SUBST(SHLIB_CFLAGS)
1990 AC_SUBST(LD_LIBRARY_PATH_VAR)
1992 # These must be called after we do the basic CFLAGS checks and
1993 # verify any possible 64-bit or similar switches are necessary
1998 #--------------------------------------------------------------------
2001 # Determine which interface to use to talk to the serial port.
2002 # Note that #include lines must begin in leftmost column for
2003 # some compilers to recognize them as preprocessor directives,
2004 # and some build environments have stdin not pointing at a
2005 # pseudo-terminal (usually /dev/null instead.)
2012 # Defines only one of the following vars:
2018 #--------------------------------------------------------------------
2020 AC_DEFUN(TEA_SERIAL_PORT, [
2021 AC_CHECK_HEADERS(sys/modem.h)
2022 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2024 #include <termios.h>
2028 if (tcgetattr(0, &t) == 0) {
2030 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2034 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2035 if test $tcl_cv_api_serial = no ; then
2041 if (ioctl(0, TCGETA, &t) == 0) {
2042 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2046 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2048 if test $tcl_cv_api_serial = no ; then
2054 if (ioctl(0, TIOCGETP, &t) == 0) {
2056 t.sg_flags |= ODDP | EVENP | RAW;
2060 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2062 if test $tcl_cv_api_serial = no ; then
2064 #include <termios.h>
2069 if (tcgetattr(0, &t) == 0
2070 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2072 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2076 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2078 if test $tcl_cv_api_serial = no; then
2085 if (ioctl(0, TCGETA, &t) == 0
2086 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2087 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2091 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2093 if test $tcl_cv_api_serial = no; then
2100 if (ioctl(0, TIOCGETP, &t) == 0
2101 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2103 t.sg_flags |= ODDP | EVENP | RAW;
2107 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2109 case $tcl_cv_api_serial in
2110 termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
2111 termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
2112 sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
2116 #--------------------------------------------------------------------
2117 # TEA_MISSING_POSIX_HEADERS
2119 # Supply substitutes for missing POSIX header files. Special
2121 # - stdlib.h doesn't define strtol, strtoul, or
2122 # strtod insome versions of SunOS
2123 # - some versions of string.h don't declare procedures such
2131 # Defines some of the following vars:
2135 # HAVE_LIMITS_H or NO_LIMITS_H
2144 # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and
2146 #--------------------------------------------------------------------
2148 AC_DEFUN(TEA_MISSING_POSIX_HEADERS, [
2149 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h,
2150 AC_TRY_LINK([#include <sys/types.h>
2151 #include <dirent.h>], [
2152 #ifndef _POSIX_SOURCE
2155 * Generate compilation error to make the test fail: Lynx headers
2156 * are only valid if really in the POSIX environment.
2159 missing_procedure();
2163 struct dirent *entryPtr;
2165 d = opendir("foobar");
2166 entryPtr = readdir(d);
2167 p = entryPtr->d_name;
2169 ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no))
2171 if test $tcl_cv_dirent_h = no; then
2172 AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
2175 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
2176 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
2177 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
2178 AC_CHECK_HEADER(limits.h,
2179 [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
2180 [AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
2181 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2182 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2183 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2184 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2185 if test $tcl_ok = 0; then
2186 AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
2188 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2189 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2190 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2192 # See also memmove check below for a place where NO_STRING_H can be
2195 if test $tcl_ok = 0; then
2196 AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
2199 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
2200 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
2202 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2203 AC_HAVE_HEADERS(sys/param.h)
2206 #--------------------------------------------------------------------
2209 # Locate the X11 header files and the X11 library archive. Try
2210 # the ac_path_x macro first, but if it doesn't find the X stuff
2211 # (e.g. because there's no xmkmf program) then check through
2212 # a list of possible directories. Under some conditions the
2213 # autoconf macro will return an include directory that contains
2214 # no include files, so double-check its result just to be safe.
2216 # This should be called after TEA_CONFIG_CFLAGS as setting the
2217 # LIBS line can confuse some configure macro magic.
2224 # Sets the following vars:
2227 # PKG_LIBS (appends to)
2229 #--------------------------------------------------------------------
2231 AC_DEFUN(TEA_PATH_X, [
2232 if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
2237 AC_DEFUN(TEA_PATH_UNIX_X, [
2240 if test "$no_x" = ""; then
2241 if test "$x_includes" = ""; then
2242 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2244 if test ! -r $x_includes/X11/Intrinsic.h; then
2245 not_really_there="yes"
2249 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2250 AC_MSG_CHECKING([for X11 header files])
2251 found_xincludes="no"
2252 AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2253 if test "$found_xincludes" = "no"; then
2254 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"
2256 if test -r $i/X11/Intrinsic.h; then
2259 found_xincludes="yes"
2265 if test "$x_includes" != ""; then
2266 XINCLUDES="-I$x_includes"
2267 found_xincludes="yes"
2270 if test found_xincludes = "no"; then
2271 AC_MSG_RESULT([couldn't find any!])
2274 if test "$no_x" = yes; then
2275 AC_MSG_CHECKING([for X11 libraries])
2277 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"
2279 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
2287 if test "$x_libraries" = ""; then
2290 XLIBSW="-L$x_libraries -lX11"
2293 if test "$XLIBSW" = nope ; then
2294 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2296 if test "$XLIBSW" = nope ; then
2297 AC_MSG_RESULT([could not find any! Using -lX11.])
2300 if test x"${XLIBSW}" != x ; then
2301 PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
2305 #--------------------------------------------------------------------
2306 # TEA_BLOCKING_STYLE
2308 # The statements below check for systems where POSIX-style
2309 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2310 # On these systems (mostly older ones), use the old BSD-style
2311 # FIONBIO approach instead.
2318 # Defines some of the following vars:
2324 #--------------------------------------------------------------------
2326 AC_DEFUN(TEA_BLOCKING_STYLE, [
2327 AC_CHECK_HEADERS(sys/ioctl.h)
2328 AC_CHECK_HEADERS(sys/filio.h)
2330 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2332 # There used to be code here to use FIONBIO under AIX. However, it
2333 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
2334 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
2335 # code (JO, 5/31/97).
2338 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2339 AC_MSG_RESULT([FIONBIO])
2342 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2343 AC_MSG_RESULT([FIONBIO])
2346 AC_MSG_RESULT([O_NONBLOCK])
2351 #--------------------------------------------------------------------
2354 # Checks how the system deals with time.h, what time structures
2355 # are used on the system, and what fields the structures have.
2362 # Defines some of the following vars:
2368 #--------------------------------------------------------------------
2370 AC_DEFUN(TEA_TIME_HANDLER, [
2371 AC_CHECK_HEADERS(sys/time.h)
2375 AC_CHECK_FUNCS(gmtime_r localtime_r)
2377 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj,
2378 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2379 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no))
2380 if test $tcl_cv_member_tm_tzadj = yes ; then
2381 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2384 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff,
2385 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2386 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no))
2387 if test $tcl_cv_member_tm_gmtoff = yes ; then
2388 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2392 # Its important to include time.h in this check, as some systems
2393 # (like convex) have timezone functions, etc.
2395 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long,
2396 AC_TRY_COMPILE([#include <time.h>],
2397 [extern long timezone;
2400 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no))
2401 if test $tcl_cv_timezone_long = yes ; then
2402 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2405 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2407 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time,
2408 AC_TRY_COMPILE([#include <time.h>],
2409 [extern time_t timezone;
2412 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no))
2413 if test $tcl_cv_timezone_time = yes ; then
2414 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2419 #--------------------------------------------------------------------
2422 # Under Solaris 2.4, strtod returns the wrong value for the
2423 # terminating character under some conditions. Check for this
2424 # and if the problem exists use a substitute procedure
2425 # "fixstrtod" (provided by Tcl) that corrects the error.
2426 # Also, on Compaq's Tru64 Unix 5.0,
2427 # strtod(" ") returns 0.0 instead of a failure to convert.
2434 # Might defines some of the following vars:
2435 # strtod (=fixstrtod)
2437 #--------------------------------------------------------------------
2439 AC_DEFUN(TEA_BUGGY_STRTOD, [
2440 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2441 if test "$tcl_strtod" = 1; then
2442 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2444 extern double strtod();
2446 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2449 value = strtod(infString, &term);
2450 if ((term != infString) && (term[-1] == 0)) {
2453 value = strtod(nanString, &term);
2454 if ((term != nanString) && (term[-1] == 0)) {
2457 value = strtod(spaceString, &term);
2458 if (term == (spaceString+1)) {
2462 }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2463 tcl_cv_strtod_buggy=buggy)])
2464 if test "$tcl_cv_strtod_buggy" = buggy; then
2465 AC_LIBOBJ([fixstrtod])
2467 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
2472 #--------------------------------------------------------------------
2475 # Search for the libraries needed to link the Tcl shell.
2476 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2477 # -lnsl) are dealt with here.
2480 # Requires the following vars to be set in the Makefile:
2487 # Subst's the following var:
2491 # Might append to the following vars:
2494 # Might define the following vars:
2497 #--------------------------------------------------------------------
2499 AC_DEFUN(TEA_TCL_LINK_LIBS, [
2500 #--------------------------------------------------------------------
2501 # On a few very rare systems, all of the libm.a stuff is
2502 # already in libc.a. Set compiler flags accordingly.
2503 # Also, Linux requires the "ieee" library for math to work
2504 # right (and it must appear before "-lm").
2505 #--------------------------------------------------------------------
2507 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2508 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2510 #--------------------------------------------------------------------
2511 # Interactive UNIX requires -linet instead of -lsocket, plus it
2512 # needs net/errno.h to define the socket-related error codes.
2513 #--------------------------------------------------------------------
2515 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2516 AC_CHECK_HEADER(net/errno.h, [
2517 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2519 #--------------------------------------------------------------------
2520 # Check for the existence of the -lsocket and -lnsl libraries.
2521 # The order here is important, so that they end up in the right
2522 # order in the command line generated by make. Here are some
2523 # special considerations:
2524 # 1. Use "connect" and "accept" to check for -lsocket, and
2525 # "gethostbyname" to check for -lnsl.
2526 # 2. Use each function name only once: can't redo a check because
2527 # autoconf caches the results of the last check and won't redo it.
2528 # 3. Use -lnsl and -lsocket only if they supply procedures that
2529 # aren't already present in the normal libraries. This is because
2530 # IRIX 5.2 has libraries, but they aren't needed and they're
2531 # bogus: they goof up name resolution if used.
2532 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2533 # To get around this problem, check for both libraries together
2534 # if -lsocket doesn't work by itself.
2535 #--------------------------------------------------------------------
2538 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2539 if test "$tcl_checkSocket" = 1; then
2540 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2541 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2543 if test "$tcl_checkBoth" = 1; then
2545 LIBS="$LIBS -lsocket -lnsl"
2546 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2548 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2549 [LIBS="$LIBS -lnsl"])])
2551 # Don't perform the eval of the libraries here because DL_LIBS
2552 # won't be set until we call TEA_CONFIG_CFLAGS
2554 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2559 #--------------------------------------------------------------------
2560 # TEA_TCL_EARLY_FLAGS
2562 # Check for what flags are needed to be passed so the correct OS
2563 # features are available.
2570 # Might define the following vars:
2572 # _LARGEFILE64_SOURCE
2573 # _LARGEFILE_SOURCE64
2575 #--------------------------------------------------------------------
2577 AC_DEFUN(TEA_TCL_EARLY_FLAG,[
2578 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2579 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2580 AC_TRY_COMPILE([[#define ]$1[ 1
2582 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2583 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2584 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2585 AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
2586 tcl_flags="$tcl_flags $1"
2590 AC_DEFUN(TEA_TCL_EARLY_FLAGS,[
2591 AC_MSG_CHECKING([for required early compiler flags])
2593 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2594 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2595 TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2596 [struct stat64 buf; int i = stat64("/", &buf);])
2597 TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2598 [char *p = (char *)open64;])
2599 if test "x${tcl_flags}" = "x" ; then
2600 AC_MSG_RESULT([none])
2602 AC_MSG_RESULT([${tcl_flags}])
2606 #--------------------------------------------------------------------
2607 # TEA_TCL_64BIT_FLAGS
2609 # Check for what is defined in the way of 64-bit features.
2616 # Might define the following vars:
2617 # TCL_WIDE_INT_IS_LONG
2619 # HAVE_STRUCT_DIRENT64
2620 # HAVE_STRUCT_STAT64
2623 #--------------------------------------------------------------------
2625 AC_DEFUN(TEA_TCL_64BIT_FLAGS, [
2626 AC_MSG_CHECKING([for 64-bit integer type])
2627 AC_CACHE_VAL(tcl_cv_type_64bit,[
2628 tcl_cv_type_64bit=none
2629 # See if the compiler knows natively about __int64
2630 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2631 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2632 # See if we should use long anyway Note that we substitute in the
2633 # type that is our current guess for a 64-bit type inside this check
2634 # program, so it should be modified only carefully...
2635 AC_TRY_COMPILE(,[switch (0) {
2636 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2637 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2638 if test "${tcl_cv_type_64bit}" = none ; then
2639 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
2640 AC_MSG_RESULT([using long])
2641 elif test "${tcl_cv_type_64bit}" = "__int64" \
2642 -a "${TEA_PLATFORM}" = "windows" ; then
2643 # We actually want to use the default tcl.h checks in this
2644 # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
2645 AC_MSG_RESULT([using Tcl header defaults])
2647 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2648 [What type should be used to define wide integers?])
2649 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2651 # Now check for auxiliary declarations
2652 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2653 AC_TRY_COMPILE([#include <sys/types.h>
2654 #include <sys/dirent.h>],[struct dirent64 p;],
2655 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2656 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2657 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2660 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2661 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2663 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2664 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2665 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2668 AC_CHECK_FUNCS(open64 lseek64)
2669 AC_MSG_CHECKING([for off64_t])
2670 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2671 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2673 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2674 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2675 dnl functions lseek64 and open64 are defined.
2676 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2677 test "x${ac_cv_func_lseek64}" = "xyes" && \
2678 test "x${ac_cv_func_open64}" = "xyes" ; then
2679 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2680 AC_MSG_RESULT([yes])
2688 ## Here ends the standard Tcl configuration bits and starts the
2689 ## TEA specific functions
2692 #------------------------------------------------------------------------
2695 # Init various Tcl Extension Architecture (TEA) variables.
2696 # This should be the first called TEA_* macro.
2703 # Defines and substs the following vars:
2709 # TEA_PLATFORM (windows or unix)
2711 # "cygpath" is used on windows to generate native path names for include
2712 # files. These variables should only be used with the compiler and linker
2713 # since they generate native path names.
2716 # Select the executable extension based on the host type. This
2717 # is a lightweight replacement for AC_EXEEXT that doesn't require
2719 #------------------------------------------------------------------------
2721 AC_DEFUN(TEA_INIT, [
2722 # TEA extensions pass this us the version of TEA they think they
2723 # are compatible with.
2726 AC_MSG_CHECKING([for correct TEA configuration])
2727 if test x"${PACKAGE_NAME}" = x ; then
2729 The PACKAGE_NAME variable must be defined by your TEA configure.in])
2731 if test x"$1" = x ; then
2733 TEA version not specified.])
2734 elif test "$1" != "${TEA_VERSION}" ; then
2735 AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"])
2737 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
2739 case "`uname -s`" in
2740 *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*)
2741 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
2743 TEA_PLATFORM="windows"
2752 # Check if exec_prefix is set. If not use fall back to prefix.
2753 # Note when adjusted, so that TEA_PREFIX can correct for this.
2754 # This is needed for recursive configures, since autoconf propagates
2755 # $prefix, but not $exec_prefix (doh!).
2756 if test x$exec_prefix = xNONE ; then
2757 exec_prefix_default=yes
2764 # This package name must be replaced statically for AC_SUBST to work
2765 AC_SUBST(PKG_LIB_FILE)
2766 # Substitute STUB_LIB_FILE in case package creates a stub library too.
2767 AC_SUBST(PKG_STUB_LIB_FILE)
2769 # We AC_SUBST these here to ensure they are subst'ed,
2770 # in case the user doesn't call TEA_ADD_...
2771 AC_SUBST(PKG_STUB_SOURCES)
2772 AC_SUBST(PKG_STUB_OBJECTS)
2773 AC_SUBST(PKG_TCL_SOURCES)
2774 AC_SUBST(PKG_HEADERS)
2775 AC_SUBST(PKG_INCLUDES)
2777 AC_SUBST(PKG_CFLAGS)
2780 #------------------------------------------------------------------------
2781 # TEA_ADD_SOURCES --
2783 # Specify one or more source files. Users should check for
2784 # the right platform before adding to their list.
2785 # It is not important to specify the directory, as long as it is
2786 # in the generic, win or unix subdirectory of $(srcdir).
2789 # one or more file names
2793 # Defines and substs the following vars:
2796 #------------------------------------------------------------------------
2797 AC_DEFUN(TEA_ADD_SOURCES, [
2803 PKG_SOURCES="$PKG_SOURCES $i"
2804 PKG_OBJECTS="$PKG_OBJECTS $i"
2807 # check for existence - allows for generic/win/unix VPATH
2808 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2809 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2811 AC_MSG_ERROR([could not find source file '$i'])
2813 PKG_SOURCES="$PKG_SOURCES $i"
2814 # this assumes it is in a VPATH dir
2816 # handle user calling this before or after TEA_SETUP_COMPILER
2817 if test x"${OBJEXT}" != x ; then
2818 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2820 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2822 PKG_OBJECTS="$PKG_OBJECTS $j"
2826 AC_SUBST(PKG_SOURCES)
2827 AC_SUBST(PKG_OBJECTS)
2830 #------------------------------------------------------------------------
2831 # TEA_ADD_STUB_SOURCES --
2833 # Specify one or more source files. Users should check for
2834 # the right platform before adding to their list.
2835 # It is not important to specify the directory, as long as it is
2836 # in the generic, win or unix subdirectory of $(srcdir).
2839 # one or more file names
2843 # Defines and substs the following vars:
2846 #------------------------------------------------------------------------
2847 AC_DEFUN(TEA_ADD_STUB_SOURCES, [
2850 # check for existence - allows for generic/win/unix VPATH
2851 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2852 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2854 AC_MSG_ERROR([could not find stub source file '$i'])
2856 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
2857 # this assumes it is in a VPATH dir
2859 # handle user calling this before or after TEA_SETUP_COMPILER
2860 if test x"${OBJEXT}" != x ; then
2861 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2863 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2865 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
2867 AC_SUBST(PKG_STUB_SOURCES)
2868 AC_SUBST(PKG_STUB_OBJECTS)
2871 #------------------------------------------------------------------------
2872 # TEA_ADD_TCL_SOURCES --
2874 # Specify one or more Tcl source files. These should be platform
2875 # independent runtime files.
2878 # one or more file names
2882 # Defines and substs the following vars:
2884 #------------------------------------------------------------------------
2885 AC_DEFUN(TEA_ADD_TCL_SOURCES, [
2888 # check for existence, be strict because it is installed
2889 if test ! -f "${srcdir}/$i" ; then
2890 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
2892 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
2894 AC_SUBST(PKG_TCL_SOURCES)
2897 #------------------------------------------------------------------------
2898 # TEA_ADD_HEADERS --
2900 # Specify one or more source headers. Users should check for
2901 # the right platform before adding to their list.
2904 # one or more file names
2908 # Defines and substs the following vars:
2910 #------------------------------------------------------------------------
2911 AC_DEFUN(TEA_ADD_HEADERS, [
2914 # check for existence, be strict because it is installed
2915 if test ! -f "${srcdir}/$i" ; then
2916 AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
2918 PKG_HEADERS="$PKG_HEADERS $i"
2920 AC_SUBST(PKG_HEADERS)
2923 #------------------------------------------------------------------------
2924 # TEA_ADD_INCLUDES --
2926 # Specify one or more include dirs. Users should check for
2927 # the right platform before adding to their list.
2930 # one or more file names
2934 # Defines and substs the following vars:
2936 #------------------------------------------------------------------------
2937 AC_DEFUN(TEA_ADD_INCLUDES, [
2940 PKG_INCLUDES="$PKG_INCLUDES $i"
2942 AC_SUBST(PKG_INCLUDES)
2945 #------------------------------------------------------------------------
2948 # Specify one or more libraries. Users should check for
2949 # the right platform before adding to their list. For Windows,
2950 # libraries provided in "foo.lib" format will be converted to
2951 # "-lfoo" when using GCC (mingw).
2954 # one or more file names
2958 # Defines and substs the following vars:
2960 #------------------------------------------------------------------------
2961 AC_DEFUN(TEA_ADD_LIBS, [
2964 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
2965 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
2966 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'`
2968 PKG_LIBS="$PKG_LIBS $i"
2973 #------------------------------------------------------------------------
2976 # Specify one or more CFLAGS. Users should check for
2977 # the right platform before adding to their list.
2980 # one or more file names
2984 # Defines and substs the following vars:
2986 #------------------------------------------------------------------------
2987 AC_DEFUN(TEA_ADD_CFLAGS, [
2988 PKG_CFLAGS="$PKG_CFLAGS $@"
2989 AC_SUBST(PKG_CFLAGS)
2992 #------------------------------------------------------------------------
2995 # Handle the --prefix=... option by defaulting to what Tcl gave
3002 # If --prefix or --exec-prefix was not specified, $prefix and
3003 # $exec_prefix will be set to the values given to Tcl when it was
3005 #------------------------------------------------------------------------
3006 AC_DEFUN(TEA_PREFIX, [
3007 if test "${prefix}" = "NONE"; then
3009 if test x"${TCL_PREFIX}" != x; then
3010 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
3011 prefix=${TCL_PREFIX}
3013 AC_MSG_NOTICE([--prefix defaulting to /usr/local])
3017 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
3018 -o x"${exec_prefix_default}" = x"yes" ; then
3019 if test x"${TCL_EXEC_PREFIX}" != x; then
3020 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
3021 exec_prefix=${TCL_EXEC_PREFIX}
3023 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
3029 #------------------------------------------------------------------------
3030 # TEA_SETUP_COMPILER_CC --
3032 # Do compiler checks the way we want. This is just a replacement
3033 # for AC_PROG_CC in TEA configure.in files to make them cleaner.
3040 # Sets up CC var and other standard bits we need to make executables.
3041 #------------------------------------------------------------------------
3042 AC_DEFUN(TEA_SETUP_COMPILER_CC, [
3043 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
3044 # in this macro, they need to go into TEA_SETUP_COMPILER instead.
3046 # If the user did not set CFLAGS, set it now to keep
3047 # the AC_PROG_CC macro from adding "-g -O2".
3048 if test "${CFLAGS+set}" != "set" ; then
3057 #--------------------------------------------------------------------
3058 # Checks to see if the make program sets the $MAKE variable.
3059 #--------------------------------------------------------------------
3063 #--------------------------------------------------------------------
3065 #--------------------------------------------------------------------
3069 #--------------------------------------------------------------------
3070 # Determines the correct binary file extension (.o, .obj, .exe etc.)
3071 #--------------------------------------------------------------------
3077 #------------------------------------------------------------------------
3078 # TEA_SETUP_COMPILER --
3080 # Do compiler checks that use the compiler. This must go after
3081 # TEA_SETUP_COMPILER_CC, which does the actual compiler check.
3088 # Sets up CC var and other standard bits we need to make executables.
3089 #------------------------------------------------------------------------
3090 AC_DEFUN(TEA_SETUP_COMPILER, [
3091 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
3092 AC_REQUIRE([TEA_SETUP_COMPILER_CC])
3094 #------------------------------------------------------------------------
3095 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
3096 # It makes compiling go faster. (This is only a performance feature.)
3097 #------------------------------------------------------------------------
3099 if test -z "$no_pipe" -a -n "$GCC"; then
3100 AC_MSG_CHECKING([if the compiler understands -pipe])
3103 AC_TRY_COMPILE(,, AC_MSG_RESULT([yes]), CC="$OLDCC"
3104 AC_MSG_RESULT([no]))
3107 #--------------------------------------------------------------------
3108 # Common compiler flag setup
3109 #--------------------------------------------------------------------
3112 if test "${TEA_PLATFORM}" = "unix" ; then
3114 TEA_MISSING_POSIX_HEADERS
3115 # Let the user call this, because if it triggers, they will
3116 # need a compat/strtod.c that is correct. Users can also
3117 # use Tcl_GetDouble(FromObj) instead.
3122 #------------------------------------------------------------------------
3125 # Generate a line that can be used to build a shared/unshared library
3126 # in a platform independent manner.
3135 # Defines the following vars:
3136 # CFLAGS - Done late here to note disturb other AC macros
3137 # MAKE_LIB - Command to execute to build the Tcl library;
3138 # differs depending on whether or not Tcl is being
3139 # compiled as a shared library.
3140 # MAKE_SHARED_LIB Makefile rule for building a shared library
3141 # MAKE_STATIC_LIB Makefile rule for building a static library
3142 # MAKE_STUB_LIB Makefile rule for building a stub library
3143 #------------------------------------------------------------------------
3145 AC_DEFUN(TEA_MAKE_LIB, [
3146 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
3147 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
3148 MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
3149 MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)"
3151 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
3152 MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3153 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
3156 if test "${SHARED_BUILD}" = "1" ; then
3157 MAKE_LIB="${MAKE_SHARED_LIB} "
3159 MAKE_LIB="${MAKE_STATIC_LIB} "
3162 #--------------------------------------------------------------------
3163 # Shared libraries and static libraries have different names.
3164 # Use the double eval to make sure any variables in the suffix is
3165 # substituted. (@@@ Might not be necessary anymore)
3166 #--------------------------------------------------------------------
3168 if test "${TEA_PLATFORM}" = "windows" ; then
3169 if test "${SHARED_BUILD}" = "1" ; then
3170 # We force the unresolved linking of symbols that are really in
3171 # the private libraries of Tcl and Tk.
3172 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
3173 if test x"${TK_BIN_DIR}" != x ; then
3174 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
3176 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3178 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3180 # Some packages build their own stubs libraries
3181 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3182 # These aren't needed on Windows (either MSVC or gcc)
3186 RANLIB_STUB="${RANLIB}"
3187 if test "${SHARED_BUILD}" = "1" ; then
3188 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
3189 if test x"${TK_BIN_DIR}" != x ; then
3190 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
3192 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3195 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3197 # Some packages build their own stubs libraries
3198 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3201 # These are escaped so that only CFLAGS is picked up at configure time.
3202 # The other values will be substituted at make time.
3203 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
3204 if test "${SHARED_BUILD}" = "1" ; then
3205 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
3209 AC_SUBST(MAKE_SHARED_LIB)
3210 AC_SUBST(MAKE_STATIC_LIB)
3211 AC_SUBST(MAKE_STUB_LIB)
3212 AC_SUBST(RANLIB_STUB)
3215 #------------------------------------------------------------------------
3218 # Compute the name of an existing object library located in libdir
3219 # from the given base name and produce the appropriate linker flags.
3222 # basename The base name of the library without version
3223 # numbers, extensions, or "lib" prefixes.
3224 # extra_dir Extra directory in which to search for the
3225 # library. This location is used first, then
3226 # $prefix/$exec-prefix, then some defaults.
3229 # TEA_INIT and TEA_PREFIX must be called first.
3233 # Defines the following vars:
3234 # ${basename}_LIB_NAME The computed library name.
3235 # ${basename}_LIB_SPEC The computed linker flags.
3236 #------------------------------------------------------------------------
3238 AC_DEFUN(TEA_LIB_SPEC, [
3239 AC_MSG_CHECKING([for $1 library])
3241 # Look in exec-prefix for the library (defined by TEA_PREFIX).
3243 tea_lib_name_dir="${exec_prefix}/lib"
3245 # Or in a user-specified location.
3247 if test x"$2" != x ; then
3248 tea_extra_lib_dir=$2
3250 tea_extra_lib_dir=NONE
3254 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3255 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3256 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3257 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3258 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3259 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
3260 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3261 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
3262 if test -f "$i" ; then
3263 tea_lib_name_dir=`dirname $i`
3264 $1_LIB_NAME=`basename $i`
3270 if test "${TEA_PLATFORM}" = "windows"; then
3271 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
3273 # Strip off the leading "lib" and trailing ".a" or ".so"
3275 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
3276 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
3279 if test "x${$1_LIB_NAME}" = x ; then
3280 AC_MSG_ERROR([not found])
3282 AC_MSG_RESULT([${$1_LIB_SPEC}])
3286 #------------------------------------------------------------------------
3287 # TEA_PRIVATE_TCL_HEADERS --
3289 # Locate the private Tcl include files
3294 # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
3295 # already been called.
3299 # Substs the following vars:
3300 # TCL_TOP_DIR_NATIVE
3301 # TCL_GENERIC_DIR_NATIVE
3302 # TCL_UNIX_DIR_NATIVE
3303 # TCL_WIN_DIR_NATIVE
3304 # TCL_BMAP_DIR_NATIVE
3305 # TCL_TOOL_DIR_NATIVE
3306 # TCL_PLATFORM_DIR_NATIVE
3307 # TCL_BIN_DIR_NATIVE
3309 #------------------------------------------------------------------------
3311 AC_DEFUN(TEA_PRIVATE_TCL_HEADERS, [
3312 AC_MSG_CHECKING([for Tcl private include files])
3314 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
3315 TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
3316 TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
3317 TCL_UNIX_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
3318 TCL_WIN_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
3319 TCL_BMAP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/bitmaps\"
3320 TCL_TOOL_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/tools\"
3321 TCL_COMPAT_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/compat\"
3323 if test "${TEA_PLATFORM}" = "windows"; then
3324 TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE}
3326 TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE}
3328 # We want to ensure these are substituted so as not to require
3329 # any *_NATIVE vars be defined in the Makefile
3330 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
3331 if test "`uname -s`" = "Darwin"; then
3332 # If Tcl was built as a framework, attempt to use
3333 # the framework's Headers and PrivateHeaders directories
3336 if test -d "${TCL_BIN_DIR}/Headers" -a -d "${TCL_BIN_DIR}/PrivateHeaders"; then
3337 TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"; else
3338 TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"; fi
3343 AC_SUBST(TCL_TOP_DIR_NATIVE)
3344 AC_SUBST(TCL_GENERIC_DIR_NATIVE)
3345 AC_SUBST(TCL_UNIX_DIR_NATIVE)
3346 AC_SUBST(TCL_WIN_DIR_NATIVE)
3347 AC_SUBST(TCL_BMAP_DIR_NATIVE)
3348 AC_SUBST(TCL_TOOL_DIR_NATIVE)
3349 AC_SUBST(TCL_PLATFORM_DIR_NATIVE)
3351 AC_SUBST(TCL_INCLUDES)
3352 AC_MSG_RESULT([Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}])
3355 #------------------------------------------------------------------------
3356 # TEA_PUBLIC_TCL_HEADERS --
3358 # Locate the installed public Tcl header files
3364 # CYGPATH must be set
3368 # Adds a --with-tclinclude switch to configure.
3371 # Substs the following vars:
3373 #------------------------------------------------------------------------
3375 AC_DEFUN(TEA_PUBLIC_TCL_HEADERS, [
3376 AC_MSG_CHECKING([for Tcl public headers])
3378 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
3380 AC_CACHE_VAL(ac_cv_c_tclh, [
3381 # Use the value from --with-tclinclude, if it was given
3383 if test x"${with_tclinclude}" != x ; then
3384 if test -f "${with_tclinclude}/tcl.h" ; then
3385 ac_cv_c_tclh=${with_tclinclude}
3387 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
3390 if test "`uname -s`" = "Darwin"; then
3391 # If Tcl was built as a framework, attempt to use
3392 # the framework's Headers directory
3395 list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
3400 # Look in the source dir only if Tcl is not installed,
3401 # and in that situation, look there before installed locations.
3402 if test -f "${TCL_BIN_DIR}/Makefile" ; then
3403 list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
3406 # Check order: pkg --prefix location, Tcl's --prefix location,
3407 # relative to directory of tclConfig.sh.
3409 eval "temp_includedir=${includedir}"
3411 `ls -d ${temp_includedir} 2>/dev/null` \
3412 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3413 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3414 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3415 list="$list /usr/local/include /usr/include"
3416 if test x"${TCL_INCLUDE_SPEC}" != x ; then
3417 d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3418 list="$list `ls -d ${d} 2>/dev/null`"
3422 if test -f "$i/tcl.h" ; then
3430 # Print a message based on how we determined the include path
3432 if test x"${ac_cv_c_tclh}" = x ; then
3433 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
3435 AC_MSG_RESULT([${ac_cv_c_tclh}])
3438 # Convert to a native path and substitute into the output files.
3440 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
3442 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3444 AC_SUBST(TCL_INCLUDES)
3447 #------------------------------------------------------------------------
3448 # TEA_PRIVATE_TK_HEADERS --
3450 # Locate the private Tk include files
3455 # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
3456 # already been called.
3460 # Substs the following vars:
3462 #------------------------------------------------------------------------
3464 AC_DEFUN(TEA_PRIVATE_TK_HEADERS, [
3465 AC_MSG_CHECKING([for Tk private include files])
3467 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
3468 TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
3469 TK_UNIX_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
3470 TK_WIN_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
3471 TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
3472 TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
3473 if test "${TEA_PLATFORM}" = "windows"; then
3474 TK_PLATFORM_DIR_NATIVE=${TK_WIN_DIR_NATIVE}
3476 TK_PLATFORM_DIR_NATIVE=${TK_UNIX_DIR_NATIVE}
3478 # We want to ensure these are substituted so as not to require
3479 # any *_NATIVE vars be defined in the Makefile
3480 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
3481 if test "${TEA_WINDOWINGSYSTEM}" = "win32" \
3482 -o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3483 TK_INCLUDES="${TK_INCLUDES} -I${TK_XLIB_DIR_NATIVE}"
3485 if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3486 TK_INCLUDES="${TK_INCLUDES} -I${TK_SRC_DIR_NATIVE}/macosx"
3488 if test "`uname -s`" = "Darwin"; then
3489 # If Tk was built as a framework, attempt to use
3490 # the framework's Headers and PrivateHeaders directories
3493 if test -d "${TK_BIN_DIR}/Headers" -a -d "${TK_BIN_DIR}/PrivateHeaders"; then
3494 TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"; fi
3499 AC_SUBST(TK_TOP_DIR_NATIVE)
3500 AC_SUBST(TK_UNIX_DIR_NATIVE)
3501 AC_SUBST(TK_WIN_DIR_NATIVE)
3502 AC_SUBST(TK_GENERIC_DIR_NATIVE)
3503 AC_SUBST(TK_XLIB_DIR_NATIVE)
3504 AC_SUBST(TK_PLATFORM_DIR_NATIVE)
3506 AC_SUBST(TK_INCLUDES)
3507 AC_MSG_RESULT([Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}])
3510 #------------------------------------------------------------------------
3511 # TEA_PUBLIC_TK_HEADERS --
3513 # Locate the installed public Tk header files
3519 # CYGPATH must be set
3523 # Adds a --with-tkinclude switch to configure.
3526 # Substs the following vars:
3528 #------------------------------------------------------------------------
3530 AC_DEFUN(TEA_PUBLIC_TK_HEADERS, [
3531 AC_MSG_CHECKING([for Tk public headers])
3533 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files.], with_tkinclude=${withval})
3535 AC_CACHE_VAL(ac_cv_c_tkh, [
3536 # Use the value from --with-tkinclude, if it was given
3538 if test x"${with_tkinclude}" != x ; then
3539 if test -f "${with_tkinclude}/tk.h" ; then
3540 ac_cv_c_tkh=${with_tkinclude}
3542 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
3545 if test "`uname -s`" = "Darwin"; then
3546 # If Tk was built as a framework, attempt to use
3547 # the framework's Headers directory.
3550 list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
3555 # Look in the source dir only if Tk is not installed,
3556 # and in that situation, look there before installed locations.
3557 if test -f "${TK_BIN_DIR}/Makefile" ; then
3558 list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
3561 # Check order: pkg --prefix location, Tk's --prefix location,
3562 # relative to directory of tkConfig.sh, Tcl's --prefix location,
3563 # relative to directory of tclConfig.sh.
3565 eval "temp_includedir=${includedir}"
3567 `ls -d ${temp_includedir} 2>/dev/null` \
3568 `ls -d ${TK_PREFIX}/include 2>/dev/null` \
3569 `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
3570 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3571 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3572 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3573 list="$list /usr/local/include /usr/include"
3576 if test -f "$i/tk.h" ; then
3584 # Print a message based on how we determined the include path
3586 if test x"${ac_cv_c_tkh}" = x ; then
3587 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
3589 AC_MSG_RESULT([${ac_cv_c_tkh}])
3592 # Convert to a native path and substitute into the output files.
3594 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
3596 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3598 AC_SUBST(TK_INCLUDES)
3600 if test "${TEA_WINDOWINGSYSTEM}" = "win32" \
3601 -o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3602 # On Windows and Aqua, we need the X compat headers
3603 AC_MSG_CHECKING([for X11 header files])
3604 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
3605 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
3606 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3607 AC_SUBST(TK_XINCLUDES)
3609 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
3613 #------------------------------------------------------------------------
3615 # Determine the fully qualified path name of the tclsh executable
3616 # in the Tcl build directory or the tclsh installed in a bin
3617 # directory. This macro will correctly determine the name
3618 # of the tclsh executable even if tclsh has not yet been
3619 # built in the build directory. The tclsh found is always
3620 # associated with a tclConfig.sh file. This tclsh should be used
3621 # only for running extension test cases. It should never be
3622 # or generation of files (like pkgIndex.tcl) at build time.
3628 # Subst's the following values:
3630 #------------------------------------------------------------------------
3632 AC_DEFUN(TEA_PROG_TCLSH, [
3633 AC_MSG_CHECKING([for tclsh])
3634 if test -f "${TCL_BIN_DIR}/Makefile" ; then
3635 # tclConfig.sh is in Tcl build directory
3636 if test "${TEA_PLATFORM}" = "windows"; then
3637 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
3639 TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
3642 # tclConfig.sh is in install location
3643 if test "${TEA_PLATFORM}" = "windows"; then
3644 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
3646 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
3648 list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
3649 `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
3650 `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
3652 if test -f "$i/${TCLSH_PROG}" ; then
3653 REAL_TCL_BIN_DIR="`cd "$i"; pwd`"
3657 TCLSH_PROG="${REAL_TCL_BIN_DIR}/${TCLSH_PROG}"
3659 AC_MSG_RESULT([${TCLSH_PROG}])
3660 AC_SUBST(TCLSH_PROG)
3663 #------------------------------------------------------------------------
3665 # Determine the fully qualified path name of the wish executable
3666 # in the Tk build directory or the wish installed in a bin
3667 # directory. This macro will correctly determine the name
3668 # of the wish executable even if wish has not yet been
3669 # built in the build directory. The wish found is always
3670 # associated with a tkConfig.sh file. This wish should be used
3671 # only for running extension test cases. It should never be
3672 # or generation of files (like pkgIndex.tcl) at build time.
3678 # Subst's the following values:
3680 #------------------------------------------------------------------------
3682 AC_DEFUN(TEA_PROG_WISH, [
3683 AC_MSG_CHECKING([for wish])
3684 if test -f "${TK_BIN_DIR}/Makefile" ; then
3685 # tkConfig.sh is in Tk build directory
3686 if test "${TEA_PLATFORM}" = "windows"; then
3687 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
3689 WISH_PROG="${TK_BIN_DIR}/wish"
3692 # tkConfig.sh is in install location
3693 if test "${TEA_PLATFORM}" = "windows"; then
3694 WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
3696 WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}"
3698 list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
3699 `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
3700 `ls -d ${TK_PREFIX}/bin 2>/dev/null`"
3702 if test -f "$i/${WISH_PROG}" ; then
3703 REAL_TK_BIN_DIR="`cd "$i"; pwd`"
3707 WISH_PROG="${REAL_TK_BIN_DIR}/${WISH_PROG}"
3709 AC_MSG_RESULT([${WISH_PROG}])
3713 #------------------------------------------------------------------------
3714 # TEA_PATH_CONFIG --
3716 # Locate the ${1}Config.sh file and perform a sanity check on
3717 # the ${1} compile flags. These are used by packages like
3718 # [incr Tk] that load *Config.sh files from more than Tcl and Tk.
3725 # Adds the following arguments to configure:
3728 # Defines the following vars:
3729 # $1_BIN_DIR Full path to the directory containing
3730 # the $1Config.sh file
3731 #------------------------------------------------------------------------
3733 AC_DEFUN(TEA_PATH_CONFIG, [
3735 # Ok, lets find the $1 configuration
3736 # First, look for one uninstalled.
3737 # the alternative search directory is invoked by --with-$1
3740 if test x"${no_$1}" = x ; then
3741 # we reset no_$1 in case something fails here
3743 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
3744 AC_MSG_CHECKING([for $1 configuration])
3745 AC_CACHE_VAL(ac_cv_c_$1config,[
3747 # First check to see if --with-$1 was specified.
3748 if test x"${with_$1config}" != x ; then
3749 case ${with_$1config} in
3751 if test -f ${with_$1config}; then
3752 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
3753 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
3756 if test -f "${with_$1config}/$1Config.sh" ; then
3757 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
3759 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
3763 # then check for a private $1 installation
3764 if test x"${ac_cv_c_$1config}" = x ; then
3767 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3768 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3769 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3770 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3772 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3773 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3774 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3775 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3777 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3778 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3779 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3780 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3782 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3783 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3784 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3785 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3787 if test -f "$i/$1Config.sh" ; then
3788 ac_cv_c_$1config=`(cd $i; pwd)`
3791 if test -f "$i/unix/$1Config.sh" ; then
3792 ac_cv_c_$1config=`(cd $i/unix; pwd)`
3798 # check in a few common install locations
3799 if test x"${ac_cv_c_$1config}" = x ; then
3800 for i in `ls -d ${libdir} 2>/dev/null` \
3801 `ls -d ${exec_prefix}/lib 2>/dev/null` \
3802 `ls -d ${prefix}/lib 2>/dev/null` \
3803 `ls -d /usr/local/lib 2>/dev/null` \
3804 `ls -d /usr/contrib/lib 2>/dev/null` \
3805 `ls -d /usr/lib 2>/dev/null` \
3807 if test -f "$i/$1Config.sh" ; then
3808 ac_cv_c_$1config=`(cd $i; pwd)`
3815 if test x"${ac_cv_c_$1config}" = x ; then
3816 $1_BIN_DIR="# no $1 configs found"
3817 AC_MSG_WARN([Cannot find $1 configuration definitions])
3821 $1_BIN_DIR=${ac_cv_c_$1config}
3822 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
3827 #------------------------------------------------------------------------
3828 # TEA_LOAD_CONFIG --
3830 # Load the $1Config.sh file
3834 # Requires the following vars to be set:
3839 # Subst the following vars:
3844 #------------------------------------------------------------------------
3846 AC_DEFUN(TEA_LOAD_CONFIG, [
3847 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
3849 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
3850 AC_MSG_RESULT([loading])
3851 . ${$1_BIN_DIR}/$1Config.sh
3853 AC_MSG_RESULT([file not found])
3857 # If the $1_BIN_DIR is the build directory (not the install directory),
3858 # then set the common variable name to the value of the build variables.
3859 # For example, the variable $1_LIB_SPEC will be set to the value
3860 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
3861 # instead of $1_BUILD_LIB_SPEC since it will work with both an
3862 # installed and uninstalled version of Tcl.
3865 if test -f ${$1_BIN_DIR}/Makefile ; then
3866 AC_MSG_WARN([Found Makefile - using build library specs for $1])
3867 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
3868 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
3869 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
3872 AC_SUBST($1_VERSION)
3873 AC_SUBST($1_BIN_DIR)
3874 AC_SUBST($1_SRC_DIR)
3876 AC_SUBST($1_LIB_FILE)
3877 AC_SUBST($1_LIB_SPEC)
3879 AC_SUBST($1_STUB_LIB_FILE)
3880 AC_SUBST($1_STUB_LIB_SPEC)
3881 AC_SUBST($1_STUB_LIB_PATH)
3884 #------------------------------------------------------------------------
3887 # Locate Keuchel's celib emulation layer for targeting Win/CE
3894 # Adds the following arguments to configure:
3897 # Defines the following vars:
3898 # CELIB_DIR Full path to the directory containing
3899 # the include and platform lib files
3900 #------------------------------------------------------------------------
3902 AC_DEFUN(TEA_PATH_CELIB, [
3903 # First, look for one uninstalled.
3904 # the alternative search directory is invoked by --with-celib
3906 if test x"${no_celib}" = x ; then
3907 # we reset no_celib in case something fails here
3909 AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval})
3910 AC_MSG_CHECKING([for Windows/CE celib directory])
3911 AC_CACHE_VAL(ac_cv_c_celibconfig,[
3912 # First check to see if --with-celibconfig was specified.
3913 if test x"${with_celibconfig}" != x ; then
3914 if test -d "${with_celibconfig}/inc" ; then
3915 ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)`
3917 AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory])
3921 # then check for a celib library
3922 if test x"${ac_cv_c_celibconfig}" = x ; then
3926 ../../celib-palm-3.0 \
3928 `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \
3929 ${srcdir}/../celib-palm-3.0 \
3930 ${srcdir}/../celib \
3931 `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \
3933 if test -d "$i/inc" ; then
3934 ac_cv_c_celibconfig=`(cd $i; pwd)`
3940 if test x"${ac_cv_c_celibconfig}" = x ; then
3941 AC_MSG_ERROR([Cannot find celib support library directory])
3944 CELIB_DIR=${ac_cv_c_celibconfig}
3945 CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
3946 AC_MSG_RESULT([found $CELIB_DIR])