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.
14 dnl TEA extensions pass us the version of TEA they think they
15 dnl are compatible with (must be set in TEA_INIT below)
18 # Possible values for key variables defined:
20 # TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
21 # TEA_PLATFORM - windows unix
24 #------------------------------------------------------------------------
25 # TEA_PATH_TCLCONFIG --
27 # Locate the tclConfig.sh file and perform a sanity check on
28 # the Tcl compile flags
35 # Adds the following arguments to configure:
38 # Defines the following vars:
39 # TCL_BIN_DIR Full path to the directory containing
40 # the tclConfig.sh file
41 #------------------------------------------------------------------------
43 AC_DEFUN([TEA_PATH_TCLCONFIG], [
44 dnl TEA specific: Make sure we are initialized
45 AC_REQUIRE([TEA_INIT])
47 # Ok, lets find the tcl configuration
48 # First, look for one uninstalled.
49 # the alternative search directory is invoked by --with-tcl
52 if test x"${no_tcl}" = x ; then
53 # we reset no_tcl in case something fails here
56 AC_HELP_STRING([--with-tcl],
57 [directory containing tcl configuration (tclConfig.sh)]),
58 with_tclconfig="${withval}")
59 AC_MSG_CHECKING([for Tcl configuration])
60 AC_CACHE_VAL(ac_cv_c_tclconfig,[
62 # First check to see if --with-tcl was specified.
63 if test x"${with_tclconfig}" != x ; then
64 case "${with_tclconfig}" in
66 if test -f "${with_tclconfig}"; then
67 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
68 with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
71 if test -f "${with_tclconfig}/tclConfig.sh" ; then
72 ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
74 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
78 # then check for a private Tcl installation
79 if test x"${ac_cv_c_tclconfig}" = x ; then
82 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
83 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
84 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
86 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
87 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
88 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
90 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
91 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
92 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
93 if test "${TEA_PLATFORM}" = "windows" \
94 -a -f "$i/win/tclConfig.sh" ; then
95 ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
98 if test -f "$i/unix/tclConfig.sh" ; then
99 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
105 # on Darwin, check in Framework installation locations
106 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
107 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
108 `ls -d /Library/Frameworks 2>/dev/null` \
109 `ls -d /Network/Library/Frameworks 2>/dev/null` \
110 `ls -d /System/Library/Frameworks 2>/dev/null` \
112 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
113 ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
119 # TEA specific: on Windows, check in common installation locations
120 if test "${TEA_PLATFORM}" = "windows" \
121 -a x"${ac_cv_c_tclconfig}" = x ; then
122 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
123 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
125 if test -f "$i/tclConfig.sh" ; then
126 ac_cv_c_tclconfig="`(cd $i; pwd)`"
132 # check in a few common install locations
133 if test x"${ac_cv_c_tclconfig}" = x ; then
134 for i in `ls -d ${libdir} 2>/dev/null` \
135 `ls -d ${exec_prefix}/lib 2>/dev/null` \
136 `ls -d ${prefix}/lib 2>/dev/null` \
137 `ls -d /usr/local/lib 2>/dev/null` \
138 `ls -d /usr/contrib/lib 2>/dev/null` \
139 `ls -d /usr/lib 2>/dev/null` \
140 `ls -d /usr/lib64 2>/dev/null` \
141 `ls -d /usr/lib/tcl8.6 2>/dev/null` \
142 `ls -d /usr/lib/tcl8.5 2>/dev/null` \
144 if test -f "$i/tclConfig.sh" ; then
145 ac_cv_c_tclconfig="`(cd $i; pwd)`"
151 # check in a few other private locations
152 if test x"${ac_cv_c_tclconfig}" = x ; then
155 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
156 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
157 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
158 if test "${TEA_PLATFORM}" = "windows" \
159 -a -f "$i/win/tclConfig.sh" ; then
160 ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
163 if test -f "$i/unix/tclConfig.sh" ; then
164 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
171 if test x"${ac_cv_c_tclconfig}" = x ; then
172 TCL_BIN_DIR="# no Tcl configs found"
173 AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh])
176 TCL_BIN_DIR="${ac_cv_c_tclconfig}"
177 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
182 #------------------------------------------------------------------------
183 # TEA_PATH_TKCONFIG --
185 # Locate the tkConfig.sh file
192 # Adds the following arguments to configure:
195 # Defines the following vars:
196 # TK_BIN_DIR Full path to the directory containing
197 # the tkConfig.sh file
198 #------------------------------------------------------------------------
200 AC_DEFUN([TEA_PATH_TKCONFIG], [
202 # Ok, lets find the tk configuration
203 # First, look for one uninstalled.
204 # the alternative search directory is invoked by --with-tk
207 if test x"${no_tk}" = x ; then
208 # we reset no_tk in case something fails here
211 AC_HELP_STRING([--with-tk],
212 [directory containing tk configuration (tkConfig.sh)]),
213 with_tkconfig="${withval}")
214 AC_MSG_CHECKING([for Tk configuration])
215 AC_CACHE_VAL(ac_cv_c_tkconfig,[
217 # First check to see if --with-tkconfig was specified.
218 if test x"${with_tkconfig}" != x ; then
219 case "${with_tkconfig}" in
221 if test -f "${with_tkconfig}"; then
222 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
223 with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
226 if test -f "${with_tkconfig}/tkConfig.sh" ; then
227 ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
229 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
233 # then check for a private Tk library
234 if test x"${ac_cv_c_tkconfig}" = x ; then
237 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
238 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
239 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
241 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
242 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
243 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
245 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
246 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
247 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
248 if test "${TEA_PLATFORM}" = "windows" \
249 -a -f "$i/win/tkConfig.sh" ; then
250 ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
253 if test -f "$i/unix/tkConfig.sh" ; then
254 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
260 # on Darwin, check in Framework installation locations
261 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
262 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
263 `ls -d /Library/Frameworks 2>/dev/null` \
264 `ls -d /Network/Library/Frameworks 2>/dev/null` \
265 `ls -d /System/Library/Frameworks 2>/dev/null` \
267 if test -f "$i/Tk.framework/tkConfig.sh" ; then
268 ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
274 # check in a few common install locations
275 if test x"${ac_cv_c_tkconfig}" = x ; then
276 for i in `ls -d ${libdir} 2>/dev/null` \
277 `ls -d ${exec_prefix}/lib 2>/dev/null` \
278 `ls -d ${prefix}/lib 2>/dev/null` \
279 `ls -d /usr/local/lib 2>/dev/null` \
280 `ls -d /usr/contrib/lib 2>/dev/null` \
281 `ls -d /usr/lib 2>/dev/null` \
282 `ls -d /usr/lib64 2>/dev/null` \
284 if test -f "$i/tkConfig.sh" ; then
285 ac_cv_c_tkconfig="`(cd $i; pwd)`"
291 # TEA specific: on Windows, check in common installation locations
292 if test "${TEA_PLATFORM}" = "windows" \
293 -a x"${ac_cv_c_tkconfig}" = x ; then
294 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
295 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
297 if test -f "$i/tkConfig.sh" ; then
298 ac_cv_c_tkconfig="`(cd $i; pwd)`"
304 # check in a few other private locations
305 if test x"${ac_cv_c_tkconfig}" = x ; then
308 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
309 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
310 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
311 if test "${TEA_PLATFORM}" = "windows" \
312 -a -f "$i/win/tkConfig.sh" ; then
313 ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
316 if test -f "$i/unix/tkConfig.sh" ; then
317 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
324 if test x"${ac_cv_c_tkconfig}" = x ; then
325 TK_BIN_DIR="# no Tk configs found"
326 AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh])
329 TK_BIN_DIR="${ac_cv_c_tkconfig}"
330 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
335 #------------------------------------------------------------------------
336 # TEA_LOAD_TCLCONFIG --
338 # Load the tclConfig.sh file
342 # Requires the following vars to be set:
347 # Substitutes the following vars:
351 #------------------------------------------------------------------------
353 AC_DEFUN([TEA_LOAD_TCLCONFIG], [
354 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
356 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
357 AC_MSG_RESULT([loading])
358 . "${TCL_BIN_DIR}/tclConfig.sh"
360 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
363 # eval is required to do the TCL_DBGX substitution
364 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
365 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
367 # If the TCL_BIN_DIR is the build directory (not the install directory),
368 # then set the common variable name to the value of the build variables.
369 # For example, the variable TCL_LIB_SPEC will be set to the value
370 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
371 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
372 # installed and uninstalled version of Tcl.
373 if test -f "${TCL_BIN_DIR}/Makefile" ; then
374 TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
375 TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
376 TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
377 elif test "`uname -s`" = "Darwin"; then
378 # If Tcl was built as a framework, attempt to use the libraries
379 # from the framework at the given location so that linking works
380 # against Tcl.framework installed in an arbitrary location.
383 if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
384 for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
385 "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
386 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
387 TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
392 if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
393 TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
394 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
400 # eval is required to do the TCL_DBGX substitution
401 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
402 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
403 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
404 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
406 AC_SUBST(TCL_VERSION)
407 AC_SUBST(TCL_PATCH_LEVEL)
408 AC_SUBST(TCL_BIN_DIR)
409 AC_SUBST(TCL_SRC_DIR)
411 AC_SUBST(TCL_LIB_FILE)
412 AC_SUBST(TCL_LIB_FLAG)
413 AC_SUBST(TCL_LIB_SPEC)
415 AC_SUBST(TCL_STUB_LIB_FILE)
416 AC_SUBST(TCL_STUB_LIB_FLAG)
417 AC_SUBST(TCL_STUB_LIB_SPEC)
419 AC_MSG_CHECKING([platform])
420 hold_cc=$CC; CC="$TCL_CC"
425 ], TEA_PLATFORM="unix",
426 TEA_PLATFORM="windows"
429 AC_MSG_RESULT($TEA_PLATFORM)
431 # The BUILD_$pkg is to define the correct extern storage class
432 # handling when making this package
433 AC_DEFINE_UNQUOTED(BUILD_${PACKAGE_NAME}, [],
434 [Building extension source?])
435 # Do this here as we have fully defined TEA_PLATFORM now
436 if test "${TEA_PLATFORM}" = "windows" ; then
438 CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp"
445 AC_SUBST(TCL_EXTRA_CFLAGS)
446 AC_SUBST(TCL_LD_FLAGS)
447 AC_SUBST(TCL_SHLIB_LD_LIBS)
450 #------------------------------------------------------------------------
451 # TEA_LOAD_TKCONFIG --
453 # Load the tkConfig.sh file
457 # Requires the following vars to be set:
462 # Sets the following vars that should be in tkConfig.sh:
464 #------------------------------------------------------------------------
466 AC_DEFUN([TEA_LOAD_TKCONFIG], [
467 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
469 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
470 AC_MSG_RESULT([loading])
471 . "${TK_BIN_DIR}/tkConfig.sh"
473 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
476 # eval is required to do the TK_DBGX substitution
477 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
478 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
480 # If the TK_BIN_DIR is the build directory (not the install directory),
481 # then set the common variable name to the value of the build variables.
482 # For example, the variable TK_LIB_SPEC will be set to the value
483 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
484 # instead of TK_BUILD_LIB_SPEC since it will work with both an
485 # installed and uninstalled version of Tcl.
486 if test -f "${TK_BIN_DIR}/Makefile" ; then
487 TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
488 TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
489 TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
490 elif test "`uname -s`" = "Darwin"; then
491 # If Tk was built as a framework, attempt to use the libraries
492 # from the framework at the given location so that linking works
493 # against Tk.framework installed in an arbitrary location.
496 if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
497 for i in "`cd "${TK_BIN_DIR}"; pwd`" \
498 "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
499 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
500 TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
505 if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
506 TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
507 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
513 # eval is required to do the TK_DBGX substitution
514 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
515 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
516 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
517 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
519 # TEA specific: Ensure windowingsystem is defined
520 if test "${TEA_PLATFORM}" = "unix" ; then
523 AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
524 TEA_WINDOWINGSYSTEM="aqua"
527 TEA_WINDOWINGSYSTEM="x11"
530 elif test "${TEA_PLATFORM}" = "windows" ; then
531 TEA_WINDOWINGSYSTEM="win32"
538 AC_SUBST(TK_LIB_FILE)
539 AC_SUBST(TK_LIB_FLAG)
540 AC_SUBST(TK_LIB_SPEC)
542 AC_SUBST(TK_STUB_LIB_FILE)
543 AC_SUBST(TK_STUB_LIB_FLAG)
544 AC_SUBST(TK_STUB_LIB_SPEC)
548 AC_SUBST(TK_XINCLUDES)
551 #------------------------------------------------------------------------
553 # Determine the fully qualified path name of the tclsh executable
554 # in the Tcl build directory or the tclsh installed in a bin
555 # directory. This macro will correctly determine the name
556 # of the tclsh executable even if tclsh has not yet been
557 # built in the build directory. The tclsh found is always
558 # associated with a tclConfig.sh file. This tclsh should be used
559 # only for running extension test cases. It should never be
560 # or generation of files (like pkgIndex.tcl) at build time.
566 # Substitutes the following vars:
568 #------------------------------------------------------------------------
570 AC_DEFUN([TEA_PROG_TCLSH], [
571 AC_MSG_CHECKING([for tclsh])
572 if test -f "${TCL_BIN_DIR}/Makefile" ; then
573 # tclConfig.sh is in Tcl build directory
574 if test "${TEA_PLATFORM}" = "windows"; then
575 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
577 TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
580 # tclConfig.sh is in install location
581 if test "${TEA_PLATFORM}" = "windows"; then
582 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
584 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
586 list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
587 `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
588 `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
590 if test -f "$i/${TCLSH_PROG}" ; then
591 REAL_TCL_BIN_DIR="`cd "$i"; pwd`/"
595 TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}"
597 AC_MSG_RESULT([${TCLSH_PROG}])
601 #------------------------------------------------------------------------
603 # Determine the fully qualified path name of the wish executable
604 # in the Tk build directory or the wish installed in a bin
605 # directory. This macro will correctly determine the name
606 # of the wish executable even if wish has not yet been
607 # built in the build directory. The wish found is always
608 # associated with a tkConfig.sh file. This wish should be used
609 # only for running extension test cases. It should never be
610 # or generation of files (like pkgIndex.tcl) at build time.
616 # Substitutes the following vars:
618 #------------------------------------------------------------------------
620 AC_DEFUN([TEA_PROG_WISH], [
621 AC_MSG_CHECKING([for wish])
622 if test -f "${TK_BIN_DIR}/Makefile" ; then
623 # tkConfig.sh is in Tk build directory
624 if test "${TEA_PLATFORM}" = "windows"; then
625 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
627 WISH_PROG="${TK_BIN_DIR}/wish"
630 # tkConfig.sh is in install location
631 if test "${TEA_PLATFORM}" = "windows"; then
632 WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
634 WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}"
636 list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
637 `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
638 `ls -d ${TK_PREFIX}/bin 2>/dev/null`"
640 if test -f "$i/${WISH_PROG}" ; then
641 REAL_TK_BIN_DIR="`cd "$i"; pwd`/"
645 WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}"
647 AC_MSG_RESULT([${WISH_PROG}])
651 #------------------------------------------------------------------------
652 # TEA_ENABLE_SHARED --
654 # Allows the building of shared libraries
661 # Adds the following arguments to configure:
662 # --enable-shared=yes|no
664 # Defines the following vars:
665 # STATIC_BUILD Used for building import/export libraries
668 # Sets the following vars:
669 # SHARED_BUILD Value of 1 or 0
670 #------------------------------------------------------------------------
672 AC_DEFUN([TEA_ENABLE_SHARED], [
673 AC_MSG_CHECKING([how to build libraries])
674 AC_ARG_ENABLE(shared,
675 AC_HELP_STRING([--enable-shared],
676 [build and link with shared libraries (default: on)]),
677 [tcl_ok=$enableval], [tcl_ok=yes])
679 if test "${enable_shared+set}" = set; then
680 enableval="$enable_shared"
686 if test "$tcl_ok" = "yes" ; then
687 AC_MSG_RESULT([shared])
690 AC_MSG_RESULT([static])
692 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
694 AC_SUBST(SHARED_BUILD)
697 #------------------------------------------------------------------------
698 # TEA_ENABLE_THREADS --
700 # Specify if thread support should be enabled. If "yes" is specified
701 # as an arg (optional), threads are enabled by default, "no" means
702 # threads are disabled. "yes" is the default.
704 # TCL_THREADS is checked so that if you are compiling an extension
705 # against a threaded core, your extension must be compiled threaded
708 # Note that it is legal to have a thread enabled extension run in a
709 # threaded or non-threaded Tcl core, but a non-threaded extension may
710 # only run in a non-threaded Tcl core.
717 # Adds the following arguments to configure:
720 # Sets the following vars:
721 # THREADS_LIBS Thread library(s)
723 # Defines the following vars:
727 #------------------------------------------------------------------------
729 AC_DEFUN([TEA_ENABLE_THREADS], [
730 AC_ARG_ENABLE(threads,
731 AC_HELP_STRING([--enable-threads],
732 [build with threads]),
733 [tcl_ok=$enableval], [tcl_ok=yes])
735 if test "${enable_threads+set}" = set; then
736 enableval="$enable_threads"
742 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
745 if test "${TEA_PLATFORM}" != "windows" ; then
746 # We are always OK on Windows, so check what this platform wants:
748 # USE_THREAD_ALLOC tells us to try the special thread-based
749 # allocator that significantly reduces lock contention
750 AC_DEFINE(USE_THREAD_ALLOC, 1,
751 [Do we want to use the threaded memory allocator?])
752 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
753 if test "`uname -s`" = "SunOS" ; then
754 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
755 [Do we really want to follow the standard? Yes we do!])
757 AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
758 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
759 if test "$tcl_ok" = "no"; then
760 # Check a little harder for __pthread_mutex_init in the same
761 # library, as some systems hide it there until pthread.h is
762 # defined. We could alternatively do an AC_TRY_COMPILE with
763 # pthread.h, but that will work with libpthread really doesn't
764 # exist, like AIX 4.2. [Bug: 4359]
765 AC_CHECK_LIB(pthread, __pthread_mutex_init,
766 tcl_ok=yes, tcl_ok=no)
769 if test "$tcl_ok" = "yes"; then
770 # The space is needed
771 THREADS_LIBS=" -lpthread"
773 AC_CHECK_LIB(pthreads, pthread_mutex_init,
774 tcl_ok=yes, tcl_ok=no)
775 if test "$tcl_ok" = "yes"; then
776 # The space is needed
777 THREADS_LIBS=" -lpthreads"
779 AC_CHECK_LIB(c, pthread_mutex_init,
780 tcl_ok=yes, tcl_ok=no)
781 if test "$tcl_ok" = "no"; then
782 AC_CHECK_LIB(c_r, pthread_mutex_init,
783 tcl_ok=yes, tcl_ok=no)
784 if test "$tcl_ok" = "yes"; then
785 # The space is needed
786 THREADS_LIBS=" -pthread"
789 AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
798 # Do checking message here to not mess up interleaved configure output
799 AC_MSG_CHECKING([for building with threads])
800 if test "${TCL_THREADS}" = 1; then
801 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
802 AC_MSG_RESULT([yes (default)])
806 # TCL_THREADS sanity checking. See if our request for building with
807 # threads is the same as the way Tcl was built. If not, warn the user.
810 if test "${TCL_THREADS}" = "0"; then
812 Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
813 that IS thread-enabled. It is recommended to use --enable-threads.])
817 if test "${TCL_THREADS}" = "1"; then
819 --enable-threads requested, but building against a Tcl that is NOT
820 thread-enabled. This is an OK configuration that will also run in
821 a thread-enabled core.])
825 AC_SUBST(TCL_THREADS)
828 #------------------------------------------------------------------------
829 # TEA_ENABLE_SYMBOLS --
831 # Specify if debugging symbols should be used.
832 # Memory (TCL_MEM_DEBUG) debugging can also be enabled.
837 # TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
838 # the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
839 # Requires the following vars to be set in the Makefile:
845 # Adds the following arguments to configure:
848 # Defines the following vars:
849 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
850 # Sets to "$(CFLAGS_OPTIMIZE) -DNDEBUG" if false
851 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
852 # Sets to $(LDFLAGS_OPTIMIZE) if false
853 # DBGX Formerly used as debug library extension;
855 #------------------------------------------------------------------------
857 AC_DEFUN([TEA_ENABLE_SYMBOLS], [
858 dnl TEA specific: Make sure we are initialized
859 AC_REQUIRE([TEA_CONFIG_CFLAGS])
860 AC_MSG_CHECKING([for build with symbols])
861 AC_ARG_ENABLE(symbols,
862 AC_HELP_STRING([--enable-symbols],
863 [build with debugging symbols (default: off)]),
864 [tcl_ok=$enableval], [tcl_ok=no])
866 if test "$tcl_ok" = "no"; then
867 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE} -DNDEBUG"
868 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
871 CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
872 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
873 if test "$tcl_ok" = "yes"; then
874 AC_MSG_RESULT([yes (standard debugging)])
878 if test "${TEA_PLATFORM}" != "windows" ; then
879 LDFLAGS_DEFAULT="${LDFLAGS}"
881 AC_SUBST(CFLAGS_DEFAULT)
882 AC_SUBST(LDFLAGS_DEFAULT)
885 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
886 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
889 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
890 if test "$tcl_ok" = "all"; then
891 AC_MSG_RESULT([enabled symbols mem debugging])
893 AC_MSG_RESULT([enabled $tcl_ok debugging])
898 #------------------------------------------------------------------------
899 # TEA_ENABLE_LANGINFO --
901 # Allows use of modern nl_langinfo check for better l10n.
902 # This is only relevant for Unix.
909 # Adds the following arguments to configure:
910 # --enable-langinfo=yes|no (default is yes)
912 # Defines the following vars:
913 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
914 #------------------------------------------------------------------------
916 AC_DEFUN([TEA_ENABLE_LANGINFO], [
917 AC_ARG_ENABLE(langinfo,
918 AC_HELP_STRING([--enable-langinfo],
919 [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
920 [langinfo_ok=$enableval], [langinfo_ok=yes])
923 if test "$langinfo_ok" = "yes"; then
924 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
926 AC_MSG_CHECKING([whether to use nl_langinfo])
927 if test "$langinfo_ok" = "yes"; then
928 AC_CACHE_VAL(tcl_cv_langinfo_h, [
929 AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
930 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
931 AC_MSG_RESULT([$tcl_cv_langinfo_h])
932 if test $tcl_cv_langinfo_h = yes; then
933 AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
936 AC_MSG_RESULT([$langinfo_ok])
940 #--------------------------------------------------------------------
943 # Determine what the system is (some things cannot be easily checked
944 # on a feature-driven basis, alas). This can usually be done via the
951 # Defines the following var:
953 # system - System/platform/version identification code.
954 #--------------------------------------------------------------------
956 AC_DEFUN([TEA_CONFIG_SYSTEM], [
957 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
959 if test "${TEA_PLATFORM}" = "windows" ; then
960 tcl_cv_sys_version=windows
962 tcl_cv_sys_version=`uname -s`-`uname -r`
963 if test "$?" -ne 0 ; then
964 AC_MSG_WARN([can't find uname command])
965 tcl_cv_sys_version=unknown
967 if test "`uname -s`" = "AIX" ; then
968 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
973 system=$tcl_cv_sys_version
976 #--------------------------------------------------------------------
979 # Try to determine the proper flags to pass to the compiler
980 # for building shared libraries and other such nonsense.
987 # Defines and substitutes the following vars:
989 # DL_OBJS, DL_LIBS - removed for TEA, only needed by core.
990 # LDFLAGS - Flags to pass to the compiler when linking object
991 # files into an executable application binary such
993 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
994 # that tell the run-time dynamic linker where to look
995 # for shared libraries such as libtcl.so. Depends on
996 # the variable LIB_RUNTIME_DIR in the Makefile. Could
997 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
998 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
999 # that tell the run-time dynamic linker where to look
1000 # for shared libraries such as libtcl.so. Depends on
1001 # the variable LIB_RUNTIME_DIR in the Makefile.
1002 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
1003 # of a shared library (may request position-independent
1004 # code, among other things).
1005 # SHLIB_LD - Base command to use for combining object files
1006 # into a shared library.
1007 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
1008 # creating shared libraries. This symbol typically
1009 # goes at the end of the "ld" commands that build
1010 # shared libraries. The value of the symbol defaults to
1011 # "${LIBS}" if all of the dependent libraries should
1012 # be specified when creating a shared library. If
1013 # dependent libraries should not be specified (as on
1014 # SunOS 4.x, where they cause the link to fail, or in
1015 # general if Tcl and Tk aren't themselves shared
1016 # libraries), then this symbol has an empty string
1018 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
1019 # extensions. An empty string means we don't know how
1020 # to use shared libraries on this platform.
1021 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
1022 # in a static or shared library name, using the $PACKAGE_VERSION variable
1023 # to put the version in the right place. This is used
1024 # by platforms that need non-standard library names.
1025 # Examples: ${PACKAGE_VERSION}.so.1.1 on NetBSD, since it needs
1026 # to have a version after the .so, and ${PACKAGE_VERSION}.a
1027 # on AIX, since a shared library needs to have
1028 # a .a extension whereas shared objects for loadable
1029 # extensions have a .so extension. Defaults to
1030 # ${PACKAGE_VERSION}${SHLIB_SUFFIX}.
1032 # Flags used when running the compiler in debug mode
1034 # Flags used when running the compiler in optimize mode
1035 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
1036 #--------------------------------------------------------------------
1038 AC_DEFUN([TEA_CONFIG_CFLAGS], [
1039 dnl TEA specific: Make sure we are initialized
1040 AC_REQUIRE([TEA_INIT])
1042 # Step 0.a: Enable 64 bit support?
1044 AC_MSG_CHECKING([if 64bit support is requested])
1045 AC_ARG_ENABLE(64bit,
1046 AC_HELP_STRING([--enable-64bit],
1047 [enable 64bit support (default: off)]),
1048 [do64bit=$enableval], [do64bit=no])
1049 AC_MSG_RESULT([$do64bit])
1051 # Step 0.b: Enable Solaris 64 bit VIS support?
1053 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1054 AC_ARG_ENABLE(64bit-vis,
1055 AC_HELP_STRING([--enable-64bit-vis],
1056 [enable 64bit Sparc VIS support (default: off)]),
1057 [do64bitVIS=$enableval], [do64bitVIS=no])
1058 AC_MSG_RESULT([$do64bitVIS])
1059 # Force 64bit on with VIS
1060 AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
1062 # Step 0.c: Check if visibility support is available. Do this here so
1063 # that platform specific alternatives can be used below if this fails.
1065 AC_CACHE_CHECK([if compiler supports visibility "hidden"],
1066 tcl_cv_cc_visibility_hidden, [
1067 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
1069 extern __attribute__((__visibility__("hidden"))) void f(void);
1070 void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes,
1071 tcl_cv_cc_visibility_hidden=no)
1072 CFLAGS=$hold_cflags])
1073 AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
1074 AC_DEFINE(MODULE_SCOPE,
1075 [extern __attribute__((__visibility__("hidden")))],
1076 [Compiler support for module scope symbols])
1077 AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols])
1080 # Step 0.d: Disable -rpath support?
1082 AC_MSG_CHECKING([if rpath support is requested])
1083 AC_ARG_ENABLE(rpath,
1084 AC_HELP_STRING([--disable-rpath],
1085 [disable rpath support (default: on)]),
1086 [doRpath=$enableval], [doRpath=yes])
1087 AC_MSG_RESULT([$doRpath])
1089 # TEA specific: Cross-compiling options for Windows/CE builds?
1091 AS_IF([test "${TEA_PLATFORM}" = windows], [
1092 AC_MSG_CHECKING([if Windows/CE build is requested])
1093 AC_ARG_ENABLE(wince,
1094 AC_HELP_STRING([--enable-wince],
1095 [enable Win/CE support (where applicable)]),
1096 [doWince=$enableval], [doWince=no])
1097 AC_MSG_RESULT([$doWince])
1100 # Set the variable "system" to hold the name and version number
1105 # Require ranlib early so we can override it in special cases below.
1107 AC_REQUIRE([AC_PROG_RANLIB])
1109 # Set configuration options based on system name and version.
1110 # This is similar to Tcl's unix/tcl.m4 except that we've added a
1111 # "windows" case and removed some core-only vars.
1114 # default to '{$LIBS}' and set to "" on per-platform necessary basis
1115 SHLIB_LD_LIBS='${LIBS}'
1116 # When ld needs options to work in 64-bit mode, put them in
1117 # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
1118 # is disabled by the user. [Bug 1016796]
1120 UNSHARED_LIB_SUFFIX=""
1121 # TEA specific: use PACKAGE_VERSION instead of VERSION
1122 TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
1123 ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
1124 TCL_LIB_VERSIONS_OK=ok
1126 AS_IF([test "$GCC" = yes], [
1128 CFLAGS_WARNING="-Wall"
1133 AC_CHECK_TOOL(AR, ar)
1135 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1136 AS_IF([test "x$SHLIB_VERSION" = x],[SHLIB_VERSION="1.0"])
1140 # This is a 2-stage check to make sure we have the 64-bit SDK
1141 # We have to know where the SDK is installed.
1142 # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
1143 # MACHINE is IX86 for LINK, but this is used by the manifest,
1144 # which requires x86|amd64|ia64.
1146 if test "$do64bit" != "no" ; then
1147 if test "x${MSSDK}x" = "xx" ; then
1148 MSSDK="C:/Progra~1/Microsoft Platform SDK"
1150 MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
1154 MACHINE="AMD64" ; # default to AMD64 64-bit build
1155 PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
1159 PATH64="${MSSDK}/Bin/Win64"
1162 if test "$GCC" != "yes" -a ! -d "${PATH64}" ; then
1163 AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode])
1164 AC_MSG_WARN([Ensure latest Platform SDK is installed])
1167 AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
1172 if test "$doWince" != "no" ; then
1173 if test "$do64bit" != "no" ; then
1174 AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible])
1176 if test "$GCC" = "yes" ; then
1177 AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
1180 # Set defaults for common evc4/PPC2003 setup
1181 # Currently Tcl requires 300+, possibly 420+ for sockets
1182 CEVERSION=420; # could be 211 300 301 400 420 ...
1183 TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
1184 ARCH=ARM; # could be ARM MIPS X86EM ...
1185 PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
1186 if test "$doWince" != "yes"; then
1187 # If !yes then the user specified something
1188 # Reset ARCH to allow user to skip specifying it
1190 eval `echo $doWince | awk -F, '{ \
1191 if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
1192 if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
1193 if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
1194 if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
1195 if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
1197 if test "x${ARCH}" = "x" ; then
1201 OSVERSION=WCE$CEVERSION;
1202 if test "x${WCEROOT}" = "x" ; then
1203 WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
1204 if test ! -d "${WCEROOT}" ; then
1205 WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
1208 if test "x${SDKROOT}" = "x" ; then
1209 SDKROOT="C:/Program Files/Windows CE Tools"
1210 if test ! -d "${SDKROOT}" ; then
1211 SDKROOT="C:/Windows CE Tools"
1214 WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
1215 SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
1216 if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
1217 -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
1218 AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
1221 # We could PATH_NOSPACE these, but that's not important,
1222 # as long as we quote them when used.
1223 CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
1224 if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
1225 CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
1227 CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
1231 if test "$GCC" != "yes" ; then
1232 if test "${SHARED_BUILD}" = "0" ; then
1238 if test "$do64bit" != "no" ; then
1239 # All this magic is necessary for the Win64 SDK RC1 - hobbs
1240 CC="\"${PATH64}/cl.exe\""
1241 CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
1242 RC="\"${MSSDK}/bin/rc.exe\""
1243 lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
1244 LINKBIN="\"${PATH64}/link.exe\""
1245 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
1246 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1247 # Avoid 'unresolved external symbol __security_cookie'
1248 # errors, c.f. http://support.microsoft.com/?id=894573
1249 TEA_ADD_LIBS([bufferoverflowU.lib])
1250 elif test "$doWince" != "no" ; then
1251 CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
1252 if test "${TARGETCPU}" = "X86"; then
1253 CC="\"${CEBINROOT}/cl.exe\""
1255 CC="\"${CEBINROOT}/cl${ARCH}.exe\""
1257 CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
1258 RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
1259 arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
1260 defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
1261 if test "${SHARED_BUILD}" = "1" ; then
1262 # Static CE builds require static celib as well
1266 AC_DEFINE_UNQUOTED($i, 1, [WinCE def ]$i)
1268 AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION, [_WIN32_WCE version])
1269 AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION, [UNDER_CE version])
1270 CFLAGS_DEBUG="-nologo -Zi -Od"
1271 CFLAGS_OPTIMIZE="-nologo -Ox"
1272 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
1273 lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
1274 LINKBIN="\"${CEBINROOT}/link.exe\""
1280 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
1281 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1285 if test "$GCC" = "yes"; then
1287 AC_CHECK_TOOL(RC, windres)
1289 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1290 SHLIB_LD='${CC} -shared'
1291 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1292 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
1293 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
1295 AC_CACHE_CHECK(for cross-compile version of gcc,
1299 #error cross-compiler
1305 if test "$ac_cv_cross" = "yes"; then
1308 CC="x86_64-w64-mingw32-gcc"
1309 LD="x86_64-w64-mingw32-ld"
1310 AR="x86_64-w64-mingw32-ar"
1311 RANLIB="x86_64-w64-mingw32-ranlib"
1312 RC="x86_64-w64-mingw32-windres"
1315 CC="i686-w64-mingw32-gcc"
1316 LD="i686-w64-mingw32-ld"
1317 AR="i686-w64-mingw32-ar"
1318 RANLIB="i686-w64-mingw32-ranlib"
1319 RC="i686-w64-mingw32-windres"
1325 SHLIB_LD="${LINKBIN} -dll ${lflags}"
1326 # link -lib only works when -lib is the first arg
1327 STLIB_LD="${LINKBIN} -lib ${lflags}"
1328 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
1330 # For information on what debugtype is most useful, see:
1331 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
1333 # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx
1334 # This essentially turns it all on.
1335 LDFLAGS_DEBUG="-debug -debugtype:cv"
1336 LDFLAGS_OPTIMIZE="-release"
1337 if test "$doWince" != "no" ; then
1338 LDFLAGS_CONSOLE="-link ${lflags}"
1339 LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
1341 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
1342 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
1347 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
1349 TCL_LIB_VERSIONS_OK=nodots
1352 AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
1353 # AIX requires the _r compiler when gcc isn't being used
1359 # Make sure only first arg gets _r
1360 CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
1363 AC_MSG_RESULT([Using $CC for compiling with threads])
1369 LD_LIBRARY_PATH_VAR="LIBPATH"
1371 # Check to enable 64-bit flags for compiler/linker
1372 AS_IF([test "$do64bit" = yes], [
1373 AS_IF([test "$GCC" = yes], [
1374 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1377 CFLAGS="$CFLAGS -q64"
1379 RANLIB="${RANLIB} -X64"
1381 SHLIB_LD_FLAGS="-b64"
1385 AS_IF([test "`uname -m`" = ia64], [
1386 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1387 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1388 AS_IF([test "$GCC" = yes], [
1389 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1391 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1393 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1395 AS_IF([test "$GCC" = yes], [
1396 SHLIB_LD='${CC} -shared -Wl,-bexpall'
1398 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
1399 LDFLAGS="$LDFLAGS -brtl"
1401 SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1402 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1403 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1407 SHLIB_CFLAGS="-fPIC"
1408 SHLIB_LD='${CC} -nostart'
1411 #-----------------------------------------------------------
1412 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1413 # -lsocket, even if the network functions are in -lnet which
1414 # is always linked to, for compatibility.
1415 #-----------------------------------------------------------
1416 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1419 SHLIB_CFLAGS="-export-dynamic -fPIC"
1420 SHLIB_LD='${CC} -shared'
1422 LDFLAGS="$LDFLAGS -export-dynamic"
1428 SHLIB_LD='${CC} -shared'
1436 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1437 SHLIB_CFLAGS="-fPIC"
1439 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
1440 AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
1443 # Use updated header definitions where possible
1444 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1445 # TEA specific: Needed by Tcl, but not most extensions
1446 #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1447 #LIBS="$LIBS -lxnet" # Use the XOPEN network library
1449 AS_IF([test "`uname -m`" = ia64], [
1451 # Use newer C++ library for C++ extensions
1452 #if test "$GCC" != "yes" ; then
1458 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1459 AS_IF([test "$tcl_ok" = yes], [
1460 LDFLAGS="$LDFLAGS -Wl,-E"
1461 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1462 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1463 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1465 AS_IF([test "$GCC" = yes], [
1466 SHLIB_LD='${CC} -shared'
1467 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1470 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1471 #CFLAGS="$CFLAGS +DAportable"
1476 # Check to enable 64-bit flags for compiler/linker
1477 AS_IF([test "$do64bit" = "yes"], [
1478 AS_IF([test "$GCC" = yes], [
1479 case `${CC} -dumpmachine` in
1481 # 64-bit gcc in use. Fix flags for GNU ld.
1483 SHLIB_LD='${CC} -shared'
1484 AS_IF([test $doRpath = yes], [
1485 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1486 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1489 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1494 CFLAGS="$CFLAGS +DD64"
1495 LDFLAGS_ARCH="+DD64"
1500 SHLIB_LD="ld -n32 -shared -rdata_shared"
1502 AS_IF([test $doRpath = yes], [
1503 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1504 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1505 AS_IF([test "$GCC" = yes], [
1506 CFLAGS="$CFLAGS -mabi=n32"
1507 LDFLAGS="$LDFLAGS -mabi=n32"
1511 # Use to build 6.2 compatible binaries on 6.3.
1512 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1515 CFLAGS="$CFLAGS -n32"
1518 LDFLAGS="$LDFLAGS -n32"
1523 SHLIB_LD="ld -n32 -shared -rdata_shared"
1525 AS_IF([test $doRpath = yes], [
1526 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1527 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1529 # Check to enable 64-bit flags for compiler/linker
1531 AS_IF([test "$do64bit" = yes], [
1532 AS_IF([test "$GCC" = yes], [
1533 AC_MSG_WARN([64bit mode not supported by gcc])
1536 SHLIB_LD="ld -64 -shared -rdata_shared"
1537 CFLAGS="$CFLAGS -64"
1542 Linux*|GNU*|NetBSD-Debian)
1543 SHLIB_CFLAGS="-fPIC"
1547 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1549 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1550 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}'
1551 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1552 AS_IF([test $doRpath = yes], [
1553 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1554 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1555 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1556 AS_IF([test $do64bit = yes], [
1557 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1559 CFLAGS="$CFLAGS -m64"
1560 AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
1561 CFLAGS=$hold_cflags])
1562 AS_IF([test $tcl_cv_cc_m64 = yes], [
1563 CFLAGS="$CFLAGS -m64"
1568 # The combo of gcc + glibc has a bug related to inlining of
1569 # functions like strtod(). The -fno-builtin flag should address
1570 # this problem but it does not work. The -fno-inline flag is kind
1571 # of overkill but it works. Disable inlining only when one of the
1572 # files in compat/*.c is being linked in.
1574 AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1577 SHLIB_CFLAGS="-fPIC"
1580 SHLIB_LD='${CC} -shared'
1581 LD_FLAGS="-Wl,--export-dynamic"
1582 AS_IF([test $doRpath = yes], [
1583 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1584 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1591 SHARED_LIB_SUFFIX=""
1595 SHLIB_CFLAGS="-fPIC"
1596 SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1598 AS_IF([test $doRpath = yes], [
1599 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1600 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1601 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
1602 LDFLAGS="-Wl,-export-dynamic"
1607 CFLAGS_OPTIMIZE="-O1"
1610 CFLAGS_OPTIMIZE="-O2"
1613 AS_IF([test "${TCL_THREADS}" = "1"], [
1614 # On OpenBSD: Compile with -pthread
1615 # Don't link with -lpthread
1616 LIBS=`echo $LIBS | sed s/-lpthread//`
1617 CFLAGS="$CFLAGS -pthread"
1619 # OpenBSD doesn't do version numbers with dots.
1620 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1621 TCL_LIB_VERSIONS_OK=nodots
1624 # NetBSD has ELF and can use 'cc -shared' to build shared libs
1625 SHLIB_CFLAGS="-fPIC"
1626 SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1628 LDFLAGS="$LDFLAGS -export-dynamic"
1629 AS_IF([test $doRpath = yes], [
1630 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1631 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1632 AS_IF([test "${TCL_THREADS}" = "1"], [
1633 # The -pthread needs to go in the CFLAGS, not LIBS
1634 LIBS=`echo $LIBS | sed s/-pthread//`
1635 CFLAGS="$CFLAGS -pthread"
1636 LDFLAGS="$LDFLAGS -pthread"
1640 # This configuration from FreeBSD Ports.
1641 SHLIB_CFLAGS="-fPIC"
1642 SHLIB_LD="${CC} -shared"
1643 TCL_SHLIB_LD_EXTRAS="-Wl,-soname=\$[@]"
1644 TK_SHLIB_LD_EXTRAS="-Wl,-soname,\$[@]"
1647 AS_IF([test $doRpath = yes], [
1648 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1649 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1650 AS_IF([test "${TCL_THREADS}" = "1"], [
1651 # The -pthread needs to go in the LDFLAGS, not LIBS
1652 LIBS=`echo $LIBS | sed s/-pthread//`
1653 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1654 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
1657 # Version numbers are dot-stripped by system policy.
1658 TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
1659 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1660 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1661 TCL_LIB_VERSIONS_OK=nodots
1666 CFLAGS_OPTIMIZE="-Os"
1667 SHLIB_CFLAGS="-fno-common"
1668 # To avoid discrepancies between what headers configure sees during
1669 # preprocessing tests and compiling tests, move any -isysroot and
1670 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1671 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1672 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1673 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1674 CFLAGS="`echo " ${CFLAGS}" | \
1675 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1676 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1677 AS_IF([test $do64bit = yes], [
1680 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1681 tcl_cv_cc_arch_ppc64, [
1683 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1684 AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
1685 tcl_cv_cc_arch_ppc64=no)
1686 CFLAGS=$hold_cflags])
1687 AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1688 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1692 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1693 tcl_cv_cc_arch_x86_64, [
1695 CFLAGS="$CFLAGS -arch x86_64"
1696 AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
1697 tcl_cv_cc_arch_x86_64=no)
1698 CFLAGS=$hold_cflags])
1699 AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1700 CFLAGS="$CFLAGS -arch x86_64"
1704 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1707 # Check for combined 32-bit and 64-bit fat build
1708 AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
1709 && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1712 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1713 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
1714 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1715 hold_ldflags=$LDFLAGS
1716 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1717 AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
1718 LDFLAGS=$hold_ldflags])
1719 AS_IF([test $tcl_cv_ld_single_module = yes], [
1720 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1722 # TEA specific: link shlib with current and compatibility version flags
1723 vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
1724 SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
1725 SHLIB_SUFFIX=".dylib"
1726 # Don't use -prebind when building for Mac OS X 10.4 or later only:
1727 AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
1728 "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
1729 LDFLAGS="$LDFLAGS -prebind"])
1730 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1731 AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1732 tcl_cv_ld_search_paths_first, [
1733 hold_ldflags=$LDFLAGS
1734 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1735 AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes,
1736 tcl_cv_ld_search_paths_first=no)
1737 LDFLAGS=$hold_ldflags])
1738 AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1739 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1741 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1742 AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1743 [Compiler support for module scope symbols])
1744 tcl_cv_cc_visibility_hidden=yes
1748 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1749 # TEA specific: for combined 32 & 64 bit fat builds of Tk
1750 # extensions, verify that 64-bit build is possible.
1751 AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [
1752 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [
1753 AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
1754 for v in CFLAGS CPPFLAGS LDFLAGS; do
1755 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1757 CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
1758 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
1759 AC_TRY_LINK([#include <X11/Xlib.h>], [XrmInitialize();],
1760 tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no)
1761 for v in CFLAGS CPPFLAGS LDFLAGS; do
1762 eval $v'="$hold_'$v'"'
1765 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua], [
1766 AC_CACHE_CHECK([for 64-bit Tk], tcl_cv_lib_tk_64, [
1767 for v in CFLAGS CPPFLAGS LDFLAGS; do
1768 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1770 CPPFLAGS="$CPPFLAGS -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}"
1771 LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
1772 AC_TRY_LINK([#include <tk.h>], [Tk_InitStubs(NULL, "", 0);],
1773 tcl_cv_lib_tk_64=yes, tcl_cv_lib_tk_64=no)
1774 for v in CFLAGS CPPFLAGS LDFLAGS; do
1775 eval $v'="$hold_'$v'"'
1778 # remove 64-bit arch flags from CFLAGS et al. if configuration
1779 # does not support 64-bit.
1780 AS_IF([test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no], [
1781 AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
1782 for v in CFLAGS CPPFLAGS LDFLAGS; do
1783 eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1788 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1789 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1790 [Should OS/390 do the right thing with sockets?])
1795 AS_IF([test "$SHARED_BUILD" = 1], [
1796 SHLIB_LD='ld -shared -expect_unresolved "*"'
1798 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1801 AS_IF([test $doRpath = yes], [
1802 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1803 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1804 AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1805 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1806 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1807 AS_IF([test "${TCL_THREADS}" = 1], [
1808 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1809 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1810 LIBS=`echo $LIBS | sed s/-lpthreads//`
1811 AS_IF([test "$GCC" = yes], [
1812 LIBS="$LIBS -lpthread -lmach -lexc"
1814 CFLAGS="$CFLAGS -pthread"
1815 LDFLAGS="$LDFLAGS -pthread"
1821 # This may work for all QNX, but it was only reported for v6.
1822 SHLIB_CFLAGS="-fPIC"
1823 SHLIB_LD="ld -Bshareable -x"
1830 AS_IF([test "$GCC" = yes], [
1831 SHLIB_CFLAGS="-fPIC -melf"
1832 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1834 SHLIB_CFLAGS="-Kpic -belf"
1835 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1844 # Careful to not let 5.10+ fall into this case
1846 # Note: If _REENTRANT isn't defined, then Solaris
1847 # won't define thread-safe library routines.
1849 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1850 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1851 [Do we really want to follow the standard? Yes we do!])
1853 SHLIB_CFLAGS="-KPIC"
1855 AS_IF([test "$GCC" = yes], [
1856 SHLIB_LD='${CC} -shared'
1857 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1858 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1860 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1861 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1862 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1866 # Note: If _REENTRANT isn't defined, then Solaris
1867 # won't define thread-safe library routines.
1869 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1870 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1871 [Do we really want to follow the standard? Yes we do!])
1873 SHLIB_CFLAGS="-KPIC"
1875 # Check to enable 64-bit flags for compiler/linker
1876 AS_IF([test "$do64bit" = yes], [
1878 AS_IF([test "$arch" = "sparcv9 sparc"], [
1879 AS_IF([test "$GCC" = yes], [
1880 AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
1881 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1884 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1885 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1886 SHLIB_CFLAGS="-fPIC"
1890 AS_IF([test "$do64bitVIS" = yes], [
1891 CFLAGS="$CFLAGS -xarch=v9a"
1892 LDFLAGS_ARCH="-xarch=v9a"
1894 CFLAGS="$CFLAGS -xarch=v9"
1895 LDFLAGS_ARCH="-xarch=v9"
1897 # Solaris 64 uses this as well
1898 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1900 ], [AS_IF([test "$arch" = "amd64 i386"], [
1901 AS_IF([test "$GCC" = yes], [
1903 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1905 CFLAGS="$CFLAGS -m64"
1906 LDFLAGS="$LDFLAGS -m64";;
1908 AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
1913 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1914 CFLAGS="$CFLAGS -m64"
1915 LDFLAGS="$LDFLAGS -m64";;
1917 CFLAGS="$CFLAGS -xarch=amd64"
1918 LDFLAGS="$LDFLAGS -xarch=amd64";;
1921 ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
1925 AS_IF([test "$GCC" = yes], [
1926 SHLIB_LD='${CC} -shared'
1927 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1928 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1929 AS_IF([test "$do64bit_ok" = yes], [
1930 AS_IF([test "$arch" = "sparcv9 sparc"], [
1931 # We need to specify -static-libgcc or we need to
1932 # add the path to the sparv9 libgcc.
1933 # JH: static-libgcc is necessary for core Tcl, but may
1934 # not be necessary for extensions.
1935 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1936 # for finding sparcv9 libgcc, get the regular libgcc
1937 # path, remove so name and append 'sparcv9'
1938 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1939 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1940 ], [AS_IF([test "$arch" = "amd64 i386"], [
1941 # JH: static-libgcc is necessary for core Tcl, but may
1942 # not be necessary for extensions.
1943 SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
1948 SunOS-5.[[1-9]][[0-9]]*)
1949 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1950 SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';;
1952 SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
1954 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1955 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1958 UNIX_SV* | UnixWare-5*)
1959 SHLIB_CFLAGS="-KPIC"
1963 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1964 # that don't grok the -Bexport option. Test that it does.
1965 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1966 hold_ldflags=$LDFLAGS
1967 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1968 AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
1969 LDFLAGS=$hold_ldflags])
1970 AS_IF([test $tcl_cv_ld_Bexport = yes], [
1971 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1978 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
1979 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1982 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1983 dnl # until the end of configure, as configure's compile and link tests use
1984 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1985 dnl # preprocessing tests use only CPPFLAGS.
1986 AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1988 # Add in the arch flags late to ensure it wasn't removed.
1989 # Not necessary in TEA, but this is aligned with core
1990 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
1992 # If we're running gcc, then change the C flags for compiling shared
1993 # libraries to the right flags for gcc, instead of those for the
1994 # standard manufacturer compiler.
1996 AS_IF([test "$GCC" = yes], [
2000 CYGWIN_*|MINGW32_*) ;;
2002 NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
2006 *) SHLIB_CFLAGS="-fPIC" ;;
2009 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
2010 AC_DEFINE(MODULE_SCOPE, [extern],
2011 [No Compiler support for module scope symbols])
2014 AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
2015 # TEA specific: use PACKAGE_VERSION instead of VERSION
2016 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'])
2017 AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
2018 # TEA specific: use PACKAGE_VERSION instead of VERSION
2019 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'])
2021 if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then
2022 AC_CACHE_CHECK(for SEH support in compiler,
2025 #define WIN32_LEAN_AND_MEAN
2026 #include <windows.h>
2027 #undef WIN32_LEAN_AND_MEAN
2029 int main(int argc, char** argv) {
2034 __except (EXCEPTION_EXECUTE_HANDLER) {
2044 if test "$tcl_cv_seh" = "no" ; then
2045 AC_DEFINE(HAVE_NO_SEH, 1,
2046 [Defined when mingw does not support SEH])
2050 # Check to see if the excpt.h include file provided contains the
2051 # definition for EXCEPTION_DISPOSITION; if not, which is the case
2052 # with Cygwin's version as of 2002-04-10, define it to be int,
2053 # sufficient for getting the current code to work.
2055 AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files,
2056 tcl_cv_eh_disposition,
2058 # define WIN32_LEAN_AND_MEAN
2059 # include <windows.h>
2060 # undef WIN32_LEAN_AND_MEAN
2062 EXCEPTION_DISPOSITION x;
2064 tcl_cv_eh_disposition=yes,
2065 tcl_cv_eh_disposition=no)
2067 if test "$tcl_cv_eh_disposition" = "no" ; then
2068 AC_DEFINE(EXCEPTION_DISPOSITION, int,
2069 [Defined when cygwin/mingw does not support EXCEPTION DISPOSITION])
2072 # Check to see if winnt.h defines CHAR, SHORT, and LONG
2073 # even if VOID has already been #defined. The win32api
2074 # used by mingw and cygwin is known to do this.
2076 AC_CACHE_CHECK(for winnt.h that ignores VOID define,
2077 tcl_cv_winnt_ignore_void,
2080 #define WIN32_LEAN_AND_MEAN
2081 #include <windows.h>
2082 #undef WIN32_LEAN_AND_MEAN
2088 tcl_cv_winnt_ignore_void=yes,
2089 tcl_cv_winnt_ignore_void=no)
2091 if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
2092 AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1,
2093 [Defined when cygwin/mingw ignores VOID define in winnt.h])
2097 # See if the compiler supports casting to a union type.
2098 # This is used to stop gcc from printing a compiler
2099 # warning when initializing a union member.
2101 AC_CACHE_CHECK(for cast to union support,
2102 tcl_cv_cast_to_union,
2105 union foo { int i; double d; };
2106 union foo f = (union foo) (int) 0;
2108 tcl_cv_cast_to_union=yes,
2109 tcl_cv_cast_to_union=no)
2111 if test "$tcl_cv_cast_to_union" = "yes"; then
2112 AC_DEFINE(HAVE_CAST_TO_UNION, 1,
2113 [Defined when compiler supports casting to union type.])
2116 AC_SUBST(CFLAGS_DEBUG)
2117 AC_SUBST(CFLAGS_OPTIMIZE)
2118 AC_SUBST(CFLAGS_WARNING)
2123 AC_SUBST(SHLIB_LD_LIBS)
2124 AC_SUBST(SHLIB_CFLAGS)
2126 AC_SUBST(LD_LIBRARY_PATH_VAR)
2128 # These must be called after we do the basic CFLAGS checks and
2129 # verify any possible 64-bit or similar switches are necessary
2134 #--------------------------------------------------------------------
2137 # Determine which interface to use to talk to the serial port.
2138 # Note that #include lines must begin in leftmost column for
2139 # some compilers to recognize them as preprocessor directives,
2140 # and some build environments have stdin not pointing at a
2141 # pseudo-terminal (usually /dev/null instead.)
2148 # Defines only one of the following vars:
2153 #--------------------------------------------------------------------
2155 AC_DEFUN([TEA_SERIAL_PORT], [
2156 AC_CHECK_HEADERS(sys/modem.h)
2157 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2159 #include <termios.h>
2163 if (tcgetattr(0, &t) == 0) {
2165 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2169 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2170 if test $tcl_cv_api_serial = no ; then
2176 if (ioctl(0, TCGETA, &t) == 0) {
2177 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2181 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2183 if test $tcl_cv_api_serial = no ; then
2189 if (ioctl(0, TIOCGETP, &t) == 0) {
2191 t.sg_flags |= ODDP | EVENP | RAW;
2195 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2197 if test $tcl_cv_api_serial = no ; then
2199 #include <termios.h>
2204 if (tcgetattr(0, &t) == 0
2205 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2207 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2211 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2213 if test $tcl_cv_api_serial = no; then
2220 if (ioctl(0, TCGETA, &t) == 0
2221 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2222 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2226 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2228 if test $tcl_cv_api_serial = no; then
2235 if (ioctl(0, TIOCGETP, &t) == 0
2236 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2238 t.sg_flags |= ODDP | EVENP | RAW;
2242 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2244 case $tcl_cv_api_serial in
2245 termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
2246 termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
2247 sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
2251 #--------------------------------------------------------------------
2252 # TEA_MISSING_POSIX_HEADERS
2254 # Supply substitutes for missing POSIX header files. Special
2256 # - stdlib.h doesn't define strtol, strtoul, or
2257 # strtod in some versions of SunOS
2258 # - some versions of string.h don't declare procedures such
2266 # Defines some of the following vars:
2270 # HAVE_LIMITS_H or NO_LIMITS_H
2279 # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and
2281 #--------------------------------------------------------------------
2283 AC_DEFUN([TEA_MISSING_POSIX_HEADERS], [
2284 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2285 AC_TRY_LINK([#include <sys/types.h>
2286 #include <dirent.h>], [
2287 #ifndef _POSIX_SOURCE
2290 * Generate compilation error to make the test fail: Lynx headers
2291 * are only valid if really in the POSIX environment.
2294 missing_procedure();
2298 struct dirent *entryPtr;
2300 d = opendir("foobar");
2301 entryPtr = readdir(d);
2302 p = entryPtr->d_name;
2304 ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
2306 if test $tcl_cv_dirent_h = no; then
2307 AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
2311 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
2312 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
2313 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
2314 AC_CHECK_HEADER(limits.h,
2315 [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
2316 [AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
2317 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2318 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2319 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2320 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2321 if test $tcl_ok = 0; then
2322 AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
2324 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2325 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2326 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2328 # See also memmove check below for a place where NO_STRING_H can be
2331 if test $tcl_ok = 0; then
2332 AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
2335 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
2336 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
2338 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2339 AC_HAVE_HEADERS(sys/param.h)
2342 #--------------------------------------------------------------------
2345 # Locate the X11 header files and the X11 library archive. Try
2346 # the ac_path_x macro first, but if it doesn't find the X stuff
2347 # (e.g. because there's no xmkmf program) then check through
2348 # a list of possible directories. Under some conditions the
2349 # autoconf macro will return an include directory that contains
2350 # no include files, so double-check its result just to be safe.
2352 # This should be called after TEA_CONFIG_CFLAGS as setting the
2353 # LIBS line can confuse some configure macro magic.
2360 # Sets the following vars:
2363 # PKG_LIBS (appends to)
2364 #--------------------------------------------------------------------
2366 AC_DEFUN([TEA_PATH_X], [
2367 if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
2372 AC_DEFUN([TEA_PATH_UNIX_X], [
2375 if test "$no_x" = ""; then
2376 if test "$x_includes" = ""; then
2377 AC_TRY_CPP([#include <X11/Xlib.h>], , not_really_there="yes")
2379 if test ! -r $x_includes/X11/Xlib.h; then
2380 not_really_there="yes"
2384 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2385 AC_MSG_CHECKING([for X11 header files])
2386 found_xincludes="no"
2387 AC_TRY_CPP([#include <X11/Xlib.h>], found_xincludes="yes", found_xincludes="no")
2388 if test "$found_xincludes" = "no"; then
2389 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"
2391 if test -r $i/X11/Xlib.h; then
2394 found_xincludes="yes"
2400 if test "$x_includes" != ""; then
2401 XINCLUDES="-I$x_includes"
2402 found_xincludes="yes"
2405 if test "$found_xincludes" = "no"; then
2406 AC_MSG_RESULT([couldn't find any!])
2409 if test "$no_x" = yes; then
2410 AC_MSG_CHECKING([for X11 libraries])
2412 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"
2414 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2422 if test "$x_libraries" = ""; then
2425 XLIBSW="-L$x_libraries -lX11"
2428 if test "$XLIBSW" = nope ; then
2429 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2431 if test "$XLIBSW" = nope ; then
2432 AC_MSG_RESULT([could not find any! Using -lX11.])
2436 if test x"${XLIBSW}" != x ; then
2437 PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
2441 #--------------------------------------------------------------------
2442 # TEA_BLOCKING_STYLE
2444 # The statements below check for systems where POSIX-style
2445 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2446 # On these systems (mostly older ones), use the old BSD-style
2447 # FIONBIO approach instead.
2454 # Defines some of the following vars:
2459 #--------------------------------------------------------------------
2461 AC_DEFUN([TEA_BLOCKING_STYLE], [
2462 AC_CHECK_HEADERS(sys/ioctl.h)
2463 AC_CHECK_HEADERS(sys/filio.h)
2465 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2468 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2469 AC_MSG_RESULT([FIONBIO])
2472 AC_MSG_RESULT([O_NONBLOCK])
2477 #--------------------------------------------------------------------
2480 # Checks how the system deals with time.h, what time structures
2481 # are used on the system, and what fields the structures have.
2488 # Defines some of the following vars:
2493 #--------------------------------------------------------------------
2495 AC_DEFUN([TEA_TIME_HANDLER], [
2496 AC_CHECK_HEADERS(sys/time.h)
2500 AC_CHECK_FUNCS(gmtime_r localtime_r)
2502 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2503 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2504 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
2505 if test $tcl_cv_member_tm_tzadj = yes ; then
2506 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2509 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2510 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2511 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
2512 if test $tcl_cv_member_tm_gmtoff = yes ; then
2513 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2517 # Its important to include time.h in this check, as some systems
2518 # (like convex) have timezone functions, etc.
2520 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2521 AC_TRY_COMPILE([#include <time.h>],
2522 [extern long timezone;
2525 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
2526 if test $tcl_cv_timezone_long = yes ; then
2527 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2530 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2532 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2533 AC_TRY_COMPILE([#include <time.h>],
2534 [extern time_t timezone;
2537 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
2538 if test $tcl_cv_timezone_time = yes ; then
2539 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2544 #--------------------------------------------------------------------
2547 # Under Solaris 2.4, strtod returns the wrong value for the
2548 # terminating character under some conditions. Check for this
2549 # and if the problem exists use a substitute procedure
2550 # "fixstrtod" (provided by Tcl) that corrects the error.
2551 # Also, on Compaq's Tru64 Unix 5.0,
2552 # strtod(" ") returns 0.0 instead of a failure to convert.
2559 # Might defines some of the following vars:
2560 # strtod (=fixstrtod)
2561 #--------------------------------------------------------------------
2563 AC_DEFUN([TEA_BUGGY_STRTOD], [
2564 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2565 if test "$tcl_strtod" = 1; then
2566 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2568 extern double strtod();
2570 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2573 value = strtod(infString, &term);
2574 if ((term != infString) && (term[-1] == 0)) {
2577 value = strtod(nanString, &term);
2578 if ((term != nanString) && (term[-1] == 0)) {
2581 value = strtod(spaceString, &term);
2582 if (term == (spaceString+1)) {
2586 }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2587 tcl_cv_strtod_buggy=buggy)])
2588 if test "$tcl_cv_strtod_buggy" = buggy; then
2589 AC_LIBOBJ([fixstrtod])
2591 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
2596 #--------------------------------------------------------------------
2599 # Search for the libraries needed to link the Tcl shell.
2600 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2601 # -lnsl) are dealt with here.
2604 # Requires the following vars to be set in the Makefile:
2605 # DL_LIBS (not in TEA, only needed in core)
2611 # Substitutes the following vars:
2615 # Might append to the following vars:
2618 # Might define the following vars:
2620 #--------------------------------------------------------------------
2622 AC_DEFUN([TEA_TCL_LINK_LIBS], [
2623 #--------------------------------------------------------------------
2624 # On a few very rare systems, all of the libm.a stuff is
2625 # already in libc.a. Set compiler flags accordingly.
2626 # Also, Linux requires the "ieee" library for math to work
2627 # right (and it must appear before "-lm").
2628 #--------------------------------------------------------------------
2630 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2631 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2633 #--------------------------------------------------------------------
2634 # Interactive UNIX requires -linet instead of -lsocket, plus it
2635 # needs net/errno.h to define the socket-related error codes.
2636 #--------------------------------------------------------------------
2638 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2639 AC_CHECK_HEADER(net/errno.h, [
2640 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2642 #--------------------------------------------------------------------
2643 # Check for the existence of the -lsocket and -lnsl libraries.
2644 # The order here is important, so that they end up in the right
2645 # order in the command line generated by make. Here are some
2646 # special considerations:
2647 # 1. Use "connect" and "accept" to check for -lsocket, and
2648 # "gethostbyname" to check for -lnsl.
2649 # 2. Use each function name only once: can't redo a check because
2650 # autoconf caches the results of the last check and won't redo it.
2651 # 3. Use -lnsl and -lsocket only if they supply procedures that
2652 # aren't already present in the normal libraries. This is because
2653 # IRIX 5.2 has libraries, but they aren't needed and they're
2654 # bogus: they goof up name resolution if used.
2655 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2656 # To get around this problem, check for both libraries together
2657 # if -lsocket doesn't work by itself.
2658 #--------------------------------------------------------------------
2661 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2662 if test "$tcl_checkSocket" = 1; then
2663 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2664 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2666 if test "$tcl_checkBoth" = 1; then
2668 LIBS="$LIBS -lsocket -lnsl"
2669 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2671 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2672 [LIBS="$LIBS -lnsl"])])
2674 # TEA specific: Don't perform the eval of the libraries here because
2675 # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS
2677 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2682 #--------------------------------------------------------------------
2683 # TEA_TCL_EARLY_FLAGS
2685 # Check for what flags are needed to be passed so the correct OS
2686 # features are available.
2693 # Might define the following vars:
2695 # _LARGEFILE64_SOURCE
2696 # _LARGEFILE_SOURCE64
2697 #--------------------------------------------------------------------
2699 AC_DEFUN([TEA_TCL_EARLY_FLAG],[
2700 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2701 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2702 AC_TRY_COMPILE([[#define ]$1[ 1
2704 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2705 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2706 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2707 AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
2708 tcl_flags="$tcl_flags $1"
2712 AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
2713 AC_MSG_CHECKING([for required early compiler flags])
2715 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2716 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2717 TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2718 [struct stat64 buf; int i = stat64("/", &buf);])
2719 TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2720 [char *p = (char *)open64;])
2721 if test "x${tcl_flags}" = "x" ; then
2722 AC_MSG_RESULT([none])
2724 AC_MSG_RESULT([${tcl_flags}])
2728 #--------------------------------------------------------------------
2729 # TEA_TCL_64BIT_FLAGS
2731 # Check for what is defined in the way of 64-bit features.
2738 # Might define the following vars:
2739 # TCL_WIDE_INT_IS_LONG
2741 # HAVE_STRUCT_DIRENT64
2742 # HAVE_STRUCT_STAT64
2744 #--------------------------------------------------------------------
2746 AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
2747 AC_MSG_CHECKING([for 64-bit integer type])
2748 AC_CACHE_VAL(tcl_cv_type_64bit,[
2749 tcl_cv_type_64bit=none
2750 # See if the compiler knows natively about __int64
2751 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2752 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2753 # See if we should use long anyway Note that we substitute in the
2754 # type that is our current guess for a 64-bit type inside this check
2755 # program, so it should be modified only carefully...
2756 AC_TRY_COMPILE(,[switch (0) {
2757 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2758 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2759 if test "${tcl_cv_type_64bit}" = none ; then
2760 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
2761 AC_MSG_RESULT([using long])
2762 elif test "${tcl_cv_type_64bit}" = "__int64" \
2763 -a "${TEA_PLATFORM}" = "windows" ; then
2764 # TEA specific: We actually want to use the default tcl.h checks in
2765 # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
2766 AC_MSG_RESULT([using Tcl header defaults])
2768 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2769 [What type should be used to define wide integers?])
2770 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2772 # Now check for auxiliary declarations
2773 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2774 AC_TRY_COMPILE([#include <sys/types.h>
2775 #include <dirent.h>],[struct dirent64 p;],
2776 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2777 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2778 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2781 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2782 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2784 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2785 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2786 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2789 AC_CHECK_FUNCS(open64 lseek64)
2790 AC_MSG_CHECKING([for off64_t])
2791 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2792 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2794 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2795 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2796 dnl functions lseek64 and open64 are defined.
2797 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2798 test "x${ac_cv_func_lseek64}" = "xyes" && \
2799 test "x${ac_cv_func_open64}" = "xyes" ; then
2800 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2801 AC_MSG_RESULT([yes])
2809 ## Here ends the standard Tcl configuration bits and starts the
2810 ## TEA specific functions
2813 #------------------------------------------------------------------------
2816 # Init various Tcl Extension Architecture (TEA) variables.
2817 # This should be the first called TEA_* macro.
2824 # Defines and substs the following vars:
2830 # TEA_PLATFORM (windows or unix)
2832 # "cygpath" is used on windows to generate native path names for include
2833 # files. These variables should only be used with the compiler and linker
2834 # since they generate native path names.
2837 # Select the executable extension based on the host type. This
2838 # is a lightweight replacement for AC_EXEEXT that doesn't require
2840 #------------------------------------------------------------------------
2842 AC_DEFUN([TEA_INIT], [
2843 # TEA extensions pass this us the version of TEA they think they
2844 # are compatible with.
2847 AC_MSG_CHECKING([for correct TEA configuration])
2848 if test x"${PACKAGE_NAME}" = x ; then
2850 The PACKAGE_NAME variable must be defined by your TEA configure.in])
2852 if test x"$1" = x ; then
2854 TEA version not specified.])
2855 elif test "$1" != "${TEA_VERSION}" ; then
2856 AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"])
2858 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
2861 # If the user did not set CFLAGS, set it now to keep macros
2862 # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
2863 if test "${CFLAGS+set}" != "set" ; then
2867 case "`uname -s`" in
2868 *win32*|*WIN32*|*MINGW32_*)
2869 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
2871 TEA_PLATFORM="windows"
2876 # TEA_PLATFORM is determined later in LOAD_TCLCONFIG
2880 # Maybe we are cross-compiling....
2881 case ${host_alias} in
2884 TEA_PLATFORM="windows"
2894 # Check if exec_prefix is set. If not use fall back to prefix.
2895 # Note when adjusted, so that TEA_PREFIX can correct for this.
2896 # This is needed for recursive configures, since autoconf propagates
2897 # $prefix, but not $exec_prefix (doh!).
2898 if test x$exec_prefix = xNONE ; then
2899 exec_prefix_default=yes
2903 AC_MSG_NOTICE([configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}])
2908 # This package name must be replaced statically for AC_SUBST to work
2909 AC_SUBST(PKG_LIB_FILE)
2910 # Substitute STUB_LIB_FILE in case package creates a stub library too.
2911 AC_SUBST(PKG_STUB_LIB_FILE)
2913 # We AC_SUBST these here to ensure they are subst'ed,
2914 # in case the user doesn't call TEA_ADD_...
2915 AC_SUBST(PKG_STUB_SOURCES)
2916 AC_SUBST(PKG_STUB_OBJECTS)
2917 AC_SUBST(PKG_TCL_SOURCES)
2918 AC_SUBST(PKG_HEADERS)
2919 AC_SUBST(PKG_INCLUDES)
2921 AC_SUBST(PKG_CFLAGS)
2924 #------------------------------------------------------------------------
2925 # TEA_ADD_SOURCES --
2927 # Specify one or more source files. Users should check for
2928 # the right platform before adding to their list.
2929 # It is not important to specify the directory, as long as it is
2930 # in the generic, win or unix subdirectory of $(srcdir).
2933 # one or more file names
2937 # Defines and substs the following vars:
2940 #------------------------------------------------------------------------
2941 AC_DEFUN([TEA_ADD_SOURCES], [
2947 PKG_SOURCES="$PKG_SOURCES $i"
2948 PKG_OBJECTS="$PKG_OBJECTS $i"
2951 # check for existence - allows for generic/win/unix VPATH
2952 # To add more dirs here (like 'src'), you have to update VPATH
2953 # in Makefile.in as well
2954 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2955 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2956 -a ! -f "${srcdir}/macosx/$i" \
2958 AC_MSG_ERROR([could not find source file '$i'])
2960 PKG_SOURCES="$PKG_SOURCES $i"
2961 # this assumes it is in a VPATH dir
2963 # handle user calling this before or after TEA_SETUP_COMPILER
2964 if test x"${OBJEXT}" != x ; then
2965 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2967 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2969 PKG_OBJECTS="$PKG_OBJECTS $j"
2973 AC_SUBST(PKG_SOURCES)
2974 AC_SUBST(PKG_OBJECTS)
2977 #------------------------------------------------------------------------
2978 # TEA_ADD_STUB_SOURCES --
2980 # Specify one or more source files. Users should check for
2981 # the right platform before adding to their list.
2982 # It is not important to specify the directory, as long as it is
2983 # in the generic, win or unix subdirectory of $(srcdir).
2986 # one or more file names
2990 # Defines and substs the following vars:
2993 #------------------------------------------------------------------------
2994 AC_DEFUN([TEA_ADD_STUB_SOURCES], [
2997 # check for existence - allows for generic/win/unix VPATH
2998 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2999 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
3000 -a ! -f "${srcdir}/macosx/$i" \
3002 AC_MSG_ERROR([could not find stub source file '$i'])
3004 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
3005 # this assumes it is in a VPATH dir
3007 # handle user calling this before or after TEA_SETUP_COMPILER
3008 if test x"${OBJEXT}" != x ; then
3009 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
3011 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
3013 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
3015 AC_SUBST(PKG_STUB_SOURCES)
3016 AC_SUBST(PKG_STUB_OBJECTS)
3019 #------------------------------------------------------------------------
3020 # TEA_ADD_TCL_SOURCES --
3022 # Specify one or more Tcl source files. These should be platform
3023 # independent runtime files.
3026 # one or more file names
3030 # Defines and substs the following vars:
3032 #------------------------------------------------------------------------
3033 AC_DEFUN([TEA_ADD_TCL_SOURCES], [
3036 # check for existence, be strict because it is installed
3037 if test ! -f "${srcdir}/$i" ; then
3038 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
3040 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
3042 AC_SUBST(PKG_TCL_SOURCES)
3045 #------------------------------------------------------------------------
3046 # TEA_ADD_HEADERS --
3048 # Specify one or more source headers. Users should check for
3049 # the right platform before adding to their list.
3052 # one or more file names
3056 # Defines and substs the following vars:
3058 #------------------------------------------------------------------------
3059 AC_DEFUN([TEA_ADD_HEADERS], [
3062 # check for existence, be strict because it is installed
3063 if test ! -f "${srcdir}/$i" ; then
3064 AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
3066 PKG_HEADERS="$PKG_HEADERS $i"
3068 AC_SUBST(PKG_HEADERS)
3071 #------------------------------------------------------------------------
3072 # TEA_ADD_INCLUDES --
3074 # Specify one or more include dirs. Users should check for
3075 # the right platform before adding to their list.
3078 # one or more file names
3082 # Defines and substs the following vars:
3084 #------------------------------------------------------------------------
3085 AC_DEFUN([TEA_ADD_INCLUDES], [
3088 PKG_INCLUDES="$PKG_INCLUDES $i"
3090 AC_SUBST(PKG_INCLUDES)
3093 #------------------------------------------------------------------------
3096 # Specify one or more libraries. Users should check for
3097 # the right platform before adding to their list. For Windows,
3098 # libraries provided in "foo.lib" format will be converted to
3099 # "-lfoo" when using GCC (mingw).
3102 # one or more file names
3106 # Defines and substs the following vars:
3108 #------------------------------------------------------------------------
3109 AC_DEFUN([TEA_ADD_LIBS], [
3112 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
3113 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
3114 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'`
3116 PKG_LIBS="$PKG_LIBS $i"
3121 #------------------------------------------------------------------------
3124 # Specify one or more CFLAGS. Users should check for
3125 # the right platform before adding to their list.
3128 # one or more file names
3132 # Defines and substs the following vars:
3134 #------------------------------------------------------------------------
3135 AC_DEFUN([TEA_ADD_CFLAGS], [
3136 PKG_CFLAGS="$PKG_CFLAGS $@"
3137 AC_SUBST(PKG_CFLAGS)
3140 #------------------------------------------------------------------------
3141 # TEA_ADD_CLEANFILES --
3143 # Specify one or more CLEANFILES.
3146 # one or more file names to clean target
3150 # Appends to CLEANFILES, already defined for subst in LOAD_TCLCONFIG
3151 #------------------------------------------------------------------------
3152 AC_DEFUN([TEA_ADD_CLEANFILES], [
3153 CLEANFILES="$CLEANFILES $@"
3156 #------------------------------------------------------------------------
3159 # Handle the --prefix=... option by defaulting to what Tcl gave
3166 # If --prefix or --exec-prefix was not specified, $prefix and
3167 # $exec_prefix will be set to the values given to Tcl when it was
3169 #------------------------------------------------------------------------
3170 AC_DEFUN([TEA_PREFIX], [
3171 if test "${prefix}" = "NONE"; then
3173 if test x"${TCL_PREFIX}" != x; then
3174 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
3175 prefix=${TCL_PREFIX}
3177 AC_MSG_NOTICE([--prefix defaulting to /usr/local])
3181 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
3182 -o x"${exec_prefix_default}" = x"yes" ; then
3183 if test x"${TCL_EXEC_PREFIX}" != x; then
3184 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
3185 exec_prefix=${TCL_EXEC_PREFIX}
3187 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
3193 #------------------------------------------------------------------------
3194 # TEA_SETUP_COMPILER_CC --
3196 # Do compiler checks the way we want. This is just a replacement
3197 # for AC_PROG_CC in TEA configure.in files to make them cleaner.
3204 # Sets up CC var and other standard bits we need to make executables.
3205 #------------------------------------------------------------------------
3206 AC_DEFUN([TEA_SETUP_COMPILER_CC], [
3207 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
3208 # in this macro, they need to go into TEA_SETUP_COMPILER instead.
3213 INSTALL="\$(SHELL) \$(srcdir)/tclconfig/install-sh -c"
3215 INSTALL_DATA="\${INSTALL} -m 644"
3216 AC_SUBST(INSTALL_DATA)
3217 INSTALL_PROGRAM="\${INSTALL}"
3218 AC_SUBST(INSTALL_PROGRAM)
3219 INSTALL_SCRIPT="\${INSTALL}"
3220 AC_SUBST(INSTALL_SCRIPT)
3222 #--------------------------------------------------------------------
3223 # Checks to see if the make program sets the $MAKE variable.
3224 #--------------------------------------------------------------------
3228 #--------------------------------------------------------------------
3230 #--------------------------------------------------------------------
3232 AC_CHECK_TOOL(RANLIB, ranlib)
3234 #--------------------------------------------------------------------
3235 # Determines the correct binary file extension (.o, .obj, .exe etc.)
3236 #--------------------------------------------------------------------
3242 #------------------------------------------------------------------------
3243 # TEA_SETUP_COMPILER --
3245 # Do compiler checks that use the compiler. This must go after
3246 # TEA_SETUP_COMPILER_CC, which does the actual compiler check.
3253 # Sets up CC var and other standard bits we need to make executables.
3254 #------------------------------------------------------------------------
3255 AC_DEFUN([TEA_SETUP_COMPILER], [
3256 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
3257 AC_REQUIRE([TEA_SETUP_COMPILER_CC])
3259 #------------------------------------------------------------------------
3260 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
3261 # It makes compiling go faster. (This is only a performance feature.)
3262 #------------------------------------------------------------------------
3264 if test -z "$no_pipe" -a -n "$GCC"; then
3265 AC_CACHE_CHECK([if the compiler understands -pipe],
3267 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
3268 AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
3269 CFLAGS=$hold_cflags])
3270 if test $tcl_cv_cc_pipe = yes; then
3271 CFLAGS="$CFLAGS -pipe"
3275 #--------------------------------------------------------------------
3276 # Common compiler flag setup
3277 #--------------------------------------------------------------------
3280 if test "${TEA_PLATFORM}" = "unix" ; then
3282 TEA_MISSING_POSIX_HEADERS
3283 # Let the user call this, because if it triggers, they will
3284 # need a compat/strtod.c that is correct. Users can also
3285 # use Tcl_GetDouble(FromObj) instead.
3290 #------------------------------------------------------------------------
3293 # Generate a line that can be used to build a shared/unshared library
3294 # in a platform independent manner.
3303 # Defines the following vars:
3304 # CFLAGS - Done late here to note disturb other AC macros
3305 # MAKE_LIB - Command to execute to build the Tcl library;
3306 # differs depending on whether or not Tcl is being
3307 # compiled as a shared library.
3308 # MAKE_SHARED_LIB Makefile rule for building a shared library
3309 # MAKE_STATIC_LIB Makefile rule for building a static library
3310 # MAKE_STUB_LIB Makefile rule for building a stub library
3311 # VC_MANIFEST_EMBED_DLL Makefile rule for embedded VC manifest in DLL
3312 # VC_MANIFEST_EMBED_EXE Makefile rule for embedded VC manifest in EXE
3313 #------------------------------------------------------------------------
3315 AC_DEFUN([TEA_MAKE_LIB], [
3316 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
3317 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
3318 MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
3319 AC_EGREP_CPP([manifest needed], [
3320 #if defined(_MSC_VER) && _MSC_VER >= 1400
3321 print("manifest needed")
3324 # Could do a CHECK_PROG for mt, but should always be with MSVC8+
3325 VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;2 ; fi"
3326 VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;1 ; fi"
3327 MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
3328 TEA_ADD_CLEANFILES([*.manifest])
3330 MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[$]@ \$(PKG_STUB_OBJECTS)"
3332 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
3333 MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3334 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
3337 if test "${SHARED_BUILD}" = "1" ; then
3338 MAKE_LIB="${MAKE_SHARED_LIB} "
3340 MAKE_LIB="${MAKE_STATIC_LIB} "
3343 #--------------------------------------------------------------------
3344 # Shared libraries and static libraries have different names.
3345 # Use the double eval to make sure any variables in the suffix is
3346 # substituted. (@@@ Might not be necessary anymore)
3347 #--------------------------------------------------------------------
3349 if test "${TEA_PLATFORM}" = "windows" ; then
3350 if test "${SHARED_BUILD}" = "1" ; then
3351 # We force the unresolved linking of symbols that are really in
3352 # the private libraries of Tcl and Tk.
3353 if test x"${TK_BIN_DIR}" != x ; then
3354 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
3356 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
3357 if test "$GCC" = "yes"; then
3358 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
3360 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3362 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3363 if test "$GCC" = "yes"; then
3364 PKG_LIB_FILE=lib${PKG_LIB_FILE}
3367 # Some packages build their own stubs libraries
3368 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3369 if test "$GCC" = "yes"; then
3370 PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
3372 # These aren't needed on Windows (either MSVC or gcc)
3376 RANLIB_STUB="${RANLIB}"
3377 if test "${SHARED_BUILD}" = "1" ; then
3378 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
3379 if test x"${TK_BIN_DIR}" != x ; then
3380 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
3382 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3385 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3387 # Some packages build their own stubs libraries
3388 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3391 # These are escaped so that only CFLAGS is picked up at configure time.
3392 # The other values will be substituted at make time.
3393 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
3394 if test "${SHARED_BUILD}" = "1" ; then
3395 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
3399 AC_SUBST(MAKE_SHARED_LIB)
3400 AC_SUBST(MAKE_STATIC_LIB)
3401 AC_SUBST(MAKE_STUB_LIB)
3402 AC_SUBST(RANLIB_STUB)
3403 AC_SUBST(VC_MANIFEST_EMBED_DLL)
3404 AC_SUBST(VC_MANIFEST_EMBED_EXE)
3407 #------------------------------------------------------------------------
3410 # Compute the name of an existing object library located in libdir
3411 # from the given base name and produce the appropriate linker flags.
3414 # basename The base name of the library without version
3415 # numbers, extensions, or "lib" prefixes.
3416 # extra_dir Extra directory in which to search for the
3417 # library. This location is used first, then
3418 # $prefix/$exec-prefix, then some defaults.
3421 # TEA_INIT and TEA_PREFIX must be called first.
3425 # Defines the following vars:
3426 # ${basename}_LIB_NAME The computed library name.
3427 # ${basename}_LIB_SPEC The computed linker flags.
3428 #------------------------------------------------------------------------
3430 AC_DEFUN([TEA_LIB_SPEC], [
3431 AC_MSG_CHECKING([for $1 library])
3433 # Look in exec-prefix for the library (defined by TEA_PREFIX).
3435 tea_lib_name_dir="${exec_prefix}/lib"
3437 # Or in a user-specified location.
3439 if test x"$2" != x ; then
3440 tea_extra_lib_dir=$2
3442 tea_extra_lib_dir=NONE
3446 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3447 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3448 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3449 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3450 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3451 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
3452 `ls -dr /usr/lib64/$1[[0-9]]*.lib 2>/dev/null ` \
3453 `ls -dr /usr/lib64/lib$1[[0-9]]* 2>/dev/null ` \
3454 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3455 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
3456 if test -f "$i" ; then
3457 tea_lib_name_dir=`dirname $i`
3458 $1_LIB_NAME=`basename $i`
3464 if test "${TEA_PLATFORM}" = "windows"; then
3465 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
3467 # Strip off the leading "lib" and trailing ".a" or ".so"
3469 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
3470 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
3473 if test "x${$1_LIB_NAME}" = x ; then
3474 AC_MSG_ERROR([not found])
3476 AC_MSG_RESULT([${$1_LIB_SPEC}])
3480 #------------------------------------------------------------------------
3481 # TEA_PRIVATE_TCL_HEADERS --
3483 # Locate the private Tcl include files
3488 # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
3489 # already been called.
3493 # Substitutes the following vars:
3494 # TCL_TOP_DIR_NATIVE
3496 #------------------------------------------------------------------------
3498 AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
3499 # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh}
3500 AC_REQUIRE([TEA_PUBLIC_TCL_HEADERS])
3501 AC_MSG_CHECKING([for Tcl private include files])
3503 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
3504 TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
3506 # Check to see if tcl<Plat>Port.h isn't already with the public headers
3507 # Don't look for tclInt.h because that resides with tcl.h in the core
3508 # sources, but the <plat>Port headers are in a different directory
3509 if test "${TEA_PLATFORM}" = "windows" -a \
3510 -f "${ac_cv_c_tclh}/tclWinPort.h"; then
3511 result="private headers found with public headers"
3512 elif test "${TEA_PLATFORM}" = "unix" -a \
3513 -f "${ac_cv_c_tclh}/tclUnixPort.h"; then
3514 result="private headers found with public headers"
3516 TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
3517 if test "${TEA_PLATFORM}" = "windows"; then
3518 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
3520 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
3522 # Overwrite the previous TCL_INCLUDES as this should capture both
3523 # public and private headers in the same set.
3524 # We want to ensure these are substituted so as not to require
3525 # any *_NATIVE vars be defined in the Makefile
3526 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
3527 if test "`uname -s`" = "Darwin"; then
3528 # If Tcl was built as a framework, attempt to use
3529 # the framework's Headers and PrivateHeaders directories
3532 if test -d "${TCL_BIN_DIR}/Headers" -a \
3533 -d "${TCL_BIN_DIR}/PrivateHeaders"; then
3534 TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
3536 TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3540 result="Using ${TCL_INCLUDES}"
3542 if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
3543 AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
3545 result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}"
3549 AC_SUBST(TCL_TOP_DIR_NATIVE)
3551 AC_SUBST(TCL_INCLUDES)
3552 AC_MSG_RESULT([${result}])
3555 #------------------------------------------------------------------------
3556 # TEA_PUBLIC_TCL_HEADERS --
3558 # Locate the installed public Tcl header files
3564 # CYGPATH must be set
3568 # Adds a --with-tclinclude switch to configure.
3571 # Substitutes the following vars:
3573 #------------------------------------------------------------------------
3575 AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
3576 AC_MSG_CHECKING([for Tcl public headers])
3578 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
3580 AC_CACHE_VAL(ac_cv_c_tclh, [
3581 # Use the value from --with-tclinclude, if it was given
3583 if test x"${with_tclinclude}" != x ; then
3584 if test -f "${with_tclinclude}/tcl.h" ; then
3585 ac_cv_c_tclh=${with_tclinclude}
3587 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
3591 if test "`uname -s`" = "Darwin"; then
3592 # If Tcl was built as a framework, attempt to use
3593 # the framework's Headers directory
3596 list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
3601 # Look in the source dir only if Tcl is not installed,
3602 # and in that situation, look there before installed locations.
3603 if test -f "${TCL_BIN_DIR}/Makefile" ; then
3604 list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
3607 # Check order: pkg --prefix location, Tcl's --prefix location,
3608 # relative to directory of tclConfig.sh.
3610 eval "temp_includedir=${includedir}"
3612 `ls -d ${temp_includedir} 2>/dev/null` \
3613 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3614 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3615 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3616 list="$list /usr/local/include /usr/include"
3617 if test x"${TCL_INCLUDE_SPEC}" != x ; then
3618 d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3619 list="$list `ls -d ${d} 2>/dev/null`"
3623 if test -f "$i/tcl.h" ; then
3631 # Print a message based on how we determined the include path
3633 if test x"${ac_cv_c_tclh}" = x ; then
3634 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
3636 AC_MSG_RESULT([${ac_cv_c_tclh}])
3639 # Convert to a native path and substitute into the output files.
3641 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
3643 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3645 AC_SUBST(TCL_INCLUDES)
3648 #------------------------------------------------------------------------
3649 # TEA_PRIVATE_TK_HEADERS --
3651 # Locate the private Tk include files
3656 # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
3657 # already been called.
3661 # Substitutes the following vars:
3663 #------------------------------------------------------------------------
3665 AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
3666 # Allow for --with-tkinclude to take effect and define ${ac_cv_c_tkh}
3667 AC_REQUIRE([TEA_PUBLIC_TK_HEADERS])
3668 AC_MSG_CHECKING([for Tk private include files])
3670 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
3671 TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
3673 # Check to see if tk<Plat>Port.h isn't already with the public headers
3674 # Don't look for tkInt.h because that resides with tk.h in the core
3675 # sources, but the <plat>Port headers are in a different directory
3676 if test "${TEA_PLATFORM}" = "windows" -a \
3677 -f "${ac_cv_c_tkh}/tkWinPort.h"; then
3678 result="private headers found with public headers"
3679 elif test "${TEA_PLATFORM}" = "unix" -a \
3680 -f "${ac_cv_c_tkh}/tkUnixPort.h"; then
3681 result="private headers found with public headers"
3683 TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
3684 TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
3685 if test "${TEA_PLATFORM}" = "windows"; then
3686 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
3688 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
3690 # Overwrite the previous TK_INCLUDES as this should capture both
3691 # public and private headers in the same set.
3692 # We want to ensure these are substituted so as not to require
3693 # any *_NATIVE vars be defined in the Makefile
3694 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
3695 # Detect and add ttk subdir
3696 if test -d "${TK_SRC_DIR}/generic/ttk"; then
3697 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\""
3699 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3700 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_XLIB_DIR_NATIVE}\""
3702 if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3703 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/macosx\""
3705 if test "`uname -s`" = "Darwin"; then
3706 # If Tk was built as a framework, attempt to use
3707 # the framework's Headers and PrivateHeaders directories
3710 if test -d "${TK_BIN_DIR}/Headers" -a \
3711 -d "${TK_BIN_DIR}/PrivateHeaders"; then
3712 TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"
3714 TK_INCLUDES="${TK_INCLUDES} ${TK_INCLUDE_SPEC} `echo "${TK_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3718 result="Using ${TK_INCLUDES}"
3720 if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
3721 AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
3723 result="Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}"
3727 AC_SUBST(TK_TOP_DIR_NATIVE)
3728 AC_SUBST(TK_XLIB_DIR_NATIVE)
3730 AC_SUBST(TK_INCLUDES)
3731 AC_MSG_RESULT([${result}])
3734 #------------------------------------------------------------------------
3735 # TEA_PUBLIC_TK_HEADERS --
3737 # Locate the installed public Tk header files
3743 # CYGPATH must be set
3747 # Adds a --with-tkinclude switch to configure.
3750 # Substitutes the following vars:
3752 #------------------------------------------------------------------------
3754 AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
3755 AC_MSG_CHECKING([for Tk public headers])
3757 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files], with_tkinclude=${withval})
3759 AC_CACHE_VAL(ac_cv_c_tkh, [
3760 # Use the value from --with-tkinclude, if it was given
3762 if test x"${with_tkinclude}" != x ; then
3763 if test -f "${with_tkinclude}/tk.h" ; then
3764 ac_cv_c_tkh=${with_tkinclude}
3766 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
3770 if test "`uname -s`" = "Darwin"; then
3771 # If Tk was built as a framework, attempt to use
3772 # the framework's Headers directory.
3775 list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
3780 # Look in the source dir only if Tk is not installed,
3781 # and in that situation, look there before installed locations.
3782 if test -f "${TK_BIN_DIR}/Makefile" ; then
3783 list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
3786 # Check order: pkg --prefix location, Tk's --prefix location,
3787 # relative to directory of tkConfig.sh, Tcl's --prefix location,
3788 # relative to directory of tclConfig.sh.
3790 eval "temp_includedir=${includedir}"
3792 `ls -d ${temp_includedir} 2>/dev/null` \
3793 `ls -d ${TK_PREFIX}/include 2>/dev/null` \
3794 `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
3795 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3796 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3797 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3798 list="$list /usr/local/include /usr/include"
3799 if test x"${TK_INCLUDE_SPEC}" != x ; then
3800 d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3801 list="$list `ls -d ${d} 2>/dev/null`"
3805 if test -f "$i/tk.h" ; then
3813 # Print a message based on how we determined the include path
3815 if test x"${ac_cv_c_tkh}" = x ; then
3816 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
3818 AC_MSG_RESULT([${ac_cv_c_tkh}])
3821 # Convert to a native path and substitute into the output files.
3823 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
3825 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3827 AC_SUBST(TK_INCLUDES)
3829 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3830 # On Windows and Aqua, we need the X compat headers
3831 AC_MSG_CHECKING([for X11 header files])
3832 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
3833 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
3834 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3835 AC_SUBST(TK_XINCLUDES)
3837 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
3841 #------------------------------------------------------------------------
3842 # TEA_PATH_CONFIG --
3844 # Locate the ${1}Config.sh file and perform a sanity check on
3845 # the ${1} compile flags. These are used by packages like
3846 # [incr Tk] that load *Config.sh files from more than Tcl and Tk.
3853 # Adds the following arguments to configure:
3856 # Defines the following vars:
3857 # $1_BIN_DIR Full path to the directory containing
3858 # the $1Config.sh file
3859 #------------------------------------------------------------------------
3861 AC_DEFUN([TEA_PATH_CONFIG], [
3863 # Ok, lets find the $1 configuration
3864 # First, look for one uninstalled.
3865 # the alternative search directory is invoked by --with-$1
3868 if test x"${no_$1}" = x ; then
3869 # we reset no_$1 in case something fails here
3871 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
3872 AC_MSG_CHECKING([for $1 configuration])
3873 AC_CACHE_VAL(ac_cv_c_$1config,[
3875 # First check to see if --with-$1 was specified.
3876 if test x"${with_$1config}" != x ; then
3877 case ${with_$1config} in
3879 if test -f ${with_$1config}; then
3880 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
3881 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
3884 if test -f "${with_$1config}/$1Config.sh" ; then
3885 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
3887 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
3891 # then check for a private $1 installation
3892 if test x"${ac_cv_c_$1config}" = x ; then
3895 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3896 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3897 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3898 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3900 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3901 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3902 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3903 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3905 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3906 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3907 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3908 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3910 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3911 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3912 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3913 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3915 if test -f "$i/$1Config.sh" ; then
3916 ac_cv_c_$1config=`(cd $i; pwd)`
3919 if test -f "$i/unix/$1Config.sh" ; then
3920 ac_cv_c_$1config=`(cd $i/unix; pwd)`
3926 # check in a few common install locations
3927 if test x"${ac_cv_c_$1config}" = x ; then
3928 for i in `ls -d ${libdir} 2>/dev/null` \
3929 `ls -d ${exec_prefix}/lib 2>/dev/null` \
3930 `ls -d ${prefix}/lib 2>/dev/null` \
3931 `ls -d /usr/local/lib 2>/dev/null` \
3932 `ls -d /usr/contrib/lib 2>/dev/null` \
3933 `ls -d /usr/lib 2>/dev/null` \
3934 `ls -d /usr/lib64 2>/dev/null` \
3936 if test -f "$i/$1Config.sh" ; then
3937 ac_cv_c_$1config=`(cd $i; pwd)`
3944 if test x"${ac_cv_c_$1config}" = x ; then
3945 $1_BIN_DIR="# no $1 configs found"
3946 AC_MSG_WARN([Cannot find $1 configuration definitions])
3950 $1_BIN_DIR=${ac_cv_c_$1config}
3951 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
3956 #------------------------------------------------------------------------
3957 # TEA_LOAD_CONFIG --
3959 # Load the $1Config.sh file
3963 # Requires the following vars to be set:
3968 # Substitutes the following vars:
3972 #------------------------------------------------------------------------
3974 AC_DEFUN([TEA_LOAD_CONFIG], [
3975 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
3977 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
3978 AC_MSG_RESULT([loading])
3979 . "${$1_BIN_DIR}/$1Config.sh"
3981 AC_MSG_RESULT([file not found])
3985 # If the $1_BIN_DIR is the build directory (not the install directory),
3986 # then set the common variable name to the value of the build variables.
3987 # For example, the variable $1_LIB_SPEC will be set to the value
3988 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
3989 # instead of $1_BUILD_LIB_SPEC since it will work with both an
3990 # installed and uninstalled version of Tcl.
3993 if test -f "${$1_BIN_DIR}/Makefile" ; then
3994 AC_MSG_WARN([Found Makefile - using build library specs for $1])
3995 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
3996 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
3997 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
3998 $1_INCLUDE_SPEC=${$1_BUILD_INCLUDE_SPEC}
3999 $1_LIBRARY_PATH=${$1_LIBRARY_PATH}
4002 AC_SUBST($1_VERSION)
4003 AC_SUBST($1_BIN_DIR)
4004 AC_SUBST($1_SRC_DIR)
4006 AC_SUBST($1_LIB_FILE)
4007 AC_SUBST($1_LIB_SPEC)
4009 AC_SUBST($1_STUB_LIB_FILE)
4010 AC_SUBST($1_STUB_LIB_SPEC)
4011 AC_SUBST($1_STUB_LIB_PATH)
4013 # Allow the caller to prevent this auto-check by specifying any 2nd arg
4014 AS_IF([test "x$2" = x], [
4015 # Check both upper and lower-case variants
4016 # If a dev wanted non-stubs libs, this function could take an option
4017 # to not use _STUB in the paths below
4018 AS_IF([test "x${$1_STUB_LIB_SPEC}" = x],
4019 [TEA_LOAD_CONFIG_LIB(translit($1,[a-z],[A-Z])_STUB)],
4020 [TEA_LOAD_CONFIG_LIB($1_STUB)])
4024 #------------------------------------------------------------------------
4025 # TEA_LOAD_CONFIG_LIB --
4027 # Helper function to load correct library from another extension's
4028 # ${PACKAGE}Config.sh.
4031 # Adds to LIBS the appropriate extension library
4032 #------------------------------------------------------------------------
4033 AC_DEFUN([TEA_LOAD_CONFIG_LIB], [
4034 AC_MSG_CHECKING([For $1 library for LIBS])
4035 # This simplifies the use of stub libraries by automatically adding
4036 # the stub lib to your path. Normally this would add to SHLIB_LD_LIBS,
4037 # but this is called before CONFIG_CFLAGS. More importantly, this adds
4038 # to PKG_LIBS, which becomes LIBS, and that is only used by SHLIB_LD.
4039 if test "x${$1_LIB_SPEC}" != "x" ; then
4040 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
4041 TEA_ADD_LIBS([\"`${CYGPATH} ${$1_LIB_PATH}`\"])
4042 AC_MSG_RESULT([using $1_LIB_PATH ${$1_LIB_PATH}])
4044 TEA_ADD_LIBS([${$1_LIB_SPEC}])
4045 AC_MSG_RESULT([using $1_LIB_SPEC ${$1_LIB_SPEC}])
4048 AC_MSG_RESULT([file not found])
4052 #------------------------------------------------------------------------
4053 # TEA_EXPORT_CONFIG --
4055 # Define the data to insert into the ${PACKAGE}Config.sh file
4059 # Requires the following vars to be set:
4063 # Substitutes the following vars:
4064 #------------------------------------------------------------------------
4066 AC_DEFUN([TEA_EXPORT_CONFIG], [
4067 #--------------------------------------------------------------------
4068 # These are for $1Config.sh
4069 #--------------------------------------------------------------------
4071 # pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
4072 eval pkglibdir="[$]{libdir}/$1${PACKAGE_VERSION}"
4073 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
4074 eval $1_LIB_FLAG="-l$1${PACKAGE_VERSION}${DBGX}"
4075 eval $1_STUB_LIB_FLAG="-l$1stub${PACKAGE_VERSION}${DBGX}"
4077 eval $1_LIB_FLAG="-l$1`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
4078 eval $1_STUB_LIB_FLAG="-l$1stub`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
4080 $1_BUILD_LIB_SPEC="-L`pwd` ${$1_LIB_FLAG}"
4081 $1_LIB_SPEC="-L${pkglibdir} ${$1_LIB_FLAG}"
4082 $1_BUILD_STUB_LIB_SPEC="-L`pwd` [$]{$1_STUB_LIB_FLAG}"
4083 $1_STUB_LIB_SPEC="-L${pkglibdir} [$]{$1_STUB_LIB_FLAG}"
4084 $1_BUILD_STUB_LIB_PATH="`pwd`/[$]{PKG_STUB_LIB_FILE}"
4085 $1_STUB_LIB_PATH="${pkglibdir}/[$]{PKG_STUB_LIB_FILE}"
4087 AC_SUBST($1_BUILD_LIB_SPEC)
4088 AC_SUBST($1_LIB_SPEC)
4089 AC_SUBST($1_BUILD_STUB_LIB_SPEC)
4090 AC_SUBST($1_STUB_LIB_SPEC)
4091 AC_SUBST($1_BUILD_STUB_LIB_PATH)
4092 AC_SUBST($1_STUB_LIB_PATH)
4094 AC_SUBST(MAJOR_VERSION)
4095 AC_SUBST(MINOR_VERSION)
4096 AC_SUBST(PATCHLEVEL)
4100 #------------------------------------------------------------------------
4103 # Locate Keuchel's celib emulation layer for targeting Win/CE
4110 # Adds the following arguments to configure:
4113 # Defines the following vars:
4114 # CELIB_DIR Full path to the directory containing
4115 # the include and platform lib files
4116 #------------------------------------------------------------------------
4118 AC_DEFUN([TEA_PATH_CELIB], [
4119 # First, look for one uninstalled.
4120 # the alternative search directory is invoked by --with-celib
4122 if test x"${no_celib}" = x ; then
4123 # we reset no_celib in case something fails here
4125 AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval})
4126 AC_MSG_CHECKING([for Windows/CE celib directory])
4127 AC_CACHE_VAL(ac_cv_c_celibconfig,[
4128 # First check to see if --with-celibconfig was specified.
4129 if test x"${with_celibconfig}" != x ; then
4130 if test -d "${with_celibconfig}/inc" ; then
4131 ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)`
4133 AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory])
4137 # then check for a celib library
4138 if test x"${ac_cv_c_celibconfig}" = x ; then
4142 ../../celib-palm-3.0 \
4144 `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \
4145 ${srcdir}/../celib-palm-3.0 \
4146 ${srcdir}/../celib \
4147 `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \
4149 if test -d "$i/inc" ; then
4150 ac_cv_c_celibconfig=`(cd $i; pwd)`
4156 if test x"${ac_cv_c_celibconfig}" = x ; then
4157 AC_MSG_ERROR([Cannot find celib support library directory])
4160 CELIB_DIR=${ac_cv_c_celibconfig}
4161 CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
4162 AC_MSG_RESULT([found $CELIB_DIR])