3 # This file provides a set of autoconf macros to help TEA-enable
6 # Copyright (c) 1999-2000 Ajuba Solutions.
7 # Copyright (c) 2002-2005 ActiveState Corporation.
9 # See the file "license.terms" for information on usage and redistribution
10 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 # Possible values for key variables defined:
16 # TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
17 # TEA_PLATFORM - windows unix
18 # TEA_TK_EXTENSION - True if this is a Tk extension
21 #------------------------------------------------------------------------
22 # TEA_PATH_TCLCONFIG --
24 # Locate the tclConfig.sh file and perform a sanity check on
25 # the Tcl compile flags
32 # Adds the following arguments to configure:
35 # Defines the following vars:
36 # TCL_BIN_DIR Full path to the directory containing
37 # the tclConfig.sh file
38 #------------------------------------------------------------------------
40 AC_DEFUN([TEA_PATH_TCLCONFIG], [
41 dnl TEA specific: Make sure we are initialized
42 AC_REQUIRE([TEA_INIT])
44 # Ok, lets find the tcl configuration
45 # First, look for one uninstalled.
46 # the alternative search directory is invoked by --with-tcl
49 if test x"${no_tcl}" = x ; then
50 # we reset no_tcl in case something fails here
53 AS_HELP_STRING([--with-tcl],
54 [directory containing tcl configuration (tclConfig.sh)]),
55 [with_tclconfig="${withval}"])
56 AC_MSG_CHECKING([for Tcl configuration])
57 AC_CACHE_VAL(ac_cv_c_tclconfig,[
59 # First check to see if --with-tcl was specified.
60 if test x"${with_tclconfig}" != x ; then
61 case "${with_tclconfig}" in
63 if test -f "${with_tclconfig}"; then
64 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
65 with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
68 if test -f "${with_tclconfig}/tclConfig.sh" ; then
69 ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
71 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
75 # then check for a private Tcl installation
76 if test x"${ac_cv_c_tclconfig}" = x ; then
79 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
80 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
81 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
83 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
84 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
85 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
87 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
88 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
89 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
90 if test "${TEA_PLATFORM}" = "windows" \
91 -a -f "$i/win/tclConfig.sh" ; then
92 ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
95 if test -f "$i/unix/tclConfig.sh" ; then
96 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
102 # on Darwin, check in Framework installation locations
103 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
104 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
105 `ls -d /Library/Frameworks 2>/dev/null` \
106 `ls -d /Network/Library/Frameworks 2>/dev/null` \
107 `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks/Tcl.framework 2>/dev/null` \
108 `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Network/Library/Frameworks/Tcl.framework 2>/dev/null` \
109 `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework 2>/dev/null` \
111 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
112 ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
118 # TEA specific: on Windows, check in common installation locations
119 if test "${TEA_PLATFORM}" = "windows" \
120 -a x"${ac_cv_c_tclconfig}" = x ; then
121 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
122 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
124 if test -f "$i/tclConfig.sh" ; then
125 ac_cv_c_tclconfig="`(cd $i; pwd)`"
131 # check in a few common install locations
132 if test x"${ac_cv_c_tclconfig}" = x ; then
133 for i in `ls -d ${libdir} 2>/dev/null` \
134 `ls -d ${exec_prefix}/lib 2>/dev/null` \
135 `ls -d ${prefix}/lib 2>/dev/null` \
136 `ls -d /usr/local/lib 2>/dev/null` \
137 `ls -d /usr/contrib/lib 2>/dev/null` \
138 `ls -d /usr/pkg/lib 2>/dev/null` \
139 `ls -d /usr/lib 2>/dev/null` \
140 `ls -d /usr/lib64 2>/dev/null` \
141 `ls -d /usr/lib/tcl8.6 2>/dev/null` \
142 `ls -d /usr/lib/tcl8.5 2>/dev/null` \
143 `ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
144 `ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
145 `ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \
146 `ls -d /usr/local/lib/tcl/tcl8.5 2>/dev/null` \
148 if test -f "$i/tclConfig.sh" ; then
149 ac_cv_c_tclconfig="`(cd $i; pwd)`"
155 # check in a few other private locations
156 if test x"${ac_cv_c_tclconfig}" = x ; then
159 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
160 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
161 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
162 if test "${TEA_PLATFORM}" = "windows" \
163 -a -f "$i/win/tclConfig.sh" ; then
164 ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
167 if test -f "$i/unix/tclConfig.sh" ; then
168 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
175 if test x"${ac_cv_c_tclconfig}" = x ; then
176 TCL_BIN_DIR="# no Tcl configs found"
177 AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh])
180 TCL_BIN_DIR="${ac_cv_c_tclconfig}"
181 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
186 #------------------------------------------------------------------------
187 # TEA_PATH_TKCONFIG --
189 # Locate the tkConfig.sh file
196 # Adds the following arguments to configure:
199 # Defines the following vars:
200 # TK_BIN_DIR Full path to the directory containing
201 # the tkConfig.sh file
202 #------------------------------------------------------------------------
204 AC_DEFUN([TEA_PATH_TKCONFIG], [
206 # Ok, lets find the tk configuration
207 # First, look for one uninstalled.
208 # the alternative search directory is invoked by --with-tk
211 if test x"${no_tk}" = x ; then
212 # we reset no_tk in case something fails here
215 AS_HELP_STRING([--with-tk],
216 [directory containing tk configuration (tkConfig.sh)]),
217 [with_tkconfig="${withval}"])
218 AC_MSG_CHECKING([for Tk configuration])
219 AC_CACHE_VAL(ac_cv_c_tkconfig,[
221 # First check to see if --with-tkconfig was specified.
222 if test x"${with_tkconfig}" != x ; then
223 case "${with_tkconfig}" in
225 if test -f "${with_tkconfig}"; then
226 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
227 with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
230 if test -f "${with_tkconfig}/tkConfig.sh" ; then
231 ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
233 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
237 # then check for a private Tk library
238 if test x"${ac_cv_c_tkconfig}" = x ; then
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` \
249 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
250 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
251 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
252 if test "${TEA_PLATFORM}" = "windows" \
253 -a -f "$i/win/tkConfig.sh" ; then
254 ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
257 if test -f "$i/unix/tkConfig.sh" ; then
258 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
264 # on Darwin, check in Framework installation locations
265 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
266 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
267 `ls -d /Library/Frameworks 2>/dev/null` \
268 `ls -d /Network/Library/Frameworks 2>/dev/null` \
270 if test -f "$i/Tk.framework/tkConfig.sh" ; then
271 ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
277 # check in a few common install locations
278 if test x"${ac_cv_c_tkconfig}" = x ; then
279 for i in `ls -d ${libdir} 2>/dev/null` \
280 `ls -d ${exec_prefix}/lib 2>/dev/null` \
281 `ls -d ${prefix}/lib 2>/dev/null` \
282 `ls -d /usr/local/lib 2>/dev/null` \
283 `ls -d /usr/contrib/lib 2>/dev/null` \
284 `ls -d /usr/pkg/lib 2>/dev/null` \
285 `ls -d /usr/lib/tk8.6 2>/dev/null` \
286 `ls -d /usr/lib/tk8.5 2>/dev/null` \
287 `ls -d /usr/lib 2>/dev/null` \
288 `ls -d /usr/lib64 2>/dev/null` \
289 `ls -d /usr/local/lib/tk8.6 2>/dev/null` \
290 `ls -d /usr/local/lib/tk8.5 2>/dev/null` \
291 `ls -d /usr/local/lib/tcl/tk8.6 2>/dev/null` \
292 `ls -d /usr/local/lib/tcl/tk8.5 2>/dev/null` \
294 if test -f "$i/tkConfig.sh" ; then
295 ac_cv_c_tkconfig="`(cd $i; pwd)`"
301 # TEA specific: on Windows, check in common installation locations
302 if test "${TEA_PLATFORM}" = "windows" \
303 -a x"${ac_cv_c_tkconfig}" = x ; then
304 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
305 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
307 if test -f "$i/tkConfig.sh" ; then
308 ac_cv_c_tkconfig="`(cd $i; pwd)`"
314 # check in a few other private locations
315 if test x"${ac_cv_c_tkconfig}" = x ; then
318 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
319 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
320 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
321 if test "${TEA_PLATFORM}" = "windows" \
322 -a -f "$i/win/tkConfig.sh" ; then
323 ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
326 if test -f "$i/unix/tkConfig.sh" ; then
327 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
334 if test x"${ac_cv_c_tkconfig}" = x ; then
335 TK_BIN_DIR="# no Tk configs found"
336 AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh])
339 TK_BIN_DIR="${ac_cv_c_tkconfig}"
340 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
345 #------------------------------------------------------------------------
346 # TEA_LOAD_TCLCONFIG --
348 # Load the tclConfig.sh file
352 # Requires the following vars to be set:
357 # Substitutes the following vars:
363 #------------------------------------------------------------------------
365 AC_DEFUN([TEA_LOAD_TCLCONFIG], [
366 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
368 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
369 AC_MSG_RESULT([loading])
370 . "${TCL_BIN_DIR}/tclConfig.sh"
372 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
375 # If the TCL_BIN_DIR is the build directory (not the install directory),
376 # then set the common variable name to the value of the build variables.
377 # For example, the variable TCL_LIB_SPEC will be set to the value
378 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
379 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
380 # installed and uninstalled version of Tcl.
381 if test -f "${TCL_BIN_DIR}/Makefile" ; then
382 TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
383 TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
384 TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
385 elif test "`uname -s`" = "Darwin"; then
386 # If Tcl was built as a framework, attempt to use the libraries
387 # from the framework at the given location so that linking works
388 # against Tcl.framework installed in an arbitrary location.
391 if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
392 for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
393 "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
394 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
395 TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
400 if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
401 TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
402 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
408 AC_SUBST(TCL_VERSION)
409 AC_SUBST(TCL_PATCH_LEVEL)
410 AC_SUBST(TCL_BIN_DIR)
411 AC_SUBST(TCL_SRC_DIR)
413 AC_SUBST(TCL_LIB_FILE)
414 AC_SUBST(TCL_LIB_FLAG)
415 AC_SUBST(TCL_LIB_SPEC)
417 AC_SUBST(TCL_STUB_LIB_FILE)
418 AC_SUBST(TCL_STUB_LIB_FLAG)
419 AC_SUBST(TCL_STUB_LIB_SPEC)
421 AC_MSG_CHECKING([platform])
422 hold_cc=$CC; CC="$TCL_CC"
423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
428 # first test we've already retrieved platform (cross-compile), fallback to unix otherwise:
429 TEA_PLATFORM="${TEA_PLATFORM-unix}"
432 TEA_PLATFORM="windows"
433 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
436 AC_MSG_RESULT($TEA_PLATFORM)
438 # The BUILD_$pkg is to define the correct extern storage class
439 # handling when making this package
440 AC_DEFINE_UNQUOTED(BUILD_${PACKAGE_NAME}, [],
441 [Building extension source?])
442 # Do this here as we have fully defined TEA_PLATFORM now
443 if test "${TEA_PLATFORM}" = "windows" ; then
445 CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp"
452 AC_SUBST(TCL_EXTRA_CFLAGS)
453 AC_SUBST(TCL_LD_FLAGS)
454 AC_SUBST(TCL_SHLIB_LD_LIBS)
457 #------------------------------------------------------------------------
458 # TEA_LOAD_TKCONFIG --
460 # Load the tkConfig.sh file
464 # Requires the following vars to be set:
469 # Sets the following vars that should be in tkConfig.sh:
471 #------------------------------------------------------------------------
473 AC_DEFUN([TEA_LOAD_TKCONFIG], [
474 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
476 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
477 AC_MSG_RESULT([loading])
478 . "${TK_BIN_DIR}/tkConfig.sh"
480 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
483 # If the TK_BIN_DIR is the build directory (not the install directory),
484 # then set the common variable name to the value of the build variables.
485 # For example, the variable TK_LIB_SPEC will be set to the value
486 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
487 # instead of TK_BUILD_LIB_SPEC since it will work with both an
488 # installed and uninstalled version of Tcl.
489 if test -f "${TK_BIN_DIR}/Makefile" ; then
490 TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
491 TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
492 TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
493 elif test "`uname -s`" = "Darwin"; then
494 # If Tk was built as a framework, attempt to use the libraries
495 # from the framework at the given location so that linking works
496 # against Tk.framework installed in an arbitrary location.
499 if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
500 for i in "`cd "${TK_BIN_DIR}"; pwd`" \
501 "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
502 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
503 TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
508 if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
509 TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
510 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
516 # TEA specific: Ensure windowingsystem is defined
517 if test "${TEA_PLATFORM}" = "unix" ; then
520 AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
521 TEA_WINDOWINGSYSTEM="aqua"
524 TEA_WINDOWINGSYSTEM="x11"
527 elif test "${TEA_PLATFORM}" = "windows" ; then
528 TEA_WINDOWINGSYSTEM="win32"
535 AC_SUBST(TK_LIB_FILE)
536 AC_SUBST(TK_LIB_FLAG)
537 AC_SUBST(TK_LIB_SPEC)
539 AC_SUBST(TK_STUB_LIB_FILE)
540 AC_SUBST(TK_STUB_LIB_FLAG)
541 AC_SUBST(TK_STUB_LIB_SPEC)
545 AC_SUBST(TK_XINCLUDES)
548 #------------------------------------------------------------------------
550 # Determine the fully qualified path name of the tclsh executable
551 # in the Tcl build directory or the tclsh installed in a bin
552 # directory. This macro will correctly determine the name
553 # of the tclsh executable even if tclsh has not yet been
554 # built in the build directory. The tclsh found is always
555 # associated with a tclConfig.sh file. This tclsh should be used
556 # only for running extension test cases. It should never be
557 # or generation of files (like pkgIndex.tcl) at build time.
563 # Substitutes the following vars:
565 #------------------------------------------------------------------------
567 AC_DEFUN([TEA_PROG_TCLSH], [
568 AC_MSG_CHECKING([for tclsh])
569 if test -f "${TCL_BIN_DIR}/Makefile" ; then
570 # tclConfig.sh is in Tcl build directory
571 if test "${TEA_PLATFORM}" = "windows"; then
572 if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}" ; then
573 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}"
574 elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}s${EXEEXT}" ; then
575 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}s${EXEEXT}"
576 elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}t${EXEEXT}" ; then
577 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}t${EXEEXT}"
578 elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}st${EXEEXT}" ; then
579 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}st${EXEEXT}"
582 TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
585 # tclConfig.sh is in install location
586 if test "${TEA_PLATFORM}" = "windows"; then
587 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}"
589 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}"
591 list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
592 `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
593 `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
595 if test -f "$i/${TCLSH_PROG}" ; then
596 REAL_TCL_BIN_DIR="`cd "$i"; pwd`/"
600 TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}"
602 AC_MSG_RESULT([${TCLSH_PROG}])
606 #------------------------------------------------------------------------
608 # Determine the fully qualified path name of the wish executable
609 # in the Tk build directory or the wish installed in a bin
610 # directory. This macro will correctly determine the name
611 # of the wish executable even if wish has not yet been
612 # built in the build directory. The wish found is always
613 # associated with a tkConfig.sh file. This wish should be used
614 # only for running extension test cases. It should never be
615 # or generation of files (like pkgIndex.tcl) at build time.
621 # Substitutes the following vars:
623 #------------------------------------------------------------------------
625 AC_DEFUN([TEA_PROG_WISH], [
626 AC_MSG_CHECKING([for wish])
627 if test -f "${TK_BIN_DIR}/Makefile" ; then
628 # tkConfig.sh is in Tk build directory
629 if test "${TEA_PLATFORM}" = "windows"; then
630 if test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}" ; then
631 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}"
632 elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}s${EXEEXT}" ; then
633 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}$s{EXEEXT}"
634 elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}t${EXEEXT}" ; then
635 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}t${EXEEXT}"
636 elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}st${EXEEXT}" ; then
637 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}st${EXEEXT}"
640 WISH_PROG="${TK_BIN_DIR}/wish"
643 # tkConfig.sh is in install location
644 if test "${TEA_PLATFORM}" = "windows"; then
645 WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}"
647 WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}"
649 list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
650 `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
651 `ls -d ${TK_PREFIX}/bin 2>/dev/null`"
653 if test -f "$i/${WISH_PROG}" ; then
654 REAL_TK_BIN_DIR="`cd "$i"; pwd`/"
658 WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}"
660 AC_MSG_RESULT([${WISH_PROG}])
664 #------------------------------------------------------------------------
665 # TEA_ENABLE_SHARED --
667 # Allows the building of shared libraries
674 # Adds the following arguments to configure:
675 # --enable-shared=yes|no
676 # --enable-stubs=yes|no
678 # Defines the following vars:
679 # STATIC_BUILD Used for building import/export libraries
682 # Sets the following vars:
683 # SHARED_BUILD Value of 1 or 0
684 # STUBS_BUILD Value if 1 or 0
685 # USE_TCL_STUBS Value true: if SHARED_BUILD or --enable-stubs
686 # USE_TCLOO_STUBS Value true: if SHARED_BUILD or --enable-stubs
687 # USE_TK_STUBS Value true: if SHARED_BUILD or --enable-stubs
688 # AND TEA_WINDOWING_SYSTEM != ""
689 #------------------------------------------------------------------------
690 AC_DEFUN([TEA_ENABLE_SHARED], [
691 AC_MSG_CHECKING([how to build libraries])
692 AC_ARG_ENABLE(shared,
693 AS_HELP_STRING([--enable-shared],
694 [build and link with shared libraries (default: on)]),
695 [shared_ok=$enableval], [shared_ok=yes])
697 if test "${enable_shared+set}" = set; then
698 enableval="$enable_shared"
705 AS_HELP_STRING([--enable-stubs],
706 [build and link with stub libraries. Always true for shared builds (default: on)]),
707 [stubs_ok=$enableval], [stubs_ok=yes])
709 if test "${enable_stubs+set}" = set; then
710 enableval="$enable_stubs"
716 # Stubs are always enabled for shared builds
717 if test "$shared_ok" = "yes" ; then
718 AC_MSG_RESULT([shared])
722 AC_MSG_RESULT([static])
724 AC_DEFINE(STATIC_BUILD, 1, [This a static build])
725 if test "$stubs_ok" = "yes" ; then
731 if test "${STUBS_BUILD}" = "1" ; then
732 AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs])
733 AC_DEFINE(USE_TCLOO_STUBS, 1, [Use TclOO stubs])
734 if test "${TEA_WINDOWINGSYSTEM}" != ""; then
735 AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs])
739 AC_SUBST(SHARED_BUILD)
740 AC_SUBST(STUBS_BUILD)
743 #------------------------------------------------------------------------
744 # TEA_ENABLE_THREADS --
746 # Specify if thread support should be enabled. If "yes" is specified
747 # as an arg (optional), threads are enabled by default, "no" means
748 # threads are disabled. "yes" is the default.
750 # TCL_THREADS is checked so that if you are compiling an extension
751 # against a threaded core, your extension must be compiled threaded
754 # Note that it is legal to have a thread enabled extension run in a
755 # threaded or non-threaded Tcl core, but a non-threaded extension may
756 # only run in a non-threaded Tcl core.
763 # Adds the following arguments to configure:
766 # Sets the following vars:
767 # THREADS_LIBS Thread library(s)
769 # Defines the following vars:
773 #------------------------------------------------------------------------
775 AC_DEFUN([TEA_ENABLE_THREADS], [
776 AC_ARG_ENABLE(threads,
777 AS_HELP_STRING([--enable-threads],
778 [build with threads (default: on)]),
779 [tcl_ok=$enableval], [tcl_ok=yes])
781 if test "${enable_threads+set}" = set; then
782 enableval="$enable_threads"
788 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
791 if test "${TEA_PLATFORM}" != "windows" ; then
792 # We are always OK on Windows, so check what this platform wants:
794 # USE_THREAD_ALLOC tells us to try the special thread-based
795 # allocator that significantly reduces lock contention
796 AC_DEFINE(USE_THREAD_ALLOC, 1,
797 [Do we want to use the threaded memory allocator?])
798 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
799 if test "`uname -s`" = "SunOS" ; then
800 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
801 [Do we really want to follow the standard? Yes we do!])
803 AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
804 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
805 if test "$tcl_ok" = "no"; then
806 # Check a little harder for __pthread_mutex_init in the same
807 # library, as some systems hide it there until pthread.h is
808 # defined. We could alternatively do an AC_TRY_COMPILE with
809 # pthread.h, but that will work with libpthread really doesn't
810 # exist, like AIX 4.2. [Bug: 4359]
811 AC_CHECK_LIB(pthread, __pthread_mutex_init,
812 tcl_ok=yes, tcl_ok=no)
815 if test "$tcl_ok" = "yes"; then
816 # The space is needed
817 THREADS_LIBS=" -lpthread"
819 AC_CHECK_LIB(pthreads, pthread_mutex_init,
820 tcl_ok=yes, tcl_ok=no)
821 if test "$tcl_ok" = "yes"; then
822 # The space is needed
823 THREADS_LIBS=" -lpthreads"
825 AC_CHECK_LIB(c, pthread_mutex_init,
826 tcl_ok=yes, tcl_ok=no)
827 if test "$tcl_ok" = "no"; then
828 AC_CHECK_LIB(c_r, pthread_mutex_init,
829 tcl_ok=yes, tcl_ok=no)
830 if test "$tcl_ok" = "yes"; then
831 # The space is needed
832 THREADS_LIBS=" -pthread"
835 AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
844 # Do checking message here to not mess up interleaved configure output
845 AC_MSG_CHECKING([for building with threads])
846 if test "${TCL_THREADS}" = 1; then
847 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
848 AC_MSG_RESULT([yes (default)])
852 # TCL_THREADS sanity checking. See if our request for building with
853 # threads is the same as the way Tcl was built. If not, warn the user.
856 if test "${TCL_THREADS}" = "0"; then
858 Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
859 that IS thread-enabled. It is recommended to use --enable-threads.])
863 AC_SUBST(TCL_THREADS)
866 #------------------------------------------------------------------------
867 # TEA_ENABLE_SYMBOLS --
869 # Specify if debugging symbols should be used.
870 # Memory (TCL_MEM_DEBUG) debugging can also be enabled.
875 # TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
876 # the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
877 # Requires the following vars to be set in the Makefile:
883 # Adds the following arguments to configure:
886 # Defines the following vars:
887 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
888 # Sets to "$(CFLAGS_OPTIMIZE) -DNDEBUG" if false
889 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
890 # Sets to $(LDFLAGS_OPTIMIZE) if false
891 #------------------------------------------------------------------------
893 AC_DEFUN([TEA_ENABLE_SYMBOLS], [
894 dnl TEA specific: Make sure we are initialized
895 AC_REQUIRE([TEA_CONFIG_CFLAGS])
896 AC_MSG_CHECKING([for build with symbols])
897 AC_ARG_ENABLE(symbols,
898 AS_HELP_STRING([--enable-symbols],
899 [build with debugging symbols (default: off)]),
900 [tcl_ok=$enableval], [tcl_ok=no])
901 if test "$tcl_ok" = "no"; then
902 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE} -DNDEBUG"
903 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
905 AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
907 CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
908 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
909 if test "$tcl_ok" = "yes"; then
910 AC_MSG_RESULT([yes (standard debugging)])
913 AC_SUBST(CFLAGS_DEFAULT)
914 AC_SUBST(LDFLAGS_DEFAULT)
916 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
917 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
920 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
921 if test "$tcl_ok" = "all"; then
922 AC_MSG_RESULT([enabled symbols mem debugging])
924 AC_MSG_RESULT([enabled $tcl_ok debugging])
929 #------------------------------------------------------------------------
930 # TEA_ENABLE_LANGINFO --
932 # Allows use of modern nl_langinfo check for better l10n.
933 # This is only relevant for Unix.
940 # Adds the following arguments to configure:
941 # --enable-langinfo=yes|no (default is yes)
943 # Defines the following vars:
944 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
945 #------------------------------------------------------------------------
947 AC_DEFUN([TEA_ENABLE_LANGINFO], [
948 AC_ARG_ENABLE(langinfo,
949 AS_HELP_STRING([--enable-langinfo],
950 [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
951 [langinfo_ok=$enableval], [langinfo_ok=yes])
954 if test "$langinfo_ok" = "yes"; then
955 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
957 AC_MSG_CHECKING([whether to use nl_langinfo])
958 if test "$langinfo_ok" = "yes"; then
959 AC_CACHE_VAL(tcl_cv_langinfo_h, [
960 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(CODESET);]])],
961 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
962 AC_MSG_RESULT([$tcl_cv_langinfo_h])
963 if test $tcl_cv_langinfo_h = yes; then
964 AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
967 AC_MSG_RESULT([$langinfo_ok])
971 #--------------------------------------------------------------------
974 # Determine what the system is (some things cannot be easily checked
975 # on a feature-driven basis, alas). This can usually be done via the
982 # Defines the following var:
984 # system - System/platform/version identification code.
986 #--------------------------------------------------------------------
988 AC_DEFUN([TEA_CONFIG_SYSTEM], [
989 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
991 if test "${TEA_PLATFORM}" = "windows" ; then
992 tcl_cv_sys_version=windows
994 tcl_cv_sys_version=`uname -s`-`uname -r`
995 if test "$?" -ne 0 ; then
996 AC_MSG_WARN([can't find uname command])
997 tcl_cv_sys_version=unknown
999 if test "`uname -s`" = "AIX" ; then
1000 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
1002 if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
1003 tcl_cv_sys_version=NetBSD-Debian
1008 system=$tcl_cv_sys_version
1011 #--------------------------------------------------------------------
1014 # Try to determine the proper flags to pass to the compiler
1015 # for building shared libraries and other such nonsense.
1022 # Defines and substitutes the following vars:
1024 # DL_OBJS, DL_LIBS - removed for TEA, only needed by core.
1025 # LDFLAGS - Flags to pass to the compiler when linking object
1026 # files into an executable application binary such
1028 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
1029 # that tell the run-time dynamic linker where to look
1030 # for shared libraries such as libtcl.so. Depends on
1031 # the variable LIB_RUNTIME_DIR in the Makefile. Could
1032 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
1033 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
1034 # that tell the run-time dynamic linker where to look
1035 # for shared libraries such as libtcl.so. Depends on
1036 # the variable LIB_RUNTIME_DIR in the Makefile.
1037 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
1038 # of a shared library (may request position-independent
1039 # code, among other things).
1040 # SHLIB_LD - Base command to use for combining object files
1041 # into a shared library.
1042 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
1043 # creating shared libraries. This symbol typically
1044 # goes at the end of the "ld" commands that build
1045 # shared libraries. The value of the symbol defaults to
1046 # "${LIBS}" if all of the dependent libraries should
1047 # be specified when creating a shared library. If
1048 # dependent libraries should not be specified (as on
1049 # SunOS 4.x, where they cause the link to fail, or in
1050 # general if Tcl and Tk aren't themselves shared
1051 # libraries), then this symbol has an empty string
1053 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
1054 # extensions. An empty string means we don't know how
1055 # to use shared libraries on this platform.
1056 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
1057 # in a static or shared library name, using the $PACKAGE_VERSION variable
1058 # to put the version in the right place. This is used
1059 # by platforms that need non-standard library names.
1060 # Examples: ${PACKAGE_VERSION}.so.1.1 on NetBSD, since it needs
1061 # to have a version after the .so, and ${PACKAGE_VERSION}.a
1062 # on AIX, since a shared library needs to have
1063 # a .a extension whereas shared objects for loadable
1064 # extensions have a .so extension. Defaults to
1065 # ${PACKAGE_VERSION}${SHLIB_SUFFIX}.
1067 # Flags used when running the compiler in debug mode
1069 # Flags used when running the compiler in optimize mode
1070 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
1071 #--------------------------------------------------------------------
1073 AC_DEFUN([TEA_CONFIG_CFLAGS], [
1074 dnl TEA specific: Make sure we are initialized
1075 AC_REQUIRE([TEA_INIT])
1077 # Step 0.a: Enable 64 bit support?
1079 AC_MSG_CHECKING([if 64bit support is requested])
1080 AC_ARG_ENABLE(64bit,
1081 AS_HELP_STRING([--enable-64bit],
1082 [enable 64bit support (default: off)]),
1083 [do64bit=$enableval], [do64bit=no])
1084 AC_MSG_RESULT([$do64bit])
1086 # Step 0.b: Enable Solaris 64 bit VIS support?
1088 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1089 AC_ARG_ENABLE(64bit-vis,
1090 AS_HELP_STRING([--enable-64bit-vis],
1091 [enable 64bit Sparc VIS support (default: off)]),
1092 [do64bitVIS=$enableval], [do64bitVIS=no])
1093 AC_MSG_RESULT([$do64bitVIS])
1094 # Force 64bit on with VIS
1095 AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
1097 # Step 0.c: Check if visibility support is available. Do this here so
1098 # that platform specific alternatives can be used below if this fails.
1100 AC_CACHE_CHECK([if compiler supports visibility "hidden"],
1101 tcl_cv_cc_visibility_hidden, [
1102 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
1103 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1104 extern __attribute__((__visibility__("hidden"))) void f(void);
1105 void f(void) {}]], [[f();]])],[tcl_cv_cc_visibility_hidden=yes],
1106 [tcl_cv_cc_visibility_hidden=no])
1107 CFLAGS=$hold_cflags])
1108 AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
1109 AC_DEFINE(MODULE_SCOPE,
1110 [extern __attribute__((__visibility__("hidden")))],
1111 [Compiler support for module scope symbols])
1112 AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols])
1115 # Step 0.d: Disable -rpath support?
1117 AC_MSG_CHECKING([if rpath support is requested])
1118 AC_ARG_ENABLE(rpath,
1119 AS_HELP_STRING([--disable-rpath],
1120 [disable rpath support (default: on)]),
1121 [doRpath=$enableval], [doRpath=yes])
1122 AC_MSG_RESULT([$doRpath])
1124 # Set the variable "system" to hold the name and version number
1129 # Require ranlib early so we can override it in special cases below.
1131 AC_REQUIRE([AC_PROG_RANLIB])
1133 # Set configuration options based on system name and version.
1134 # This is similar to Tcl's unix/tcl.m4 except that we've added a
1135 # "windows" case and removed some core-only vars.
1138 # default to '{$LIBS}' and set to "" on per-platform necessary basis
1139 SHLIB_LD_LIBS='${LIBS}'
1140 # When ld needs options to work in 64-bit mode, put them in
1141 # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
1142 # is disabled by the user. [Bug 1016796]
1144 UNSHARED_LIB_SUFFIX=""
1145 # TEA specific: use PACKAGE_VERSION instead of VERSION
1146 TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
1147 ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
1148 TCL_LIB_VERSIONS_OK=ok
1150 AS_IF([test "$GCC" = yes], [
1152 CFLAGS_WARNING="-Wall"
1157 AC_CHECK_TOOL(AR, ar)
1159 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1160 AS_IF([test "x$SHLIB_VERSION" = x],[SHLIB_VERSION=""],[SHLIB_VERSION=".$SHLIB_VERSION"])
1165 if test "$do64bit" != "no" ; then
1168 MACHINE="AMD64" ; # default to AMD64 64-bit build
1176 if test "$GCC" != "yes" ; then
1177 if test "${SHARED_BUILD}" = "0" ; then
1182 case "x`echo \${VisualStudioVersion}`" in
1184 lflags="${lflags} -nodefaultlib:libucrt.lib"
1185 TEA_ADD_LIBS([ucrt.lib])
1191 if test "$do64bit" != "no" ; then
1194 lflags="${lflags} -nologo -MACHINE:${MACHINE} "
1196 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
1197 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1198 # Avoid 'unresolved external symbol __security_cookie'
1199 # errors, c.f. http://support.microsoft.com/?id=894573
1200 TEA_ADD_LIBS([bufferoverflowU.lib])
1203 lflags="${lflags} -nologo"
1205 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
1206 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1210 if test "$GCC" = "yes"; then
1212 AC_CHECK_TOOL(RC, windres)
1214 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1215 SHLIB_LD='${CC} -shared'
1216 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1217 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
1218 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
1220 AC_CACHE_CHECK(for cross-compile version of gcc,
1222 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1224 #error cross-compiler
1230 if test "$ac_cv_cross" = "yes"; then
1233 CC="x86_64-w64-mingw32-${CC}"
1234 LD="x86_64-w64-mingw32-ld"
1235 AR="x86_64-w64-mingw32-ar"
1236 RANLIB="x86_64-w64-mingw32-ranlib"
1237 RC="x86_64-w64-mingw32-windres"
1240 CC="i686-w64-mingw32-${CC}"
1241 LD="i686-w64-mingw32-ld"
1242 AR="i686-w64-mingw32-ar"
1243 RANLIB="i686-w64-mingw32-ranlib"
1244 RC="i686-w64-mingw32-windres"
1250 SHLIB_LD="${LINKBIN} -dll ${lflags}"
1251 # link -lib only works when -lib is the first arg
1252 STLIB_LD="${LINKBIN} -lib ${lflags}"
1253 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
1255 # For information on what debugtype is most useful, see:
1256 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
1258 # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx
1259 # This essentially turns it all on.
1260 LDFLAGS_DEBUG="-debug -debugtype:cv"
1261 LDFLAGS_OPTIMIZE="-release"
1262 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
1263 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
1267 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
1269 TCL_LIB_VERSIONS_OK=nodots
1272 AS_IF([test "$GCC" != "yes"], [
1273 # AIX requires the _r compiler when gcc isn't being used
1279 # Make sure only first arg gets _r
1280 CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
1283 AC_MSG_RESULT([Using $CC for compiling with threads])
1289 LD_LIBRARY_PATH_VAR="LIBPATH"
1291 # Check to enable 64-bit flags for compiler/linker
1292 AS_IF([test "$do64bit" = yes], [
1293 AS_IF([test "$GCC" = yes], [
1294 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1297 CFLAGS="$CFLAGS -q64"
1299 RANLIB="${RANLIB} -X64"
1301 SHLIB_LD_FLAGS="-b64"
1305 AS_IF([test "`uname -m`" = ia64], [
1306 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1307 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1308 AS_IF([test "$GCC" = yes], [
1309 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1311 CC_SEARCH_FLAGS='"-R${LIB_RUNTIME_DIR}"'
1313 LD_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
1315 AS_IF([test "$GCC" = yes], [
1316 SHLIB_LD='${CC} -shared -Wl,-bexpall'
1318 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
1319 LDFLAGS="$LDFLAGS -brtl"
1321 SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1322 CC_SEARCH_FLAGS='"-L${LIB_RUNTIME_DIR}"'
1323 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1327 SHLIB_CFLAGS="-fPIC"
1328 SHLIB_LD='${CC} -nostart'
1331 #-----------------------------------------------------------
1332 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1333 # -lsocket, even if the network functions are in -lnet which
1334 # is always linked to, for compatibility.
1335 #-----------------------------------------------------------
1336 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1338 BSD/OS-2.1*|BSD/OS-3*)
1340 SHLIB_LD="shlicc -r"
1346 SHLIB_CFLAGS="-export-dynamic -fPIC"
1347 SHLIB_LD='${CC} -shared'
1349 LDFLAGS="$LDFLAGS -export-dynamic"
1355 SHLIB_LD='${CC} -shared'
1357 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$[@].a"
1364 SHLIB_CFLAGS="-K PIC"
1372 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1373 SHLIB_CFLAGS="-fPIC"
1375 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
1376 AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
1379 # Use updated header definitions where possible
1380 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1381 # TEA specific: Needed by Tcl, but not most extensions
1382 #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1383 #LIBS="$LIBS -lxnet" # Use the XOPEN network library
1385 AS_IF([test "`uname -m`" = ia64], [
1390 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1391 AS_IF([test "$tcl_ok" = yes], [
1394 LDFLAGS="$LDFLAGS -Wl,-E"
1395 CC_SEARCH_FLAGS='"-Wl,+s,+b,${LIB_RUNTIME_DIR}:."'
1396 LD_SEARCH_FLAGS='+s +b "${LIB_RUNTIME_DIR}:."'
1397 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1399 AS_IF([test "$GCC" = yes], [
1400 SHLIB_LD='${CC} -shared'
1401 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1406 # Check to enable 64-bit flags for compiler/linker
1407 AS_IF([test "$do64bit" = "yes"], [
1408 AS_IF([test "$GCC" = yes], [
1409 case `${CC} -dumpmachine` in
1411 # 64-bit gcc in use. Fix flags for GNU ld.
1413 SHLIB_LD='${CC} -shared'
1414 AS_IF([test $doRpath = yes], [
1415 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1416 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1419 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1424 CFLAGS="$CFLAGS +DD64"
1425 LDFLAGS_ARCH="+DD64"
1428 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1430 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1431 AS_IF([test "$tcl_ok" = yes], [
1435 LDFLAGS="$LDFLAGS -Wl,-E"
1436 CC_SEARCH_FLAGS='"-Wl,+s,+b,${LIB_RUNTIME_DIR}:."'
1437 LD_SEARCH_FLAGS='+s +b "${LIB_RUNTIME_DIR}:."'
1438 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1442 SHLIB_LD="ld -shared -rdata_shared"
1445 AS_IF([test $doRpath = yes], [
1446 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1447 LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
1451 SHLIB_LD="ld -n32 -shared -rdata_shared"
1453 AS_IF([test $doRpath = yes], [
1454 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1455 LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
1456 AS_IF([test "$GCC" = yes], [
1457 CFLAGS="$CFLAGS -mabi=n32"
1458 LDFLAGS="$LDFLAGS -mabi=n32"
1462 # Use to build 6.2 compatible binaries on 6.3.
1463 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1466 CFLAGS="$CFLAGS -n32"
1469 LDFLAGS="$LDFLAGS -n32"
1474 SHLIB_LD="ld -n32 -shared -rdata_shared"
1476 AS_IF([test $doRpath = yes], [
1477 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1478 LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
1480 # Check to enable 64-bit flags for compiler/linker
1482 AS_IF([test "$do64bit" = yes], [
1483 AS_IF([test "$GCC" = yes], [
1484 AC_MSG_WARN([64bit mode not supported by gcc])
1487 SHLIB_LD="ld -64 -shared -rdata_shared"
1488 CFLAGS="$CFLAGS -64"
1493 Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
1494 SHLIB_CFLAGS="-fPIC"
1498 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1500 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1501 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS_DEFAULT} -shared'
1502 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1505 DragonFly-*|FreeBSD-*)
1506 AS_IF([test "${TCL_THREADS}" = "1"], [
1507 # The -pthread needs to go in the LDFLAGS, not LIBS
1508 LIBS=`echo $LIBS | sed s/-pthread//`
1509 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1510 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
1514 AS_IF([test $doRpath = yes], [
1515 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1516 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1517 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1518 AS_IF([test $do64bit = yes], [
1519 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1521 CFLAGS="$CFLAGS -m64"
1522 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1523 [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
1524 CFLAGS=$hold_cflags])
1525 AS_IF([test $tcl_cv_cc_m64 = yes], [
1526 CFLAGS="$CFLAGS -m64"
1531 # The combo of gcc + glibc has a bug related to inlining of
1532 # functions like strtod(). The -fno-builtin flag should address
1533 # this problem but it does not work. The -fno-inline flag is kind
1534 # of overkill but it works. Disable inlining only when one of the
1535 # files in compat/*.c is being linked in.
1537 AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1540 SHLIB_CFLAGS="-fPIC"
1543 SHLIB_LD='${CC} -shared'
1544 LD_FLAGS="-Wl,--export-dynamic"
1545 AS_IF([test $doRpath = yes], [
1546 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1547 LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1553 SHLIB_CFLAGS="-fPIC"
1556 SHLIB_CFLAGS="-fpic"
1559 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1561 AS_IF([test $doRpath = yes], [
1562 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1563 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1564 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
1565 LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
1566 CFLAGS_OPTIMIZE="-O2"
1567 # On OpenBSD: Compile with -pthread
1568 # Don't link with -lpthread
1569 LIBS=`echo $LIBS | sed s/-lpthread//`
1570 CFLAGS="$CFLAGS -pthread"
1571 # OpenBSD doesn't do version numbers with dots.
1572 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1573 TCL_LIB_VERSIONS_OK=nodots
1576 # NetBSD has ELF and can use 'cc -shared' to build shared libs
1577 SHLIB_CFLAGS="-fPIC"
1578 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1580 LDFLAGS="$LDFLAGS -export-dynamic"
1581 AS_IF([test $doRpath = yes], [
1582 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1583 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1584 # The -pthread needs to go in the CFLAGS, not LIBS
1585 LIBS=`echo $LIBS | sed s/-pthread//`
1586 CFLAGS="$CFLAGS -pthread"
1587 LDFLAGS="$LDFLAGS -pthread"
1590 CFLAGS_OPTIMIZE="-Os"
1591 SHLIB_CFLAGS="-fno-common"
1592 # To avoid discrepancies between what headers configure sees during
1593 # preprocessing tests and compiling tests, move any -isysroot and
1594 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1595 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1596 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1597 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1598 CFLAGS="`echo " ${CFLAGS}" | \
1599 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1600 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1601 AS_IF([test $do64bit = yes], [
1604 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1605 tcl_cv_cc_arch_ppc64, [
1607 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1608 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1609 [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no])
1610 CFLAGS=$hold_cflags])
1611 AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1612 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1616 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1617 tcl_cv_cc_arch_x86_64, [
1619 CFLAGS="$CFLAGS -arch x86_64"
1620 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1621 [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no])
1622 CFLAGS=$hold_cflags])
1623 AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1624 CFLAGS="$CFLAGS -arch x86_64"
1628 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1631 # Check for combined 32-bit and 64-bit fat build
1632 AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
1633 && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1636 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1637 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
1638 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1639 hold_ldflags=$LDFLAGS
1640 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1641 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
1642 [tcl_cv_ld_single_module=yes],[tcl_cv_ld_single_module=no])
1643 LDFLAGS=$hold_ldflags])
1644 AS_IF([test $tcl_cv_ld_single_module = yes], [
1645 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1647 # TEA specific: link shlib with current and compatibility version flags
1648 vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
1649 SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
1650 SHLIB_SUFFIX=".dylib"
1651 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1652 AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1653 tcl_cv_ld_search_paths_first, [
1654 hold_ldflags=$LDFLAGS
1655 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1656 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
1657 [tcl_cv_ld_search_paths_first=yes],[tcl_cv_ld_search_paths_first=no])
1658 LDFLAGS=$hold_ldflags])
1659 AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1660 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1662 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1663 AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1664 [Compiler support for module scope symbols])
1665 tcl_cv_cc_visibility_hidden=yes
1669 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1670 # TEA specific: for combined 32 & 64 bit fat builds of Tk
1671 # extensions, verify that 64-bit build is possible.
1672 AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [
1673 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [
1674 AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
1675 for v in CFLAGS CPPFLAGS LDFLAGS; do
1676 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1678 CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
1679 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
1680 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize();]])],
1681 [tcl_cv_lib_x11_64=yes],[tcl_cv_lib_x11_64=no])
1682 for v in CFLAGS CPPFLAGS LDFLAGS; do
1683 eval $v'="$hold_'$v'"'
1686 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua], [
1687 AC_CACHE_CHECK([for 64-bit Tk], tcl_cv_lib_tk_64, [
1688 for v in CFLAGS CPPFLAGS LDFLAGS; do
1689 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1691 CPPFLAGS="$CPPFLAGS -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}"
1692 LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
1693 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <tk.h>]], [[Tk_InitStubs(NULL, "", 0);]])],
1694 [tcl_cv_lib_tk_64=yes],[tcl_cv_lib_tk_64=no])
1695 for v in CFLAGS CPPFLAGS LDFLAGS; do
1696 eval $v'="$hold_'$v'"'
1699 # remove 64-bit arch flags from CFLAGS et al. if configuration
1700 # does not support 64-bit.
1701 AS_IF([test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no], [
1702 AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
1703 for v in CFLAGS CPPFLAGS LDFLAGS; do
1704 eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1709 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1710 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1711 [Should OS/390 do the right thing with sockets?])
1716 AS_IF([test "$SHARED_BUILD" = 1], [
1717 SHLIB_LD='ld -shared -expect_unresolved "*"'
1719 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1722 AS_IF([test $doRpath = yes], [
1723 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1724 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1725 AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1726 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1727 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1728 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1729 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1730 LIBS=`echo $LIBS | sed s/-lpthreads//`
1731 AS_IF([test "$GCC" = yes], [
1732 LIBS="$LIBS -lpthread -lmach -lexc"
1734 CFLAGS="$CFLAGS -pthread"
1735 LDFLAGS="$LDFLAGS -pthread"
1740 # This may work for all QNX, but it was only reported for v6.
1741 SHLIB_CFLAGS="-fPIC"
1742 SHLIB_LD="ld -Bshareable -x"
1749 AS_IF([test "$GCC" = yes], [
1750 SHLIB_CFLAGS="-fPIC -melf"
1751 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1753 SHLIB_CFLAGS="-Kpic -belf"
1754 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1763 # Careful to not let 5.10+ fall into this case
1765 # Note: If _REENTRANT isn't defined, then Solaris
1766 # won't define thread-safe library routines.
1768 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1769 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1770 [Do we really want to follow the standard? Yes we do!])
1772 SHLIB_CFLAGS="-KPIC"
1774 AS_IF([test "$GCC" = yes], [
1775 SHLIB_LD='${CC} -shared'
1776 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1777 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1779 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1780 CC_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
1781 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1785 # Note: If _REENTRANT isn't defined, then Solaris
1786 # won't define thread-safe library routines.
1788 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1789 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1790 [Do we really want to follow the standard? Yes we do!])
1792 SHLIB_CFLAGS="-KPIC"
1794 # Check to enable 64-bit flags for compiler/linker
1795 AS_IF([test "$do64bit" = yes], [
1797 AS_IF([test "$arch" = "sparcv9 sparc"], [
1798 AS_IF([test "$GCC" = yes], [
1799 AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
1800 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1803 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1804 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1805 SHLIB_CFLAGS="-fPIC"
1809 AS_IF([test "$do64bitVIS" = yes], [
1810 CFLAGS="$CFLAGS -xarch=v9a"
1811 LDFLAGS_ARCH="-xarch=v9a"
1813 CFLAGS="$CFLAGS -xarch=v9"
1814 LDFLAGS_ARCH="-xarch=v9"
1816 # Solaris 64 uses this as well
1817 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1819 ], [AS_IF([test "$arch" = "amd64 i386"], [
1820 AS_IF([test "$GCC" = yes], [
1822 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1824 CFLAGS="$CFLAGS -m64"
1825 LDFLAGS="$LDFLAGS -m64";;
1827 AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
1832 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1833 CFLAGS="$CFLAGS -m64"
1834 LDFLAGS="$LDFLAGS -m64";;
1836 CFLAGS="$CFLAGS -xarch=amd64"
1837 LDFLAGS="$LDFLAGS -xarch=amd64";;
1840 ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
1844 AS_IF([test "$GCC" = yes], [
1845 SHLIB_LD='${CC} -shared'
1846 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1847 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1848 AS_IF([test "$do64bit_ok" = yes], [
1849 AS_IF([test "$arch" = "sparcv9 sparc"], [
1850 # We need to specify -static-libgcc or we need to
1851 # add the path to the sparv9 libgcc.
1852 # JH: static-libgcc is necessary for core Tcl, but may
1853 # not be necessary for extensions.
1854 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1855 # for finding sparcv9 libgcc, get the regular libgcc
1856 # path, remove so name and append 'sparcv9'
1857 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1858 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1859 ], [AS_IF([test "$arch" = "amd64 i386"], [
1860 # JH: static-libgcc is necessary for core Tcl, but may
1861 # not be necessary for extensions.
1862 SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
1867 SunOS-5.[[1-9]][[0-9]]*)
1868 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1869 SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';;
1871 SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
1873 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1874 LD_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
1877 UNIX_SV* | UnixWare-5*)
1878 SHLIB_CFLAGS="-KPIC"
1882 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1883 # that don't grok the -Bexport option. Test that it does.
1884 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1885 hold_ldflags=$LDFLAGS
1886 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1887 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
1888 [tcl_cv_ld_Bexport=yes],[tcl_cv_ld_Bexport=no])
1889 LDFLAGS=$hold_ldflags])
1890 AS_IF([test $tcl_cv_ld_Bexport = yes], [
1891 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1898 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
1899 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1902 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1903 dnl # until the end of configure, as configure's compile and link tests use
1904 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1905 dnl # preprocessing tests use only CPPFLAGS.
1906 AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1908 # Add in the arch flags late to ensure it wasn't removed.
1909 # Not necessary in TEA, but this is aligned with core
1910 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
1912 # If we're running gcc, then change the C flags for compiling shared
1913 # libraries to the right flags for gcc, instead of those for the
1914 # standard manufacturer compiler.
1916 AS_IF([test "$GCC" = yes], [
1920 CYGWIN_*|MINGW32_*|MINGW64_*|MSYS_*) ;;
1922 NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;;
1926 *) SHLIB_CFLAGS="-fPIC" ;;
1929 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1930 AC_DEFINE(MODULE_SCOPE, [extern],
1931 [No Compiler support for module scope symbols])
1934 AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
1935 # TEA specific: use PACKAGE_VERSION instead of VERSION
1936 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'])
1937 AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
1938 # TEA specific: use PACKAGE_VERSION instead of VERSION
1939 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'])
1941 if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then
1942 AC_CACHE_CHECK(for SEH support in compiler,
1944 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1945 #define WIN32_LEAN_AND_MEAN
1946 #include <windows.h>
1947 #undef WIN32_LEAN_AND_MEAN
1949 int main(int argc, char** argv) {
1954 __except (EXCEPTION_EXECUTE_HANDLER) {
1964 if test "$tcl_cv_seh" = "no" ; then
1965 AC_DEFINE(HAVE_NO_SEH, 1,
1966 [Defined when mingw does not support SEH])
1970 # Check to see if the excpt.h include file provided contains the
1971 # definition for EXCEPTION_DISPOSITION; if not, which is the case
1972 # with Cygwin's version as of 2002-04-10, define it to be int,
1973 # sufficient for getting the current code to work.
1975 AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files,
1976 tcl_cv_eh_disposition,
1977 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1978 # define WIN32_LEAN_AND_MEAN
1979 # include <windows.h>
1980 # undef WIN32_LEAN_AND_MEAN
1982 EXCEPTION_DISPOSITION x;
1984 [tcl_cv_eh_disposition=yes],
1985 [tcl_cv_eh_disposition=no])
1987 if test "$tcl_cv_eh_disposition" = "no" ; then
1988 AC_DEFINE(EXCEPTION_DISPOSITION, int,
1989 [Defined when cygwin/mingw does not support EXCEPTION DISPOSITION])
1992 # Check to see if winnt.h defines CHAR, SHORT, and LONG
1993 # even if VOID has already been #defined. The win32api
1994 # used by mingw and cygwin is known to do this.
1996 AC_CACHE_CHECK(for winnt.h that ignores VOID define,
1997 tcl_cv_winnt_ignore_void,
1998 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2000 #define WIN32_LEAN_AND_MEAN
2001 #include <windows.h>
2002 #undef WIN32_LEAN_AND_MEAN
2008 [tcl_cv_winnt_ignore_void=yes],
2009 [tcl_cv_winnt_ignore_void=no])
2011 if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
2012 AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1,
2013 [Defined when cygwin/mingw ignores VOID define in winnt.h])
2017 # See if the compiler supports casting to a union type.
2018 # This is used to stop gcc from printing a compiler
2019 # warning when initializing a union member.
2021 AC_CACHE_CHECK(for cast to union support,
2022 tcl_cv_cast_to_union,
2023 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2024 union foo { int i; double d; };
2025 union foo f = (union foo) (int) 0;
2027 [tcl_cv_cast_to_union=yes],
2028 [tcl_cv_cast_to_union=no])
2030 if test "$tcl_cv_cast_to_union" = "yes"; then
2031 AC_DEFINE(HAVE_CAST_TO_UNION, 1,
2032 [Defined when compiler supports casting to union type.])
2035 AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],)
2037 AC_SUBST(CFLAGS_DEBUG)
2038 AC_SUBST(CFLAGS_OPTIMIZE)
2039 AC_SUBST(CFLAGS_WARNING)
2040 AC_SUBST(LDFLAGS_DEBUG)
2041 AC_SUBST(LDFLAGS_OPTIMIZE)
2046 AC_SUBST(SHLIB_LD_LIBS)
2047 AC_SUBST(SHLIB_CFLAGS)
2049 AC_SUBST(LD_LIBRARY_PATH_VAR)
2051 # These must be called after we do the basic CFLAGS checks and
2052 # verify any possible 64-bit or similar switches are necessary
2057 #--------------------------------------------------------------------
2060 # Determine which interface to use to talk to the serial port.
2061 # Note that #include lines must begin in leftmost column for
2062 # some compilers to recognize them as preprocessor directives,
2063 # and some build environments have stdin not pointing at a
2064 # pseudo-terminal (usually /dev/null instead.)
2071 # Defines only one of the following vars:
2076 #--------------------------------------------------------------------
2078 AC_DEFUN([TEA_SERIAL_PORT], [
2079 AC_CHECK_HEADERS(sys/modem.h)
2080 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2081 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2082 #include <termios.h>
2086 if (tcgetattr(0, &t) == 0) {
2088 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2092 }]])],[tcl_cv_api_serial=termios],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2093 if test $tcl_cv_api_serial = no ; then
2094 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2099 if (ioctl(0, TCGETA, &t) == 0) {
2100 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2104 }]])],[tcl_cv_api_serial=termio],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2106 if test $tcl_cv_api_serial = no ; then
2107 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2112 if (ioctl(0, TIOCGETP, &t) == 0) {
2114 t.sg_flags |= ODDP | EVENP | RAW;
2118 }]])],[tcl_cv_api_serial=sgtty],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2120 if test $tcl_cv_api_serial = no ; then
2121 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2122 #include <termios.h>
2127 if (tcgetattr(0, &t) == 0
2128 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2130 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2134 }]])],[tcl_cv_api_serial=termios],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2136 if test $tcl_cv_api_serial = no; then
2137 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2143 if (ioctl(0, TCGETA, &t) == 0
2144 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2145 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2149 }]])],[tcl_cv_api_serial=termio],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2151 if test $tcl_cv_api_serial = no; then
2152 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2158 if (ioctl(0, TIOCGETP, &t) == 0
2159 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2161 t.sg_flags |= ODDP | EVENP | RAW;
2165 }]])],[tcl_cv_api_serial=sgtty],[tcl_cv_api_serial=none],[tcl_cv_api_serial=none])
2167 case $tcl_cv_api_serial in
2168 termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
2169 termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
2170 sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
2174 #--------------------------------------------------------------------
2177 # Locate the X11 header files and the X11 library archive. Try
2178 # the ac_path_x macro first, but if it doesn't find the X stuff
2179 # (e.g. because there's no xmkmf program) then check through
2180 # a list of possible directories. Under some conditions the
2181 # autoconf macro will return an include directory that contains
2182 # no include files, so double-check its result just to be safe.
2184 # This should be called after TEA_CONFIG_CFLAGS as setting the
2185 # LIBS line can confuse some configure macro magic.
2192 # Sets the following vars:
2195 # PKG_LIBS (appends to)
2196 #--------------------------------------------------------------------
2198 AC_DEFUN([TEA_PATH_X], [
2199 if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
2204 AC_DEFUN([TEA_PATH_UNIX_X], [
2207 if test "$no_x" = ""; then
2208 if test "$x_includes" = ""; then
2209 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[],[not_really_there="yes"])
2211 if test ! -r $x_includes/X11/Xlib.h; then
2212 not_really_there="yes"
2216 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2217 AC_MSG_CHECKING([for X11 header files])
2218 found_xincludes="no"
2219 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[found_xincludes="yes"],[found_xincludes="no"])
2220 if test "$found_xincludes" = "no"; then
2221 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"
2223 if test -r $i/X11/Xlib.h; then
2226 found_xincludes="yes"
2232 if test "$x_includes" != ""; then
2233 XINCLUDES="-I$x_includes"
2234 found_xincludes="yes"
2237 if test "$found_xincludes" = "no"; then
2238 AC_MSG_RESULT([couldn't find any!])
2241 if test "$no_x" = yes; then
2242 AC_MSG_CHECKING([for X11 libraries])
2244 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"
2246 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2254 if test "$x_libraries" = ""; then
2257 XLIBSW="-L$x_libraries -lX11"
2260 if test "$XLIBSW" = nope ; then
2261 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2263 if test "$XLIBSW" = nope ; then
2264 AC_MSG_RESULT([could not find any! Using -lX11.])
2268 if test x"${XLIBSW}" != x ; then
2269 PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
2273 #--------------------------------------------------------------------
2274 # TEA_BLOCKING_STYLE
2276 # The statements below check for systems where POSIX-style
2277 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2278 # On these systems (mostly older ones), use the old BSD-style
2279 # FIONBIO approach instead.
2286 # Defines some of the following vars:
2291 #--------------------------------------------------------------------
2293 AC_DEFUN([TEA_BLOCKING_STYLE], [
2294 AC_CHECK_HEADERS(sys/ioctl.h)
2295 AC_CHECK_HEADERS(sys/filio.h)
2297 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2300 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2301 AC_MSG_RESULT([FIONBIO])
2304 AC_MSG_RESULT([O_NONBLOCK])
2309 #--------------------------------------------------------------------
2312 # Checks how the system deals with time.h, what time structures
2313 # are used on the system, and what fields the structures have.
2320 # Defines some of the following vars:
2326 #--------------------------------------------------------------------
2328 AC_DEFUN([TEA_TIME_HANDLER], [
2329 AC_CHECK_HEADERS(sys/time.h)
2333 AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
2335 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2336 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_tzadj;]])],
2337 [tcl_cv_member_tm_tzadj=yes],
2338 [tcl_cv_member_tm_tzadj=no])])
2339 if test $tcl_cv_member_tm_tzadj = yes ; then
2340 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2343 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2344 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_gmtoff;]])],
2345 [tcl_cv_member_tm_gmtoff=yes],
2346 [tcl_cv_member_tm_gmtoff=no])])
2347 if test $tcl_cv_member_tm_gmtoff = yes ; then
2348 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2352 # Its important to include time.h in this check, as some systems
2353 # (like convex) have timezone functions, etc.
2355 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
2357 [[extern long timezone;
2360 [tcl_cv_timezone_long=yes], [tcl_cv_timezone_long=no])])
2361 if test $tcl_cv_timezone_long = yes ; then
2362 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2365 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2367 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2368 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
2369 [[extern time_t timezone;
2372 [tcl_cv_timezone_time=yes], [tcl_cv_timezone_time=no])])
2373 if test $tcl_cv_timezone_time = yes ; then
2374 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2379 #--------------------------------------------------------------------
2382 # Under Solaris 2.4, strtod returns the wrong value for the
2383 # terminating character under some conditions. Check for this
2384 # and if the problem exists use a substitute procedure
2385 # "fixstrtod" (provided by Tcl) that corrects the error.
2386 # Also, on Compaq's Tru64 Unix 5.0,
2387 # strtod(" ") returns 0.0 instead of a failure to convert.
2394 # Might defines some of the following vars:
2395 # strtod (=fixstrtod)
2396 #--------------------------------------------------------------------
2398 AC_DEFUN([TEA_BUGGY_STRTOD], [
2399 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2400 if test "$tcl_strtod" = 1; then
2401 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2402 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2404 extern double strtod();
2406 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2409 value = strtod(infString, &term);
2410 if ((term != infString) && (term[-1] == 0)) {
2413 value = strtod(nanString, &term);
2414 if ((term != nanString) && (term[-1] == 0)) {
2417 value = strtod(spaceString, &term);
2418 if (term == (spaceString+1)) {
2422 }]])], [tcl_cv_strtod_buggy=ok], [tcl_cv_strtod_buggy=buggy],
2423 [tcl_cv_strtod_buggy=buggy])])
2424 if test "$tcl_cv_strtod_buggy" = buggy; then
2425 AC_LIBOBJ([fixstrtod])
2427 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
2432 #--------------------------------------------------------------------
2435 # Search for the libraries needed to link the Tcl shell.
2436 # Things like the math library (-lm), socket stuff (-lsocket vs.
2437 # -lnsl), zlib (-lz) and libtommath (-ltommath) are dealt with here.
2444 # Might append to the following vars:
2448 # Might define the following vars:
2451 #--------------------------------------------------------------------
2453 AC_DEFUN([TEA_TCL_LINK_LIBS], [
2454 #--------------------------------------------------------------------
2455 # On a few very rare systems, all of the libm.a stuff is
2456 # already in libc.a. Set compiler flags accordingly.
2457 #--------------------------------------------------------------------
2459 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2461 #--------------------------------------------------------------------
2462 # Interactive UNIX requires -linet instead of -lsocket, plus it
2463 # needs net/errno.h to define the socket-related error codes.
2464 #--------------------------------------------------------------------
2466 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2467 AC_CHECK_HEADER(net/errno.h, [
2468 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2470 #--------------------------------------------------------------------
2471 # Check for the existence of the -lsocket and -lnsl libraries.
2472 # The order here is important, so that they end up in the right
2473 # order in the command line generated by make. Here are some
2474 # special considerations:
2475 # 1. Use "connect" and "accept" to check for -lsocket, and
2476 # "gethostbyname" to check for -lnsl.
2477 # 2. Use each function name only once: can't redo a check because
2478 # autoconf caches the results of the last check and won't redo it.
2479 # 3. Use -lnsl and -lsocket only if they supply procedures that
2480 # aren't already present in the normal libraries. This is because
2481 # IRIX 5.2 has libraries, but they aren't needed and they're
2482 # bogus: they goof up name resolution if used.
2483 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2484 # To get around this problem, check for both libraries together
2485 # if -lsocket doesn't work by itself.
2486 #--------------------------------------------------------------------
2489 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2490 if test "$tcl_checkSocket" = 1; then
2491 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2492 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2494 if test "$tcl_checkBoth" = 1; then
2496 LIBS="$LIBS -lsocket -lnsl"
2497 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2499 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2500 [LIBS="$LIBS -lnsl"])])
2501 AC_CHECK_FUNC(mp_log_u32, , [AC_CHECK_LIB(tommath, mp_log_u32,
2502 [LIBS="$LIBS -ltommath"])])
2503 AC_CHECK_FUNC(deflateSetHeader, , [AC_CHECK_LIB(z, deflateSetHeader,
2504 [LIBS="$LIBS -lz"])])
2507 #--------------------------------------------------------------------
2508 # TEA_TCL_EARLY_FLAGS
2510 # Check for what flags are needed to be passed so the correct OS
2511 # features are available.
2518 # Might define the following vars:
2520 # _LARGEFILE64_SOURCE
2521 # _LARGEFILE_SOURCE64
2523 #--------------------------------------------------------------------
2525 AC_DEFUN([TEA_TCL_EARLY_FLAG],[
2526 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2527 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])],
2528 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[[#define ]$1[ 1
2530 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2531 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)]))
2532 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2533 AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
2534 tcl_flags="$tcl_flags $1"
2538 AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
2539 AC_MSG_CHECKING([for required early compiler flags])
2541 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2542 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2543 TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2544 [struct stat64 buf; int i = stat64("/", &buf);])
2545 TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2546 [char *p = (char *)open64;])
2547 if test "x${tcl_flags}" = "x" ; then
2548 AC_MSG_RESULT([none])
2550 AC_MSG_RESULT([${tcl_flags}])
2554 #--------------------------------------------------------------------
2555 # TEA_TCL_64BIT_FLAGS
2557 # Check for what is defined in the way of 64-bit features.
2564 # Might define the following vars:
2565 # TCL_WIDE_INT_IS_LONG
2567 # HAVE_STRUCT_DIRENT64, HAVE_DIR64
2568 # HAVE_STRUCT_STAT64
2571 #--------------------------------------------------------------------
2573 AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
2574 AC_MSG_CHECKING([for 64-bit integer type])
2575 AC_CACHE_VAL(tcl_cv_type_64bit,[
2576 tcl_cv_type_64bit=none
2577 # See if the compiler knows natively about __int64
2578 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__int64 value = (__int64) 0;]])],
2579 [tcl_type_64bit=__int64],[tcl_type_64bit="long long"])
2580 # See if we could use long anyway Note that we substitute in the
2581 # type that is our current guess for a 64-bit type inside this check
2582 # program, so it should be modified only carefully...
2583 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) {
2584 case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
2585 }]])],[tcl_cv_type_64bit=${tcl_type_64bit}],[])])
2586 if test "${tcl_cv_type_64bit}" = none ; then
2587 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?])
2588 AC_MSG_RESULT([yes])
2589 elif test "${tcl_cv_type_64bit}" = "__int64" \
2590 -a "${TEA_PLATFORM}" = "windows" ; then
2591 # TEA specific: We actually want to use the default tcl.h checks in
2592 # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
2593 AC_MSG_RESULT([using Tcl header defaults])
2595 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2596 [What type should be used to define wide integers?])
2597 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2599 # Now check for auxiliary declarations
2600 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2601 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2602 #include <dirent.h>]], [[struct dirent64 p;]])],
2603 [tcl_cv_struct_dirent64=yes],[tcl_cv_struct_dirent64=no])])
2604 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2605 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2608 AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[
2609 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2610 #include <dirent.h>]], [[struct dirent64 *p; DIR64 d = opendir64(".");
2611 p = readdir64(d); rewinddir64(d); closedir64(d);]])],
2612 [tcl_cv_DIR64=yes], [tcl_cv_DIR64=no])])
2613 if test "x${tcl_cv_DIR64}" = "xyes" ; then
2614 AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?])
2617 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2618 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat64 p;
2620 [tcl_cv_struct_stat64=yes], [tcl_cv_struct_stat64=no])])
2621 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2622 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2625 AC_CHECK_FUNCS(open64 lseek64)
2626 AC_MSG_CHECKING([for off64_t])
2627 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2628 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[off64_t offset;
2630 [tcl_cv_type_off64_t=yes], [tcl_cv_type_off64_t=no])])
2631 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2632 dnl functions lseek64 and open64 are defined.
2633 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2634 test "x${ac_cv_func_lseek64}" = "xyes" && \
2635 test "x${ac_cv_func_open64}" = "xyes" ; then
2636 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2637 AC_MSG_RESULT([yes])
2645 ## Here ends the standard Tcl configuration bits and starts the
2646 ## TEA specific functions
2649 #------------------------------------------------------------------------
2652 # Init various Tcl Extension Architecture (TEA) variables.
2653 # This should be the first called TEA_* macro.
2660 # Defines and substs the following vars:
2666 # TEA_PLATFORM (windows or unix)
2668 # "cygpath" is used on windows to generate native path names for include
2669 # files. These variables should only be used with the compiler and linker
2670 # since they generate native path names.
2673 # Select the executable extension based on the host type. This
2674 # is a lightweight replacement for AC_EXEEXT that doesn't require
2676 #------------------------------------------------------------------------
2678 AC_DEFUN([TEA_INIT], [
2681 AC_MSG_CHECKING([TEA configuration])
2682 if test x"${PACKAGE_NAME}" = x ; then
2684 The PACKAGE_NAME variable must be defined by your TEA configure.ac])
2686 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
2688 # If the user did not set CFLAGS, set it now to keep macros
2689 # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
2690 if test "${CFLAGS+set}" != "set" ; then
2694 case "`uname -s`" in
2695 *win32*|*WIN32*|*MINGW32_*|*MINGW64_*|*MSYS_*)
2696 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
2698 TEA_PLATFORM="windows"
2702 # CYGPATH and TEA_PLATFORM are determined later in LOAD_TCLCONFIG
2706 # Maybe we are cross-compiling....
2707 case ${host_alias} in
2710 TEA_PLATFORM="windows"
2720 # Check if exec_prefix is set. If not use fall back to prefix.
2721 # Note when adjusted, so that TEA_PREFIX can correct for this.
2722 # This is needed for recursive configures, since autoconf propagates
2723 # $prefix, but not $exec_prefix (doh!).
2724 if test x$exec_prefix = xNONE ; then
2725 exec_prefix_default=yes
2729 AC_MSG_NOTICE([configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}])
2734 # This package name must be replaced statically for AC_SUBST to work
2735 AC_SUBST(PKG_LIB_FILE)
2736 AC_SUBST(PKG_LIB_FILE8)
2737 AC_SUBST(PKG_LIB_FILE9)
2738 # Substitute STUB_LIB_FILE in case package creates a stub library too.
2739 AC_SUBST(PKG_STUB_LIB_FILE)
2741 # We AC_SUBST these here to ensure they are subst'ed,
2742 # in case the user doesn't call TEA_ADD_...
2743 AC_SUBST(PKG_STUB_SOURCES)
2744 AC_SUBST(PKG_STUB_OBJECTS)
2745 AC_SUBST(PKG_TCL_SOURCES)
2746 AC_SUBST(PKG_HEADERS)
2747 AC_SUBST(PKG_INCLUDES)
2749 AC_SUBST(PKG_CFLAGS)
2751 # Configure the installer.
2755 #------------------------------------------------------------------------
2756 # TEA_ADD_SOURCES --
2758 # Specify one or more source files. Users should check for
2759 # the right platform before adding to their list.
2760 # It is not important to specify the directory, as long as it is
2761 # in the generic, win or unix subdirectory of $(srcdir).
2764 # one or more file names
2768 # Defines and substs the following vars:
2771 #------------------------------------------------------------------------
2772 AC_DEFUN([TEA_ADD_SOURCES], [
2778 PKG_SOURCES="$PKG_SOURCES $i"
2779 PKG_OBJECTS="$PKG_OBJECTS $i"
2782 # check for existence - allows for generic/win/unix VPATH
2783 # To add more dirs here (like 'src'), you have to update VPATH
2784 # in Makefile.in as well
2785 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2786 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2787 -a ! -f "${srcdir}/macosx/$i" \
2789 AC_MSG_ERROR([could not find source file '$i'])
2791 PKG_SOURCES="$PKG_SOURCES $i"
2792 # this assumes it is in a VPATH dir
2794 # handle user calling this before or after TEA_SETUP_COMPILER
2795 if test x"${OBJEXT}" != x ; then
2796 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2798 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2800 PKG_OBJECTS="$PKG_OBJECTS $j"
2804 AC_SUBST(PKG_SOURCES)
2805 AC_SUBST(PKG_OBJECTS)
2808 #------------------------------------------------------------------------
2809 # TEA_ADD_STUB_SOURCES --
2811 # Specify one or more source files. Users should check for
2812 # the right platform before adding to their list.
2813 # It is not important to specify the directory, as long as it is
2814 # in the generic, win or unix subdirectory of $(srcdir).
2817 # one or more file names
2821 # Defines and substs the following vars:
2824 #------------------------------------------------------------------------
2825 AC_DEFUN([TEA_ADD_STUB_SOURCES], [
2828 # check for existence - allows for generic/win/unix VPATH
2829 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2830 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2831 -a ! -f "${srcdir}/macosx/$i" \
2833 AC_MSG_ERROR([could not find stub source file '$i'])
2835 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
2836 # this assumes it is in a VPATH dir
2838 # handle user calling this before or after TEA_SETUP_COMPILER
2839 if test x"${OBJEXT}" != x ; then
2840 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2842 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2844 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
2846 AC_SUBST(PKG_STUB_SOURCES)
2847 AC_SUBST(PKG_STUB_OBJECTS)
2850 #------------------------------------------------------------------------
2851 # TEA_ADD_TCL_SOURCES --
2853 # Specify one or more Tcl source files. These should be platform
2854 # independent runtime files.
2857 # one or more file names
2861 # Defines and substs the following vars:
2863 #------------------------------------------------------------------------
2864 AC_DEFUN([TEA_ADD_TCL_SOURCES], [
2867 # check for existence, be strict because it is installed
2868 if test ! -f "${srcdir}/$i" ; then
2869 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
2871 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
2873 AC_SUBST(PKG_TCL_SOURCES)
2876 #------------------------------------------------------------------------
2877 # TEA_ADD_HEADERS --
2879 # Specify one or more source headers. Users should check for
2880 # the right platform before adding to their list.
2883 # one or more file names
2887 # Defines and substs the following vars:
2889 #------------------------------------------------------------------------
2890 AC_DEFUN([TEA_ADD_HEADERS], [
2893 # check for existence, be strict because it is installed
2894 if test ! -f "${srcdir}/$i" ; then
2895 AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
2897 PKG_HEADERS="$PKG_HEADERS $i"
2899 AC_SUBST(PKG_HEADERS)
2902 #------------------------------------------------------------------------
2903 # TEA_ADD_INCLUDES --
2905 # Specify one or more include dirs. Users should check for
2906 # the right platform before adding to their list.
2909 # one or more file names
2913 # Defines and substs the following vars:
2915 #------------------------------------------------------------------------
2916 AC_DEFUN([TEA_ADD_INCLUDES], [
2919 PKG_INCLUDES="$PKG_INCLUDES $i"
2921 AC_SUBST(PKG_INCLUDES)
2924 #------------------------------------------------------------------------
2927 # Specify one or more libraries. Users should check for
2928 # the right platform before adding to their list. For Windows,
2929 # libraries provided in "foo.lib" format will be converted to
2930 # "-lfoo" when using GCC (mingw).
2933 # one or more file names
2937 # Defines and substs the following vars:
2939 #------------------------------------------------------------------------
2940 AC_DEFUN([TEA_ADD_LIBS], [
2943 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
2944 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
2945 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.[[lL]][[iI]][[bB]][$]/-l\1/'`
2947 PKG_LIBS="$PKG_LIBS $i"
2952 #------------------------------------------------------------------------
2955 # Specify one or more CFLAGS. Users should check for
2956 # the right platform before adding to their list.
2959 # one or more file names
2963 # Defines and substs the following vars:
2965 #------------------------------------------------------------------------
2966 AC_DEFUN([TEA_ADD_CFLAGS], [
2967 PKG_CFLAGS="$PKG_CFLAGS $@"
2968 AC_SUBST(PKG_CFLAGS)
2971 #------------------------------------------------------------------------
2972 # TEA_ADD_CLEANFILES --
2974 # Specify one or more CLEANFILES.
2977 # one or more file names to clean target
2981 # Appends to CLEANFILES, already defined for subst in LOAD_TCLCONFIG
2982 #------------------------------------------------------------------------
2983 AC_DEFUN([TEA_ADD_CLEANFILES], [
2984 CLEANFILES="$CLEANFILES $@"
2987 #------------------------------------------------------------------------
2990 # Handle the --prefix=... option by defaulting to what Tcl gave
2997 # If --prefix or --exec-prefix was not specified, $prefix and
2998 # $exec_prefix will be set to the values given to Tcl when it was
3000 #------------------------------------------------------------------------
3001 AC_DEFUN([TEA_PREFIX], [
3002 if test "${prefix}" = "NONE"; then
3004 if test x"${TCL_PREFIX}" != x; then
3005 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
3006 prefix=${TCL_PREFIX}
3008 AC_MSG_NOTICE([--prefix defaulting to /usr/local])
3012 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
3013 -o x"${exec_prefix_default}" = x"yes" ; then
3014 if test x"${TCL_EXEC_PREFIX}" != x; then
3015 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
3016 exec_prefix=${TCL_EXEC_PREFIX}
3018 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
3024 #------------------------------------------------------------------------
3025 # TEA_SETUP_COMPILER_CC --
3027 # Do compiler checks the way we want. This is just a replacement
3028 # for AC_PROG_CC in TEA configure.ac files to make them cleaner.
3035 # Sets up CC var and other standard bits we need to make executables.
3036 #------------------------------------------------------------------------
3037 AC_DEFUN([TEA_SETUP_COMPILER_CC], [
3038 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
3039 # in this macro, they need to go into TEA_SETUP_COMPILER instead.
3044 #--------------------------------------------------------------------
3045 # Checks to see if the make program sets the $MAKE variable.
3046 #--------------------------------------------------------------------
3050 #--------------------------------------------------------------------
3052 #--------------------------------------------------------------------
3054 AC_CHECK_TOOL(RANLIB, ranlib)
3056 #--------------------------------------------------------------------
3057 # Determines the correct binary file extension (.o, .obj, .exe etc.)
3058 #--------------------------------------------------------------------
3064 #------------------------------------------------------------------------
3065 # TEA_SETUP_COMPILER --
3067 # Do compiler checks that use the compiler. This must go after
3068 # TEA_SETUP_COMPILER_CC, which does the actual compiler check.
3075 # Sets up CC var and other standard bits we need to make executables.
3076 #------------------------------------------------------------------------
3077 AC_DEFUN([TEA_SETUP_COMPILER], [
3078 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
3079 AC_REQUIRE([TEA_SETUP_COMPILER_CC])
3081 #------------------------------------------------------------------------
3082 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
3083 # It makes compiling go faster. (This is only a performance feature.)
3084 #------------------------------------------------------------------------
3086 if test -z "$no_pipe" -a -n "$GCC"; then
3087 AC_CACHE_CHECK([if the compiler understands -pipe],
3089 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
3090 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_pipe=yes],[tcl_cv_cc_pipe=no])
3091 CFLAGS=$hold_cflags])
3092 if test $tcl_cv_cc_pipe = yes; then
3093 CFLAGS="$CFLAGS -pipe"
3097 #--------------------------------------------------------------------
3098 # Common compiler flag setup
3099 #--------------------------------------------------------------------
3104 #------------------------------------------------------------------------
3107 # Generate a line that can be used to build a shared/unshared library
3108 # in a platform independent manner.
3117 # Defines the following vars:
3118 # CFLAGS - Done late here to note disturb other AC macros
3119 # MAKE_LIB - Command to execute to build the Tcl library;
3120 # differs depending on whether or not Tcl is being
3121 # compiled as a shared library.
3122 # MAKE_SHARED_LIB Makefile rule for building a shared library
3123 # MAKE_STATIC_LIB Makefile rule for building a static library
3124 # MAKE_STUB_LIB Makefile rule for building a stub library
3125 # VC_MANIFEST_EMBED_DLL Makefile rule for embedded VC manifest in DLL
3126 # VC_MANIFEST_EMBED_EXE Makefile rule for embedded VC manifest in EXE
3127 #------------------------------------------------------------------------
3129 AC_DEFUN([TEA_MAKE_LIB], [
3130 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
3131 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
3132 MAKE_SHARED_LIB="\${SHLIB_LD} \${LDFLAGS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3133 AC_EGREP_CPP([manifest needed], [
3134 #if defined(_MSC_VER) && _MSC_VER >= 1400
3135 print("manifest needed")
3138 # Could do a CHECK_PROG for mt, but should always be with MSVC8+
3139 VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;2 ; fi"
3140 VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;1 ; fi"
3141 MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
3142 TEA_ADD_CLEANFILES([*.manifest])
3144 MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[$]@ \$(PKG_STUB_OBJECTS)"
3146 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
3147 MAKE_SHARED_LIB="\${SHLIB_LD} \${LDFLAGS} \${LDFLAGS_DEFAULT} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3148 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
3151 if test "${SHARED_BUILD}" = "1" ; then
3152 MAKE_LIB="${MAKE_SHARED_LIB} "
3154 MAKE_LIB="${MAKE_STATIC_LIB} "
3157 #--------------------------------------------------------------------
3158 # Shared libraries and static libraries have different names.
3159 # Use the double eval to make sure any variables in the suffix is
3160 # substituted. (@@@ Might not be necessary anymore)
3161 #--------------------------------------------------------------------
3163 PACKAGE_LIB_PREFIX8="${PACKAGE_LIB_PREFIX}"
3164 PACKAGE_LIB_PREFIX9="${PACKAGE_LIB_PREFIX}tcl9"
3165 if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
3166 PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX9}"
3168 PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX8}"
3170 if test "${TEA_PLATFORM}" = "windows" ; then
3171 if test "${SHARED_BUILD}" = "1" ; then
3172 # We force the unresolved linking of symbols that are really in
3173 # the private libraries of Tcl and Tk.
3174 if test x"${TK_BIN_DIR}" != x ; then
3175 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
3177 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
3178 if test "$GCC" = "yes"; then
3179 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
3181 eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3182 eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3183 eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3185 if test "$GCC" = "yes"; then
3186 PACKAGE_LIB_PREFIX=lib${PACKAGE_LIB_PREFIX}
3188 eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3189 eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3190 eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3192 # Some packages build their own stubs libraries
3193 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3194 if test "$GCC" = "yes"; then
3195 PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
3197 # These aren't needed on Windows (either MSVC or gcc)
3201 RANLIB_STUB="${RANLIB}"
3202 if test "${SHARED_BUILD}" = "1" ; then
3203 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
3204 if test x"${TK_BIN_DIR}" != x ; then
3205 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
3207 eval eval "PKG_LIB_FILE8=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3208 eval eval "PKG_LIB_FILE9=lib${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3209 eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3212 eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3213 eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3214 eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3216 # Some packages build their own stubs libraries
3217 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3220 # These are escaped so that only CFLAGS is picked up at configure time.
3221 # The other values will be substituted at make time.
3222 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
3223 if test "${SHARED_BUILD}" = "1" ; then
3224 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
3228 AC_SUBST(MAKE_SHARED_LIB)
3229 AC_SUBST(MAKE_STATIC_LIB)
3230 AC_SUBST(MAKE_STUB_LIB)
3231 AC_SUBST(RANLIB_STUB)
3232 AC_SUBST(VC_MANIFEST_EMBED_DLL)
3233 AC_SUBST(VC_MANIFEST_EMBED_EXE)
3236 #------------------------------------------------------------------------
3239 # Compute the name of an existing object library located in libdir
3240 # from the given base name and produce the appropriate linker flags.
3243 # basename The base name of the library without version
3244 # numbers, extensions, or "lib" prefixes.
3245 # extra_dir Extra directory in which to search for the
3246 # library. This location is used first, then
3247 # $prefix/$exec-prefix, then some defaults.
3250 # TEA_INIT and TEA_PREFIX must be called first.
3254 # Defines the following vars:
3255 # ${basename}_LIB_NAME The computed library name.
3256 # ${basename}_LIB_SPEC The computed linker flags.
3257 #------------------------------------------------------------------------
3259 AC_DEFUN([TEA_LIB_SPEC], [
3260 AC_MSG_CHECKING([for $1 library])
3262 # Look in exec-prefix for the library (defined by TEA_PREFIX).
3264 tea_lib_name_dir="${exec_prefix}/lib"
3266 # Or in a user-specified location.
3268 if test x"$2" != x ; then
3269 tea_extra_lib_dir=$2
3271 tea_extra_lib_dir=NONE
3275 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3276 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3277 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3278 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3279 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3280 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
3281 `ls -dr /usr/lib64/$1[[0-9]]*.lib 2>/dev/null ` \
3282 `ls -dr /usr/lib64/lib$1[[0-9]]* 2>/dev/null ` \
3283 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3284 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
3285 if test -f "$i" ; then
3286 tea_lib_name_dir=`dirname $i`
3287 $1_LIB_NAME=`basename $i`
3293 if test "${TEA_PLATFORM}" = "windows"; then
3294 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
3296 # Strip off the leading "lib" and trailing ".a" or ".so"
3298 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
3299 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
3302 if test "x${$1_LIB_NAME}" = x ; then
3303 AC_MSG_ERROR([not found])
3305 AC_MSG_RESULT([${$1_LIB_SPEC}])
3309 #------------------------------------------------------------------------
3310 # TEA_PRIVATE_TCL_HEADERS --
3312 # Locate the private Tcl include files
3317 # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
3318 # already been called.
3322 # Substitutes the following vars:
3323 # TCL_TOP_DIR_NATIVE
3325 #------------------------------------------------------------------------
3327 AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
3328 # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh}
3329 AC_REQUIRE([TEA_PUBLIC_TCL_HEADERS])
3330 AC_MSG_CHECKING([for Tcl private include files])
3332 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
3333 TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
3335 # Check to see if tcl<Plat>Port.h isn't already with the public headers
3336 # Don't look for tclInt.h because that resides with tcl.h in the core
3337 # sources, but the <plat>Port headers are in a different directory
3338 if test "${TEA_PLATFORM}" = "windows" -a \
3339 -f "${ac_cv_c_tclh}/tclWinPort.h"; then
3340 result="private headers found with public headers"
3341 elif test "${TEA_PLATFORM}" = "unix" -a \
3342 -f "${ac_cv_c_tclh}/tclUnixPort.h"; then
3343 result="private headers found with public headers"
3345 TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
3346 if test "${TEA_PLATFORM}" = "windows"; then
3347 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
3349 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
3351 # Overwrite the previous TCL_INCLUDES as this should capture both
3352 # public and private headers in the same set.
3353 # We want to ensure these are substituted so as not to require
3354 # any *_NATIVE vars be defined in the Makefile
3355 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
3356 if test "`uname -s`" = "Darwin"; then
3357 # If Tcl was built as a framework, attempt to use
3358 # the framework's Headers and PrivateHeaders directories
3361 if test -d "${TCL_BIN_DIR}/Headers" -a \
3362 -d "${TCL_BIN_DIR}/PrivateHeaders"; then
3363 TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
3365 TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3369 result="Using ${TCL_INCLUDES}"
3371 if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
3372 AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
3374 result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}"
3378 AC_SUBST(TCL_TOP_DIR_NATIVE)
3380 AC_SUBST(TCL_INCLUDES)
3381 AC_MSG_RESULT([${result}])
3384 #------------------------------------------------------------------------
3385 # TEA_PUBLIC_TCL_HEADERS --
3387 # Locate the installed public Tcl header files
3393 # CYGPATH must be set
3397 # Adds a --with-tclinclude switch to configure.
3400 # Substitutes the following vars:
3402 #------------------------------------------------------------------------
3404 AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
3405 AC_MSG_CHECKING([for Tcl public headers])
3407 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
3409 AC_CACHE_VAL(ac_cv_c_tclh, [
3410 # Use the value from --with-tclinclude, if it was given
3412 if test x"${with_tclinclude}" != x ; then
3413 if test -f "${with_tclinclude}/tcl.h" ; then
3414 ac_cv_c_tclh=${with_tclinclude}
3416 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
3420 if test "`uname -s`" = "Darwin"; then
3421 # If Tcl was built as a framework, attempt to use
3422 # the framework's Headers directory
3425 list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
3430 # Look in the source dir only if Tcl is not installed,
3431 # and in that situation, look there before installed locations.
3432 if test -f "${TCL_BIN_DIR}/Makefile" ; then
3433 list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
3436 # Check order: pkg --prefix location, Tcl's --prefix location,
3437 # relative to directory of tclConfig.sh.
3439 eval "temp_includedir=${includedir}"
3441 `ls -d ${temp_includedir} 2>/dev/null` \
3442 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3443 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3444 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3445 list="$list /usr/local/include /usr/include"
3446 if test x"${TCL_INCLUDE_SPEC}" != x ; then
3447 d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3448 list="$list `ls -d ${d} 2>/dev/null`"
3452 if test -f "$i/tcl.h" ; then
3460 # Print a message based on how we determined the include path
3462 if test x"${ac_cv_c_tclh}" = x ; then
3463 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
3465 AC_MSG_RESULT([${ac_cv_c_tclh}])
3468 # Convert to a native path and substitute into the output files.
3470 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
3472 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3474 AC_SUBST(TCL_INCLUDES)
3477 #------------------------------------------------------------------------
3478 # TEA_PRIVATE_TK_HEADERS --
3480 # Locate the private Tk include files
3485 # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
3486 # already been called.
3490 # Substitutes the following vars:
3492 #------------------------------------------------------------------------
3494 AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
3495 # Allow for --with-tkinclude to take effect and define ${ac_cv_c_tkh}
3496 AC_REQUIRE([TEA_PUBLIC_TK_HEADERS])
3497 AC_MSG_CHECKING([for Tk private include files])
3499 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
3500 TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
3502 # Check to see if tk<Plat>Port.h isn't already with the public headers
3503 # Don't look for tkInt.h because that resides with tk.h in the core
3504 # sources, but the <plat>Port headers are in a different directory
3505 if test "${TEA_PLATFORM}" = "windows" -a \
3506 -f "${ac_cv_c_tkh}/tkWinPort.h"; then
3507 result="private headers found with public headers"
3508 elif test "${TEA_PLATFORM}" = "unix" -a \
3509 -f "${ac_cv_c_tkh}/tkUnixPort.h"; then
3510 result="private headers found with public headers"
3512 TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
3513 TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
3514 if test "${TEA_PLATFORM}" = "windows"; then
3515 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
3517 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
3519 # Overwrite the previous TK_INCLUDES as this should capture both
3520 # public and private headers in the same set.
3521 # We want to ensure these are substituted so as not to require
3522 # any *_NATIVE vars be defined in the Makefile
3523 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
3524 # Detect and add ttk subdir
3525 if test -d "${TK_SRC_DIR}/generic/ttk"; then
3526 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\""
3528 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3529 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_XLIB_DIR_NATIVE}\""
3531 if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3532 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/macosx\""
3534 if test "`uname -s`" = "Darwin"; then
3535 # If Tk was built as a framework, attempt to use
3536 # the framework's Headers and PrivateHeaders directories
3539 if test -d "${TK_BIN_DIR}/Headers" -a \
3540 -d "${TK_BIN_DIR}/PrivateHeaders"; then
3541 TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"
3543 TK_INCLUDES="${TK_INCLUDES} ${TK_INCLUDE_SPEC} `echo "${TK_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3547 result="Using ${TK_INCLUDES}"
3549 if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
3550 AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
3552 result="Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}"
3556 AC_SUBST(TK_TOP_DIR_NATIVE)
3557 AC_SUBST(TK_XLIB_DIR_NATIVE)
3559 AC_SUBST(TK_INCLUDES)
3560 AC_MSG_RESULT([${result}])
3563 #------------------------------------------------------------------------
3564 # TEA_PUBLIC_TK_HEADERS --
3566 # Locate the installed public Tk header files
3572 # CYGPATH must be set
3576 # Adds a --with-tkinclude switch to configure.
3579 # Substitutes the following vars:
3581 #------------------------------------------------------------------------
3583 AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
3584 AC_MSG_CHECKING([for Tk public headers])
3586 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files], with_tkinclude=${withval})
3588 AC_CACHE_VAL(ac_cv_c_tkh, [
3589 # Use the value from --with-tkinclude, if it was given
3591 if test x"${with_tkinclude}" != x ; then
3592 if test -f "${with_tkinclude}/tk.h" ; then
3593 ac_cv_c_tkh=${with_tkinclude}
3595 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
3599 if test "`uname -s`" = "Darwin"; then
3600 # If Tk was built as a framework, attempt to use
3601 # the framework's Headers directory.
3604 list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
3609 # Look in the source dir only if Tk is not installed,
3610 # and in that situation, look there before installed locations.
3611 if test -f "${TK_BIN_DIR}/Makefile" ; then
3612 list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
3615 # Check order: pkg --prefix location, Tk's --prefix location,
3616 # relative to directory of tkConfig.sh, Tcl's --prefix location,
3617 # relative to directory of tclConfig.sh.
3619 eval "temp_includedir=${includedir}"
3621 `ls -d ${temp_includedir} 2>/dev/null` \
3622 `ls -d ${TK_PREFIX}/include 2>/dev/null` \
3623 `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
3624 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3625 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3626 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3627 list="$list /usr/local/include /usr/include"
3628 if test x"${TK_INCLUDE_SPEC}" != x ; then
3629 d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3630 list="$list `ls -d ${d} 2>/dev/null`"
3634 if test -f "$i/tk.h" ; then
3642 # Print a message based on how we determined the include path
3644 if test x"${ac_cv_c_tkh}" = x ; then
3645 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
3647 AC_MSG_RESULT([${ac_cv_c_tkh}])
3650 # Convert to a native path and substitute into the output files.
3652 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
3654 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3656 AC_SUBST(TK_INCLUDES)
3658 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3659 # On Windows and Aqua, we need the X compat headers
3660 AC_MSG_CHECKING([for X11 header files])
3661 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
3662 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
3663 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3664 AC_SUBST(TK_XINCLUDES)
3666 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
3670 #------------------------------------------------------------------------
3671 # TEA_PATH_CONFIG --
3673 # Locate the ${1}Config.sh file and perform a sanity check on
3674 # the ${1} compile flags. These are used by packages like
3675 # [incr Tk] that load *Config.sh files from more than Tcl and Tk.
3682 # Adds the following arguments to configure:
3685 # Defines the following vars:
3686 # $1_BIN_DIR Full path to the directory containing
3687 # the $1Config.sh file
3688 #------------------------------------------------------------------------
3690 AC_DEFUN([TEA_PATH_CONFIG], [
3692 # Ok, lets find the $1 configuration
3693 # First, look for one uninstalled.
3694 # the alternative search directory is invoked by --with-$1
3697 if test x"${no_$1}" = x ; then
3698 # we reset no_$1 in case something fails here
3700 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
3701 AC_MSG_CHECKING([for $1 configuration])
3702 AC_CACHE_VAL(ac_cv_c_$1config,[
3704 # First check to see if --with-$1 was specified.
3705 if test x"${with_$1config}" != x ; then
3706 case ${with_$1config} in
3708 if test -f ${with_$1config}; then
3709 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
3710 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
3713 if test -f "${with_$1config}/$1Config.sh" ; then
3714 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
3716 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
3720 # then check for a private $1 installation
3721 if test x"${ac_cv_c_$1config}" = x ; then
3724 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3725 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3726 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3727 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3729 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3730 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3731 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3732 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3734 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3735 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3736 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3737 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3739 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3740 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3741 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3742 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3744 if test -f "$i/$1Config.sh" ; then
3745 ac_cv_c_$1config=`(cd $i; pwd)`
3748 if test -f "$i/unix/$1Config.sh" ; then
3749 ac_cv_c_$1config=`(cd $i/unix; pwd)`
3755 # check in a few common install locations
3756 if test x"${ac_cv_c_$1config}" = x ; then
3757 for i in `ls -d ${libdir} 2>/dev/null` \
3758 `ls -d ${exec_prefix}/lib 2>/dev/null` \
3759 `ls -d ${prefix}/lib 2>/dev/null` \
3760 `ls -d /usr/local/lib 2>/dev/null` \
3761 `ls -d /usr/contrib/lib 2>/dev/null` \
3762 `ls -d /usr/pkg/lib 2>/dev/null` \
3763 `ls -d /usr/lib 2>/dev/null` \
3764 `ls -d /usr/lib64 2>/dev/null` \
3766 if test -f "$i/$1Config.sh" ; then
3767 ac_cv_c_$1config=`(cd $i; pwd)`
3774 if test x"${ac_cv_c_$1config}" = x ; then
3775 $1_BIN_DIR="# no $1 configs found"
3776 AC_MSG_WARN([Cannot find $1 configuration definitions])
3780 $1_BIN_DIR=${ac_cv_c_$1config}
3781 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
3786 #------------------------------------------------------------------------
3787 # TEA_LOAD_CONFIG --
3789 # Load the $1Config.sh file
3793 # Requires the following vars to be set:
3798 # Substitutes the following vars:
3802 #------------------------------------------------------------------------
3804 AC_DEFUN([TEA_LOAD_CONFIG], [
3805 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
3807 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
3808 AC_MSG_RESULT([loading])
3809 . "${$1_BIN_DIR}/$1Config.sh"
3811 AC_MSG_RESULT([file not found])
3815 # If the $1_BIN_DIR is the build directory (not the install directory),
3816 # then set the common variable name to the value of the build variables.
3817 # For example, the variable $1_LIB_SPEC will be set to the value
3818 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
3819 # instead of $1_BUILD_LIB_SPEC since it will work with both an
3820 # installed and uninstalled version of Tcl.
3823 if test -f "${$1_BIN_DIR}/Makefile" ; then
3824 AC_MSG_WARN([Found Makefile - using build library specs for $1])
3825 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
3826 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
3827 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
3828 $1_INCLUDE_SPEC=${$1_BUILD_INCLUDE_SPEC}
3829 $1_LIBRARY_PATH=${$1_LIBRARY_PATH}
3832 AC_SUBST($1_VERSION)
3833 AC_SUBST($1_BIN_DIR)
3834 AC_SUBST($1_SRC_DIR)
3836 AC_SUBST($1_LIB_FILE)
3837 AC_SUBST($1_LIB_SPEC)
3839 AC_SUBST($1_STUB_LIB_FILE)
3840 AC_SUBST($1_STUB_LIB_SPEC)
3841 AC_SUBST($1_STUB_LIB_PATH)
3843 # Allow the caller to prevent this auto-check by specifying any 2nd arg
3844 AS_IF([test "x$2" = x], [
3845 # Check both upper and lower-case variants
3846 # If a dev wanted non-stubs libs, this function could take an option
3847 # to not use _STUB in the paths below
3848 AS_IF([test "x${$1_STUB_LIB_SPEC}" = x],
3849 [TEA_LOAD_CONFIG_LIB(translit($1,[a-z],[A-Z])_STUB)],
3850 [TEA_LOAD_CONFIG_LIB($1_STUB)])
3854 #------------------------------------------------------------------------
3855 # TEA_LOAD_CONFIG_LIB --
3857 # Helper function to load correct library from another extension's
3858 # ${PACKAGE}Config.sh.
3861 # Adds to LIBS the appropriate extension library
3862 #------------------------------------------------------------------------
3863 AC_DEFUN([TEA_LOAD_CONFIG_LIB], [
3864 AC_MSG_CHECKING([For $1 library for LIBS])
3865 # This simplifies the use of stub libraries by automatically adding
3866 # the stub lib to your path. Normally this would add to SHLIB_LD_LIBS,
3867 # but this is called before CONFIG_CFLAGS. More importantly, this adds
3868 # to PKG_LIBS, which becomes LIBS, and that is only used by SHLIB_LD.
3869 if test "x${$1_LIB_SPEC}" != "x" ; then
3870 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
3871 TEA_ADD_LIBS([\"`${CYGPATH} ${$1_LIB_PATH}`\"])
3872 AC_MSG_RESULT([using $1_LIB_PATH ${$1_LIB_PATH}])
3874 TEA_ADD_LIBS([${$1_LIB_SPEC}])
3875 AC_MSG_RESULT([using $1_LIB_SPEC ${$1_LIB_SPEC}])
3878 AC_MSG_RESULT([file not found])
3882 #------------------------------------------------------------------------
3883 # TEA_EXPORT_CONFIG --
3885 # Define the data to insert into the ${PACKAGE}Config.sh file
3889 # Requires the following vars to be set:
3893 # Substitutes the following vars:
3894 #------------------------------------------------------------------------
3896 AC_DEFUN([TEA_EXPORT_CONFIG], [
3897 #--------------------------------------------------------------------
3898 # These are for $1Config.sh
3899 #--------------------------------------------------------------------
3901 # pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
3902 eval pkglibdir="[$]{libdir}/$1${PACKAGE_VERSION}"
3903 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
3904 eval $1_LIB_FLAG="-l$1${PACKAGE_VERSION}"
3905 eval $1_STUB_LIB_FLAG="-l$1stub${PACKAGE_VERSION}"
3907 eval $1_LIB_FLAG="-l$1`echo ${PACKAGE_VERSION} | tr -d .`"
3908 eval $1_STUB_LIB_FLAG="-l$1stub`echo ${PACKAGE_VERSION} | tr -d .`"
3910 $1_BUILD_LIB_SPEC="-L`$CYGPATH $(pwd)` ${$1_LIB_FLAG}"
3911 $1_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` ${$1_LIB_FLAG}"
3912 $1_BUILD_STUB_LIB_SPEC="-L`$CYGPATH $(pwd)` [$]{$1_STUB_LIB_FLAG}"
3913 $1_STUB_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` [$]{$1_STUB_LIB_FLAG}"
3914 $1_BUILD_STUB_LIB_PATH="`$CYGPATH $(pwd)`/[$]{PKG_STUB_LIB_FILE}"
3915 $1_STUB_LIB_PATH="`$CYGPATH ${pkglibdir}`/[$]{PKG_STUB_LIB_FILE}"
3917 AC_SUBST($1_BUILD_LIB_SPEC)
3918 AC_SUBST($1_LIB_SPEC)
3919 AC_SUBST($1_BUILD_STUB_LIB_SPEC)
3920 AC_SUBST($1_STUB_LIB_SPEC)
3921 AC_SUBST($1_BUILD_STUB_LIB_PATH)
3922 AC_SUBST($1_STUB_LIB_PATH)
3924 AC_SUBST(MAJOR_VERSION)
3925 AC_SUBST(MINOR_VERSION)
3926 AC_SUBST(PATCHLEVEL)
3930 #------------------------------------------------------------------------
3933 # Configure the installer.
3939 # Substitutes the following vars:
3946 #------------------------------------------------------------------------
3948 AC_DEFUN([TEA_INSTALLER], [
3949 INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c'
3950 INSTALL_DATA_DIR='${INSTALL} -d -m 755'
3951 INSTALL_DATA='${INSTALL} -m 644'
3952 INSTALL_PROGRAM='${INSTALL} -m 755'
3953 INSTALL_SCRIPT='${INSTALL} -m 755'
3957 HP-UX-*) INSTALL_LIBRARY='${INSTALL} -m 755' ;;
3958 *) INSTALL_LIBRARY='${INSTALL} -m 644' ;;
3962 AC_SUBST(INSTALL_DATA_DIR)
3963 AC_SUBST(INSTALL_DATA)
3964 AC_SUBST(INSTALL_PROGRAM)
3965 AC_SUBST(INSTALL_SCRIPT)
3966 AC_SUBST(INSTALL_LIBRARY)
3970 # Tip 430 - ZipFS Modifications
3972 #------------------------------------------------------------------------
3974 # Locate a zip encoder installed on the system path, or none.
3980 # Substitutes the following vars:
3984 # ZIP_PROG_VFSSEARCH
3986 #------------------------------------------------------------------------
3988 AC_DEFUN([TEA_ZIPFS_SUPPORT], [
3992 ZIP_PROG_VFSSEARCH=""
3995 AC_MSG_CHECKING([for macher])
3996 AC_CACHE_VAL(ac_cv_path_macher, [
3997 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
3998 for dir in $search_path ; do
3999 for j in `ls -r $dir/macher 2> /dev/null` \
4000 `ls -r $dir/macher 2> /dev/null` ; do
4001 if test x"$ac_cv_path_macher" = x ; then
4002 if test -f "$j" ; then
4003 ac_cv_path_macher=$j
4010 if test -f "$ac_cv_path_macher" ; then
4011 MACHER_PROG="$ac_cv_path_macher"
4012 AC_MSG_RESULT([$MACHER_PROG])
4013 AC_MSG_RESULT([Found macher in environment])
4015 AC_MSG_CHECKING([for zip])
4016 AC_CACHE_VAL(ac_cv_path_zip, [
4017 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
4018 for dir in $search_path ; do
4019 for j in `ls -r $dir/zip 2> /dev/null` \
4020 `ls -r $dir/zip 2> /dev/null` ; do
4021 if test x"$ac_cv_path_zip" = x ; then
4022 if test -f "$j" ; then
4030 if test -f "$ac_cv_path_zip" ; then
4031 ZIP_PROG="$ac_cv_path_zip"
4032 AC_MSG_RESULT([$ZIP_PROG])
4033 ZIP_PROG_OPTIONS="-rq"
4034 ZIP_PROG_VFSSEARCH="*"
4035 AC_MSG_RESULT([Found INFO Zip in environment])
4036 # Use standard arguments for zip
4038 # It is not an error if an installed version of Zip can't be located.
4039 # We can use the locally distributed minizip instead
4040 ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
4041 ZIP_PROG_OPTIONS="-o -r"
4042 ZIP_PROG_VFSSEARCH="*"
4043 ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
4044 AC_MSG_RESULT([No zip found on PATH. Building minizip])
4046 AC_SUBST(MACHER_PROG)
4048 AC_SUBST(ZIP_PROG_OPTIONS)
4049 AC_SUBST(ZIP_PROG_VFSSEARCH)
4050 AC_SUBST(ZIP_INSTALL_OBJS)