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
1179 if test "$GCC" != "yes" ; then
1180 if test "${SHARED_BUILD}" = "0" ; then
1185 case "x`echo \${VisualStudioVersion}`" in
1187 lflags="${lflags} -nodefaultlib:libucrt.lib"
1188 TEA_ADD_LIBS([ucrt.lib])
1194 if test "$do64bit" != "no" ; then
1197 lflags="${lflags} -nologo -MACHINE:${MACHINE} "
1199 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
1200 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1201 # Avoid 'unresolved external symbol __security_cookie'
1202 # errors, c.f. http://support.microsoft.com/?id=894573
1203 TEA_ADD_LIBS([bufferoverflowU.lib])
1206 lflags="${lflags} -nologo"
1208 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
1209 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1213 if test "$GCC" = "yes"; then
1215 AC_CHECK_TOOL(RC, windres)
1217 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1218 SHLIB_LD='${CC} -shared'
1219 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1220 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
1221 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
1223 AC_CACHE_CHECK(for cross-compile version of gcc,
1225 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1227 #error cross-compiler
1233 if test "$ac_cv_cross" = "yes"; then
1236 CC="x86_64-w64-mingw32-${CC}"
1237 LD="x86_64-w64-mingw32-ld"
1238 AR="x86_64-w64-mingw32-ar"
1239 RANLIB="x86_64-w64-mingw32-ranlib"
1240 RC="x86_64-w64-mingw32-windres"
1243 CC="aarch64-w64-mingw32-clang"
1244 LD="aarch64-w64-mingw32-ld"
1245 AR="aarch64-w64-mingw32-ar"
1246 RANLIB="aarch64-w64-mingw32-ranlib"
1247 RC="aarch64-w64-mingw32-windres"
1250 CC="i686-w64-mingw32-${CC}"
1251 LD="i686-w64-mingw32-ld"
1252 AR="i686-w64-mingw32-ar"
1253 RANLIB="i686-w64-mingw32-ranlib"
1254 RC="i686-w64-mingw32-windres"
1260 SHLIB_LD="${LINKBIN} -dll ${lflags}"
1261 # link -lib only works when -lib is the first arg
1262 STLIB_LD="${LINKBIN} -lib ${lflags}"
1263 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
1265 # For information on what debugtype is most useful, see:
1266 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
1268 # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx
1269 # This essentially turns it all on.
1270 LDFLAGS_DEBUG="-debug -debugtype:cv"
1271 LDFLAGS_OPTIMIZE="-release"
1272 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
1273 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
1277 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
1279 TCL_LIB_VERSIONS_OK=nodots
1282 AS_IF([test "$GCC" != "yes"], [
1283 # AIX requires the _r compiler when gcc isn't being used
1289 # Make sure only first arg gets _r
1290 CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
1293 AC_MSG_RESULT([Using $CC for compiling with threads])
1299 LD_LIBRARY_PATH_VAR="LIBPATH"
1301 # Check to enable 64-bit flags for compiler/linker
1302 AS_IF([test "$do64bit" = yes], [
1303 AS_IF([test "$GCC" = yes], [
1304 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1307 CFLAGS="$CFLAGS -q64"
1309 RANLIB="${RANLIB} -X64"
1311 SHLIB_LD_FLAGS="-b64"
1315 AS_IF([test "`uname -m`" = ia64], [
1316 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1317 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1318 AS_IF([test "$GCC" = yes], [
1319 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1321 CC_SEARCH_FLAGS='"-R${LIB_RUNTIME_DIR}"'
1323 LD_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
1325 AS_IF([test "$GCC" = yes], [
1326 SHLIB_LD='${CC} -shared -Wl,-bexpall'
1328 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
1329 LDFLAGS="$LDFLAGS -brtl"
1331 SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1332 CC_SEARCH_FLAGS='"-L${LIB_RUNTIME_DIR}"'
1333 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1337 SHLIB_CFLAGS="-fPIC"
1338 SHLIB_LD='${CC} -nostart'
1341 #-----------------------------------------------------------
1342 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1343 # -lsocket, even if the network functions are in -lnet which
1344 # is always linked to, for compatibility.
1345 #-----------------------------------------------------------
1346 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1348 BSD/OS-2.1*|BSD/OS-3*)
1350 SHLIB_LD="shlicc -r"
1356 SHLIB_CFLAGS="-export-dynamic -fPIC"
1357 SHLIB_LD='${CC} -shared'
1359 LDFLAGS="$LDFLAGS -export-dynamic"
1365 SHLIB_LD='${CC} -shared'
1367 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$[@].a"
1374 SHLIB_CFLAGS="-K PIC"
1382 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1383 SHLIB_CFLAGS="-fPIC"
1385 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
1386 AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
1389 # Use updated header definitions where possible
1390 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1391 # TEA specific: Needed by Tcl, but not most extensions
1392 #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1393 #LIBS="$LIBS -lxnet" # Use the XOPEN network library
1395 AS_IF([test "`uname -m`" = ia64], [
1400 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1401 AS_IF([test "$tcl_ok" = yes], [
1404 LDFLAGS="$LDFLAGS -Wl,-E"
1405 CC_SEARCH_FLAGS='"-Wl,+s,+b,${LIB_RUNTIME_DIR}:."'
1406 LD_SEARCH_FLAGS='+s +b "${LIB_RUNTIME_DIR}:."'
1407 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1409 AS_IF([test "$GCC" = yes], [
1410 SHLIB_LD='${CC} -shared'
1411 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1416 # Check to enable 64-bit flags for compiler/linker
1417 AS_IF([test "$do64bit" = "yes"], [
1418 AS_IF([test "$GCC" = yes], [
1419 case `${CC} -dumpmachine` in
1421 # 64-bit gcc in use. Fix flags for GNU ld.
1423 SHLIB_LD='${CC} -shared'
1424 AS_IF([test $doRpath = yes], [
1425 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1426 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1429 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1434 CFLAGS="$CFLAGS +DD64"
1435 LDFLAGS_ARCH="+DD64"
1438 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1440 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1441 AS_IF([test "$tcl_ok" = yes], [
1445 LDFLAGS="$LDFLAGS -Wl,-E"
1446 CC_SEARCH_FLAGS='"-Wl,+s,+b,${LIB_RUNTIME_DIR}:."'
1447 LD_SEARCH_FLAGS='+s +b "${LIB_RUNTIME_DIR}:."'
1448 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1452 SHLIB_LD="ld -shared -rdata_shared"
1455 AS_IF([test $doRpath = yes], [
1456 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1457 LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
1461 SHLIB_LD="ld -n32 -shared -rdata_shared"
1463 AS_IF([test $doRpath = yes], [
1464 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1465 LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
1466 AS_IF([test "$GCC" = yes], [
1467 CFLAGS="$CFLAGS -mabi=n32"
1468 LDFLAGS="$LDFLAGS -mabi=n32"
1472 # Use to build 6.2 compatible binaries on 6.3.
1473 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1476 CFLAGS="$CFLAGS -n32"
1479 LDFLAGS="$LDFLAGS -n32"
1484 SHLIB_LD="ld -n32 -shared -rdata_shared"
1486 AS_IF([test $doRpath = yes], [
1487 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1488 LD_SEARCH_FLAGS='-rpath "${LIB_RUNTIME_DIR}"'])
1490 # Check to enable 64-bit flags for compiler/linker
1492 AS_IF([test "$do64bit" = yes], [
1493 AS_IF([test "$GCC" = yes], [
1494 AC_MSG_WARN([64bit mode not supported by gcc])
1497 SHLIB_LD="ld -64 -shared -rdata_shared"
1498 CFLAGS="$CFLAGS -64"
1503 Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
1504 SHLIB_CFLAGS="-fPIC"
1508 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1510 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1511 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS_DEFAULT} -shared'
1512 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1515 DragonFly-*|FreeBSD-*)
1516 AS_IF([test "${TCL_THREADS}" = "1"], [
1517 # The -pthread needs to go in the LDFLAGS, not LIBS
1518 LIBS=`echo $LIBS | sed s/-pthread//`
1519 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1520 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
1524 AS_IF([test $doRpath = yes], [
1525 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1526 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1527 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1528 AS_IF([test $do64bit = yes], [
1529 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1531 CFLAGS="$CFLAGS -m64"
1532 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1533 [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
1534 CFLAGS=$hold_cflags])
1535 AS_IF([test $tcl_cv_cc_m64 = yes], [
1536 CFLAGS="$CFLAGS -m64"
1541 # The combo of gcc + glibc has a bug related to inlining of
1542 # functions like strtod(). The -fno-builtin flag should address
1543 # this problem but it does not work. The -fno-inline flag is kind
1544 # of overkill but it works. Disable inlining only when one of the
1545 # files in compat/*.c is being linked in.
1547 AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1550 SHLIB_CFLAGS="-fPIC"
1553 SHLIB_LD='${CC} -shared'
1554 LD_FLAGS="-Wl,--export-dynamic"
1555 AS_IF([test $doRpath = yes], [
1556 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1557 LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1563 SHLIB_CFLAGS="-fPIC"
1566 SHLIB_CFLAGS="-fpic"
1569 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1571 AS_IF([test $doRpath = yes], [
1572 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1573 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1574 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
1575 LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
1576 CFLAGS_OPTIMIZE="-O2"
1577 # On OpenBSD: Compile with -pthread
1578 # Don't link with -lpthread
1579 LIBS=`echo $LIBS | sed s/-lpthread//`
1580 CFLAGS="$CFLAGS -pthread"
1581 # OpenBSD doesn't do version numbers with dots.
1582 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1583 TCL_LIB_VERSIONS_OK=nodots
1586 # NetBSD has ELF and can use 'cc -shared' to build shared libs
1587 SHLIB_CFLAGS="-fPIC"
1588 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1590 LDFLAGS="$LDFLAGS -export-dynamic"
1591 AS_IF([test $doRpath = yes], [
1592 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1593 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1594 # The -pthread needs to go in the CFLAGS, not LIBS
1595 LIBS=`echo $LIBS | sed s/-pthread//`
1596 CFLAGS="$CFLAGS -pthread"
1597 LDFLAGS="$LDFLAGS -pthread"
1600 CFLAGS_OPTIMIZE="-Os"
1601 SHLIB_CFLAGS="-fno-common"
1602 # To avoid discrepancies between what headers configure sees during
1603 # preprocessing tests and compiling tests, move any -isysroot and
1604 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1605 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1606 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1607 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1608 CFLAGS="`echo " ${CFLAGS}" | \
1609 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1610 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1611 AS_IF([test $do64bit = yes], [
1614 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1615 tcl_cv_cc_arch_ppc64, [
1617 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1618 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1619 [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no])
1620 CFLAGS=$hold_cflags])
1621 AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1622 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1626 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1627 tcl_cv_cc_arch_x86_64, [
1629 CFLAGS="$CFLAGS -arch x86_64"
1630 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1631 [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no])
1632 CFLAGS=$hold_cflags])
1633 AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1634 CFLAGS="$CFLAGS -arch x86_64"
1638 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1641 # Check for combined 32-bit and 64-bit fat build
1642 AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
1643 && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1646 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1647 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
1648 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1649 hold_ldflags=$LDFLAGS
1650 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1651 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
1652 [tcl_cv_ld_single_module=yes],[tcl_cv_ld_single_module=no])
1653 LDFLAGS=$hold_ldflags])
1654 AS_IF([test $tcl_cv_ld_single_module = yes], [
1655 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1657 # TEA specific: link shlib with current and compatibility version flags
1658 vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
1659 SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
1660 SHLIB_SUFFIX=".dylib"
1661 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1662 AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1663 tcl_cv_ld_search_paths_first, [
1664 hold_ldflags=$LDFLAGS
1665 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1666 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
1667 [tcl_cv_ld_search_paths_first=yes],[tcl_cv_ld_search_paths_first=no])
1668 LDFLAGS=$hold_ldflags])
1669 AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1670 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1672 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1673 AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1674 [Compiler support for module scope symbols])
1675 tcl_cv_cc_visibility_hidden=yes
1679 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1680 # TEA specific: for combined 32 & 64 bit fat builds of Tk
1681 # extensions, verify that 64-bit build is possible.
1682 AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [
1683 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [
1684 AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
1685 for v in CFLAGS CPPFLAGS LDFLAGS; do
1686 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1688 CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
1689 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
1690 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize();]])],
1691 [tcl_cv_lib_x11_64=yes],[tcl_cv_lib_x11_64=no])
1692 for v in CFLAGS CPPFLAGS LDFLAGS; do
1693 eval $v'="$hold_'$v'"'
1696 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua], [
1697 AC_CACHE_CHECK([for 64-bit Tk], tcl_cv_lib_tk_64, [
1698 for v in CFLAGS CPPFLAGS LDFLAGS; do
1699 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1701 CPPFLAGS="$CPPFLAGS -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}"
1702 LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
1703 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <tk.h>]], [[Tk_InitStubs(NULL, "", 0);]])],
1704 [tcl_cv_lib_tk_64=yes],[tcl_cv_lib_tk_64=no])
1705 for v in CFLAGS CPPFLAGS LDFLAGS; do
1706 eval $v'="$hold_'$v'"'
1709 # remove 64-bit arch flags from CFLAGS et al. if configuration
1710 # does not support 64-bit.
1711 AS_IF([test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no], [
1712 AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
1713 for v in CFLAGS CPPFLAGS LDFLAGS; do
1714 eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1719 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1720 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1721 [Should OS/390 do the right thing with sockets?])
1726 AS_IF([test "$SHARED_BUILD" = 1], [
1727 SHLIB_LD='ld -shared -expect_unresolved "*"'
1729 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1732 AS_IF([test $doRpath = yes], [
1733 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1734 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1735 AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1736 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1737 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1738 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1739 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1740 LIBS=`echo $LIBS | sed s/-lpthreads//`
1741 AS_IF([test "$GCC" = yes], [
1742 LIBS="$LIBS -lpthread -lmach -lexc"
1744 CFLAGS="$CFLAGS -pthread"
1745 LDFLAGS="$LDFLAGS -pthread"
1750 # This may work for all QNX, but it was only reported for v6.
1751 SHLIB_CFLAGS="-fPIC"
1752 SHLIB_LD="ld -Bshareable -x"
1759 AS_IF([test "$GCC" = yes], [
1760 SHLIB_CFLAGS="-fPIC -melf"
1761 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1763 SHLIB_CFLAGS="-Kpic -belf"
1764 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1773 # Careful to not let 5.10+ fall into this case
1775 # Note: If _REENTRANT isn't defined, then Solaris
1776 # won't define thread-safe library routines.
1778 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1779 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1780 [Do we really want to follow the standard? Yes we do!])
1782 SHLIB_CFLAGS="-KPIC"
1784 AS_IF([test "$GCC" = yes], [
1785 SHLIB_LD='${CC} -shared'
1786 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1787 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1789 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1790 CC_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
1791 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1795 # Note: If _REENTRANT isn't defined, then Solaris
1796 # won't define thread-safe library routines.
1798 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1799 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1800 [Do we really want to follow the standard? Yes we do!])
1802 SHLIB_CFLAGS="-KPIC"
1804 # Check to enable 64-bit flags for compiler/linker
1805 AS_IF([test "$do64bit" = yes], [
1807 AS_IF([test "$arch" = "sparcv9 sparc"], [
1808 AS_IF([test "$GCC" = yes], [
1809 AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
1810 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1813 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1814 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1815 SHLIB_CFLAGS="-fPIC"
1819 AS_IF([test "$do64bitVIS" = yes], [
1820 CFLAGS="$CFLAGS -xarch=v9a"
1821 LDFLAGS_ARCH="-xarch=v9a"
1823 CFLAGS="$CFLAGS -xarch=v9"
1824 LDFLAGS_ARCH="-xarch=v9"
1826 # Solaris 64 uses this as well
1827 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1829 ], [AS_IF([test "$arch" = "amd64 i386"], [
1830 AS_IF([test "$GCC" = yes], [
1832 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1834 CFLAGS="$CFLAGS -m64"
1835 LDFLAGS="$LDFLAGS -m64";;
1837 AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
1842 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1843 CFLAGS="$CFLAGS -m64"
1844 LDFLAGS="$LDFLAGS -m64";;
1846 CFLAGS="$CFLAGS -xarch=amd64"
1847 LDFLAGS="$LDFLAGS -xarch=amd64";;
1850 ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
1854 AS_IF([test "$GCC" = yes], [
1855 SHLIB_LD='${CC} -shared'
1856 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1857 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1858 AS_IF([test "$do64bit_ok" = yes], [
1859 AS_IF([test "$arch" = "sparcv9 sparc"], [
1860 # We need to specify -static-libgcc or we need to
1861 # add the path to the sparv9 libgcc.
1862 # JH: static-libgcc is necessary for core Tcl, but may
1863 # not be necessary for extensions.
1864 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1865 # for finding sparcv9 libgcc, get the regular libgcc
1866 # path, remove so name and append 'sparcv9'
1867 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1868 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1869 ], [AS_IF([test "$arch" = "amd64 i386"], [
1870 # JH: static-libgcc is necessary for core Tcl, but may
1871 # not be necessary for extensions.
1872 SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
1877 SunOS-5.[[1-9]][[0-9]]*)
1878 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1879 SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';;
1881 SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
1883 CC_SEARCH_FLAGS='"-Wl,-R,${LIB_RUNTIME_DIR}"'
1884 LD_SEARCH_FLAGS='-R "${LIB_RUNTIME_DIR}"'
1887 UNIX_SV* | UnixWare-5*)
1888 SHLIB_CFLAGS="-KPIC"
1892 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1893 # that don't grok the -Bexport option. Test that it does.
1894 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1895 hold_ldflags=$LDFLAGS
1896 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1897 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
1898 [tcl_cv_ld_Bexport=yes],[tcl_cv_ld_Bexport=no])
1899 LDFLAGS=$hold_ldflags])
1900 AS_IF([test $tcl_cv_ld_Bexport = yes], [
1901 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1908 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
1909 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1912 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1913 dnl # until the end of configure, as configure's compile and link tests use
1914 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1915 dnl # preprocessing tests use only CPPFLAGS.
1916 AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1918 # Add in the arch flags late to ensure it wasn't removed.
1919 # Not necessary in TEA, but this is aligned with core
1920 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
1922 # If we're running gcc, then change the C flags for compiling shared
1923 # libraries to the right flags for gcc, instead of those for the
1924 # standard manufacturer compiler.
1926 AS_IF([test "$GCC" = yes], [
1930 CYGWIN_*|MINGW32_*|MINGW64_*|MSYS_*) ;;
1932 NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;;
1936 *) SHLIB_CFLAGS="-fPIC" ;;
1939 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1940 AC_DEFINE(MODULE_SCOPE, [extern],
1941 [No Compiler support for module scope symbols])
1944 AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
1945 # TEA specific: use PACKAGE_VERSION instead of VERSION
1946 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'])
1947 AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
1948 # TEA specific: use PACKAGE_VERSION instead of VERSION
1949 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'])
1951 if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then
1952 AC_CACHE_CHECK(for SEH support in compiler,
1954 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1955 #define WIN32_LEAN_AND_MEAN
1956 #include <windows.h>
1957 #undef WIN32_LEAN_AND_MEAN
1959 int main(int argc, char** argv) {
1964 __except (EXCEPTION_EXECUTE_HANDLER) {
1974 if test "$tcl_cv_seh" = "no" ; then
1975 AC_DEFINE(HAVE_NO_SEH, 1,
1976 [Defined when mingw does not support SEH])
1980 # Check to see if the excpt.h include file provided contains the
1981 # definition for EXCEPTION_DISPOSITION; if not, which is the case
1982 # with Cygwin's version as of 2002-04-10, define it to be int,
1983 # sufficient for getting the current code to work.
1985 AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files,
1986 tcl_cv_eh_disposition,
1987 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1988 # define WIN32_LEAN_AND_MEAN
1989 # include <windows.h>
1990 # undef WIN32_LEAN_AND_MEAN
1992 EXCEPTION_DISPOSITION x;
1994 [tcl_cv_eh_disposition=yes],
1995 [tcl_cv_eh_disposition=no])
1997 if test "$tcl_cv_eh_disposition" = "no" ; then
1998 AC_DEFINE(EXCEPTION_DISPOSITION, int,
1999 [Defined when cygwin/mingw does not support EXCEPTION DISPOSITION])
2002 # Check to see if winnt.h defines CHAR, SHORT, and LONG
2003 # even if VOID has already been #defined. The win32api
2004 # used by mingw and cygwin is known to do this.
2006 AC_CACHE_CHECK(for winnt.h that ignores VOID define,
2007 tcl_cv_winnt_ignore_void,
2008 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2010 #define WIN32_LEAN_AND_MEAN
2011 #include <windows.h>
2012 #undef WIN32_LEAN_AND_MEAN
2018 [tcl_cv_winnt_ignore_void=yes],
2019 [tcl_cv_winnt_ignore_void=no])
2021 if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
2022 AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1,
2023 [Defined when cygwin/mingw ignores VOID define in winnt.h])
2027 # See if the compiler supports casting to a union type.
2028 # This is used to stop gcc from printing a compiler
2029 # warning when initializing a union member.
2031 AC_CACHE_CHECK(for cast to union support,
2032 tcl_cv_cast_to_union,
2033 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2034 union foo { int i; double d; };
2035 union foo f = (union foo) (int) 0;
2037 [tcl_cv_cast_to_union=yes],
2038 [tcl_cv_cast_to_union=no])
2040 if test "$tcl_cv_cast_to_union" = "yes"; then
2041 AC_DEFINE(HAVE_CAST_TO_UNION, 1,
2042 [Defined when compiler supports casting to union type.])
2045 AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],)
2047 AC_SUBST(CFLAGS_DEBUG)
2048 AC_SUBST(CFLAGS_OPTIMIZE)
2049 AC_SUBST(CFLAGS_WARNING)
2050 AC_SUBST(LDFLAGS_DEBUG)
2051 AC_SUBST(LDFLAGS_OPTIMIZE)
2056 AC_SUBST(SHLIB_LD_LIBS)
2057 AC_SUBST(SHLIB_CFLAGS)
2059 AC_SUBST(LD_LIBRARY_PATH_VAR)
2061 # These must be called after we do the basic CFLAGS checks and
2062 # verify any possible 64-bit or similar switches are necessary
2067 #--------------------------------------------------------------------
2070 # Determine which interface to use to talk to the serial port.
2071 # Note that #include lines must begin in leftmost column for
2072 # some compilers to recognize them as preprocessor directives,
2073 # and some build environments have stdin not pointing at a
2074 # pseudo-terminal (usually /dev/null instead.)
2081 # Defines only one of the following vars:
2086 #--------------------------------------------------------------------
2088 AC_DEFUN([TEA_SERIAL_PORT], [
2089 AC_CHECK_HEADERS(sys/modem.h)
2090 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2091 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2092 #include <termios.h>
2096 if (tcgetattr(0, &t) == 0) {
2098 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2102 }]])],[tcl_cv_api_serial=termios],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2103 if test $tcl_cv_api_serial = no ; then
2104 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2109 if (ioctl(0, TCGETA, &t) == 0) {
2110 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2114 }]])],[tcl_cv_api_serial=termio],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2116 if test $tcl_cv_api_serial = no ; then
2117 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2122 if (ioctl(0, TIOCGETP, &t) == 0) {
2124 t.sg_flags |= ODDP | EVENP | RAW;
2128 }]])],[tcl_cv_api_serial=sgtty],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2130 if test $tcl_cv_api_serial = no ; then
2131 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2132 #include <termios.h>
2137 if (tcgetattr(0, &t) == 0
2138 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2140 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2144 }]])],[tcl_cv_api_serial=termios],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2146 if test $tcl_cv_api_serial = no; then
2147 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2153 if (ioctl(0, TCGETA, &t) == 0
2154 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2155 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2159 }]])],[tcl_cv_api_serial=termio],[tcl_cv_api_serial=no],[tcl_cv_api_serial=no])
2161 if test $tcl_cv_api_serial = no; then
2162 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2168 if (ioctl(0, TIOCGETP, &t) == 0
2169 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2171 t.sg_flags |= ODDP | EVENP | RAW;
2175 }]])],[tcl_cv_api_serial=sgtty],[tcl_cv_api_serial=none],[tcl_cv_api_serial=none])
2177 case $tcl_cv_api_serial in
2178 termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
2179 termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
2180 sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
2184 #--------------------------------------------------------------------
2187 # Locate the X11 header files and the X11 library archive. Try
2188 # the ac_path_x macro first, but if it doesn't find the X stuff
2189 # (e.g. because there's no xmkmf program) then check through
2190 # a list of possible directories. Under some conditions the
2191 # autoconf macro will return an include directory that contains
2192 # no include files, so double-check its result just to be safe.
2194 # This should be called after TEA_CONFIG_CFLAGS as setting the
2195 # LIBS line can confuse some configure macro magic.
2202 # Sets the following vars:
2205 # PKG_LIBS (appends to)
2206 #--------------------------------------------------------------------
2208 AC_DEFUN([TEA_PATH_X], [
2209 if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
2214 AC_DEFUN([TEA_PATH_UNIX_X], [
2217 if test "$no_x" = ""; then
2218 if test "$x_includes" = ""; then
2219 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[],[not_really_there="yes"])
2221 if test ! -r $x_includes/X11/Xlib.h; then
2222 not_really_there="yes"
2226 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2227 AC_MSG_CHECKING([for X11 header files])
2228 found_xincludes="no"
2229 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[found_xincludes="yes"],[found_xincludes="no"])
2230 if test "$found_xincludes" = "no"; then
2231 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"
2233 if test -r $i/X11/Xlib.h; then
2236 found_xincludes="yes"
2242 if test "$x_includes" != ""; then
2243 XINCLUDES="-I$x_includes"
2244 found_xincludes="yes"
2247 if test "$found_xincludes" = "no"; then
2248 AC_MSG_RESULT([couldn't find any!])
2251 if test "$no_x" = yes; then
2252 AC_MSG_CHECKING([for X11 libraries])
2254 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"
2256 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2264 if test "$x_libraries" = ""; then
2267 XLIBSW="-L$x_libraries -lX11"
2270 if test "$XLIBSW" = nope ; then
2271 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2273 if test "$XLIBSW" = nope ; then
2274 AC_MSG_RESULT([could not find any! Using -lX11.])
2278 if test x"${XLIBSW}" != x ; then
2279 PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
2283 #--------------------------------------------------------------------
2284 # TEA_BLOCKING_STYLE
2286 # The statements below check for systems where POSIX-style
2287 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2288 # On these systems (mostly older ones), use the old BSD-style
2289 # FIONBIO approach instead.
2296 # Defines some of the following vars:
2301 #--------------------------------------------------------------------
2303 AC_DEFUN([TEA_BLOCKING_STYLE], [
2304 AC_CHECK_HEADERS(sys/ioctl.h)
2305 AC_CHECK_HEADERS(sys/filio.h)
2307 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2310 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2311 AC_MSG_RESULT([FIONBIO])
2314 AC_MSG_RESULT([O_NONBLOCK])
2319 #--------------------------------------------------------------------
2322 # Checks how the system deals with time.h, what time structures
2323 # are used on the system, and what fields the structures have.
2330 # Defines some of the following vars:
2336 #--------------------------------------------------------------------
2338 AC_DEFUN([TEA_TIME_HANDLER], [
2339 AC_CHECK_HEADERS(sys/time.h)
2343 AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
2345 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2346 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_tzadj;]])],
2347 [tcl_cv_member_tm_tzadj=yes],
2348 [tcl_cv_member_tm_tzadj=no])])
2349 if test $tcl_cv_member_tm_tzadj = yes ; then
2350 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2353 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2354 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_gmtoff;]])],
2355 [tcl_cv_member_tm_gmtoff=yes],
2356 [tcl_cv_member_tm_gmtoff=no])])
2357 if test $tcl_cv_member_tm_gmtoff = yes ; then
2358 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2362 # Its important to include time.h in this check, as some systems
2363 # (like convex) have timezone functions, etc.
2365 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2366 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
2367 #include <stdlib.h>]],
2368 [[extern long timezone;
2371 [tcl_cv_timezone_long=yes], [tcl_cv_timezone_long=no])])
2372 if test $tcl_cv_timezone_long = yes ; then
2373 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2376 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2378 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2379 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
2380 #include <stdlib.h>]],
2381 [[extern time_t timezone;
2384 [tcl_cv_timezone_time=yes], [tcl_cv_timezone_time=no])])
2385 if test $tcl_cv_timezone_time = yes ; then
2386 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2391 #--------------------------------------------------------------------
2394 # Under Solaris 2.4, strtod returns the wrong value for the
2395 # terminating character under some conditions. Check for this
2396 # and if the problem exists use a substitute procedure
2397 # "fixstrtod" (provided by Tcl) that corrects the error.
2398 # Also, on Compaq's Tru64 Unix 5.0,
2399 # strtod(" ") returns 0.0 instead of a failure to convert.
2406 # Might defines some of the following vars:
2407 # strtod (=fixstrtod)
2408 #--------------------------------------------------------------------
2410 AC_DEFUN([TEA_BUGGY_STRTOD], [
2411 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2412 if test "$tcl_strtod" = 1; then
2413 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2414 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2416 extern double strtod();
2418 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2421 value = strtod(infString, &term);
2422 if ((term != infString) && (term[-1] == 0)) {
2425 value = strtod(nanString, &term);
2426 if ((term != nanString) && (term[-1] == 0)) {
2429 value = strtod(spaceString, &term);
2430 if (term == (spaceString+1)) {
2434 }]])], [tcl_cv_strtod_buggy=ok], [tcl_cv_strtod_buggy=buggy],
2435 [tcl_cv_strtod_buggy=buggy])])
2436 if test "$tcl_cv_strtod_buggy" = buggy; then
2437 AC_LIBOBJ([fixstrtod])
2439 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
2444 #--------------------------------------------------------------------
2447 # Search for the libraries needed to link the Tcl shell.
2448 # Things like the math library (-lm), socket stuff (-lsocket vs.
2449 # -lnsl), zlib (-lz) and libtommath (-ltommath) are dealt with here.
2456 # Might append to the following vars:
2460 # Might define the following vars:
2463 #--------------------------------------------------------------------
2465 AC_DEFUN([TEA_TCL_LINK_LIBS], [
2466 #--------------------------------------------------------------------
2467 # On a few very rare systems, all of the libm.a stuff is
2468 # already in libc.a. Set compiler flags accordingly.
2469 #--------------------------------------------------------------------
2471 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2473 #--------------------------------------------------------------------
2474 # Interactive UNIX requires -linet instead of -lsocket, plus it
2475 # needs net/errno.h to define the socket-related error codes.
2476 #--------------------------------------------------------------------
2478 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2479 AC_CHECK_HEADER(net/errno.h, [
2480 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2482 #--------------------------------------------------------------------
2483 # Check for the existence of the -lsocket and -lnsl libraries.
2484 # The order here is important, so that they end up in the right
2485 # order in the command line generated by make. Here are some
2486 # special considerations:
2487 # 1. Use "connect" and "accept" to check for -lsocket, and
2488 # "gethostbyname" to check for -lnsl.
2489 # 2. Use each function name only once: can't redo a check because
2490 # autoconf caches the results of the last check and won't redo it.
2491 # 3. Use -lnsl and -lsocket only if they supply procedures that
2492 # aren't already present in the normal libraries. This is because
2493 # IRIX 5.2 has libraries, but they aren't needed and they're
2494 # bogus: they goof up name resolution if used.
2495 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2496 # To get around this problem, check for both libraries together
2497 # if -lsocket doesn't work by itself.
2498 #--------------------------------------------------------------------
2501 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2502 if test "$tcl_checkSocket" = 1; then
2503 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2504 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2506 if test "$tcl_checkBoth" = 1; then
2508 LIBS="$LIBS -lsocket -lnsl"
2509 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2511 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2512 [LIBS="$LIBS -lnsl"])])
2513 AC_CHECK_FUNC(mp_log_u32, , [AC_CHECK_LIB(tommath, mp_log_u32,
2514 [LIBS="$LIBS -ltommath"])])
2515 AC_CHECK_FUNC(deflateSetHeader, , [AC_CHECK_LIB(z, deflateSetHeader,
2516 [LIBS="$LIBS -lz"])])
2519 #--------------------------------------------------------------------
2520 # TEA_TCL_EARLY_FLAGS
2522 # Check for what flags are needed to be passed so the correct OS
2523 # features are available.
2530 # Might define the following vars:
2532 # _LARGEFILE64_SOURCE
2533 # _LARGEFILE_SOURCE64
2535 #--------------------------------------------------------------------
2537 AC_DEFUN([TEA_TCL_EARLY_FLAG],[
2538 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2539 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])],
2540 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[[#define ]$1[ 1
2542 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2543 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)]))
2544 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2545 AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
2546 tcl_flags="$tcl_flags $1"
2550 AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
2551 AC_MSG_CHECKING([for required early compiler flags])
2553 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2554 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2555 TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2556 [struct stat64 buf; int i = stat64("/", &buf);])
2557 TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2558 [char *p = (char *)open64;])
2559 if test "x${tcl_flags}" = "x" ; then
2560 AC_MSG_RESULT([none])
2562 AC_MSG_RESULT([${tcl_flags}])
2566 #--------------------------------------------------------------------
2567 # TEA_TCL_64BIT_FLAGS
2569 # Check for what is defined in the way of 64-bit features.
2576 # Might define the following vars:
2577 # TCL_WIDE_INT_IS_LONG
2579 # HAVE_STRUCT_DIRENT64, HAVE_DIR64
2580 # HAVE_STRUCT_STAT64
2583 #--------------------------------------------------------------------
2585 AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
2586 AC_MSG_CHECKING([for 64-bit integer type])
2587 AC_CACHE_VAL(tcl_cv_type_64bit,[
2588 tcl_cv_type_64bit=none
2589 # See if the compiler knows natively about __int64
2590 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__int64 value = (__int64) 0;]])],
2591 [tcl_type_64bit=__int64],[tcl_type_64bit="long long"])
2592 # See if we could use long anyway Note that we substitute in the
2593 # type that is our current guess for a 64-bit type inside this check
2594 # program, so it should be modified only carefully...
2595 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) {
2596 case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
2597 }]])],[tcl_cv_type_64bit=${tcl_type_64bit}],[])])
2598 if test "${tcl_cv_type_64bit}" = none ; then
2599 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?])
2600 AC_MSG_RESULT([yes])
2601 elif test "${tcl_cv_type_64bit}" = "__int64" \
2602 -a "${TEA_PLATFORM}" = "windows" ; then
2603 # TEA specific: We actually want to use the default tcl.h checks in
2604 # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
2605 AC_MSG_RESULT([using Tcl header defaults])
2607 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2608 [What type should be used to define wide integers?])
2609 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2611 # Now check for auxiliary declarations
2612 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2613 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2614 #include <dirent.h>]], [[struct dirent64 p;]])],
2615 [tcl_cv_struct_dirent64=yes],[tcl_cv_struct_dirent64=no])])
2616 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2617 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2620 AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[
2621 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2622 #include <dirent.h>]], [[struct dirent64 *p; DIR64 d = opendir64(".");
2623 p = readdir64(d); rewinddir64(d); closedir64(d);]])],
2624 [tcl_cv_DIR64=yes], [tcl_cv_DIR64=no])])
2625 if test "x${tcl_cv_DIR64}" = "xyes" ; then
2626 AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?])
2629 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2630 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat64 p;
2632 [tcl_cv_struct_stat64=yes], [tcl_cv_struct_stat64=no])])
2633 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2634 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2637 AC_CHECK_FUNCS(open64 lseek64)
2638 AC_MSG_CHECKING([for off64_t])
2639 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2640 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[off64_t offset;
2642 [tcl_cv_type_off64_t=yes], [tcl_cv_type_off64_t=no])])
2643 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2644 dnl functions lseek64 and open64 are defined.
2645 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2646 test "x${ac_cv_func_lseek64}" = "xyes" && \
2647 test "x${ac_cv_func_open64}" = "xyes" ; then
2648 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2649 AC_MSG_RESULT([yes])
2657 ## Here ends the standard Tcl configuration bits and starts the
2658 ## TEA specific functions
2661 #------------------------------------------------------------------------
2664 # Init various Tcl Extension Architecture (TEA) variables.
2665 # This should be the first called TEA_* macro.
2672 # Defines and substs the following vars:
2678 # TEA_PLATFORM (windows or unix)
2680 # "cygpath" is used on windows to generate native path names for include
2681 # files. These variables should only be used with the compiler and linker
2682 # since they generate native path names.
2685 # Select the executable extension based on the host type. This
2686 # is a lightweight replacement for AC_EXEEXT that doesn't require
2688 #------------------------------------------------------------------------
2690 AC_DEFUN([TEA_INIT], [
2693 AC_MSG_CHECKING([TEA configuration])
2694 if test x"${PACKAGE_NAME}" = x ; then
2696 The PACKAGE_NAME variable must be defined by your TEA configure.ac])
2698 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
2700 # If the user did not set CFLAGS, set it now to keep macros
2701 # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
2702 if test "${CFLAGS+set}" != "set" ; then
2706 case "`uname -s`" in
2707 *win32*|*WIN32*|*MINGW32_*|*MINGW64_*|*MSYS_*)
2708 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
2710 TEA_PLATFORM="windows"
2714 # CYGPATH and TEA_PLATFORM are determined later in LOAD_TCLCONFIG
2718 # Maybe we are cross-compiling....
2719 case ${host_alias} in
2722 TEA_PLATFORM="windows"
2732 # Check if exec_prefix is set. If not use fall back to prefix.
2733 # Note when adjusted, so that TEA_PREFIX can correct for this.
2734 # This is needed for recursive configures, since autoconf propagates
2735 # $prefix, but not $exec_prefix (doh!).
2736 if test x$exec_prefix = xNONE ; then
2737 exec_prefix_default=yes
2741 AC_MSG_NOTICE([configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}])
2746 # This package name must be replaced statically for AC_SUBST to work
2747 AC_SUBST(PKG_LIB_FILE)
2748 AC_SUBST(PKG_LIB_FILE8)
2749 AC_SUBST(PKG_LIB_FILE9)
2750 # Substitute STUB_LIB_FILE in case package creates a stub library too.
2751 AC_SUBST(PKG_STUB_LIB_FILE)
2753 # We AC_SUBST these here to ensure they are subst'ed,
2754 # in case the user doesn't call TEA_ADD_...
2755 AC_SUBST(PKG_STUB_SOURCES)
2756 AC_SUBST(PKG_STUB_OBJECTS)
2757 AC_SUBST(PKG_TCL_SOURCES)
2758 AC_SUBST(PKG_HEADERS)
2759 AC_SUBST(PKG_INCLUDES)
2761 AC_SUBST(PKG_CFLAGS)
2763 # Configure the installer.
2767 #------------------------------------------------------------------------
2768 # TEA_ADD_SOURCES --
2770 # Specify one or more source files. Users should check for
2771 # the right platform before adding to their list.
2772 # It is not important to specify the directory, as long as it is
2773 # in the generic, win or unix subdirectory of $(srcdir).
2776 # one or more file names
2780 # Defines and substs the following vars:
2783 #------------------------------------------------------------------------
2784 AC_DEFUN([TEA_ADD_SOURCES], [
2790 PKG_SOURCES="$PKG_SOURCES $i"
2791 PKG_OBJECTS="$PKG_OBJECTS $i"
2794 # check for existence - allows for generic/win/unix VPATH
2795 # To add more dirs here (like 'src'), you have to update VPATH
2796 # in Makefile.in as well
2797 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2798 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2799 -a ! -f "${srcdir}/macosx/$i" \
2801 AC_MSG_ERROR([could not find source file '$i'])
2803 PKG_SOURCES="$PKG_SOURCES $i"
2804 # this assumes it is in a VPATH dir
2806 # handle user calling this before or after TEA_SETUP_COMPILER
2807 if test x"${OBJEXT}" != x ; then
2808 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2810 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2812 PKG_OBJECTS="$PKG_OBJECTS $j"
2816 AC_SUBST(PKG_SOURCES)
2817 AC_SUBST(PKG_OBJECTS)
2820 #------------------------------------------------------------------------
2821 # TEA_ADD_STUB_SOURCES --
2823 # Specify one or more source files. Users should check for
2824 # the right platform before adding to their list.
2825 # It is not important to specify the directory, as long as it is
2826 # in the generic, win or unix subdirectory of $(srcdir).
2829 # one or more file names
2833 # Defines and substs the following vars:
2836 #------------------------------------------------------------------------
2837 AC_DEFUN([TEA_ADD_STUB_SOURCES], [
2840 # check for existence - allows for generic/win/unix VPATH
2841 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2842 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2843 -a ! -f "${srcdir}/macosx/$i" \
2845 AC_MSG_ERROR([could not find stub source file '$i'])
2847 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
2848 # this assumes it is in a VPATH dir
2850 # handle user calling this before or after TEA_SETUP_COMPILER
2851 if test x"${OBJEXT}" != x ; then
2852 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2854 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2856 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
2858 AC_SUBST(PKG_STUB_SOURCES)
2859 AC_SUBST(PKG_STUB_OBJECTS)
2862 #------------------------------------------------------------------------
2863 # TEA_ADD_TCL_SOURCES --
2865 # Specify one or more Tcl source files. These should be platform
2866 # independent runtime files.
2869 # one or more file names
2873 # Defines and substs the following vars:
2875 #------------------------------------------------------------------------
2876 AC_DEFUN([TEA_ADD_TCL_SOURCES], [
2879 # check for existence, be strict because it is installed
2880 if test ! -f "${srcdir}/$i" ; then
2881 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
2883 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
2885 AC_SUBST(PKG_TCL_SOURCES)
2888 #------------------------------------------------------------------------
2889 # TEA_ADD_HEADERS --
2891 # Specify one or more source headers. Users should check for
2892 # the right platform before adding to their list.
2895 # one or more file names
2899 # Defines and substs the following vars:
2901 #------------------------------------------------------------------------
2902 AC_DEFUN([TEA_ADD_HEADERS], [
2905 # check for existence, be strict because it is installed
2906 if test ! -f "${srcdir}/$i" ; then
2907 AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
2909 PKG_HEADERS="$PKG_HEADERS $i"
2911 AC_SUBST(PKG_HEADERS)
2914 #------------------------------------------------------------------------
2915 # TEA_ADD_INCLUDES --
2917 # Specify one or more include dirs. Users should check for
2918 # the right platform before adding to their list.
2921 # one or more file names
2925 # Defines and substs the following vars:
2927 #------------------------------------------------------------------------
2928 AC_DEFUN([TEA_ADD_INCLUDES], [
2931 PKG_INCLUDES="$PKG_INCLUDES $i"
2933 AC_SUBST(PKG_INCLUDES)
2936 #------------------------------------------------------------------------
2939 # Specify one or more libraries. Users should check for
2940 # the right platform before adding to their list. For Windows,
2941 # libraries provided in "foo.lib" format will be converted to
2942 # "-lfoo" when using GCC (mingw).
2945 # one or more file names
2949 # Defines and substs the following vars:
2951 #------------------------------------------------------------------------
2952 AC_DEFUN([TEA_ADD_LIBS], [
2955 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
2956 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
2957 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.[[lL]][[iI]][[bB]][$]/-l\1/'`
2959 PKG_LIBS="$PKG_LIBS $i"
2964 #------------------------------------------------------------------------
2967 # Specify one or more CFLAGS. Users should check for
2968 # the right platform before adding to their list.
2971 # one or more file names
2975 # Defines and substs the following vars:
2977 #------------------------------------------------------------------------
2978 AC_DEFUN([TEA_ADD_CFLAGS], [
2979 PKG_CFLAGS="$PKG_CFLAGS $@"
2980 AC_SUBST(PKG_CFLAGS)
2983 #------------------------------------------------------------------------
2984 # TEA_ADD_CLEANFILES --
2986 # Specify one or more CLEANFILES.
2989 # one or more file names to clean target
2993 # Appends to CLEANFILES, already defined for subst in LOAD_TCLCONFIG
2994 #------------------------------------------------------------------------
2995 AC_DEFUN([TEA_ADD_CLEANFILES], [
2996 CLEANFILES="$CLEANFILES $@"
2999 #------------------------------------------------------------------------
3002 # Handle the --prefix=... option by defaulting to what Tcl gave
3009 # If --prefix or --exec-prefix was not specified, $prefix and
3010 # $exec_prefix will be set to the values given to Tcl when it was
3012 #------------------------------------------------------------------------
3013 AC_DEFUN([TEA_PREFIX], [
3014 if test "${prefix}" = "NONE"; then
3016 if test x"${TCL_PREFIX}" != x; then
3017 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
3018 prefix=${TCL_PREFIX}
3020 AC_MSG_NOTICE([--prefix defaulting to /usr/local])
3024 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
3025 -o x"${exec_prefix_default}" = x"yes" ; then
3026 if test x"${TCL_EXEC_PREFIX}" != x; then
3027 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
3028 exec_prefix=${TCL_EXEC_PREFIX}
3030 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
3036 #------------------------------------------------------------------------
3037 # TEA_SETUP_COMPILER_CC --
3039 # Do compiler checks the way we want. This is just a replacement
3040 # for AC_PROG_CC in TEA configure.ac files to make them cleaner.
3047 # Sets up CC var and other standard bits we need to make executables.
3048 #------------------------------------------------------------------------
3049 AC_DEFUN([TEA_SETUP_COMPILER_CC], [
3050 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
3051 # in this macro, they need to go into TEA_SETUP_COMPILER instead.
3056 #--------------------------------------------------------------------
3057 # Checks to see if the make program sets the $MAKE variable.
3058 #--------------------------------------------------------------------
3062 #--------------------------------------------------------------------
3064 #--------------------------------------------------------------------
3066 AC_CHECK_TOOL(RANLIB, ranlib)
3068 #--------------------------------------------------------------------
3069 # Determines the correct binary file extension (.o, .obj, .exe etc.)
3070 #--------------------------------------------------------------------
3076 #------------------------------------------------------------------------
3077 # TEA_SETUP_COMPILER --
3079 # Do compiler checks that use the compiler. This must go after
3080 # TEA_SETUP_COMPILER_CC, which does the actual compiler check.
3087 # Sets up CC var and other standard bits we need to make executables.
3088 #------------------------------------------------------------------------
3089 AC_DEFUN([TEA_SETUP_COMPILER], [
3090 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
3091 AC_REQUIRE([TEA_SETUP_COMPILER_CC])
3093 #------------------------------------------------------------------------
3094 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
3095 # It makes compiling go faster. (This is only a performance feature.)
3096 #------------------------------------------------------------------------
3098 if test -z "$no_pipe" -a -n "$GCC"; then
3099 AC_CACHE_CHECK([if the compiler understands -pipe],
3101 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
3102 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_pipe=yes],[tcl_cv_cc_pipe=no])
3103 CFLAGS=$hold_cflags])
3104 if test $tcl_cv_cc_pipe = yes; then
3105 CFLAGS="$CFLAGS -pipe"
3109 #--------------------------------------------------------------------
3110 # Common compiler flag setup
3111 #--------------------------------------------------------------------
3116 #------------------------------------------------------------------------
3119 # Generate a line that can be used to build a shared/unshared library
3120 # in a platform independent manner.
3129 # Defines the following vars:
3130 # CFLAGS - Done late here to note disturb other AC macros
3131 # MAKE_LIB - Command to execute to build the Tcl library;
3132 # differs depending on whether or not Tcl is being
3133 # compiled as a shared library.
3134 # MAKE_SHARED_LIB Makefile rule for building a shared library
3135 # MAKE_STATIC_LIB Makefile rule for building a static library
3136 # MAKE_STUB_LIB Makefile rule for building a stub library
3137 # VC_MANIFEST_EMBED_DLL Makefile rule for embedded VC manifest in DLL
3138 # VC_MANIFEST_EMBED_EXE Makefile rule for embedded VC manifest in EXE
3139 #------------------------------------------------------------------------
3141 AC_DEFUN([TEA_MAKE_LIB], [
3142 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
3143 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
3144 MAKE_SHARED_LIB="\${SHLIB_LD} \${LDFLAGS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3145 AC_EGREP_CPP([manifest needed], [
3146 #if defined(_MSC_VER) && _MSC_VER >= 1400
3147 print("manifest needed")
3150 # Could do a CHECK_PROG for mt, but should always be with MSVC8+
3151 VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;2 ; fi"
3152 VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;1 ; fi"
3153 MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
3154 TEA_ADD_CLEANFILES([*.manifest])
3156 MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[$]@ \$(PKG_STUB_OBJECTS)"
3158 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
3159 MAKE_SHARED_LIB="\${SHLIB_LD} \${LDFLAGS} \${LDFLAGS_DEFAULT} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3160 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
3163 if test "${SHARED_BUILD}" = "1" ; then
3164 MAKE_LIB="${MAKE_SHARED_LIB} "
3166 MAKE_LIB="${MAKE_STATIC_LIB} "
3169 #--------------------------------------------------------------------
3170 # Shared libraries and static libraries have different names.
3171 # Use the double eval to make sure any variables in the suffix is
3172 # substituted. (@@@ Might not be necessary anymore)
3173 #--------------------------------------------------------------------
3175 PACKAGE_LIB_PREFIX8="${PACKAGE_LIB_PREFIX}"
3176 PACKAGE_LIB_PREFIX9="${PACKAGE_LIB_PREFIX}tcl9"
3177 if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
3178 PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX9}"
3180 PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX8}"
3182 if test "${TEA_PLATFORM}" = "windows" ; then
3183 if test "${SHARED_BUILD}" = "1" ; then
3184 # We force the unresolved linking of symbols that are really in
3185 # the private libraries of Tcl and Tk.
3186 if test x"${TK_BIN_DIR}" != x ; then
3187 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
3189 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
3190 if test "$GCC" = "yes"; then
3191 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
3193 eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3194 eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3195 eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3197 if test "$GCC" = "yes"; then
3198 PACKAGE_LIB_PREFIX=lib${PACKAGE_LIB_PREFIX}
3200 eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3201 eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3202 eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3204 # Some packages build their own stubs libraries
3205 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3206 if test "$GCC" = "yes"; then
3207 PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
3209 # These aren't needed on Windows (either MSVC or gcc)
3213 RANLIB_STUB="${RANLIB}"
3214 if test "${SHARED_BUILD}" = "1" ; then
3215 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
3216 if test x"${TK_BIN_DIR}" != x ; then
3217 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
3219 eval eval "PKG_LIB_FILE8=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3220 eval eval "PKG_LIB_FILE9=lib${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3221 eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3224 eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3225 eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3226 eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3228 # Some packages build their own stubs libraries
3229 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3232 # These are escaped so that only CFLAGS is picked up at configure time.
3233 # The other values will be substituted at make time.
3234 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
3235 if test "${SHARED_BUILD}" = "1" ; then
3236 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
3240 AC_SUBST(MAKE_SHARED_LIB)
3241 AC_SUBST(MAKE_STATIC_LIB)
3242 AC_SUBST(MAKE_STUB_LIB)
3243 AC_SUBST(RANLIB_STUB)
3244 AC_SUBST(VC_MANIFEST_EMBED_DLL)
3245 AC_SUBST(VC_MANIFEST_EMBED_EXE)
3248 #------------------------------------------------------------------------
3251 # Compute the name of an existing object library located in libdir
3252 # from the given base name and produce the appropriate linker flags.
3255 # basename The base name of the library without version
3256 # numbers, extensions, or "lib" prefixes.
3257 # extra_dir Extra directory in which to search for the
3258 # library. This location is used first, then
3259 # $prefix/$exec-prefix, then some defaults.
3262 # TEA_INIT and TEA_PREFIX must be called first.
3266 # Defines the following vars:
3267 # ${basename}_LIB_NAME The computed library name.
3268 # ${basename}_LIB_SPEC The computed linker flags.
3269 #------------------------------------------------------------------------
3271 AC_DEFUN([TEA_LIB_SPEC], [
3272 AC_MSG_CHECKING([for $1 library])
3274 # Look in exec-prefix for the library (defined by TEA_PREFIX).
3276 tea_lib_name_dir="${exec_prefix}/lib"
3278 # Or in a user-specified location.
3280 if test x"$2" != x ; then
3281 tea_extra_lib_dir=$2
3283 tea_extra_lib_dir=NONE
3287 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3288 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3289 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3290 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3291 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3292 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
3293 `ls -dr /usr/lib64/$1[[0-9]]*.lib 2>/dev/null ` \
3294 `ls -dr /usr/lib64/lib$1[[0-9]]* 2>/dev/null ` \
3295 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3296 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
3297 if test -f "$i" ; then
3298 tea_lib_name_dir=`dirname $i`
3299 $1_LIB_NAME=`basename $i`
3305 if test "${TEA_PLATFORM}" = "windows"; then
3306 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
3308 # Strip off the leading "lib" and trailing ".a" or ".so"
3310 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
3311 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
3314 if test "x${$1_LIB_NAME}" = x ; then
3315 AC_MSG_ERROR([not found])
3317 AC_MSG_RESULT([${$1_LIB_SPEC}])
3321 #------------------------------------------------------------------------
3322 # TEA_PRIVATE_TCL_HEADERS --
3324 # Locate the private Tcl include files
3329 # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
3330 # already been called.
3334 # Substitutes the following vars:
3335 # TCL_TOP_DIR_NATIVE
3337 #------------------------------------------------------------------------
3339 AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
3340 # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh}
3341 AC_REQUIRE([TEA_PUBLIC_TCL_HEADERS])
3342 AC_MSG_CHECKING([for Tcl private include files])
3344 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
3345 TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
3347 # Check to see if tcl<Plat>Port.h isn't already with the public headers
3348 # Don't look for tclInt.h because that resides with tcl.h in the core
3349 # sources, but the <plat>Port headers are in a different directory
3350 if test "${TEA_PLATFORM}" = "windows" -a \
3351 -f "${ac_cv_c_tclh}/tclWinPort.h"; then
3352 result="private headers found with public headers"
3353 elif test "${TEA_PLATFORM}" = "unix" -a \
3354 -f "${ac_cv_c_tclh}/tclUnixPort.h"; then
3355 result="private headers found with public headers"
3357 TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
3358 if test "${TEA_PLATFORM}" = "windows"; then
3359 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
3361 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
3363 # Overwrite the previous TCL_INCLUDES as this should capture both
3364 # public and private headers in the same set.
3365 # We want to ensure these are substituted so as not to require
3366 # any *_NATIVE vars be defined in the Makefile
3367 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
3368 if test "`uname -s`" = "Darwin"; then
3369 # If Tcl was built as a framework, attempt to use
3370 # the framework's Headers and PrivateHeaders directories
3373 if test -d "${TCL_BIN_DIR}/Headers" -a \
3374 -d "${TCL_BIN_DIR}/PrivateHeaders"; then
3375 TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
3377 TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3381 result="Using ${TCL_INCLUDES}"
3383 if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
3384 AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
3386 result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}"
3390 AC_SUBST(TCL_TOP_DIR_NATIVE)
3392 AC_SUBST(TCL_INCLUDES)
3393 AC_MSG_RESULT([${result}])
3396 #------------------------------------------------------------------------
3397 # TEA_PUBLIC_TCL_HEADERS --
3399 # Locate the installed public Tcl header files
3405 # CYGPATH must be set
3409 # Adds a --with-tclinclude switch to configure.
3412 # Substitutes the following vars:
3414 #------------------------------------------------------------------------
3416 AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
3417 AC_MSG_CHECKING([for Tcl public headers])
3419 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
3421 AC_CACHE_VAL(ac_cv_c_tclh, [
3422 # Use the value from --with-tclinclude, if it was given
3424 if test x"${with_tclinclude}" != x ; then
3425 if test -f "${with_tclinclude}/tcl.h" ; then
3426 ac_cv_c_tclh=${with_tclinclude}
3428 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
3432 if test "`uname -s`" = "Darwin"; then
3433 # If Tcl was built as a framework, attempt to use
3434 # the framework's Headers directory
3437 list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
3442 # Look in the source dir only if Tcl is not installed,
3443 # and in that situation, look there before installed locations.
3444 if test -f "${TCL_BIN_DIR}/Makefile" ; then
3445 list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
3448 # Check order: pkg --prefix location, Tcl's --prefix location,
3449 # relative to directory of tclConfig.sh.
3451 eval "temp_includedir=${includedir}"
3453 `ls -d ${temp_includedir} 2>/dev/null` \
3454 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3455 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3456 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3457 list="$list /usr/local/include /usr/include"
3458 if test x"${TCL_INCLUDE_SPEC}" != x ; then
3459 d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3460 list="$list `ls -d ${d} 2>/dev/null`"
3464 if test -f "$i/tcl.h" ; then
3472 # Print a message based on how we determined the include path
3474 if test x"${ac_cv_c_tclh}" = x ; then
3475 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
3477 AC_MSG_RESULT([${ac_cv_c_tclh}])
3480 # Convert to a native path and substitute into the output files.
3482 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
3484 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3486 AC_SUBST(TCL_INCLUDES)
3489 #------------------------------------------------------------------------
3490 # TEA_PRIVATE_TK_HEADERS --
3492 # Locate the private Tk include files
3497 # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
3498 # already been called.
3502 # Substitutes the following vars:
3504 #------------------------------------------------------------------------
3506 AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
3507 # Allow for --with-tkinclude to take effect and define ${ac_cv_c_tkh}
3508 AC_REQUIRE([TEA_PUBLIC_TK_HEADERS])
3509 AC_MSG_CHECKING([for Tk private include files])
3511 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
3512 TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
3514 # Check to see if tk<Plat>Port.h isn't already with the public headers
3515 # Don't look for tkInt.h because that resides with tk.h in the core
3516 # sources, but the <plat>Port headers are in a different directory
3517 if test "${TEA_PLATFORM}" = "windows" -a \
3518 -f "${ac_cv_c_tkh}/tkWinPort.h"; then
3519 result="private headers found with public headers"
3520 elif test "${TEA_PLATFORM}" = "unix" -a \
3521 -f "${ac_cv_c_tkh}/tkUnixPort.h"; then
3522 result="private headers found with public headers"
3524 TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
3525 TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
3526 if test "${TEA_PLATFORM}" = "windows"; then
3527 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
3529 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
3531 # Overwrite the previous TK_INCLUDES as this should capture both
3532 # public and private headers in the same set.
3533 # We want to ensure these are substituted so as not to require
3534 # any *_NATIVE vars be defined in the Makefile
3535 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
3536 # Detect and add ttk subdir
3537 if test -d "${TK_SRC_DIR}/generic/ttk"; then
3538 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\""
3540 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3541 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_XLIB_DIR_NATIVE}\""
3543 if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3544 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/macosx\""
3546 if test "`uname -s`" = "Darwin"; then
3547 # If Tk was built as a framework, attempt to use
3548 # the framework's Headers and PrivateHeaders directories
3551 if test -d "${TK_BIN_DIR}/Headers" -a \
3552 -d "${TK_BIN_DIR}/PrivateHeaders"; then
3553 TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"
3555 TK_INCLUDES="${TK_INCLUDES} ${TK_INCLUDE_SPEC} `echo "${TK_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3559 result="Using ${TK_INCLUDES}"
3561 if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
3562 AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
3564 result="Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}"
3568 AC_SUBST(TK_TOP_DIR_NATIVE)
3569 AC_SUBST(TK_XLIB_DIR_NATIVE)
3571 AC_SUBST(TK_INCLUDES)
3572 AC_MSG_RESULT([${result}])
3575 #------------------------------------------------------------------------
3576 # TEA_PUBLIC_TK_HEADERS --
3578 # Locate the installed public Tk header files
3584 # CYGPATH must be set
3588 # Adds a --with-tkinclude switch to configure.
3591 # Substitutes the following vars:
3593 #------------------------------------------------------------------------
3595 AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
3596 AC_MSG_CHECKING([for Tk public headers])
3598 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files], with_tkinclude=${withval})
3600 AC_CACHE_VAL(ac_cv_c_tkh, [
3601 # Use the value from --with-tkinclude, if it was given
3603 if test x"${with_tkinclude}" != x ; then
3604 if test -f "${with_tkinclude}/tk.h" ; then
3605 ac_cv_c_tkh=${with_tkinclude}
3607 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
3611 if test "`uname -s`" = "Darwin"; then
3612 # If Tk was built as a framework, attempt to use
3613 # the framework's Headers directory.
3616 list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
3621 # Look in the source dir only if Tk is not installed,
3622 # and in that situation, look there before installed locations.
3623 if test -f "${TK_BIN_DIR}/Makefile" ; then
3624 list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
3627 # Check order: pkg --prefix location, Tk's --prefix location,
3628 # relative to directory of tkConfig.sh, Tcl's --prefix location,
3629 # relative to directory of tclConfig.sh.
3631 eval "temp_includedir=${includedir}"
3633 `ls -d ${temp_includedir} 2>/dev/null` \
3634 `ls -d ${TK_PREFIX}/include 2>/dev/null` \
3635 `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
3636 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3637 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3638 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3639 list="$list /usr/local/include /usr/include"
3640 if test x"${TK_INCLUDE_SPEC}" != x ; then
3641 d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3642 list="$list `ls -d ${d} 2>/dev/null`"
3646 if test -f "$i/tk.h" ; then
3654 # Print a message based on how we determined the include path
3656 if test x"${ac_cv_c_tkh}" = x ; then
3657 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
3659 AC_MSG_RESULT([${ac_cv_c_tkh}])
3662 # Convert to a native path and substitute into the output files.
3664 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
3666 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3668 AC_SUBST(TK_INCLUDES)
3670 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3671 # On Windows and Aqua, we need the X compat headers
3672 AC_MSG_CHECKING([for X11 header files])
3673 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
3674 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
3675 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3676 AC_SUBST(TK_XINCLUDES)
3678 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
3682 #------------------------------------------------------------------------
3683 # TEA_PATH_CONFIG --
3685 # Locate the ${1}Config.sh file and perform a sanity check on
3686 # the ${1} compile flags. These are used by packages like
3687 # [incr Tk] that load *Config.sh files from more than Tcl and Tk.
3694 # Adds the following arguments to configure:
3697 # Defines the following vars:
3698 # $1_BIN_DIR Full path to the directory containing
3699 # the $1Config.sh file
3700 #------------------------------------------------------------------------
3702 AC_DEFUN([TEA_PATH_CONFIG], [
3704 # Ok, lets find the $1 configuration
3705 # First, look for one uninstalled.
3706 # the alternative search directory is invoked by --with-$1
3709 if test x"${no_$1}" = x ; then
3710 # we reset no_$1 in case something fails here
3712 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
3713 AC_MSG_CHECKING([for $1 configuration])
3714 AC_CACHE_VAL(ac_cv_c_$1config,[
3716 # First check to see if --with-$1 was specified.
3717 if test x"${with_$1config}" != x ; then
3718 case ${with_$1config} in
3720 if test -f ${with_$1config}; then
3721 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
3722 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
3725 if test -f "${with_$1config}/$1Config.sh" ; then
3726 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
3728 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
3732 # then check for a private $1 installation
3733 if test x"${ac_cv_c_$1config}" = x ; then
3736 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3737 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3738 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3739 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3741 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3742 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3743 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3744 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3746 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3747 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3748 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3749 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3751 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3752 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3753 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3754 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3756 if test -f "$i/$1Config.sh" ; then
3757 ac_cv_c_$1config=`(cd $i; pwd)`
3760 if test -f "$i/unix/$1Config.sh" ; then
3761 ac_cv_c_$1config=`(cd $i/unix; pwd)`
3767 # check in a few common install locations
3768 if test x"${ac_cv_c_$1config}" = x ; then
3769 for i in `ls -d ${libdir} 2>/dev/null` \
3770 `ls -d ${exec_prefix}/lib 2>/dev/null` \
3771 `ls -d ${prefix}/lib 2>/dev/null` \
3772 `ls -d /usr/local/lib 2>/dev/null` \
3773 `ls -d /usr/contrib/lib 2>/dev/null` \
3774 `ls -d /usr/pkg/lib 2>/dev/null` \
3775 `ls -d /usr/lib 2>/dev/null` \
3776 `ls -d /usr/lib64 2>/dev/null` \
3778 if test -f "$i/$1Config.sh" ; then
3779 ac_cv_c_$1config=`(cd $i; pwd)`
3786 if test x"${ac_cv_c_$1config}" = x ; then
3787 $1_BIN_DIR="# no $1 configs found"
3788 AC_MSG_WARN([Cannot find $1 configuration definitions])
3792 $1_BIN_DIR=${ac_cv_c_$1config}
3793 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
3798 #------------------------------------------------------------------------
3799 # TEA_LOAD_CONFIG --
3801 # Load the $1Config.sh file
3805 # Requires the following vars to be set:
3810 # Substitutes the following vars:
3814 #------------------------------------------------------------------------
3816 AC_DEFUN([TEA_LOAD_CONFIG], [
3817 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
3819 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
3820 AC_MSG_RESULT([loading])
3821 . "${$1_BIN_DIR}/$1Config.sh"
3823 AC_MSG_RESULT([file not found])
3827 # If the $1_BIN_DIR is the build directory (not the install directory),
3828 # then set the common variable name to the value of the build variables.
3829 # For example, the variable $1_LIB_SPEC will be set to the value
3830 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
3831 # instead of $1_BUILD_LIB_SPEC since it will work with both an
3832 # installed and uninstalled version of Tcl.
3835 if test -f "${$1_BIN_DIR}/Makefile" ; then
3836 AC_MSG_WARN([Found Makefile - using build library specs for $1])
3837 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
3838 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
3839 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
3840 $1_INCLUDE_SPEC=${$1_BUILD_INCLUDE_SPEC}
3841 $1_LIBRARY_PATH=${$1_LIBRARY_PATH}
3844 AC_SUBST($1_VERSION)
3845 AC_SUBST($1_BIN_DIR)
3846 AC_SUBST($1_SRC_DIR)
3848 AC_SUBST($1_LIB_FILE)
3849 AC_SUBST($1_LIB_SPEC)
3851 AC_SUBST($1_STUB_LIB_FILE)
3852 AC_SUBST($1_STUB_LIB_SPEC)
3853 AC_SUBST($1_STUB_LIB_PATH)
3855 # Allow the caller to prevent this auto-check by specifying any 2nd arg
3856 AS_IF([test "x$2" = x], [
3857 # Check both upper and lower-case variants
3858 # If a dev wanted non-stubs libs, this function could take an option
3859 # to not use _STUB in the paths below
3860 AS_IF([test "x${$1_STUB_LIB_SPEC}" = x],
3861 [TEA_LOAD_CONFIG_LIB(translit($1,[a-z],[A-Z])_STUB)],
3862 [TEA_LOAD_CONFIG_LIB($1_STUB)])
3866 #------------------------------------------------------------------------
3867 # TEA_LOAD_CONFIG_LIB --
3869 # Helper function to load correct library from another extension's
3870 # ${PACKAGE}Config.sh.
3873 # Adds to LIBS the appropriate extension library
3874 #------------------------------------------------------------------------
3875 AC_DEFUN([TEA_LOAD_CONFIG_LIB], [
3876 AC_MSG_CHECKING([For $1 library for LIBS])
3877 # This simplifies the use of stub libraries by automatically adding
3878 # the stub lib to your path. Normally this would add to SHLIB_LD_LIBS,
3879 # but this is called before CONFIG_CFLAGS. More importantly, this adds
3880 # to PKG_LIBS, which becomes LIBS, and that is only used by SHLIB_LD.
3881 if test "x${$1_LIB_SPEC}" != "x" ; then
3882 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
3883 TEA_ADD_LIBS([\"`${CYGPATH} ${$1_LIB_PATH}`\"])
3884 AC_MSG_RESULT([using $1_LIB_PATH ${$1_LIB_PATH}])
3886 TEA_ADD_LIBS([${$1_LIB_SPEC}])
3887 AC_MSG_RESULT([using $1_LIB_SPEC ${$1_LIB_SPEC}])
3890 AC_MSG_RESULT([file not found])
3894 #------------------------------------------------------------------------
3895 # TEA_EXPORT_CONFIG --
3897 # Define the data to insert into the ${PACKAGE}Config.sh file
3901 # Requires the following vars to be set:
3905 # Substitutes the following vars:
3906 #------------------------------------------------------------------------
3908 AC_DEFUN([TEA_EXPORT_CONFIG], [
3909 #--------------------------------------------------------------------
3910 # These are for $1Config.sh
3911 #--------------------------------------------------------------------
3913 # pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
3914 eval pkglibdir="[$]{libdir}/$1${PACKAGE_VERSION}"
3915 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
3916 eval $1_LIB_FLAG="-l$1${PACKAGE_VERSION}"
3917 eval $1_STUB_LIB_FLAG="-l$1stub${PACKAGE_VERSION}"
3919 eval $1_LIB_FLAG="-l$1`echo ${PACKAGE_VERSION} | tr -d .`"
3920 eval $1_STUB_LIB_FLAG="-l$1stub`echo ${PACKAGE_VERSION} | tr -d .`"
3922 $1_BUILD_LIB_SPEC="-L`$CYGPATH $(pwd)` ${$1_LIB_FLAG}"
3923 $1_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` ${$1_LIB_FLAG}"
3924 $1_BUILD_STUB_LIB_SPEC="-L`$CYGPATH $(pwd)` [$]{$1_STUB_LIB_FLAG}"
3925 $1_STUB_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` [$]{$1_STUB_LIB_FLAG}"
3926 $1_BUILD_STUB_LIB_PATH="`$CYGPATH $(pwd)`/[$]{PKG_STUB_LIB_FILE}"
3927 $1_STUB_LIB_PATH="`$CYGPATH ${pkglibdir}`/[$]{PKG_STUB_LIB_FILE}"
3929 AC_SUBST($1_BUILD_LIB_SPEC)
3930 AC_SUBST($1_LIB_SPEC)
3931 AC_SUBST($1_BUILD_STUB_LIB_SPEC)
3932 AC_SUBST($1_STUB_LIB_SPEC)
3933 AC_SUBST($1_BUILD_STUB_LIB_PATH)
3934 AC_SUBST($1_STUB_LIB_PATH)
3936 AC_SUBST(MAJOR_VERSION)
3937 AC_SUBST(MINOR_VERSION)
3938 AC_SUBST(PATCHLEVEL)
3942 #------------------------------------------------------------------------
3945 # Configure the installer.
3951 # Substitutes the following vars:
3958 #------------------------------------------------------------------------
3960 AC_DEFUN([TEA_INSTALLER], [
3961 INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c'
3962 INSTALL_DATA_DIR='${INSTALL} -d -m 755'
3963 INSTALL_DATA='${INSTALL} -m 644'
3964 INSTALL_PROGRAM='${INSTALL} -m 755'
3965 INSTALL_SCRIPT='${INSTALL} -m 755'
3969 HP-UX-*) INSTALL_LIBRARY='${INSTALL} -m 755' ;;
3970 *) INSTALL_LIBRARY='${INSTALL} -m 644' ;;
3974 AC_SUBST(INSTALL_DATA_DIR)
3975 AC_SUBST(INSTALL_DATA)
3976 AC_SUBST(INSTALL_PROGRAM)
3977 AC_SUBST(INSTALL_SCRIPT)
3978 AC_SUBST(INSTALL_LIBRARY)
3982 # Tip 430 - ZipFS Modifications
3984 #------------------------------------------------------------------------
3986 # Locate a zip encoder installed on the system path, or none.
3992 # Substitutes the following vars:
3996 # ZIP_PROG_VFSSEARCH
3998 #------------------------------------------------------------------------
4000 AC_DEFUN([TEA_ZIPFS_SUPPORT], [
4004 ZIP_PROG_VFSSEARCH=""
4007 AC_MSG_CHECKING([for macher])
4008 AC_CACHE_VAL(ac_cv_path_macher, [
4009 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
4010 for dir in $search_path ; do
4011 for j in `ls -r $dir/macher 2> /dev/null` \
4012 `ls -r $dir/macher 2> /dev/null` ; do
4013 if test x"$ac_cv_path_macher" = x ; then
4014 if test -f "$j" ; then
4015 ac_cv_path_macher=$j
4022 if test -f "$ac_cv_path_macher" ; then
4023 MACHER_PROG="$ac_cv_path_macher"
4024 AC_MSG_RESULT([$MACHER_PROG])
4025 AC_MSG_RESULT([Found macher in environment])
4027 AC_MSG_CHECKING([for zip])
4028 AC_CACHE_VAL(ac_cv_path_zip, [
4029 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
4030 for dir in $search_path ; do
4031 for j in `ls -r $dir/zip 2> /dev/null` \
4032 `ls -r $dir/zip 2> /dev/null` ; do
4033 if test x"$ac_cv_path_zip" = x ; then
4034 if test -f "$j" ; then
4042 if test -f "$ac_cv_path_zip" ; then
4043 ZIP_PROG="$ac_cv_path_zip"
4044 AC_MSG_RESULT([$ZIP_PROG])
4045 ZIP_PROG_OPTIONS="-rq"
4046 ZIP_PROG_VFSSEARCH="*"
4047 AC_MSG_RESULT([Found INFO Zip in environment])
4048 # Use standard arguments for zip
4050 # It is not an error if an installed version of Zip can't be located.
4051 # We can use the locally distributed minizip instead
4052 ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
4053 ZIP_PROG_OPTIONS="-o -r"
4054 ZIP_PROG_VFSSEARCH="*"
4055 ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
4056 AC_MSG_RESULT([No zip found on PATH. Building minizip])
4058 AC_SUBST(MACHER_PROG)
4060 AC_SUBST(ZIP_PROG_OPTIONS)
4061 AC_SUBST(ZIP_PROG_VFSSEARCH)
4062 AC_SUBST(ZIP_INSTALL_OBJS)