3 # This file provides a set of autoconf macros to help TEA-enable
6 # Copyright (c) 1999-2000 Ajuba Solutions.
7 # Copyright (c) 2002-2005 ActiveState Corporation.
9 # See the file "license.terms" for information on usage and redistribution
10 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 # RCS: @(#) $Id: tcl.m4,v 1.6 2010/09/16 20:46:47 hobbs Exp $
16 dnl TEA extensions pass us the version of TEA they think they
17 dnl are compatible with (must be set in TEA_INIT below)
20 # Possible values for key variables defined:
22 # TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
23 # TEA_PLATFORM - windows unix
26 #------------------------------------------------------------------------
27 # TEA_PATH_TCLCONFIG --
29 # Locate the tclConfig.sh file and perform a sanity check on
30 # the Tcl compile flags
37 # Adds the following arguments to configure:
40 # Defines the following vars:
41 # TCL_BIN_DIR Full path to the directory containing
42 # the tclConfig.sh file
43 #------------------------------------------------------------------------
45 AC_DEFUN([TEA_PATH_TCLCONFIG], [
46 dnl TEA specific: Make sure we are initialized
47 AC_REQUIRE([TEA_INIT])
49 # Ok, lets find the tcl configuration
50 # First, look for one uninstalled.
51 # the alternative search directory is invoked by --with-tcl
54 if test x"${no_tcl}" = x ; then
55 # we reset no_tcl in case something fails here
58 AC_HELP_STRING([--with-tcl],
59 [directory containing tcl configuration (tclConfig.sh)]),
60 with_tclconfig="${withval}")
61 AC_MSG_CHECKING([for Tcl configuration])
62 AC_CACHE_VAL(ac_cv_c_tclconfig,[
64 # First check to see if --with-tcl was specified.
65 if test x"${with_tclconfig}" != x ; then
66 case "${with_tclconfig}" in
68 if test -f "${with_tclconfig}"; then
69 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
70 with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
73 if test -f "${with_tclconfig}/tclConfig.sh" ; then
74 ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
76 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
80 # then check for a private Tcl installation
81 if test x"${ac_cv_c_tclconfig}" = x ; then
84 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
85 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
86 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
88 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
89 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
90 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
92 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
93 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
94 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
95 if test "${TEA_PLATFORM}" = "windows" \
96 -a -f "$i/win/tclConfig.sh" ; then
97 ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
100 if test -f "$i/unix/tclConfig.sh" ; then
101 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
107 # on Darwin, check in Framework installation locations
108 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
109 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
110 `ls -d /Library/Frameworks 2>/dev/null` \
111 `ls -d /Network/Library/Frameworks 2>/dev/null` \
112 `ls -d /System/Library/Frameworks 2>/dev/null` \
114 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
115 ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
121 # TEA specific: on Windows, check in common installation locations
122 if test "${TEA_PLATFORM}" = "windows" \
123 -a x"${ac_cv_c_tclconfig}" = x ; then
124 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
125 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
127 if test -f "$i/tclConfig.sh" ; then
128 ac_cv_c_tclconfig="`(cd $i; pwd)`"
134 # check in a few common install locations
135 if test x"${ac_cv_c_tclconfig}" = x ; then
136 for i in `ls -d ${libdir} 2>/dev/null` \
137 `ls -d ${exec_prefix}/lib 2>/dev/null` \
138 `ls -d ${prefix}/lib 2>/dev/null` \
139 `ls -d /usr/local/lib 2>/dev/null` \
140 `ls -d /usr/contrib/lib 2>/dev/null` \
141 `ls -d /usr/lib 2>/dev/null` \
142 `ls -d /usr/lib64 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])
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])
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 # Subst the following vars:
352 #------------------------------------------------------------------------
354 AC_DEFUN([TEA_LOAD_TCLCONFIG], [
355 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
357 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
358 AC_MSG_RESULT([loading])
359 . "${TCL_BIN_DIR}/tclConfig.sh"
361 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
364 # eval is required to do the TCL_DBGX substitution
365 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
366 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
368 # If the TCL_BIN_DIR is the build directory (not the install directory),
369 # then set the common variable name to the value of the build variables.
370 # For example, the variable TCL_LIB_SPEC will be set to the value
371 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
372 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
373 # installed and uninstalled version of Tcl.
374 if test -f "${TCL_BIN_DIR}/Makefile" ; then
375 TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
376 TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
377 TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
378 elif test "`uname -s`" = "Darwin"; then
379 # If Tcl was built as a framework, attempt to use the libraries
380 # from the framework at the given location so that linking works
381 # against Tcl.framework installed in an arbitrary location.
384 if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
385 for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
386 "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
387 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
388 TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
393 if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
394 TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
395 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
401 # eval is required to do the TCL_DBGX substitution
402 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
403 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
404 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
405 eval "TCL_STUB_LIB_SPEC=\"-Wl,--whole-archive,${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE},--no-whole-archive\""
407 AC_SUBST(TCL_VERSION)
408 AC_SUBST(TCL_PATCH_LEVEL)
409 AC_SUBST(TCL_BIN_DIR)
410 AC_SUBST(TCL_SRC_DIR)
412 AC_SUBST(TCL_LIB_FILE)
413 AC_SUBST(TCL_LIB_FLAG)
414 AC_SUBST(TCL_LIB_SPEC)
416 AC_SUBST(TCL_STUB_LIB_FILE)
417 AC_SUBST(TCL_STUB_LIB_FLAG)
418 AC_SUBST(TCL_STUB_LIB_SPEC)
422 AC_MSG_CHECKING([for cygwin variant])
423 case ${TCL_EXTRA_CFLAGS} in
424 *-mwin32*|*-mno-cygwin*)
425 TEA_PLATFORM="windows"
426 CFLAGS="$CFLAGS -mwin32"
427 AC_MSG_RESULT([win32])
431 AC_MSG_RESULT([unix])
440 # The BUILD_$pkg is to define the correct extern storage class
441 # handling when making this package
442 AC_DEFINE_UNQUOTED(BUILD_${PACKAGE_NAME}, [],
443 [Building extension source?])
444 # Do this here as we have fully defined TEA_PLATFORM now
445 if test "${TEA_PLATFORM}" = "windows" ; then
446 CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp"
453 AC_SUBST(TCL_EXTRA_CFLAGS)
454 AC_SUBST(TCL_LD_FLAGS)
455 AC_SUBST(TCL_SHLIB_LD_LIBS)
458 #------------------------------------------------------------------------
459 # TEA_LOAD_TKCONFIG --
461 # Load the tkConfig.sh file
465 # Requires the following vars to be set:
470 # Sets the following vars that should be in tkConfig.sh:
472 #------------------------------------------------------------------------
474 AC_DEFUN([TEA_LOAD_TKCONFIG], [
475 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
477 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
478 AC_MSG_RESULT([loading])
479 . "${TK_BIN_DIR}/tkConfig.sh"
481 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
484 # eval is required to do the TK_DBGX substitution
485 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
486 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
488 # If the TK_BIN_DIR is the build directory (not the install directory),
489 # then set the common variable name to the value of the build variables.
490 # For example, the variable TK_LIB_SPEC will be set to the value
491 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
492 # instead of TK_BUILD_LIB_SPEC since it will work with both an
493 # installed and uninstalled version of Tcl.
494 if test -f "${TK_BIN_DIR}/Makefile" ; then
495 TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
496 TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
497 TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
498 elif test "`uname -s`" = "Darwin"; then
499 # If Tk was built as a framework, attempt to use the libraries
500 # from the framework at the given location so that linking works
501 # against Tk.framework installed in an arbitrary location.
504 if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
505 for i in "`cd "${TK_BIN_DIR}"; pwd`" \
506 "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
507 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
508 TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
513 if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
514 TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
515 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
521 # eval is required to do the TK_DBGX substitution
522 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
523 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
524 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
525 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
527 # TEA specific: Ensure windowingsystem is defined
528 if test "${TEA_PLATFORM}" = "unix" ; then
531 AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
532 TEA_WINDOWINGSYSTEM="aqua"
535 TEA_WINDOWINGSYSTEM="x11"
538 elif test "${TEA_PLATFORM}" = "windows" ; then
539 TEA_WINDOWINGSYSTEM="win32"
546 AC_SUBST(TK_LIB_FILE)
547 AC_SUBST(TK_LIB_FLAG)
548 AC_SUBST(TK_LIB_SPEC)
550 AC_SUBST(TK_STUB_LIB_FILE)
551 AC_SUBST(TK_STUB_LIB_FLAG)
552 AC_SUBST(TK_STUB_LIB_SPEC)
556 AC_SUBST(TK_XINCLUDES)
559 #------------------------------------------------------------------------
561 # Determine the fully qualified path name of the tclsh executable
562 # in the Tcl build directory or the tclsh installed in a bin
563 # directory. This macro will correctly determine the name
564 # of the tclsh executable even if tclsh has not yet been
565 # built in the build directory. The tclsh found is always
566 # associated with a tclConfig.sh file. This tclsh should be used
567 # only for running extension test cases. It should never be
568 # or generation of files (like pkgIndex.tcl) at build time.
574 # Subst's the following values:
576 #------------------------------------------------------------------------
578 AC_DEFUN([TEA_PROG_TCLSH], [
579 AC_MSG_CHECKING([for tclsh])
580 if test -f "${TCL_BIN_DIR}/Makefile" ; then
581 # tclConfig.sh is in Tcl build directory
582 if test "${TEA_PLATFORM}" = "windows"; then
583 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
585 TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
588 # tclConfig.sh is in install location
589 if test "${TEA_PLATFORM}" = "windows"; then
590 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
592 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
594 list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
595 `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
596 `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
598 if test -f "$i/${TCLSH_PROG}" ; then
599 REAL_TCL_BIN_DIR="`cd "$i"; pwd`/"
603 TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}"
605 AC_MSG_RESULT([${TCLSH_PROG}])
609 #------------------------------------------------------------------------
611 # Determine the fully qualified path name of the wish executable
612 # in the Tk build directory or the wish installed in a bin
613 # directory. This macro will correctly determine the name
614 # of the wish executable even if wish has not yet been
615 # built in the build directory. The wish found is always
616 # associated with a tkConfig.sh file. This wish should be used
617 # only for running extension test cases. It should never be
618 # or generation of files (like pkgIndex.tcl) at build time.
624 # Subst's the following values:
626 #------------------------------------------------------------------------
628 AC_DEFUN([TEA_PROG_WISH], [
629 AC_MSG_CHECKING([for wish])
630 if test -f "${TK_BIN_DIR}/Makefile" ; then
631 # tkConfig.sh is in Tk build directory
632 if test "${TEA_PLATFORM}" = "windows"; then
633 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
635 WISH_PROG="${TK_BIN_DIR}/wish"
638 # tkConfig.sh is in install location
639 if test "${TEA_PLATFORM}" = "windows"; then
640 WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
642 WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}"
644 list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
645 `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
646 `ls -d ${TK_PREFIX}/bin 2>/dev/null`"
648 if test -f "$i/${WISH_PROG}" ; then
649 REAL_TK_BIN_DIR="`cd "$i"; pwd`/"
653 WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}"
655 AC_MSG_RESULT([${WISH_PROG}])
659 #------------------------------------------------------------------------
660 # TEA_ENABLE_SHARED --
662 # Allows the building of shared libraries
669 # Adds the following arguments to configure:
670 # --enable-shared=yes|no
672 # Defines the following vars:
673 # STATIC_BUILD Used for building import/export libraries
676 # Sets the following vars:
677 # SHARED_BUILD Value of 1 or 0
678 #------------------------------------------------------------------------
680 AC_DEFUN([TEA_ENABLE_SHARED], [
681 AC_MSG_CHECKING([how to build libraries])
682 AC_ARG_ENABLE(shared,
683 AC_HELP_STRING([--enable-shared],
684 [build and link with shared libraries (default: on)]),
685 [tcl_ok=$enableval], [tcl_ok=yes])
687 if test "${enable_shared+set}" = set; then
688 enableval="$enable_shared"
694 if test "$tcl_ok" = "yes" ; then
695 AC_MSG_RESULT([shared])
698 AC_MSG_RESULT([static])
700 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
702 AC_SUBST(SHARED_BUILD)
705 #------------------------------------------------------------------------
706 # TEA_ENABLE_THREADS --
708 # Specify if thread support should be enabled. If "yes" is specified
709 # as an arg (optional), threads are enabled by default, "no" means
710 # threads are disabled. "yes" is the default.
712 # TCL_THREADS is checked so that if you are compiling an extension
713 # against a threaded core, your extension must be compiled threaded
716 # Note that it is legal to have a thread enabled extension run in a
717 # threaded or non-threaded Tcl core, but a non-threaded extension may
718 # only run in a non-threaded Tcl core.
725 # Adds the following arguments to configure:
728 # Sets the following vars:
729 # THREADS_LIBS Thread library(s)
731 # Defines the following vars:
736 #------------------------------------------------------------------------
738 AC_DEFUN([TEA_ENABLE_THREADS], [
739 AC_ARG_ENABLE(threads,
740 AC_HELP_STRING([--enable-threads],
741 [build with threads]),
742 [tcl_ok=$enableval], [tcl_ok=yes])
744 if test "${enable_threads+set}" = set; then
745 enableval="$enable_threads"
751 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
754 if test "${TEA_PLATFORM}" != "windows" ; then
755 # We are always OK on Windows, so check what this platform wants:
757 # USE_THREAD_ALLOC tells us to try the special thread-based
758 # allocator that significantly reduces lock contention
759 AC_DEFINE(USE_THREAD_ALLOC, 1,
760 [Do we want to use the threaded memory allocator?])
761 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
762 if test "`uname -s`" = "SunOS" ; then
763 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
764 [Do we really want to follow the standard? Yes we do!])
766 AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
767 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
768 if test "$tcl_ok" = "no"; then
769 # Check a little harder for __pthread_mutex_init in the same
770 # library, as some systems hide it there until pthread.h is
771 # defined. We could alternatively do an AC_TRY_COMPILE with
772 # pthread.h, but that will work with libpthread really doesn't
773 # exist, like AIX 4.2. [Bug: 4359]
774 AC_CHECK_LIB(pthread, __pthread_mutex_init,
775 tcl_ok=yes, tcl_ok=no)
778 if test "$tcl_ok" = "yes"; then
779 # The space is needed
780 THREADS_LIBS=" -lpthread"
782 AC_CHECK_LIB(pthreads, 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=" -lpthreads"
788 AC_CHECK_LIB(c, pthread_mutex_init,
789 tcl_ok=yes, tcl_ok=no)
790 if test "$tcl_ok" = "no"; then
791 AC_CHECK_LIB(c_r, pthread_mutex_init,
792 tcl_ok=yes, tcl_ok=no)
793 if test "$tcl_ok" = "yes"; then
794 # The space is needed
795 THREADS_LIBS=" -pthread"
798 AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
807 # Do checking message here to not mess up interleaved configure output
808 AC_MSG_CHECKING([for building with threads])
809 if test "${TCL_THREADS}" = 1; then
810 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
811 AC_MSG_RESULT([yes (default)])
815 # TCL_THREADS sanity checking. See if our request for building with
816 # threads is the same as the way Tcl was built. If not, warn the user.
819 if test "${TCL_THREADS}" = "0"; then
821 Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
822 that IS thread-enabled. It is recommended to use --enable-threads.])
826 if test "${TCL_THREADS}" = "1"; then
828 --enable-threads requested, but building against a Tcl that is NOT
829 thread-enabled. This is an OK configuration that will also run in
830 a thread-enabled core.])
834 AC_SUBST(TCL_THREADS)
837 #------------------------------------------------------------------------
838 # TEA_ENABLE_SYMBOLS --
840 # Specify if debugging symbols should be used.
841 # Memory (TCL_MEM_DEBUG) debugging can also be enabled.
846 # TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
847 # the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
848 # Requires the following vars to be set in the Makefile:
854 # Adds the following arguments to configure:
857 # Defines the following vars:
858 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
859 # Sets to $(CFLAGS_OPTIMIZE) if false
860 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
861 # Sets to $(LDFLAGS_OPTIMIZE) if false
862 # DBGX Formerly used as debug library extension;
865 #------------------------------------------------------------------------
867 AC_DEFUN([TEA_ENABLE_SYMBOLS], [
868 dnl TEA specific: Make sure we are initialized
869 AC_REQUIRE([TEA_CONFIG_CFLAGS])
870 AC_MSG_CHECKING([for build with symbols])
871 AC_ARG_ENABLE(symbols,
872 AC_HELP_STRING([--enable-symbols],
873 [build with debugging symbols (default: off)]),
874 [tcl_ok=$enableval], [tcl_ok=no])
876 if test "$tcl_ok" = "no"; then
877 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
878 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
881 CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
882 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
883 if test "$tcl_ok" = "yes"; then
884 AC_MSG_RESULT([yes (standard debugging)])
888 if test "${TEA_PLATFORM}" != "windows" ; then
889 LDFLAGS_DEFAULT="${LDFLAGS}"
891 AC_SUBST(CFLAGS_DEFAULT)
892 AC_SUBST(LDFLAGS_DEFAULT)
895 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
896 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
899 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
900 if test "$tcl_ok" = "all"; then
901 AC_MSG_RESULT([enabled symbols mem debugging])
903 AC_MSG_RESULT([enabled $tcl_ok debugging])
908 #------------------------------------------------------------------------
909 # TEA_ENABLE_LANGINFO --
911 # Allows use of modern nl_langinfo check for better l10n.
912 # This is only relevant for Unix.
919 # Adds the following arguments to configure:
920 # --enable-langinfo=yes|no (default is yes)
922 # Defines the following vars:
923 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
925 #------------------------------------------------------------------------
927 AC_DEFUN([TEA_ENABLE_LANGINFO], [
928 AC_ARG_ENABLE(langinfo,
929 AC_HELP_STRING([--enable-langinfo],
930 [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
931 [langinfo_ok=$enableval], [langinfo_ok=yes])
934 if test "$langinfo_ok" = "yes"; then
935 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
937 AC_MSG_CHECKING([whether to use nl_langinfo])
938 if test "$langinfo_ok" = "yes"; then
939 AC_CACHE_VAL(tcl_cv_langinfo_h, [
940 AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
941 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
942 AC_MSG_RESULT([$tcl_cv_langinfo_h])
943 if test $tcl_cv_langinfo_h = yes; then
944 AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
947 AC_MSG_RESULT([$langinfo_ok])
951 #--------------------------------------------------------------------
954 # Determine what the system is (some things cannot be easily checked
955 # on a feature-driven basis, alas). This can usually be done via the
962 # Defines the following var:
964 # system - System/platform/version identification code.
966 #--------------------------------------------------------------------
968 AC_DEFUN([TEA_CONFIG_SYSTEM], [
969 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
971 if test "${TEA_PLATFORM}" = "windows" ; then
972 tcl_cv_sys_version=windows
974 tcl_cv_sys_version=`uname -s`-`uname -r`
975 if test "$?" -ne 0 ; then
976 AC_MSG_WARN([can't find uname command])
977 tcl_cv_sys_version=unknown
979 if test "`uname -s`" = "AIX" ; then
980 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
985 system=$tcl_cv_sys_version
988 #--------------------------------------------------------------------
991 # Try to determine the proper flags to pass to the compiler
992 # for building shared libraries and other such nonsense.
999 # Defines and substitutes the following vars:
1001 # DL_OBJS, DL_LIBS - removed for TEA, only needed by core.
1002 # LDFLAGS - Flags to pass to the compiler when linking object
1003 # files into an executable application binary such
1005 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
1006 # that tell the run-time dynamic linker where to look
1007 # for shared libraries such as libtcl.so. Depends on
1008 # the variable LIB_RUNTIME_DIR in the Makefile. Could
1009 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
1010 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
1011 # that tell the run-time dynamic linker where to look
1012 # for shared libraries such as libtcl.so. Depends on
1013 # the variable LIB_RUNTIME_DIR in the Makefile.
1014 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
1015 # of a shared library (may request position-independent
1016 # code, among other things).
1017 # SHLIB_LD - Base command to use for combining object files
1018 # into a shared library.
1019 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
1020 # creating shared libraries. This symbol typically
1021 # goes at the end of the "ld" commands that build
1022 # shared libraries. The value of the symbol defaults to
1023 # "${LIBS}" if all of the dependent libraries should
1024 # be specified when creating a shared library. If
1025 # dependent libraries should not be specified (as on
1026 # SunOS 4.x, where they cause the link to fail, or in
1027 # general if Tcl and Tk aren't themselves shared
1028 # libraries), then this symbol has an empty string
1030 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
1031 # extensions. An empty string means we don't know how
1032 # to use shared libraries on this platform.
1033 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
1034 # in a static or shared library name, using the $VERSION variable
1035 # to put the version in the right place. This is used
1036 # by platforms that need non-standard library names.
1037 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
1038 # to have a version after the .so, and ${VERSION}.a
1039 # on AIX, since a shared library needs to have
1040 # a .a extension whereas shared objects for loadable
1041 # extensions have a .so extension. Defaults to
1042 # ${VERSION}${SHLIB_SUFFIX}.
1044 # Flags used when running the compiler in debug mode
1046 # Flags used when running the compiler in optimize mode
1047 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
1049 #--------------------------------------------------------------------
1051 AC_DEFUN([TEA_CONFIG_CFLAGS], [
1052 dnl TEA specific: Make sure we are initialized
1053 AC_REQUIRE([TEA_INIT])
1055 # Step 0.a: Enable 64 bit support?
1057 AC_MSG_CHECKING([if 64bit support is requested])
1058 AC_ARG_ENABLE(64bit,
1059 AC_HELP_STRING([--enable-64bit],
1060 [enable 64bit support (default: off)]),
1061 [do64bit=$enableval], [do64bit=no])
1062 AC_MSG_RESULT([$do64bit])
1064 # Step 0.b: Enable Solaris 64 bit VIS support?
1066 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1067 AC_ARG_ENABLE(64bit-vis,
1068 AC_HELP_STRING([--enable-64bit-vis],
1069 [enable 64bit Sparc VIS support (default: off)]),
1070 [do64bitVIS=$enableval], [do64bitVIS=no])
1071 AC_MSG_RESULT([$do64bitVIS])
1072 # Force 64bit on with VIS
1073 AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
1075 # Step 0.c: Check if visibility support is available. Do this here so
1076 # that platform specific alternatives can be used below if this fails.
1078 AC_CACHE_CHECK([if compiler supports visibility "hidden"],
1079 tcl_cv_cc_visibility_hidden, [
1080 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
1082 extern __attribute__((__visibility__("hidden"))) void f(void);
1083 void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes,
1084 tcl_cv_cc_visibility_hidden=no)
1085 CFLAGS=$hold_cflags])
1086 AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
1087 AC_DEFINE(MODULE_SCOPE,
1088 [extern __attribute__((__visibility__("hidden")))],
1089 [Compiler support for module scope symbols])
1092 # Step 0.d: Disable -rpath support?
1094 AC_MSG_CHECKING([if rpath support is requested])
1095 AC_ARG_ENABLE(rpath,
1096 AC_HELP_STRING([--disable-rpath],
1097 [disable rpath support (default: on)]),
1098 [doRpath=$enableval], [doRpath=yes])
1099 AC_MSG_RESULT([$doRpath])
1101 # TEA specific: Cross-compiling options for Windows/CE builds?
1103 AS_IF([test "${TEA_PLATFORM}" = windows], [
1104 AC_MSG_CHECKING([if Windows/CE build is requested])
1105 AC_ARG_ENABLE(wince,
1106 AC_HELP_STRING([--enable-wince],
1107 [enable Win/CE support (where applicable)]),
1108 [doWince=$enableval], [doWince=no])
1109 AC_MSG_RESULT([$doWince])
1112 # Set the variable "system" to hold the name and version number
1117 # Require ranlib early so we can override it in special cases below.
1119 AC_REQUIRE([AC_PROG_RANLIB])
1121 # Set configuration options based on system name and version.
1122 # This is similar to Tcl's unix/tcl.m4 except that we've added a
1123 # "windows" case and removed some core-only vars.
1126 # default to '{$LIBS}' and set to "" on per-platform necessary basis
1127 SHLIB_LD_LIBS='${LIBS}'
1128 # When ld needs options to work in 64-bit mode, put them in
1129 # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
1130 # is disabled by the user. [Bug 1016796]
1132 UNSHARED_LIB_SUFFIX=""
1133 # TEA specific: use PACKAGE_VERSION instead of VERSION
1134 TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
1135 ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
1136 TCL_LIB_VERSIONS_OK=ok
1139 AS_IF([test "$GCC" = yes], [
1142 CFLAGS_WARNING="-Wall"
1143 ], [CFLAGS_WARNING=""])
1144 dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
1145 dnl AC_CHECK_TOOL(AR, ar)
1146 AC_CHECK_PROG(AR, ar, ar)
1148 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1149 AS_IF([test "x$SHLIB_VERSION" = x],[SHLIB_VERSION="1.0"])
1153 # This is a 2-stage check to make sure we have the 64-bit SDK
1154 # We have to know where the SDK is installed.
1155 # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
1156 # MACHINE is IX86 for LINK, but this is used by the manifest,
1157 # which requires x86|amd64|ia64.
1159 if test "$do64bit" != "no" ; then
1160 if test "x${MSSDK}x" = "xx" ; then
1161 MSSDK="C:/Progra~1/Microsoft Platform SDK"
1163 MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
1167 MACHINE="AMD64" ; # default to AMD64 64-bit build
1168 PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
1172 PATH64="${MSSDK}/Bin/Win64"
1175 if test ! -d "${PATH64}" ; then
1176 AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode])
1177 AC_MSG_WARN([Ensure latest Platform SDK is installed])
1180 AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
1185 if test "$doWince" != "no" ; then
1186 if test "$do64bit" != "no" ; then
1187 AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible])
1189 if test "$GCC" = "yes" ; then
1190 AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
1193 # Set defaults for common evc4/PPC2003 setup
1194 # Currently Tcl requires 300+, possibly 420+ for sockets
1195 CEVERSION=420; # could be 211 300 301 400 420 ...
1196 TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
1197 ARCH=ARM; # could be ARM MIPS X86EM ...
1198 PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
1199 if test "$doWince" != "yes"; then
1200 # If !yes then the user specified something
1201 # Reset ARCH to allow user to skip specifying it
1203 eval `echo $doWince | awk -F, '{ \
1204 if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
1205 if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
1206 if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
1207 if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
1208 if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
1210 if test "x${ARCH}" = "x" ; then
1214 OSVERSION=WCE$CEVERSION;
1215 if test "x${WCEROOT}" = "x" ; then
1216 WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
1217 if test ! -d "${WCEROOT}" ; then
1218 WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
1221 if test "x${SDKROOT}" = "x" ; then
1222 SDKROOT="C:/Program Files/Windows CE Tools"
1223 if test ! -d "${SDKROOT}" ; then
1224 SDKROOT="C:/Windows CE Tools"
1227 WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
1228 SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
1229 if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
1230 -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
1231 AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
1234 # We could PATH_NOSPACE these, but that's not important,
1235 # as long as we quote them when used.
1236 CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
1237 if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
1238 CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
1240 CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
1244 if test "$GCC" != "yes" ; then
1245 if test "${SHARED_BUILD}" = "0" ; then
1251 if test "$do64bit" != "no" ; then
1252 # All this magic is necessary for the Win64 SDK RC1 - hobbs
1253 CC="\"${PATH64}/cl.exe\""
1254 CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
1255 RC="\"${MSSDK}/bin/rc.exe\""
1256 lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
1257 LINKBIN="\"${PATH64}/link.exe\""
1258 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
1259 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1260 # Avoid 'unresolved external symbol __security_cookie'
1261 # errors, c.f. http://support.microsoft.com/?id=894573
1262 TEA_ADD_LIBS([bufferoverflowU.lib])
1263 elif test "$doWince" != "no" ; then
1264 CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
1265 if test "${TARGETCPU}" = "X86"; then
1266 CC="\"${CEBINROOT}/cl.exe\""
1268 CC="\"${CEBINROOT}/cl${ARCH}.exe\""
1270 CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
1271 RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
1272 arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
1273 defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
1274 if test "${SHARED_BUILD}" = "1" ; then
1275 # Static CE builds require static celib as well
1279 AC_DEFINE_UNQUOTED($i, 1, [WinCE def ]$i)
1281 AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION, [_WIN32_WCE version])
1282 AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION, [UNDER_CE version])
1283 CFLAGS_DEBUG="-nologo -Zi -Od"
1284 CFLAGS_OPTIMIZE="-nologo -Ox"
1285 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
1286 lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
1287 LINKBIN="\"${CEBINROOT}/link.exe\""
1293 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
1294 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1298 if test "$GCC" = "yes"; then
1302 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1303 SHLIB_LD="$CC -shared"
1304 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1305 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
1306 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
1308 SHLIB_LD="${LINKBIN} -dll ${lflags}"
1309 # link -lib only works when -lib is the first arg
1310 STLIB_LD="${LINKBIN} -lib ${lflags}"
1311 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
1313 # For information on what debugtype is most useful, see:
1314 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
1316 # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx
1317 # This essentially turns it all on.
1318 LDFLAGS_DEBUG="-debug -debugtype:cv"
1319 LDFLAGS_OPTIMIZE="-release"
1320 if test "$doWince" != "no" ; then
1321 LDFLAGS_CONSOLE="-link ${lflags}"
1322 LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
1324 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
1325 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
1330 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
1332 TCL_LIB_VERSIONS_OK=nodots
1335 AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
1336 # AIX requires the _r compiler when gcc isn't being used
1342 # Make sure only first arg gets _r
1343 CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
1346 AC_MSG_RESULT([Using $CC for compiling with threads])
1352 LD_LIBRARY_PATH_VAR="LIBPATH"
1354 # Check to enable 64-bit flags for compiler/linker
1355 AS_IF([test "$do64bit" = yes], [
1356 AS_IF([test "$GCC" = yes], [
1357 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1360 CFLAGS="$CFLAGS -q64"
1362 RANLIB="${RANLIB} -X64"
1364 SHLIB_LD_FLAGS="-b64"
1368 AS_IF([test "`uname -m`" = ia64], [
1369 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1370 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1371 AS_IF([test "$GCC" = yes], [
1372 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1374 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1376 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1378 AS_IF([test "$GCC" = yes], [
1379 SHLIB_LD='${CC} -shared -Wl,-bexpall'
1381 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
1382 LDFLAGS="$LDFLAGS -brtl"
1384 SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1385 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1386 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1390 SHLIB_CFLAGS="-fPIC"
1391 SHLIB_LD='${CC} -nostart'
1394 #-----------------------------------------------------------
1395 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1396 # -lsocket, even if the network functions are in -lnet which
1397 # is always linked to, for compatibility.
1398 #-----------------------------------------------------------
1399 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1402 SHLIB_CFLAGS="-export-dynamic -fPIC"
1403 SHLIB_LD='${CC} -shared'
1405 LDFLAGS="$LDFLAGS -export-dynamic"
1411 SHLIB_LD='${CC} -shared'
1418 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1419 SHLIB_CFLAGS="-fPIC"
1421 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
1422 AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
1425 # Use updated header definitions where possible
1426 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1427 # TEA specific: Needed by Tcl, but not most extensions
1428 #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1429 #LIBS="$LIBS -lxnet" # Use the XOPEN network library
1431 AS_IF([test "`uname -m`" = ia64], [
1433 # Use newer C++ library for C++ extensions
1434 #if test "$GCC" != "yes" ; then
1440 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1441 AS_IF([test "$tcl_ok" = yes], [
1442 LDFLAGS="$LDFLAGS -Wl,-E"
1443 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1444 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1445 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1447 AS_IF([test "$GCC" = yes], [
1448 SHLIB_LD='${CC} -shared'
1449 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1452 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1453 #CFLAGS="$CFLAGS +DAportable"
1458 # Check to enable 64-bit flags for compiler/linker
1459 AS_IF([test "$do64bit" = "yes"], [
1460 AS_IF([test "$GCC" = yes], [
1461 case `${CC} -dumpmachine` in
1463 # 64-bit gcc in use. Fix flags for GNU ld.
1465 SHLIB_LD='${CC} -shared'
1466 AS_IF([test $doRpath = yes], [
1467 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1468 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1471 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1476 CFLAGS="$CFLAGS +DD64"
1477 LDFLAGS_ARCH="+DD64"
1482 SHLIB_LD="ld -n32 -shared -rdata_shared"
1484 AS_IF([test $doRpath = yes], [
1485 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1486 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1487 AS_IF([test "$GCC" = yes], [
1488 CFLAGS="$CFLAGS -mabi=n32"
1489 LDFLAGS="$LDFLAGS -mabi=n32"
1493 # Use to build 6.2 compatible binaries on 6.3.
1494 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1497 CFLAGS="$CFLAGS -n32"
1500 LDFLAGS="$LDFLAGS -n32"
1505 SHLIB_LD="ld -n32 -shared -rdata_shared"
1507 AS_IF([test $doRpath = yes], [
1508 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1509 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1511 # Check to enable 64-bit flags for compiler/linker
1513 AS_IF([test "$do64bit" = yes], [
1514 AS_IF([test "$GCC" = yes], [
1515 AC_MSG_WARN([64bit mode not supported by gcc])
1518 SHLIB_LD="ld -64 -shared -rdata_shared"
1519 CFLAGS="$CFLAGS -64"
1525 SHLIB_CFLAGS="-fPIC"
1529 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1531 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1532 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}'
1533 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1534 AS_IF([test $doRpath = yes], [
1535 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1536 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1537 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1538 AS_IF([test $do64bit = yes], [
1539 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1541 CFLAGS="$CFLAGS -m64"
1542 AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
1543 CFLAGS=$hold_cflags])
1544 AS_IF([test $tcl_cv_cc_m64 = yes], [
1545 CFLAGS="$CFLAGS -m64"
1550 # The combo of gcc + glibc has a bug related to inlining of
1551 # functions like strtod(). The -fno-builtin flag should address
1552 # this problem but it does not work. The -fno-inline flag is kind
1553 # of overkill but it works. Disable inlining only when one of the
1554 # files in compat/*.c is being linked in.
1556 AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1560 SHLIB_CFLAGS="-fPIC"
1563 SHLIB_LD='${CC} -shared'
1564 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1567 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1570 SHLIB_CFLAGS="-fPIC"
1573 SHLIB_LD='${CC} -shared'
1574 LD_FLAGS="-Wl,--export-dynamic"
1575 AS_IF([test $doRpath = yes], [
1576 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1577 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1580 SHLIB_CFLAGS="-fPIC"
1581 SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1583 AS_IF([test $doRpath = yes], [
1584 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1585 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1586 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
1587 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1592 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1593 AS_IF([test $tcl_cv_ld_elf = yes], [
1594 LDFLAGS=-Wl,-export-dynamic
1596 AS_IF([test "${TCL_THREADS}" = "1"], [
1597 # OpenBSD builds and links with -pthread, never -lpthread.
1598 LIBS=`echo $LIBS | sed s/-lpthread//`
1599 CFLAGS="$CFLAGS -pthread"
1600 SHLIB_CFLAGS="$SHLIB_CFLAGS -pthread"
1602 # OpenBSD doesn't do version numbers with dots.
1603 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1604 TCL_LIB_VERSIONS_OK=nodots
1606 NetBSD-*|FreeBSD-[[3-4]].*)
1607 # FreeBSD 3.* and greater have ELF.
1608 # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs
1609 SHLIB_CFLAGS="-fPIC"
1610 SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1612 LDFLAGS="$LDFLAGS -export-dynamic"
1613 AS_IF([test $doRpath = yes], [
1614 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1615 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1616 AS_IF([test "${TCL_THREADS}" = "1"], [
1617 # The -pthread needs to go in the CFLAGS, not LIBS
1618 LIBS=`echo $LIBS | sed s/-pthread//`
1619 CFLAGS="$CFLAGS -pthread"
1620 LDFLAGS="$LDFLAGS -pthread"
1624 # FreeBSD-3 doesn't handle version numbers with dots.
1625 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1626 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1627 TCL_LIB_VERSIONS_OK=nodots
1632 # This configuration from FreeBSD Ports.
1633 SHLIB_CFLAGS="-fPIC"
1634 SHLIB_LD="${CC} -shared"
1635 TCL_SHLIB_LD_EXTRAS="-soname \$[@]"
1638 AS_IF([test $doRpath = yes], [
1639 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1640 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1641 AS_IF([test "${TCL_THREADS}" = "1"], [
1642 # The -pthread needs to go in the LDFLAGS, not LIBS
1643 LIBS=`echo $LIBS | sed s/-pthread//`
1644 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1645 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
1646 # Version numbers are dot-stripped by system policy.
1647 TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
1648 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1649 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1'
1650 TCL_LIB_VERSIONS_OK=nodots
1653 CFLAGS_OPTIMIZE="-Os"
1654 SHLIB_CFLAGS="-fno-common"
1655 # To avoid discrepancies between what headers configure sees during
1656 # preprocessing tests and compiling tests, move any -isysroot and
1657 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1658 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1659 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1660 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1661 CFLAGS="`echo " ${CFLAGS}" | \
1662 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1663 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1664 AS_IF([test $do64bit = yes], [
1667 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1668 tcl_cv_cc_arch_ppc64, [
1670 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1671 AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
1672 tcl_cv_cc_arch_ppc64=no)
1673 CFLAGS=$hold_cflags])
1674 AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1675 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1679 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1680 tcl_cv_cc_arch_x86_64, [
1682 CFLAGS="$CFLAGS -arch x86_64"
1683 AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
1684 tcl_cv_cc_arch_x86_64=no)
1685 CFLAGS=$hold_cflags])
1686 AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1687 CFLAGS="$CFLAGS -arch x86_64"
1691 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1694 # Check for combined 32-bit and 64-bit fat build
1695 AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
1696 && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1699 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1700 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
1701 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1702 hold_ldflags=$LDFLAGS
1703 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1704 AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
1705 LDFLAGS=$hold_ldflags])
1706 AS_IF([test $tcl_cv_ld_single_module = yes], [
1707 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1709 # TEA specific: link shlib with current and compatiblity version flags
1710 vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
1711 SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
1712 SHLIB_SUFFIX=".dylib"
1713 # Don't use -prebind when building for Mac OS X 10.4 or later only:
1714 AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
1715 "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
1716 LDFLAGS="$LDFLAGS -prebind"])
1717 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1718 AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1719 tcl_cv_ld_search_paths_first, [
1720 hold_ldflags=$LDFLAGS
1721 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1722 AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes,
1723 tcl_cv_ld_search_paths_first=no)
1724 LDFLAGS=$hold_ldflags])
1725 AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1726 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1728 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1729 AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1730 [Compiler support for module scope symbols])
1731 tcl_cv_cc_visibility_hidden=yes
1735 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1736 # TEA specific: for combined 32 & 64 bit fat builds of Tk
1737 # extensions, verify that 64-bit build is possible.
1738 AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [
1739 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [
1740 AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
1741 for v in CFLAGS CPPFLAGS LDFLAGS; do
1742 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1744 CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
1745 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
1746 AC_TRY_LINK([#include <X11/Xlib.h>], [XrmInitialize();],
1747 tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no)
1748 for v in CFLAGS CPPFLAGS LDFLAGS; do
1749 eval $v'="$hold_'$v'"'
1752 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua], [
1753 AC_CACHE_CHECK([for 64-bit Tk], tcl_cv_lib_tk_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 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}"
1758 LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
1759 AC_TRY_LINK([#include <tk.h>], [Tk_InitStubs(NULL, "", 0);],
1760 tcl_cv_lib_tk_64=yes, tcl_cv_lib_tk_64=no)
1761 for v in CFLAGS CPPFLAGS LDFLAGS; do
1762 eval $v'="$hold_'$v'"'
1765 # remove 64-bit arch flags from CFLAGS et al. if configuration
1766 # does not support 64-bit.
1767 AS_IF([test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no], [
1768 AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
1769 for v in CFLAGS CPPFLAGS LDFLAGS; do
1770 eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1775 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1776 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1777 [Should OS/390 do the right thing with sockets?])
1782 AS_IF([test "$SHARED_BUILD" = 1], [
1783 SHLIB_LD='ld -shared -expect_unresolved "*"'
1785 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1788 AS_IF([test $doRpath = yes], [
1789 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1790 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1791 AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1792 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1793 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1794 AS_IF([test "${TCL_THREADS}" = 1], [
1795 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1796 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1797 LIBS=`echo $LIBS | sed s/-lpthreads//`
1798 AS_IF([test "$GCC" = yes], [
1799 LIBS="$LIBS -lpthread -lmach -lexc"
1801 CFLAGS="$CFLAGS -pthread"
1802 LDFLAGS="$LDFLAGS -pthread"
1808 # This may work for all QNX, but it was only reported for v6.
1809 SHLIB_CFLAGS="-fPIC"
1810 SHLIB_LD="ld -Bshareable -x"
1817 AS_IF([test "$GCC" = yes], [
1818 SHLIB_CFLAGS="-fPIC -melf"
1819 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1821 SHLIB_CFLAGS="-Kpic -belf"
1822 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1831 # Careful to not let 5.10+ fall into this case
1833 # Note: If _REENTRANT isn't defined, then Solaris
1834 # won't define thread-safe library routines.
1836 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1837 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1838 [Do we really want to follow the standard? Yes we do!])
1840 SHLIB_CFLAGS="-KPIC"
1842 AS_IF([test "$GCC" = yes], [
1843 SHLIB_LD='${CC} -shared'
1844 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1845 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1847 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1848 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1849 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1853 # Note: If _REENTRANT isn't defined, then Solaris
1854 # won't define thread-safe library routines.
1856 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1857 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1858 [Do we really want to follow the standard? Yes we do!])
1860 SHLIB_CFLAGS="-KPIC"
1862 # Check to enable 64-bit flags for compiler/linker
1863 AS_IF([test "$do64bit" = yes], [
1865 AS_IF([test "$arch" = "sparcv9 sparc"], [
1866 AS_IF([test "$GCC" = yes], [
1867 AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
1868 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1871 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1872 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1873 SHLIB_CFLAGS="-fPIC"
1877 AS_IF([test "$do64bitVIS" = yes], [
1878 CFLAGS="$CFLAGS -xarch=v9a"
1879 LDFLAGS_ARCH="-xarch=v9a"
1881 CFLAGS="$CFLAGS -xarch=v9"
1882 LDFLAGS_ARCH="-xarch=v9"
1884 # Solaris 64 uses this as well
1885 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1887 ], [AS_IF([test "$arch" = "amd64 i386"], [
1888 AS_IF([test "$GCC" = yes], [
1890 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1892 CFLAGS="$CFLAGS -m64"
1893 LDFLAGS="$LDFLAGS -m64";;
1895 AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
1900 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1901 CFLAGS="$CFLAGS -m64"
1902 LDFLAGS="$LDFLAGS -m64";;
1904 CFLAGS="$CFLAGS -xarch=amd64"
1905 LDFLAGS="$LDFLAGS -xarch=amd64";;
1908 ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
1912 AS_IF([test "$GCC" = yes], [
1913 SHLIB_LD='${CC} -shared'
1914 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1915 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1916 AS_IF([test "$do64bit_ok" = yes], [
1917 AS_IF([test "$arch" = "sparcv9 sparc"], [
1918 # We need to specify -static-libgcc or we need to
1919 # add the path to the sparv9 libgcc.
1920 # JH: static-libgcc is necessary for core Tcl, but may
1921 # not be necessary for extensions.
1922 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1923 # for finding sparcv9 libgcc, get the regular libgcc
1924 # path, remove so name and append 'sparcv9'
1925 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1926 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1927 ], [AS_IF([test "$arch" = "amd64 i386"], [
1928 # JH: static-libgcc is necessary for core Tcl, but may
1929 # not be necessary for extensions.
1930 SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
1935 SunOS-5.[[1-9]][[0-9]]*)
1936 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1937 SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';;
1939 SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
1941 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1942 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1947 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
1948 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1951 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1952 dnl # until the end of configure, as configure's compile and link tests use
1953 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1954 dnl # preprocessing tests use only CPPFLAGS.
1955 AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1957 # Add in the arch flags late to ensure it wasn't removed.
1958 # Not necessary in TEA, but this is aligned with core
1959 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
1961 # If we're running gcc, then change the C flags for compiling shared
1962 # libraries to the right flags for gcc, instead of those for the
1963 # standard manufacturer compiler.
1965 AS_IF([test "$GCC" = yes], [
1971 NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
1975 *) SHLIB_CFLAGS="-fPIC" ;;
1978 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1979 AC_DEFINE(MODULE_SCOPE, [extern],
1980 [No Compiler support for module scope symbols])
1981 AC_DEFINE(NO_VIZ, [], [No visibility hidden passed to zlib?])
1984 AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
1985 # TEA specific: use PACKAGE_VERSION instead of VERSION
1986 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'])
1987 AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
1988 # TEA specific: use PACKAGE_VERSION instead of VERSION
1989 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'])
1991 AC_SUBST(CFLAGS_DEBUG)
1992 AC_SUBST(CFLAGS_OPTIMIZE)
1993 AC_SUBST(CFLAGS_WARNING)
1998 AC_SUBST(SHLIB_LD_LIBS)
1999 AC_SUBST(SHLIB_CFLAGS)
2001 AC_SUBST(LD_LIBRARY_PATH_VAR)
2003 # These must be called after we do the basic CFLAGS checks and
2004 # verify any possible 64-bit or similar switches are necessary
2009 #--------------------------------------------------------------------
2012 # Determine which interface to use to talk to the serial port.
2013 # Note that #include lines must begin in leftmost column for
2014 # some compilers to recognize them as preprocessor directives,
2015 # and some build environments have stdin not pointing at a
2016 # pseudo-terminal (usually /dev/null instead.)
2023 # Defines only one of the following vars:
2029 #--------------------------------------------------------------------
2031 AC_DEFUN([TEA_SERIAL_PORT], [
2032 AC_CHECK_HEADERS(sys/modem.h)
2033 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2035 #include <termios.h>
2039 if (tcgetattr(0, &t) == 0) {
2041 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2045 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2046 if test $tcl_cv_api_serial = no ; then
2052 if (ioctl(0, TCGETA, &t) == 0) {
2053 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2057 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2059 if test $tcl_cv_api_serial = no ; then
2065 if (ioctl(0, TIOCGETP, &t) == 0) {
2067 t.sg_flags |= ODDP | EVENP | RAW;
2071 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2073 if test $tcl_cv_api_serial = no ; then
2075 #include <termios.h>
2080 if (tcgetattr(0, &t) == 0
2081 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2083 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2087 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2089 if test $tcl_cv_api_serial = no; then
2096 if (ioctl(0, TCGETA, &t) == 0
2097 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2098 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2102 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2104 if test $tcl_cv_api_serial = no; then
2111 if (ioctl(0, TIOCGETP, &t) == 0
2112 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2114 t.sg_flags |= ODDP | EVENP | RAW;
2118 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2120 case $tcl_cv_api_serial in
2121 termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
2122 termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
2123 sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
2127 #--------------------------------------------------------------------
2128 # TEA_MISSING_POSIX_HEADERS
2130 # Supply substitutes for missing POSIX header files. Special
2132 # - stdlib.h doesn't define strtol, strtoul, or
2133 # strtod in some versions of SunOS
2134 # - some versions of string.h don't declare procedures such
2142 # Defines some of the following vars:
2146 # HAVE_LIMITS_H or NO_LIMITS_H
2155 # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and
2157 #--------------------------------------------------------------------
2159 AC_DEFUN([TEA_MISSING_POSIX_HEADERS], [
2160 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2161 AC_TRY_LINK([#include <sys/types.h>
2162 #include <dirent.h>], [
2163 #ifndef _POSIX_SOURCE
2166 * Generate compilation error to make the test fail: Lynx headers
2167 * are only valid if really in the POSIX environment.
2170 missing_procedure();
2174 struct dirent *entryPtr;
2176 d = opendir("foobar");
2177 entryPtr = readdir(d);
2178 p = entryPtr->d_name;
2180 ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
2182 if test $tcl_cv_dirent_h = no; then
2183 AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
2187 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
2188 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
2189 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
2190 AC_CHECK_HEADER(limits.h,
2191 [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
2192 [AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
2193 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2194 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2195 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2196 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2197 if test $tcl_ok = 0; then
2198 AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
2200 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2201 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2202 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2204 # See also memmove check below for a place where NO_STRING_H can be
2207 if test $tcl_ok = 0; then
2208 AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
2211 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
2212 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
2214 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2215 AC_HAVE_HEADERS(sys/param.h)
2218 #--------------------------------------------------------------------
2221 # Locate the X11 header files and the X11 library archive. Try
2222 # the ac_path_x macro first, but if it doesn't find the X stuff
2223 # (e.g. because there's no xmkmf program) then check through
2224 # a list of possible directories. Under some conditions the
2225 # autoconf macro will return an include directory that contains
2226 # no include files, so double-check its result just to be safe.
2228 # This should be called after TEA_CONFIG_CFLAGS as setting the
2229 # LIBS line can confuse some configure macro magic.
2236 # Sets the following vars:
2239 # PKG_LIBS (appends to)
2241 #--------------------------------------------------------------------
2243 AC_DEFUN([TEA_PATH_X], [
2244 if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
2249 AC_DEFUN([TEA_PATH_UNIX_X], [
2252 if test "$no_x" = ""; then
2253 if test "$x_includes" = ""; then
2254 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2256 if test ! -r $x_includes/X11/Intrinsic.h; then
2257 not_really_there="yes"
2261 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2262 AC_MSG_CHECKING([for X11 header files])
2263 found_xincludes="no"
2264 AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2265 if test "$found_xincludes" = "no"; then
2266 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"
2268 if test -r $i/X11/Intrinsic.h; then
2271 found_xincludes="yes"
2277 if test "$x_includes" != ""; then
2278 XINCLUDES="-I$x_includes"
2279 found_xincludes="yes"
2282 if test "$found_xincludes" = "no"; then
2283 AC_MSG_RESULT([couldn't find any!])
2286 if test "$no_x" = yes; then
2287 AC_MSG_CHECKING([for X11 libraries])
2289 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"
2291 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2299 if test "$x_libraries" = ""; then
2302 XLIBSW="-L$x_libraries -lX11"
2305 if test "$XLIBSW" = nope ; then
2306 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2308 if test "$XLIBSW" = nope ; then
2309 AC_MSG_RESULT([could not find any! Using -lX11.])
2313 if test x"${XLIBSW}" != x ; then
2314 PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
2318 #--------------------------------------------------------------------
2319 # TEA_BLOCKING_STYLE
2321 # The statements below check for systems where POSIX-style
2322 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2323 # On these systems (mostly older ones), use the old BSD-style
2324 # FIONBIO approach instead.
2331 # Defines some of the following vars:
2337 #--------------------------------------------------------------------
2339 AC_DEFUN([TEA_BLOCKING_STYLE], [
2340 AC_CHECK_HEADERS(sys/ioctl.h)
2341 AC_CHECK_HEADERS(sys/filio.h)
2343 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2346 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2347 AC_MSG_RESULT([FIONBIO])
2350 AC_MSG_RESULT([O_NONBLOCK])
2355 #--------------------------------------------------------------------
2358 # Checks how the system deals with time.h, what time structures
2359 # are used on the system, and what fields the structures have.
2366 # Defines some of the following vars:
2372 #--------------------------------------------------------------------
2374 AC_DEFUN([TEA_TIME_HANDLER], [
2375 AC_CHECK_HEADERS(sys/time.h)
2379 AC_CHECK_FUNCS(gmtime_r localtime_r)
2381 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2382 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2383 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
2384 if test $tcl_cv_member_tm_tzadj = yes ; then
2385 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2388 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2389 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2390 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
2391 if test $tcl_cv_member_tm_gmtoff = yes ; then
2392 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2396 # Its important to include time.h in this check, as some systems
2397 # (like convex) have timezone functions, etc.
2399 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2400 AC_TRY_COMPILE([#include <time.h>],
2401 [extern long timezone;
2404 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
2405 if test $tcl_cv_timezone_long = yes ; then
2406 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2409 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2411 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2412 AC_TRY_COMPILE([#include <time.h>],
2413 [extern time_t timezone;
2416 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
2417 if test $tcl_cv_timezone_time = yes ; then
2418 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2423 #--------------------------------------------------------------------
2426 # Under Solaris 2.4, strtod returns the wrong value for the
2427 # terminating character under some conditions. Check for this
2428 # and if the problem exists use a substitute procedure
2429 # "fixstrtod" (provided by Tcl) that corrects the error.
2430 # Also, on Compaq's Tru64 Unix 5.0,
2431 # strtod(" ") returns 0.0 instead of a failure to convert.
2438 # Might defines some of the following vars:
2439 # strtod (=fixstrtod)
2441 #--------------------------------------------------------------------
2443 AC_DEFUN([TEA_BUGGY_STRTOD], [
2444 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2445 if test "$tcl_strtod" = 1; then
2446 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2448 extern double strtod();
2450 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2453 value = strtod(infString, &term);
2454 if ((term != infString) && (term[-1] == 0)) {
2457 value = strtod(nanString, &term);
2458 if ((term != nanString) && (term[-1] == 0)) {
2461 value = strtod(spaceString, &term);
2462 if (term == (spaceString+1)) {
2466 }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2467 tcl_cv_strtod_buggy=buggy)])
2468 if test "$tcl_cv_strtod_buggy" = buggy; then
2469 AC_LIBOBJ([fixstrtod])
2471 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
2476 #--------------------------------------------------------------------
2479 # Search for the libraries needed to link the Tcl shell.
2480 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2481 # -lnsl) are dealt with here.
2484 # Requires the following vars to be set in the Makefile:
2485 # DL_LIBS (not in TEA, only needed in core)
2491 # Subst's the following var:
2495 # Might append to the following vars:
2498 # Might define the following vars:
2501 #--------------------------------------------------------------------
2503 AC_DEFUN([TEA_TCL_LINK_LIBS], [
2504 #--------------------------------------------------------------------
2505 # On a few very rare systems, all of the libm.a stuff is
2506 # already in libc.a. Set compiler flags accordingly.
2507 # Also, Linux requires the "ieee" library for math to work
2508 # right (and it must appear before "-lm").
2509 #--------------------------------------------------------------------
2511 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2512 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2514 #--------------------------------------------------------------------
2515 # Interactive UNIX requires -linet instead of -lsocket, plus it
2516 # needs net/errno.h to define the socket-related error codes.
2517 #--------------------------------------------------------------------
2519 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2520 AC_CHECK_HEADER(net/errno.h, [
2521 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2523 #--------------------------------------------------------------------
2524 # Check for the existence of the -lsocket and -lnsl libraries.
2525 # The order here is important, so that they end up in the right
2526 # order in the command line generated by make. Here are some
2527 # special considerations:
2528 # 1. Use "connect" and "accept" to check for -lsocket, and
2529 # "gethostbyname" to check for -lnsl.
2530 # 2. Use each function name only once: can't redo a check because
2531 # autoconf caches the results of the last check and won't redo it.
2532 # 3. Use -lnsl and -lsocket only if they supply procedures that
2533 # aren't already present in the normal libraries. This is because
2534 # IRIX 5.2 has libraries, but they aren't needed and they're
2535 # bogus: they goof up name resolution if used.
2536 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2537 # To get around this problem, check for both libraries together
2538 # if -lsocket doesn't work by itself.
2539 #--------------------------------------------------------------------
2542 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2543 if test "$tcl_checkSocket" = 1; then
2544 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2545 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2547 if test "$tcl_checkBoth" = 1; then
2549 LIBS="$LIBS -lsocket -lnsl"
2550 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2552 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2553 [LIBS="$LIBS -lnsl"])])
2555 # TEA specific: Don't perform the eval of the libraries here because
2556 # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS
2558 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2563 #--------------------------------------------------------------------
2564 # TEA_TCL_EARLY_FLAGS
2566 # Check for what flags are needed to be passed so the correct OS
2567 # features are available.
2574 # Might define the following vars:
2576 # _LARGEFILE64_SOURCE
2577 # _LARGEFILE_SOURCE64
2579 #--------------------------------------------------------------------
2581 AC_DEFUN([TEA_TCL_EARLY_FLAG],[
2582 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2583 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2584 AC_TRY_COMPILE([[#define ]$1[ 1
2586 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2587 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2588 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2589 AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
2590 tcl_flags="$tcl_flags $1"
2594 AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
2595 AC_MSG_CHECKING([for required early compiler flags])
2597 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2598 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2599 TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2600 [struct stat64 buf; int i = stat64("/", &buf);])
2601 TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2602 [char *p = (char *)open64;])
2603 if test "x${tcl_flags}" = "x" ; then
2604 AC_MSG_RESULT([none])
2606 AC_MSG_RESULT([${tcl_flags}])
2610 #--------------------------------------------------------------------
2611 # TEA_TCL_64BIT_FLAGS
2613 # Check for what is defined in the way of 64-bit features.
2620 # Might define the following vars:
2621 # TCL_WIDE_INT_IS_LONG
2623 # HAVE_STRUCT_DIRENT64
2624 # HAVE_STRUCT_STAT64
2627 #--------------------------------------------------------------------
2629 AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
2630 AC_MSG_CHECKING([for 64-bit integer type])
2631 AC_CACHE_VAL(tcl_cv_type_64bit,[
2632 tcl_cv_type_64bit=none
2633 # See if the compiler knows natively about __int64
2634 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2635 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2636 # See if we should use long anyway Note that we substitute in the
2637 # type that is our current guess for a 64-bit type inside this check
2638 # program, so it should be modified only carefully...
2639 AC_TRY_COMPILE(,[switch (0) {
2640 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2641 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2642 if test "${tcl_cv_type_64bit}" = none ; then
2643 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
2644 AC_MSG_RESULT([using long])
2645 elif test "${tcl_cv_type_64bit}" = "__int64" \
2646 -a "${TEA_PLATFORM}" = "windows" ; then
2647 # TEA specific: We actually want to use the default tcl.h checks in
2648 # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
2649 AC_MSG_RESULT([using Tcl header defaults])
2651 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2652 [What type should be used to define wide integers?])
2653 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2655 # Now check for auxiliary declarations
2656 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2657 AC_TRY_COMPILE([#include <sys/types.h>
2658 #include <sys/dirent.h>],[struct dirent64 p;],
2659 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2660 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2661 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2664 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2665 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2667 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2668 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2669 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2672 AC_CHECK_FUNCS(open64 lseek64)
2673 AC_MSG_CHECKING([for off64_t])
2674 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2675 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2677 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2678 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2679 dnl functions lseek64 and open64 are defined.
2680 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2681 test "x${ac_cv_func_lseek64}" = "xyes" && \
2682 test "x${ac_cv_func_open64}" = "xyes" ; then
2683 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2684 AC_MSG_RESULT([yes])
2692 ## Here ends the standard Tcl configuration bits and starts the
2693 ## TEA specific functions
2696 #------------------------------------------------------------------------
2699 # Init various Tcl Extension Architecture (TEA) variables.
2700 # This should be the first called TEA_* macro.
2707 # Defines and substs the following vars:
2713 # TEA_PLATFORM (windows or unix)
2715 # "cygpath" is used on windows to generate native path names for include
2716 # files. These variables should only be used with the compiler and linker
2717 # since they generate native path names.
2720 # Select the executable extension based on the host type. This
2721 # is a lightweight replacement for AC_EXEEXT that doesn't require
2723 #------------------------------------------------------------------------
2725 AC_DEFUN([TEA_INIT], [
2726 # TEA extensions pass this us the version of TEA they think they
2727 # are compatible with.
2730 AC_MSG_CHECKING([for correct TEA configuration])
2731 if test x"${PACKAGE_NAME}" = x ; then
2733 The PACKAGE_NAME variable must be defined by your TEA configure.in])
2735 if test x"$1" = x ; then
2737 TEA version not specified.])
2738 elif test "$1" != "${TEA_VERSION}" ; then
2739 AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"])
2741 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
2743 case "`uname -s`" in
2744 *win32*|*WIN32*|*MINGW32_*)
2745 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
2747 TEA_PLATFORM="windows"
2752 # TEA_PLATFORM is determined later in LOAD_TCLCONFIG
2761 # Check if exec_prefix is set. If not use fall back to prefix.
2762 # Note when adjusted, so that TEA_PREFIX can correct for this.
2763 # This is needed for recursive configures, since autoconf propagates
2764 # $prefix, but not $exec_prefix (doh!).
2765 if test x$exec_prefix = xNONE ; then
2766 exec_prefix_default=yes
2770 AC_MSG_NOTICE([configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}])
2775 # This package name must be replaced statically for AC_SUBST to work
2776 AC_SUBST(PKG_LIB_FILE)
2777 # Substitute STUB_LIB_FILE in case package creates a stub library too.
2778 AC_SUBST(PKG_STUB_LIB_FILE)
2780 # We AC_SUBST these here to ensure they are subst'ed,
2781 # in case the user doesn't call TEA_ADD_...
2782 AC_SUBST(PKG_STUB_SOURCES)
2783 AC_SUBST(PKG_STUB_OBJECTS)
2784 AC_SUBST(PKG_TCL_SOURCES)
2785 AC_SUBST(PKG_HEADERS)
2786 AC_SUBST(PKG_INCLUDES)
2788 AC_SUBST(PKG_CFLAGS)
2791 #------------------------------------------------------------------------
2792 # TEA_ADD_SOURCES --
2794 # Specify one or more source files. Users should check for
2795 # the right platform before adding to their list.
2796 # It is not important to specify the directory, as long as it is
2797 # in the generic, win or unix subdirectory of $(srcdir).
2800 # one or more file names
2804 # Defines and substs the following vars:
2807 #------------------------------------------------------------------------
2808 AC_DEFUN([TEA_ADD_SOURCES], [
2814 PKG_SOURCES="$PKG_SOURCES $i"
2815 PKG_OBJECTS="$PKG_OBJECTS $i"
2818 # check for existence - allows for generic/win/unix VPATH
2819 # To add more dirs here (like 'src'), you have to update VPATH
2820 # in Makefile.in as well
2821 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2822 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2823 -a ! -f "${srcdir}/macosx/$i" \
2825 AC_MSG_ERROR([could not find source file '$i'])
2827 PKG_SOURCES="$PKG_SOURCES $i"
2828 # this assumes it is in a VPATH dir
2830 # handle user calling this before or after TEA_SETUP_COMPILER
2831 if test x"${OBJEXT}" != x ; then
2832 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2834 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2836 PKG_OBJECTS="$PKG_OBJECTS $j"
2840 AC_SUBST(PKG_SOURCES)
2841 AC_SUBST(PKG_OBJECTS)
2844 #------------------------------------------------------------------------
2845 # TEA_ADD_STUB_SOURCES --
2847 # Specify one or more source files. Users should check for
2848 # the right platform before adding to their list.
2849 # It is not important to specify the directory, as long as it is
2850 # in the generic, win or unix subdirectory of $(srcdir).
2853 # one or more file names
2857 # Defines and substs the following vars:
2860 #------------------------------------------------------------------------
2861 AC_DEFUN([TEA_ADD_STUB_SOURCES], [
2864 # check for existence - allows for generic/win/unix VPATH
2865 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2866 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2867 -a ! -f "${srcdir}/macosx/$i" \
2869 AC_MSG_ERROR([could not find stub source file '$i'])
2871 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
2872 # this assumes it is in a VPATH dir
2874 # handle user calling this before or after TEA_SETUP_COMPILER
2875 if test x"${OBJEXT}" != x ; then
2876 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2878 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2880 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
2882 AC_SUBST(PKG_STUB_SOURCES)
2883 AC_SUBST(PKG_STUB_OBJECTS)
2886 #------------------------------------------------------------------------
2887 # TEA_ADD_TCL_SOURCES --
2889 # Specify one or more Tcl source files. These should be platform
2890 # independent runtime files.
2893 # one or more file names
2897 # Defines and substs the following vars:
2899 #------------------------------------------------------------------------
2900 AC_DEFUN([TEA_ADD_TCL_SOURCES], [
2903 # check for existence, be strict because it is installed
2904 if test ! -f "${srcdir}/$i" ; then
2905 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
2907 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
2909 AC_SUBST(PKG_TCL_SOURCES)
2912 #------------------------------------------------------------------------
2913 # TEA_ADD_HEADERS --
2915 # Specify one or more source headers. Users should check for
2916 # the right platform before adding to their list.
2919 # one or more file names
2923 # Defines and substs the following vars:
2925 #------------------------------------------------------------------------
2926 AC_DEFUN([TEA_ADD_HEADERS], [
2929 # check for existence, be strict because it is installed
2930 if test ! -f "${srcdir}/$i" ; then
2931 AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
2933 PKG_HEADERS="$PKG_HEADERS $i"
2935 AC_SUBST(PKG_HEADERS)
2938 #------------------------------------------------------------------------
2939 # TEA_ADD_INCLUDES --
2941 # Specify one or more include dirs. Users should check for
2942 # the right platform before adding to their list.
2945 # one or more file names
2949 # Defines and substs the following vars:
2951 #------------------------------------------------------------------------
2952 AC_DEFUN([TEA_ADD_INCLUDES], [
2955 PKG_INCLUDES="$PKG_INCLUDES $i"
2957 AC_SUBST(PKG_INCLUDES)
2960 #------------------------------------------------------------------------
2963 # Specify one or more libraries. Users should check for
2964 # the right platform before adding to their list. For Windows,
2965 # libraries provided in "foo.lib" format will be converted to
2966 # "-lfoo" when using GCC (mingw).
2969 # one or more file names
2973 # Defines and substs the following vars:
2975 #------------------------------------------------------------------------
2976 AC_DEFUN([TEA_ADD_LIBS], [
2979 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
2980 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
2981 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'`
2983 PKG_LIBS="$PKG_LIBS $i"
2988 #------------------------------------------------------------------------
2991 # Specify one or more CFLAGS. Users should check for
2992 # the right platform before adding to their list.
2995 # one or more file names
2999 # Defines and substs the following vars:
3001 #------------------------------------------------------------------------
3002 AC_DEFUN([TEA_ADD_CFLAGS], [
3003 PKG_CFLAGS="$PKG_CFLAGS $@"
3004 AC_SUBST(PKG_CFLAGS)
3007 #------------------------------------------------------------------------
3008 # TEA_ADD_CLEANFILES --
3010 # Specify one or more CLEANFILES.
3013 # one or more file names to clean target
3017 # Appends to CLEANFILES, already defined for subst in LOAD_TCLCONFIG
3018 #------------------------------------------------------------------------
3019 AC_DEFUN([TEA_ADD_CLEANFILES], [
3020 CLEANFILES="$CLEANFILES $@"
3023 #------------------------------------------------------------------------
3026 # Handle the --prefix=... option by defaulting to what Tcl gave
3033 # If --prefix or --exec-prefix was not specified, $prefix and
3034 # $exec_prefix will be set to the values given to Tcl when it was
3036 #------------------------------------------------------------------------
3037 AC_DEFUN([TEA_PREFIX], [
3038 if test "${prefix}" = "NONE"; then
3040 if test x"${TCL_PREFIX}" != x; then
3041 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
3042 prefix=${TCL_PREFIX}
3044 AC_MSG_NOTICE([--prefix defaulting to /usr/local])
3048 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
3049 -o x"${exec_prefix_default}" = x"yes" ; then
3050 if test x"${TCL_EXEC_PREFIX}" != x; then
3051 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
3052 exec_prefix=${TCL_EXEC_PREFIX}
3054 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
3060 #------------------------------------------------------------------------
3061 # TEA_SETUP_COMPILER_CC --
3063 # Do compiler checks the way we want. This is just a replacement
3064 # for AC_PROG_CC in TEA configure.in files to make them cleaner.
3071 # Sets up CC var and other standard bits we need to make executables.
3072 #------------------------------------------------------------------------
3073 AC_DEFUN([TEA_SETUP_COMPILER_CC], [
3074 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
3075 # in this macro, they need to go into TEA_SETUP_COMPILER instead.
3077 # If the user did not set CFLAGS, set it now to keep
3078 # the AC_PROG_CC macro from adding "-g -O2".
3079 if test "${CFLAGS+set}" != "set" ; then
3088 #--------------------------------------------------------------------
3089 # Checks to see if the make program sets the $MAKE variable.
3090 #--------------------------------------------------------------------
3094 #--------------------------------------------------------------------
3096 #--------------------------------------------------------------------
3100 #--------------------------------------------------------------------
3101 # Determines the correct binary file extension (.o, .obj, .exe etc.)
3102 #--------------------------------------------------------------------
3108 #------------------------------------------------------------------------
3109 # TEA_SETUP_COMPILER --
3111 # Do compiler checks that use the compiler. This must go after
3112 # TEA_SETUP_COMPILER_CC, which does the actual compiler check.
3119 # Sets up CC var and other standard bits we need to make executables.
3120 #------------------------------------------------------------------------
3121 AC_DEFUN([TEA_SETUP_COMPILER], [
3122 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
3123 AC_REQUIRE([TEA_SETUP_COMPILER_CC])
3125 #------------------------------------------------------------------------
3126 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
3127 # It makes compiling go faster. (This is only a performance feature.)
3128 #------------------------------------------------------------------------
3130 if test -z "$no_pipe" -a -n "$GCC"; then
3131 AC_CACHE_CHECK([if the compiler understands -pipe],
3133 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
3134 AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
3135 CFLAGS=$hold_cflags])
3136 if test $tcl_cv_cc_pipe = yes; then
3137 CFLAGS="$CFLAGS -pipe"
3141 #--------------------------------------------------------------------
3142 # Common compiler flag setup
3143 #--------------------------------------------------------------------
3146 if test "${TEA_PLATFORM}" = "unix" ; then
3148 TEA_MISSING_POSIX_HEADERS
3149 # Let the user call this, because if it triggers, they will
3150 # need a compat/strtod.c that is correct. Users can also
3151 # use Tcl_GetDouble(FromObj) instead.
3156 #------------------------------------------------------------------------
3159 # Generate a line that can be used to build a shared/unshared library
3160 # in a platform independent manner.
3169 # Defines the following vars:
3170 # CFLAGS - Done late here to note disturb other AC macros
3171 # MAKE_LIB - Command to execute to build the Tcl library;
3172 # differs depending on whether or not Tcl is being
3173 # compiled as a shared library.
3174 # MAKE_SHARED_LIB Makefile rule for building a shared library
3175 # MAKE_STATIC_LIB Makefile rule for building a static library
3176 # MAKE_STUB_LIB Makefile rule for building a stub library
3177 # VC_MANIFEST_EMBED_DLL Makefile rule for embedded VC manifest in DLL
3178 # VC_MANIFEST_EMBED_EXE Makefile rule for embedded VC manifest in EXE
3179 #------------------------------------------------------------------------
3181 AC_DEFUN([TEA_MAKE_LIB], [
3182 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
3183 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
3184 MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
3185 AC_EGREP_CPP([manifest needed], [
3186 #if defined(_MSC_VER) && _MSC_VER >= 1400
3187 print("manifest needed")
3190 # Could do a CHECK_PROG for mt, but should always be with MSVC8+
3191 VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;2 ; fi"
3192 VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;1 ; fi"
3193 MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
3194 TEA_ADD_CLEANFILES([*.manifest])
3196 MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)"
3198 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
3199 MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3200 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
3203 if test "${SHARED_BUILD}" = "1" ; then
3204 MAKE_LIB="${MAKE_SHARED_LIB} "
3206 MAKE_LIB="${MAKE_STATIC_LIB} "
3209 #--------------------------------------------------------------------
3210 # Shared libraries and static libraries have different names.
3211 # Use the double eval to make sure any variables in the suffix is
3212 # substituted. (@@@ Might not be necessary anymore)
3213 #--------------------------------------------------------------------
3215 if test "${TEA_PLATFORM}" = "windows" ; then
3216 if test "${SHARED_BUILD}" = "1" ; then
3217 # We force the unresolved linking of symbols that are really in
3218 # the private libraries of Tcl and Tk.
3219 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
3220 if test x"${TK_BIN_DIR}" != x ; then
3221 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
3223 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3225 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3227 # Some packages build their own stubs libraries
3228 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3229 if test "$GCC" = "yes"; then
3230 PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
3232 # These aren't needed on Windows (either MSVC or gcc)
3236 RANLIB_STUB="${RANLIB}"
3237 if test "${SHARED_BUILD}" = "1" ; then
3238 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
3239 if test x"${TK_BIN_DIR}" != x ; then
3240 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
3242 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3245 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3247 # Some packages build their own stubs libraries
3248 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3251 # These are escaped so that only CFLAGS is picked up at configure time.
3252 # The other values will be substituted at make time.
3253 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
3254 if test "${SHARED_BUILD}" = "1" ; then
3255 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
3259 AC_SUBST(MAKE_SHARED_LIB)
3260 AC_SUBST(MAKE_STATIC_LIB)
3261 AC_SUBST(MAKE_STUB_LIB)
3262 AC_SUBST(RANLIB_STUB)
3263 AC_SUBST(VC_MANIFEST_EMBED_DLL)
3264 AC_SUBST(VC_MANIFEST_EMBED_EXE)
3267 #------------------------------------------------------------------------
3270 # Compute the name of an existing object library located in libdir
3271 # from the given base name and produce the appropriate linker flags.
3274 # basename The base name of the library without version
3275 # numbers, extensions, or "lib" prefixes.
3276 # extra_dir Extra directory in which to search for the
3277 # library. This location is used first, then
3278 # $prefix/$exec-prefix, then some defaults.
3281 # TEA_INIT and TEA_PREFIX must be called first.
3285 # Defines the following vars:
3286 # ${basename}_LIB_NAME The computed library name.
3287 # ${basename}_LIB_SPEC The computed linker flags.
3288 #------------------------------------------------------------------------
3290 AC_DEFUN([TEA_LIB_SPEC], [
3291 AC_MSG_CHECKING([for $1 library])
3293 # Look in exec-prefix for the library (defined by TEA_PREFIX).
3295 tea_lib_name_dir="${exec_prefix}/lib"
3297 # Or in a user-specified location.
3299 if test x"$2" != x ; then
3300 tea_extra_lib_dir=$2
3302 tea_extra_lib_dir=NONE
3306 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3307 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3308 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3309 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3310 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3311 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
3312 `ls -dr /usr/lib64/$1[[0-9]]*.lib 2>/dev/null ` \
3313 `ls -dr /usr/lib64/lib$1[[0-9]]* 2>/dev/null ` \
3314 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3315 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
3316 if test -f "$i" ; then
3317 tea_lib_name_dir=`dirname $i`
3318 $1_LIB_NAME=`basename $i`
3324 if test "${TEA_PLATFORM}" = "windows"; then
3325 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
3327 # Strip off the leading "lib" and trailing ".a" or ".so"
3329 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
3330 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
3333 if test "x${$1_LIB_NAME}" = x ; then
3334 AC_MSG_ERROR([not found])
3336 AC_MSG_RESULT([${$1_LIB_SPEC}])
3340 #------------------------------------------------------------------------
3341 # TEA_PRIVATE_TCL_HEADERS --
3343 # Locate the private Tcl include files
3348 # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
3349 # already been called.
3353 # Substs the following vars:
3354 # TCL_TOP_DIR_NATIVE
3356 #------------------------------------------------------------------------
3358 AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
3359 # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh}
3360 AC_REQUIRE([TEA_PUBLIC_TCL_HEADERS])
3361 AC_MSG_CHECKING([for Tcl private include files])
3363 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
3364 TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
3366 # Check to see if tcl<Plat>Port.h isn't already with the public headers
3367 # Don't look for tclInt.h because that resides with tcl.h in the core
3368 # sources, but the <plat>Port headers are in a different directory
3369 if test "${TEA_PLATFORM}" = "windows" -a \
3370 -f "${ac_cv_c_tclh}/tclWinPort.h"; then
3371 result="private headers found with public headers"
3372 elif test "${TEA_PLATFORM}" = "unix" -a \
3373 -f "${ac_cv_c_tclh}/tclUnixPort.h"; then
3374 result="private headers found with public headers"
3376 TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
3377 if test "${TEA_PLATFORM}" = "windows"; then
3378 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
3380 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
3382 # Overwrite the previous TCL_INCLUDES as this should capture both
3383 # public and private headers in the same set.
3384 # We want to ensure these are substituted so as not to require
3385 # any *_NATIVE vars be defined in the Makefile
3386 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
3387 if test "`uname -s`" = "Darwin"; then
3388 # If Tcl was built as a framework, attempt to use
3389 # the framework's Headers and PrivateHeaders directories
3392 if test -d "${TCL_BIN_DIR}/Headers" -a \
3393 -d "${TCL_BIN_DIR}/PrivateHeaders"; then
3394 TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
3396 TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3400 result="Using ${TCL_INCLUDES}"
3402 if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
3403 AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
3405 result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}"
3409 AC_SUBST(TCL_TOP_DIR_NATIVE)
3411 AC_SUBST(TCL_INCLUDES)
3412 AC_MSG_RESULT([${result}])
3415 #------------------------------------------------------------------------
3416 # TEA_PUBLIC_TCL_HEADERS --
3418 # Locate the installed public Tcl header files
3424 # CYGPATH must be set
3428 # Adds a --with-tclinclude switch to configure.
3431 # Substs the following vars:
3433 #------------------------------------------------------------------------
3435 AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
3436 AC_MSG_CHECKING([for Tcl public headers])
3438 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
3440 AC_CACHE_VAL(ac_cv_c_tclh, [
3441 # Use the value from --with-tclinclude, if it was given
3443 if test x"${with_tclinclude}" != x ; then
3444 if test -f "${with_tclinclude}/tcl.h" ; then
3445 ac_cv_c_tclh=${with_tclinclude}
3447 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
3451 if test "`uname -s`" = "Darwin"; then
3452 # If Tcl was built as a framework, attempt to use
3453 # the framework's Headers directory
3456 list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
3461 # Look in the source dir only if Tcl is not installed,
3462 # and in that situation, look there before installed locations.
3463 if test -f "${TCL_BIN_DIR}/Makefile" ; then
3464 list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
3467 # Check order: pkg --prefix location, Tcl's --prefix location,
3468 # relative to directory of tclConfig.sh.
3470 eval "temp_includedir=${includedir}"
3472 `ls -d ${temp_includedir} 2>/dev/null` \
3473 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3474 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3475 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3476 list="$list /usr/local/include /usr/include"
3477 if test x"${TCL_INCLUDE_SPEC}" != x ; then
3478 d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3479 list="$list `ls -d ${d} 2>/dev/null`"
3483 if test -f "$i/tcl.h" ; then
3491 # Print a message based on how we determined the include path
3493 if test x"${ac_cv_c_tclh}" = x ; then
3494 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
3496 AC_MSG_RESULT([${ac_cv_c_tclh}])
3499 # Convert to a native path and substitute into the output files.
3501 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
3503 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3505 AC_SUBST(TCL_INCLUDES)
3508 #------------------------------------------------------------------------
3509 # TEA_PRIVATE_TK_HEADERS --
3511 # Locate the private Tk include files
3516 # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
3517 # already been called.
3521 # Substs the following vars:
3523 #------------------------------------------------------------------------
3525 AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
3526 # Allow for --with-tkinclude to take effect and define ${ac_cv_c_tkh}
3527 AC_REQUIRE([TEA_PUBLIC_TK_HEADERS])
3528 AC_MSG_CHECKING([for Tk private include files])
3530 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
3531 TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
3533 # Check to see if tk<Plat>Port.h isn't already with the public headers
3534 # Don't look for tkInt.h because that resides with tk.h in the core
3535 # sources, but the <plat>Port headers are in a different directory
3536 if test "${TEA_PLATFORM}" = "windows" -a \
3537 -f "${ac_cv_c_tkh}/tkWinPort.h"; then
3538 result="private headers found with public headers"
3539 elif test "${TEA_PLATFORM}" = "unix" -a \
3540 -f "${ac_cv_c_tkh}/tkUnixPort.h"; then
3541 result="private headers found with public headers"
3543 TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
3544 TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
3545 if test "${TEA_PLATFORM}" = "windows"; then
3546 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
3548 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
3550 # Overwrite the previous TK_INCLUDES as this should capture both
3551 # public and private headers in the same set.
3552 # We want to ensure these are substituted so as not to require
3553 # any *_NATIVE vars be defined in the Makefile
3554 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
3555 # Detect and add ttk subdir
3556 if test -d "${TK_SRC_DIR}/generic/ttk"; then
3557 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\""
3559 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3560 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_XLIB_DIR_NATIVE}\""
3562 if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3563 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/macosx\""
3565 if test "`uname -s`" = "Darwin"; then
3566 # If Tk was built as a framework, attempt to use
3567 # the framework's Headers and PrivateHeaders directories
3570 if test -d "${TK_BIN_DIR}/Headers" -a \
3571 -d "${TK_BIN_DIR}/PrivateHeaders"; then
3572 TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"
3574 TK_INCLUDES="${TK_INCLUDES} ${TK_INCLUDE_SPEC} `echo "${TK_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3578 result="Using ${TK_INCLUDES}"
3580 if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
3581 AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
3583 result="Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}"
3587 AC_SUBST(TK_TOP_DIR_NATIVE)
3588 AC_SUBST(TK_XLIB_DIR_NATIVE)
3590 AC_SUBST(TK_INCLUDES)
3591 AC_MSG_RESULT([${result}])
3594 #------------------------------------------------------------------------
3595 # TEA_PUBLIC_TK_HEADERS --
3597 # Locate the installed public Tk header files
3603 # CYGPATH must be set
3607 # Adds a --with-tkinclude switch to configure.
3610 # Substs the following vars:
3612 #------------------------------------------------------------------------
3614 AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
3615 AC_MSG_CHECKING([for Tk public headers])
3617 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files], with_tkinclude=${withval})
3619 AC_CACHE_VAL(ac_cv_c_tkh, [
3620 # Use the value from --with-tkinclude, if it was given
3622 if test x"${with_tkinclude}" != x ; then
3623 if test -f "${with_tkinclude}/tk.h" ; then
3624 ac_cv_c_tkh=${with_tkinclude}
3626 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
3630 if test "`uname -s`" = "Darwin"; then
3631 # If Tk was built as a framework, attempt to use
3632 # the framework's Headers directory.
3635 list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
3640 # Look in the source dir only if Tk is not installed,
3641 # and in that situation, look there before installed locations.
3642 if test -f "${TK_BIN_DIR}/Makefile" ; then
3643 list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
3646 # Check order: pkg --prefix location, Tk's --prefix location,
3647 # relative to directory of tkConfig.sh, Tcl's --prefix location,
3648 # relative to directory of tclConfig.sh.
3650 eval "temp_includedir=${includedir}"
3652 `ls -d ${temp_includedir} 2>/dev/null` \
3653 `ls -d ${TK_PREFIX}/include 2>/dev/null` \
3654 `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
3655 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3656 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3657 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3658 list="$list /usr/local/include /usr/include"
3659 if test x"${TK_INCLUDE_SPEC}" != x ; then
3660 d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3661 list="$list `ls -d ${d} 2>/dev/null`"
3665 if test -f "$i/tk.h" ; then
3673 # Print a message based on how we determined the include path
3675 if test x"${ac_cv_c_tkh}" = x ; then
3676 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
3678 AC_MSG_RESULT([${ac_cv_c_tkh}])
3681 # Convert to a native path and substitute into the output files.
3683 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
3685 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3687 AC_SUBST(TK_INCLUDES)
3689 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3690 # On Windows and Aqua, we need the X compat headers
3691 AC_MSG_CHECKING([for X11 header files])
3692 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
3693 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
3694 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3695 AC_SUBST(TK_XINCLUDES)
3697 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
3701 #------------------------------------------------------------------------
3702 # TEA_PATH_CONFIG --
3704 # Locate the ${1}Config.sh file and perform a sanity check on
3705 # the ${1} compile flags. These are used by packages like
3706 # [incr Tk] that load *Config.sh files from more than Tcl and Tk.
3713 # Adds the following arguments to configure:
3716 # Defines the following vars:
3717 # $1_BIN_DIR Full path to the directory containing
3718 # the $1Config.sh file
3719 #------------------------------------------------------------------------
3721 AC_DEFUN([TEA_PATH_CONFIG], [
3723 # Ok, lets find the $1 configuration
3724 # First, look for one uninstalled.
3725 # the alternative search directory is invoked by --with-$1
3728 if test x"${no_$1}" = x ; then
3729 # we reset no_$1 in case something fails here
3731 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
3732 AC_MSG_CHECKING([for $1 configuration])
3733 AC_CACHE_VAL(ac_cv_c_$1config,[
3735 # First check to see if --with-$1 was specified.
3736 if test x"${with_$1config}" != x ; then
3737 case ${with_$1config} in
3739 if test -f ${with_$1config}; then
3740 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
3741 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
3744 if test -f "${with_$1config}/$1Config.sh" ; then
3745 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
3747 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
3751 # then check for a private $1 installation
3752 if test x"${ac_cv_c_$1config}" = x ; then
3755 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3756 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3757 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3758 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3760 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3761 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3762 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3763 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3765 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3766 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3767 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3768 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3770 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3771 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3772 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3773 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3775 if test -f "$i/$1Config.sh" ; then
3776 ac_cv_c_$1config=`(cd $i; pwd)`
3779 if test -f "$i/unix/$1Config.sh" ; then
3780 ac_cv_c_$1config=`(cd $i/unix; pwd)`
3786 # check in a few common install locations
3787 if test x"${ac_cv_c_$1config}" = x ; then
3788 for i in `ls -d ${libdir} 2>/dev/null` \
3789 `ls -d ${exec_prefix}/lib 2>/dev/null` \
3790 `ls -d ${prefix}/lib 2>/dev/null` \
3791 `ls -d /usr/local/lib 2>/dev/null` \
3792 `ls -d /usr/contrib/lib 2>/dev/null` \
3793 `ls -d /usr/lib 2>/dev/null` \
3794 `ls -d /usr/lib64 2>/dev/null` \
3796 if test -f "$i/$1Config.sh" ; then
3797 ac_cv_c_$1config=`(cd $i; pwd)`
3804 if test x"${ac_cv_c_$1config}" = x ; then
3805 $1_BIN_DIR="# no $1 configs found"
3806 AC_MSG_WARN([Cannot find $1 configuration definitions])
3810 $1_BIN_DIR=${ac_cv_c_$1config}
3811 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
3816 #------------------------------------------------------------------------
3817 # TEA_LOAD_CONFIG --
3819 # Load the $1Config.sh file
3823 # Requires the following vars to be set:
3828 # Subst the following vars:
3833 #------------------------------------------------------------------------
3835 AC_DEFUN([TEA_LOAD_CONFIG], [
3836 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
3838 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
3839 AC_MSG_RESULT([loading])
3840 . "${$1_BIN_DIR}/$1Config.sh"
3842 AC_MSG_RESULT([file not found])
3846 # If the $1_BIN_DIR is the build directory (not the install directory),
3847 # then set the common variable name to the value of the build variables.
3848 # For example, the variable $1_LIB_SPEC will be set to the value
3849 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
3850 # instead of $1_BUILD_LIB_SPEC since it will work with both an
3851 # installed and uninstalled version of Tcl.
3854 if test -f "${$1_BIN_DIR}/Makefile" ; then
3855 AC_MSG_WARN([Found Makefile - using build library specs for $1])
3856 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
3857 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
3858 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
3859 $1_INCLUDE_SPEC=${$1_BUILD_INCLUDE_SPEC}
3860 $1_LIBRARY_PATH=${$1_LIBRARY_PATH}
3863 AC_SUBST($1_VERSION)
3864 AC_SUBST($1_BIN_DIR)
3865 AC_SUBST($1_SRC_DIR)
3867 AC_SUBST($1_LIB_FILE)
3868 AC_SUBST($1_LIB_SPEC)
3870 AC_SUBST($1_STUB_LIB_FILE)
3871 AC_SUBST($1_STUB_LIB_SPEC)
3872 AC_SUBST($1_STUB_LIB_PATH)
3874 # Allow the caller to prevent this auto-check by specifying any 2nd arg
3875 AS_IF([test "x$2" = x], [
3876 # Check both upper and lower-case variants
3877 # If a dev wanted non-stubs libs, this function could take an option
3878 # to not use _STUB in the paths below
3879 AS_IF([test "x${$1_STUB_LIB_SPEC}" = x],
3880 [TEA_LOAD_CONFIG_LIB(translit($1,[a-z],[A-Z])_STUB)],
3881 [TEA_LOAD_CONFIG_LIB($1_STUB)])
3885 #------------------------------------------------------------------------
3886 # TEA_LOAD_CONFIG_LIB --
3888 # Helper function to load correct library from another extension's
3889 # ${PACKAGE}Config.sh.
3892 # Adds to LIBS the appropriate extension library
3894 #------------------------------------------------------------------------
3895 AC_DEFUN([TEA_LOAD_CONFIG_LIB], [
3896 AC_MSG_CHECKING([For $1 library for LIBS])
3897 # This simplifies the use of stub libraries by automatically adding
3898 # the stub lib to your path. Normally this would add to SHLIB_LD_LIBS,
3899 # but this is called before CONFIG_CFLAGS. More importantly, this adds
3900 # to PKG_LIBS, which becomes LIBS, and that is only used by SHLIB_LD.
3901 if test "x${$1_LIB_SPEC}" != "x" ; then
3902 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
3903 TEA_ADD_LIBS([\"`${CYGPATH} ${$1_LIB_PATH}`\"])
3904 AC_MSG_RESULT([using $1_LIB_PATH ${$1_LIB_PATH}])
3906 TEA_ADD_LIBS([${$1_LIB_SPEC}])
3907 AC_MSG_RESULT([using $1_LIB_SPEC ${$1_LIB_SPEC}])
3910 AC_MSG_RESULT([file not found])
3914 #------------------------------------------------------------------------
3915 # TEA_EXPORT_CONFIG --
3917 # Define the data to insert into the ${PACKAGE}Config.sh file
3921 # Requires the following vars to be set:
3925 # Subst the following vars:
3927 #------------------------------------------------------------------------
3929 AC_DEFUN([TEA_EXPORT_CONFIG], [
3930 #--------------------------------------------------------------------
3931 # These are for $1Config.sh
3932 #--------------------------------------------------------------------
3934 # pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
3935 eval pkglibdir="[$]{libdir}/$1${PACKAGE_VERSION}"
3936 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
3937 eval $1_LIB_FLAG="-l$1${PACKAGE_VERSION}${DBGX}"
3938 eval $1_STUB_LIB_FLAG="-l$1stub${PACKAGE_VERSION}${DBGX}"
3940 eval $1_LIB_FLAG="-l$1`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
3941 eval $1_STUB_LIB_FLAG="-l$1stub`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
3943 $1_BUILD_LIB_SPEC="-L`pwd` ${$1_LIB_FLAG}"
3944 $1_LIB_SPEC="-L${pkglibdir} ${$1_LIB_FLAG}"
3945 $1_BUILD_STUB_LIB_SPEC="-L`pwd` [$]{$1_STUB_LIB_FLAG}"
3946 $1_STUB_LIB_SPEC="-L${pkglibdir} [$]{$1_STUB_LIB_FLAG}"
3947 $1_BUILD_STUB_LIB_PATH="`pwd`/[$]{PKG_STUB_LIB_FILE}"
3948 $1_STUB_LIB_PATH="${pkglibdir}/[$]{PKG_STUB_LIB_FILE}"
3950 AC_SUBST($1_BUILD_LIB_SPEC)
3951 AC_SUBST($1_LIB_SPEC)
3952 AC_SUBST($1_BUILD_STUB_LIB_SPEC)
3953 AC_SUBST($1_STUB_LIB_SPEC)
3954 AC_SUBST($1_BUILD_STUB_LIB_PATH)
3955 AC_SUBST($1_STUB_LIB_PATH)
3957 AC_SUBST(MAJOR_VERSION)
3958 AC_SUBST(MINOR_VERSION)
3959 AC_SUBST(PATCHLEVEL)
3963 #------------------------------------------------------------------------
3966 # Locate Keuchel's celib emulation layer for targeting Win/CE
3973 # Adds the following arguments to configure:
3976 # Defines the following vars:
3977 # CELIB_DIR Full path to the directory containing
3978 # the include and platform lib files
3979 #------------------------------------------------------------------------
3981 AC_DEFUN([TEA_PATH_CELIB], [
3982 # First, look for one uninstalled.
3983 # the alternative search directory is invoked by --with-celib
3985 if test x"${no_celib}" = x ; then
3986 # we reset no_celib in case something fails here
3988 AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval})
3989 AC_MSG_CHECKING([for Windows/CE celib directory])
3990 AC_CACHE_VAL(ac_cv_c_celibconfig,[
3991 # First check to see if --with-celibconfig was specified.
3992 if test x"${with_celibconfig}" != x ; then
3993 if test -d "${with_celibconfig}/inc" ; then
3994 ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)`
3996 AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory])
4000 # then check for a celib library
4001 if test x"${ac_cv_c_celibconfig}" = x ; then
4005 ../../celib-palm-3.0 \
4007 `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \
4008 ${srcdir}/../celib-palm-3.0 \
4009 ${srcdir}/../celib \
4010 `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \
4012 if test -d "$i/inc" ; then
4013 ac_cv_c_celibconfig=`(cd $i; pwd)`
4019 if test x"${ac_cv_c_celibconfig}" = x ; then
4020 AC_MSG_ERROR([Cannot find celib support library directory])
4023 CELIB_DIR=${ac_cv_c_celibconfig}
4024 CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
4025 AC_MSG_RESULT([found $CELIB_DIR])