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.
16 #------------------------------------------------------------------------
17 # TEA_PATH_TCLCONFIG --
19 # Locate the tclConfig.sh file and perform a sanity check on
20 # the Tcl compile flags
27 # Adds the following arguments to configure:
30 # Defines the following vars:
31 # TCL_BIN_DIR Full path to the directory containing
32 # the tclConfig.sh file
33 #------------------------------------------------------------------------
35 AC_DEFUN(TEA_PATH_TCLCONFIG, [
36 dnl Make sure we are initialized
37 AC_REQUIRE([TEA_INIT])
39 # Ok, lets find the tcl configuration
40 # First, look for one uninstalled.
41 # the alternative search directory is invoked by --with-tcl
44 if test x"${no_tcl}" = x ; then
45 # we reset no_tcl in case something fails here
47 AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
48 AC_MSG_CHECKING([for Tcl configuration])
49 AC_CACHE_VAL(ac_cv_c_tclconfig,[
51 # For platform-specific directories
53 windows) platform="win" ;;
54 unix) platform="unix" ;;
55 *) AC_MSG_ERROR([unknown TEA_PLATFORM: \"$TEA_PLATFORM\"])
58 # First check to see if --with-tcl was specified.
59 if test x"${with_tclconfig}" != x ; then
60 case ${with_tclconfig} in
62 if test -f ${with_tclconfig}; then
63 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
64 with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'`
67 if test -f "${with_tclconfig}/tclConfig.sh" ; then
68 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
70 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
74 # then check for a private Tcl installation
75 if test x"${ac_cv_c_tclconfig}" = x ; then
78 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
79 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
80 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
82 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
83 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
84 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
86 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
87 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
88 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
89 if test -f "$i/$platform/tclConfig.sh" ; then
90 ac_cv_c_tclconfig=`(cd $i/$platform; pwd)`
96 # check in a few common install locations
97 if test x"${ac_cv_c_tclconfig}" = x ; then
98 for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \
99 `ls -d ${prefix}/lib 2>/dev/null` \
100 `ls -d /usr/local/lib 2>/dev/null` \
101 `ls -d /usr/contrib/lib 2>/dev/null` \
102 `ls -d /usr/lib 2>/dev/null` \
104 if test -f "$i/tclConfig.sh" ; then
105 ac_cv_c_tclconfig=`(cd $i; pwd)`
111 # check in a few other private locations
112 if test x"${ac_cv_c_tclconfig}" = x ; then
115 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
116 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
117 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
119 if test -f "$i/$platform/tclConfig.sh" ; then
120 ac_cv_c_tclconfig=`(cd $i/$platform; pwd)`
127 if test x"${ac_cv_c_tclconfig}" = x ; then
128 TCL_BIN_DIR="# no Tcl configs found"
129 AC_MSG_WARN("Cannot find Tcl configuration definitions")
133 TCL_BIN_DIR=${ac_cv_c_tclconfig}
134 AC_MSG_RESULT([found $TCL_BIN_DIR/tclConfig.sh])
139 #------------------------------------------------------------------------
140 # TEA_PATH_TKCONFIG --
142 # Locate the tkConfig.sh file
149 # Adds the following arguments to configure:
152 # Defines the following vars:
153 # TK_BIN_DIR Full path to the directory containing
154 # the tkConfig.sh file
155 #------------------------------------------------------------------------
157 AC_DEFUN(TEA_PATH_TKCONFIG, [
159 # Ok, lets find the tk configuration
160 # First, look for one uninstalled.
161 # the alternative search directory is invoked by --with-tk
164 if test x"${no_tk}" = x ; then
165 # we reset no_tk in case something fails here
167 AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
168 AC_MSG_CHECKING([for Tk configuration])
169 AC_CACHE_VAL(ac_cv_c_tkconfig,[
171 # For platform-specific directories
172 case $TEA_PLATFORM in
173 windows) platform="win" ;;
174 unix) platform="unix" ;;
175 *) AC_MSG_ERROR([unknown TEA_PLATFORM: \"$TEA_PLATFORM\"])
178 # First check to see if --with-tkconfig was specified.
179 if test x"${with_tkconfig}" != x ; then
180 case ${with_tkconfig} in
182 if test -f ${with_tkconfig}; then
183 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
184 with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'`
187 if test -f "${with_tkconfig}/tkConfig.sh" ; then
188 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
190 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
194 # then check for a private Tk library
195 if test x"${ac_cv_c_tkconfig}" = x ; then
198 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
199 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
200 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
202 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
203 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
204 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
206 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
207 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
208 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
209 if test -f "$i/$platform/tkConfig.sh" ; then
210 ac_cv_c_tkconfig=`(cd $i/$platform; pwd)`
215 # check in a few common install locations
216 if test x"${ac_cv_c_tkconfig}" = x ; then
217 for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \
218 `ls -d ${prefix}/lib 2>/dev/null` \
219 `ls -d /usr/local/lib 2>/dev/null` \
220 `ls -d /usr/contrib/lib 2>/dev/null` \
221 `ls -d /usr/lib 2>/dev/null` \
223 if test -f "$i/tkConfig.sh" ; then
224 ac_cv_c_tkconfig=`(cd $i; pwd)`
229 # check in a few other private locations
230 if test x"${ac_cv_c_tkconfig}" = x ; then
233 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
234 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
235 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
236 if test -f "$i/$platform/tkConfig.sh" ; then
237 ac_cv_c_tkconfig=`(cd $i/$platform; pwd)`
243 if test x"${ac_cv_c_tkconfig}" = x ; then
244 TK_BIN_DIR="# no Tk configs found"
245 AC_MSG_WARN("Cannot find Tk configuration definitions")
249 TK_BIN_DIR=${ac_cv_c_tkconfig}
250 AC_MSG_RESULT([found $TK_BIN_DIR/tkConfig.sh])
256 #------------------------------------------------------------------------
257 # TEA_LOAD_TCLCONFIG --
259 # Load the tclConfig.sh file
263 # Requires the following vars to be set:
268 # Subst the following vars:
273 #------------------------------------------------------------------------
275 AC_DEFUN(TEA_LOAD_TCLCONFIG, [
276 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
278 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
279 AC_MSG_RESULT([loading])
280 . $TCL_BIN_DIR/tclConfig.sh
282 AC_MSG_RESULT([file not found])
286 # If the TCL_BIN_DIR is the build directory (not the install directory),
287 # then set the common variable name to the value of the build variables.
288 # For example, the variable TCL_LIB_SPEC will be set to the value
289 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
290 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
291 # installed and uninstalled version of Tcl.
294 if test -f $TCL_BIN_DIR/Makefile ; then
295 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
296 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
297 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
301 # eval is required to do the TCL_DBGX substitution
304 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
305 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
306 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
308 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
309 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
310 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
312 AC_SUBST(TCL_VERSION)
313 AC_SUBST(TCL_BIN_DIR)
314 AC_SUBST(TCL_SRC_DIR)
316 AC_SUBST(TCL_LIB_FILE)
317 AC_SUBST(TCL_LIB_FLAG)
318 AC_SUBST(TCL_LIB_SPEC)
320 AC_SUBST(TCL_STUB_LIB_FILE)
321 AC_SUBST(TCL_STUB_LIB_FLAG)
322 AC_SUBST(TCL_STUB_LIB_SPEC)
326 AC_SUBST(TCL_EXTRA_CFLAGS)
327 AC_SUBST(TCL_LD_FLAGS)
328 AC_SUBST(TCL_SHLIB_LD_LIBS)
329 #AC_SUBST(TCL_BUILD_LIB_SPEC)
330 #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
333 #------------------------------------------------------------------------
334 # TEA_LOAD_TKCONFIG --
336 # Load the tkConfig.sh file
340 # Requires the following vars to be set:
345 # Sets the following vars that should be in tkConfig.sh:
347 #------------------------------------------------------------------------
349 AC_DEFUN(TEA_LOAD_TKCONFIG, [
350 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
352 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
353 AC_MSG_RESULT([loading])
354 . $TK_BIN_DIR/tkConfig.sh
356 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
360 # If the TK_BIN_DIR is the build directory (not the install directory),
361 # then set the common variable name to the value of the build variables.
362 # For example, the variable TK_LIB_SPEC will be set to the value
363 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
364 # instead of TK_BUILD_LIB_SPEC since it will work with both an
365 # installed and uninstalled version of Tcl.
368 if test -f $TK_BIN_DIR/Makefile ; then
369 TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
370 TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
371 TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
375 # eval is required to do the TK_DBGX substitution
378 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
379 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
380 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
382 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
383 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
384 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
390 AC_SUBST(TK_LIB_FILE)
391 AC_SUBST(TK_LIB_FLAG)
392 AC_SUBST(TK_LIB_SPEC)
394 AC_SUBST(TK_STUB_LIB_FILE)
395 AC_SUBST(TK_STUB_LIB_FLAG)
396 AC_SUBST(TK_STUB_LIB_SPEC)
399 AC_SUBST(TK_XINCLUDES)
402 #------------------------------------------------------------------------
403 # TEA_ENABLE_SHARED --
405 # Allows the building of shared libraries
412 # Adds the following arguments to configure:
413 # --enable-shared=yes|no
415 # Defines the following vars:
416 # STATIC_BUILD Used for building import/export libraries
419 # Sets the following vars:
420 # SHARED_BUILD Value of 1 or 0
421 #------------------------------------------------------------------------
423 AC_DEFUN(TEA_ENABLE_SHARED, [
424 AC_MSG_CHECKING([how to build libraries])
425 AC_ARG_ENABLE(shared,
426 [ --enable-shared build and link with shared libraries [--enable-shared]],
427 [tcl_ok=$enableval], [tcl_ok=yes])
429 if test "${enable_shared+set}" = set; then
430 enableval="$enable_shared"
436 if test "$tcl_ok" = "yes" ; then
437 AC_MSG_RESULT([shared])
440 AC_MSG_RESULT([static])
442 AC_DEFINE(STATIC_BUILD)
444 AC_SUBST(SHARED_BUILD)
447 #------------------------------------------------------------------------
448 # TEA_ENABLE_THREADS --
450 # Specify if thread support should be enabled. If "yes" is
451 # specified as an arg (optional), threads are enabled by default.
452 # TCL_THREADS is checked so that if you are compiling an extension
453 # against a threaded core, your extension must be compiled threaded
461 # Adds the following arguments to configure:
464 # Sets the following vars:
465 # THREADS_LIBS Thread library(s)
467 # Defines the following vars:
471 #------------------------------------------------------------------------
473 AC_DEFUN(TEA_ENABLE_THREADS, [
474 AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
475 [tcl_ok=$enableval], [tcl_ok=$1])
477 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
480 if test "${TEA_PLATFORM}" != "windows" ; then
481 # We are always OK on Windows, so check what this platform wants.
482 AC_DEFINE(USE_THREAD_ALLOC)
483 AC_DEFINE(_REENTRANT)
484 AC_DEFINE(_THREAD_SAFE)
485 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
486 if test "$tcl_ok" = "no"; then
487 # Check a little harder for __pthread_mutex_init in the
488 # same library, as some systems hide it there until
489 # pthread.h is defined. We could alternatively do an
490 # AC_TRY_COMPILE with pthread.h, but that will work with
491 # libpthread really doesn't exist, like AIX 4.2.
493 AC_CHECK_LIB(pthread, __pthread_mutex_init,
494 tcl_ok=yes, tcl_ok=no)
497 if test "$tcl_ok" = "yes"; then
498 # The space is needed
499 THREADS_LIBS=" -lpthread"
501 AC_CHECK_LIB(pthreads, pthread_mutex_init,
502 tcl_ok=yes, tcl_ok=no)
503 if test "$tcl_ok" = "yes"; then
504 # The space is needed
505 THREADS_LIBS=" -lpthreads"
507 AC_CHECK_LIB(c, pthread_mutex_init,
508 tcl_ok=yes, tcl_ok=no)
509 if test "$tcl_ok" = "no"; then
510 AC_CHECK_LIB(c_r, pthread_mutex_init,
511 tcl_ok=yes, tcl_ok=no)
512 if test "$tcl_ok" = "yes"; then
513 # The space is needed
514 THREADS_LIBS=" -pthread"
517 AC_MSG_WARN("Don t know how to find pthread lib on your system - thread support disabled")
523 # Does the pthread-implementation provide
524 # 'pthread_attr_setstacksize' ?
527 LIBS="$LIBS $THREADS_LIBS"
528 AC_CHECK_FUNCS(pthread_attr_setstacksize)
530 AC_CHECK_FUNCS(readdir_r)
535 # Do checking message here to not mess up interleaved configure output
536 AC_MSG_CHECKING([for building with threads])
537 if test "${TCL_THREADS}" = "1"; then
538 AC_DEFINE(TCL_THREADS)
539 #LIBS="$LIBS $THREADS_LIBS"
542 AC_MSG_RESULT([no (default)])
544 # TCL_THREADS sanity checking. See if our request for building with
545 # threads is the same as the way Tcl was built. If not, warn the user.
548 if test "${TCL_THREADS}" = "0"; then
550 Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl
551 that IS thread-enabled.])
555 if test "${TCL_THREADS}" = "1"; then
557 --enable-threads requested, but attempting building against a Tcl
558 that is NOT thread-enabled.])
562 AC_SUBST(TCL_THREADS)
565 #------------------------------------------------------------------------
566 # TEA_ENABLE_SYMBOLS --
568 # Specify if debugging symbols should be used
569 # Memory (TCL_MEM_DEBUG) debugging can also be enabled.
574 # Requires the following vars to be set:
582 # Adds the following arguments to configure:
585 # Defines the following vars:
586 # CFLAGS_DEFAULT Sets to CFLAGS_DEBUG if true
587 # Sets to CFLAGS_OPTIMIZE if false
588 # LDFLAGS_DEFAULT Sets to LDFLAGS_DEBUG if true
589 # Sets to LDFLAGS_OPTIMIZE if false
590 # DBGX Formerly used as debug library extension;
593 #------------------------------------------------------------------------
595 AC_DEFUN(TEA_ENABLE_SYMBOLS, [
596 dnl Make sure we are initialized
597 AC_REQUIRE([TEA_CONFIG_CFLAGS])
601 AC_MSG_CHECKING([for build with symbols])
602 AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
603 if test "$tcl_ok" = "no"; then
604 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
605 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
608 CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
609 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
610 if test "$tcl_ok" = "yes"; then
611 AC_MSG_RESULT([yes (standard debugging)])
614 if test "${TEA_PLATFORM}" != "windows" ; then
615 LDFLAGS_DEFAULT="${LDFLAGS}"
619 AC_SUBST(CFLAGS_DEFAULT)
620 AC_SUBST(LDFLAGS_DEFAULT)
622 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
623 AC_DEFINE(TCL_MEM_DEBUG)
626 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
627 if test "$tcl_ok" = "all"; then
628 AC_MSG_RESULT([enabled symbols mem debugging])
630 AC_MSG_RESULT([enabled $tcl_ok debugging])
635 #------------------------------------------------------------------------
636 # TEA_ENABLE_LANGINFO --
638 # Allows use of modern nl_langinfo check for better l10n.
639 # This is only relevant for Unix.
646 # Adds the following arguments to configure:
647 # --enable-langinfo=yes|no (default is yes)
649 # Defines the following vars:
650 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
652 #------------------------------------------------------------------------
654 AC_DEFUN(TEA_ENABLE_LANGINFO, [
655 AC_ARG_ENABLE(langinfo,
656 [ --enable-langinfo use nl_langinfo if possible to determine
657 encoding at startup, otherwise use old heuristic],
658 [langinfo_ok=$enableval], [langinfo_ok=yes])
661 if test "$langinfo_ok" = "yes"; then
662 if test "$langinfo_ok" = "yes"; then
663 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
666 AC_MSG_CHECKING([whether to use nl_langinfo])
667 if test "$langinfo_ok" = "yes"; then
668 AC_TRY_COMPILE([#include <langinfo.h>],
669 [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no])
670 if test "$langinfo_ok" = "no"; then
671 langinfo_ok="no (could not compile with nl_langinfo)";
673 if test "$langinfo_ok" = "yes"; then
674 AC_DEFINE(HAVE_LANGINFO)
677 AC_MSG_RESULT([$langinfo_ok])
680 #--------------------------------------------------------------------
683 # Try to determine the proper flags to pass to the compiler
684 # for building shared libraries and other such nonsense.
691 # Defines the following vars:
693 # DL_OBJS - Name of the object file that implements dynamic
694 # loading for Tcl on this system.
695 # DL_LIBS - Library file(s) to include in tclsh and other base
696 # applications in order for the "load" command to work.
697 # LDFLAGS - Flags to pass to the compiler when linking object
698 # files into an executable application binary such
700 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
701 # that tell the run-time dynamic linker where to look
702 # for shared libraries such as libtcl.so. Depends on
703 # the variable LIB_RUNTIME_DIR in the Makefile.
704 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
705 # of a shared library (may request position-independent
706 # code, among other things).
707 # SHLIB_LD - Base command to use for combining object files
708 # into a shared library.
709 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
710 # creating shared libraries. This symbol typically
711 # goes at the end of the "ld" commands that build
712 # shared libraries. The value of the symbol is
713 # "${LIBS}" if all of the dependent libraries should
714 # be specified when creating a shared library. If
715 # dependent libraries should not be specified (as on
716 # SunOS 4.x, where they cause the link to fail, or in
717 # general if Tcl and Tk aren't themselves shared
718 # libraries), then this symbol has an empty string
720 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
721 # extensions. An empty string means we don't know how
722 # to use shared libraries on this platform.
723 # TCL_LIB_FILE - Name of the file that contains the Tcl library, such
724 # as libtcl7.8.so or libtcl7.8.a.
725 # TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl"
726 # in the shared library name, using the
727 # ${PACKAGE_VERSION} variable to put the version in
728 # the right place. This is used by platforms that
729 # need non-standard library names.
730 # Examples: ${PACKAGE_VERSION}.so.1.1 on NetBSD,
731 # since it needs to have a version after the .so, and
732 # ${PACKAGE_VERSION}.a on AIX, since the Tcl shared
733 # library needs to have a .a extension whereas shared
734 # objects for loadable extensions have a .so
735 # extension. Defaults to
736 # ${PACKAGE_VERSION}${SHLIB_SUFFIX}.
737 # TCL_NEEDS_EXP_FILE -
738 # 1 means that an export file is needed to link to a
740 # TCL_EXP_FILE - The name of the installed export / import file which
741 # should be used to link to the Tcl shared library.
742 # Empty if Tcl is unshared.
743 # TCL_BUILD_EXP_FILE -
744 # The name of the built export / import file which
745 # should be used to link to the Tcl shared library.
746 # Empty if Tcl is unshared.
748 # Flags used when running the compiler in debug mode
750 # Flags used when running the compiler in optimize mode
751 # CFLAGS - We add CFLAGS to pass to the compiler
753 # Subst's the following vars:
764 #--------------------------------------------------------------------
766 AC_DEFUN(TEA_CONFIG_CFLAGS, [
767 dnl Make sure we are initialized
768 AC_REQUIRE([TEA_INIT])
770 # Step 0: Enable 64 bit support?
772 AC_MSG_CHECKING([if 64bit support is enabled])
773 AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no])
774 AC_MSG_RESULT([$do64bit])
776 # Step 0.b: Enable Solaris 64 bit VIS support?
778 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
779 AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support], [do64bitVIS=$enableval], [do64bitVIS=no])
780 AC_MSG_RESULT([$do64bitVIS])
782 if test "$do64bitVIS" = "yes"; then
783 # Force 64bit on with VIS
787 # Step 0.c: Cross-compiling options for Windows/CE builds?
789 if test "${TEA_PLATFORM}" = "windows" ; then
790 AC_MSG_CHECKING([if Windows/CE build is requested])
791 AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no])
792 AC_MSG_RESULT($doWince)
795 # Step 1: set the variable "system" to hold the name and version number
796 # for the system. This can usually be done via the "uname" command, but
797 # there are a few systems, like Next, where this doesn't work.
799 AC_MSG_CHECKING([system version (for dynamic loading)])
800 if test -f /usr/lib/NextStep/software_version; then
801 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
803 system=`uname -s`-`uname -r`
804 if test "$?" -ne 0 ; then
805 AC_MSG_RESULT([unknown (can't find uname command)])
808 # Special check for weird MP-RAS system (uname returns weird
809 # results, and the version is kept in special file).
811 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
812 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
814 if test "`uname -s`" = "AIX" ; then
815 system=AIX-`uname -v`.`uname -r`
817 if test "${TEA_PLATFORM}" = "windows" ; then
820 AC_MSG_RESULT([$system])
824 # Step 2: check for existence of -ldl library. This is needed because
825 # Linux can use either -ldl or -ldld for dynamic loading.
827 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
829 # Step 3: set configuration options based on system name and version.
830 # This is similar to Tcl's unix/tcl.m4 except that we've added a
831 # "windows" case and CC_SEARCH_FLAGS becomes LD_SEARCH_FLAGS for us
832 # (and we have no CC_SEARCH_FLAGS).
835 LDFLAGS_ORIG="$LDFLAGS"
836 TCL_EXPORT_FILE_SUFFIX=""
837 UNSHARED_LIB_SUFFIX=""
838 TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
839 ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
840 TCL_LIB_VERSIONS_OK=ok
842 if test "$GCC" = "yes" ; then
844 CFLAGS_WARNING="-Wall -Wno-implicit-int"
850 TCL_BUILD_EXP_FILE=""
852 dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
853 dnl AC_CHECK_TOOL(AR, ar, :)
854 AC_CHECK_PROG(AR, ar, ar)
856 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
859 # This is a 2-stage check to make sure we have the 64-bit SDK
860 # We have to know where the SDK is installed.
861 if test "$do64bit" = "yes" ; then
862 if test "x${MSSDK}x" = "xx" ; then
863 MSSDK="C:/Progra~1/Microsoft SDK"
865 # Ensure that this path has no spaces to work in autoconf
866 TEA_PATH_NOSPACE(MSSDK, ${MSSDK})
867 if test ! -d "${MSSDK}/bin/win64" ; then
868 AC_MSG_WARN([could not find 64-bit SDK to enable 64bit mode])
875 if test "$doWince" != "no" ; then
876 if test "$do64bit" = "yes" ; then
877 AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible])
879 if test "$GCC" = "yes" ; then
880 AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
883 # Set defaults for common evc4/PPC2003 setup
884 # Currently Tcl requires 300+, possibly 420+ for sockets
885 CEVERSION=420; # could be 211 300 301 400 420 ...
886 TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
887 ARCH=ARM; # could be ARM MIPS X86EM ...
888 PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
889 if test "$doWince" != "yes"; then
890 # If !yes then the user specified something
891 # Reset ARCH to allow user to skip specifying it
893 eval `echo $doWince | awk -F, '{ \
894 if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
895 if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
896 if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
897 if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
898 if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
900 if test "x${ARCH}" = "x" ; then
904 OSVERSION=WCE$CEVERSION;
905 if test "x${WCEROOT}" = "x" ; then
906 WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
907 if test ! -d "${WCEROOT}" ; then
908 WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
911 if test "x${SDKROOT}" = "x" ; then
912 SDKROOT="C:/Program Files/Windows CE Tools"
913 if test ! -d "${SDKROOT}" ; then
914 SDKROOT="C:/Windows CE Tools"
917 # Ensure that this path has no spaces to work in autoconf
918 TEA_PATH_NOSPACE(WCEROOT, ${WCEROOT})
919 TEA_PATH_NOSPACE(SDKROOT, ${SDKROOT})
920 if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
921 -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
922 AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
925 # We could PATH_NOSPACE these, but that's not important,
926 # as long as we quote them when used.
927 CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
928 if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
929 CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
931 CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
935 if test "$GCC" != "yes" ; then
936 if test "${SHARED_BUILD}" = "0" ; then
942 if test "$do64bit" = "yes" ; then
943 # All this magic is necessary for the Win64 SDK RC1 - hobbs
944 CC="${MSSDK}/Bin/Win64/cl.exe"
945 CFLAGS="${CFLAGS} -I${MSSDK}/Include/prerelease \
946 -I${MSSDK}/Include/Win64/crt \
948 RC="${MSSDK}/bin/rc.exe"
949 lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \
950 -LIBPATH:${MSSDK}/Lib/Prerelease/IA64 -nologo"
951 LINKBIN="${MSSDK}/bin/win64/link.exe"
952 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
953 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
954 elif test "$doWince" != "no" ; then
955 CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
956 if test "${TARGETCPU}" = "X86"; then
957 CC="${CEBINROOT}/cl.exe"
959 CC="${CEBINROOT}/cl${ARCH}.exe"
961 CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
962 RC="${WCEROOT}/Common/EVC/bin/rc.exe"
963 arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
964 defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
965 if test "${SHARED_BUILD}" = "1" ; then
966 # Static CE builds require static celib as well
970 AC_DEFINE_UNQUOTED($i)
972 AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION)
973 AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION)
974 CFLAGS_DEBUG="-nologo -Zi -Od"
975 CFLAGS_OPTIMIZE="-nologo -Ox"
976 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
977 lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
978 LINKBIN="${CEBINROOT}/link.exe"
984 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
985 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
989 if test "$GCC" = "yes"; then
993 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
994 SHLIB_LD="$CC -shared"
995 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
996 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
997 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
999 SHLIB_LD="${LINKBIN} -dll ${lflags}"
1000 # link -lib only works when -lib is the first arg
1001 STLIB_LD="${LINKBIN} -lib ${lflags}"
1002 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
1004 # For information on what debugtype is most useful, see:
1005 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
1006 # This essentially turns it all on.
1007 LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2"
1008 LDFLAGS_OPTIMIZE="-release"
1009 if test "$doWince" != "no" ; then
1010 LDFLAGS_CONSOLE="-link ${lflags}"
1011 LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
1013 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
1014 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
1018 SHLIB_LD_LIBS='${LIBS}'
1020 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
1022 TCL_LIB_VERSIONS_OK=nodots
1023 # Bogus to avoid getting this turned off
1024 DL_OBJS="tclLoadNone.obj"
1027 if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
1028 # AIX requires the _r compiler when gcc isn't being used
1029 if test "${CC}" != "cc_r" ; then
1032 AC_MSG_RESULT([Using $CC for compiling with threads])
1037 SHLIB_LD_LIBS='${LIBS}'
1039 DL_OBJS="tclLoadDl.o"
1040 LD_LIBRARY_PATH_VAR="LIBPATH"
1042 # AIX v<=4.1 has some different flags than 4.2+
1043 if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
1044 #LIBOBJS="$LIBOBJS tclLoadAix.o"
1045 AC_LIBOBJ([tclLoadAix])
1049 # Check to enable 64-bit flags for compiler/linker on AIX 4+
1050 if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
1051 if test "$GCC" = "yes" ; then
1052 AC_MSG_WARN("64bit mode not supported with GCC on $system")
1055 CFLAGS="$CFLAGS -q64"
1056 LDFLAGS="$LDFLAGS -q64"
1057 RANLIB="${RANLIB} -X64"
1059 SHLIB_LD_FLAGS="-b64"
1063 if test "`uname -m`" = "ia64" ; then
1064 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1065 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1066 # AIX-5 has dl* in libc.so
1068 if test "$GCC" = "yes" ; then
1069 LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1071 LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1074 if test "$GCC" = "yes" ; then
1075 SHLIB_LD="gcc -shared"
1077 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
1079 SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1081 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1082 TCL_NEEDS_EXP_FILE=1
1083 TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp'
1086 # On AIX <=v4 systems, libbsd.a has to be linked in to support
1087 # non-blocking file IO. This library has to be linked in after
1088 # the MATH_LIBS or it breaks the pow() function. The way to
1089 # insure proper sequencing, is to add it to the tail of MATH_LIBS.
1090 # This library also supplies gettimeofday.
1092 # AIX does not have a timezone field in struct tm. When the AIX
1093 # bsd library is used, the timezone global and the gettimeofday
1094 # methods are to be avoided for timezone deduction instead, we
1095 # deduce the timezone by comparing the localtime result on a
1098 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
1099 if test $libbsd = yes; then
1100 MATH_LIBS="$MATH_LIBS -lbsd"
1101 AC_DEFINE(USE_DELTA_FOR_TZ)
1105 SHLIB_CFLAGS="-fPIC"
1106 SHLIB_LD="${CC} -nostart"
1107 SHLIB_LD_LIBS='${LIBS}'
1109 DL_OBJS="tclLoadDl.o"
1112 BSD/OS-2.1*|BSD/OS-3*)
1114 SHLIB_LD="shlicc -r"
1115 SHLIB_LD_LIBS='${LIBS}'
1117 DL_OBJS="tclLoadDl.o"
1122 SHLIB_CFLAGS="-export-dynamic -fPIC"
1123 SHLIB_LD="cc -shared"
1124 SHLIB_LD_LIBS='${LIBS}'
1126 DL_OBJS="tclLoadDl.o"
1128 LDFLAGS="$LDFLAGS -export-dynamic"
1132 SHLIB_CFLAGS="-K PIC"
1136 DL_OBJS="tclLoadDl.o"
1141 # Use updated header definitions where possible
1142 AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
1145 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1146 if test "$tcl_ok" = yes; then
1149 SHLIB_LD_LIBS='${LIBS}'
1150 DL_OBJS="tclLoadShl.o"
1152 LDFLAGS="$LDFLAGS -Wl,-E"
1153 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1154 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1156 if test "$GCC" = "yes" ; then
1157 SHLIB_LD="gcc -shared"
1158 SHLIB_LD_LIBS='${LIBS}'
1159 LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1162 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1163 #CFLAGS="$CFLAGS +DAportable"
1165 # Check to enable 64-bit flags for compiler/linker
1166 if test "$do64bit" = "yes" ; then
1167 if test "$GCC" = "yes" ; then
1168 hpux_arch=`${CC} -dumpmachine`
1171 # 64-bit gcc in use. Fix flags for GNU ld.
1173 SHLIB_LD="${CC} -shared"
1174 SHLIB_LD_LIBS='${LIBS}'
1177 AC_MSG_WARN("64bit mode not supported with GCC on $system")
1182 CFLAGS="$CFLAGS +DD64"
1183 LDFLAGS="$LDFLAGS +DD64"
1187 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1189 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1190 if test "$tcl_ok" = yes; then
1194 DL_OBJS="tclLoadShl.o"
1196 LDFLAGS="$LDFLAGS -Wl,-E"
1197 LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1199 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1204 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1205 SHLIB_LD_LIBS='${LIBS}'
1206 DL_OBJS="tclLoadAout.o"
1208 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1209 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1210 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
1214 SHLIB_LD="ld -shared -rdata_shared"
1215 SHLIB_LD_LIBS='${LIBS}'
1217 DL_OBJS="tclLoadDl.o"
1219 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1221 IRIX-6.*|IRIX64-6.5*)
1223 SHLIB_LD="ld -n32 -shared -rdata_shared"
1224 SHLIB_LD_LIBS='${LIBS}'
1226 DL_OBJS="tclLoadDl.o"
1228 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1229 if test "$GCC" = "yes" ; then
1230 CFLAGS="$CFLAGS -mabi=n32"
1231 LDFLAGS="$LDFLAGS -mabi=n32"
1235 # Use to build 6.2 compatible binaries on 6.3.
1236 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1239 CFLAGS="$CFLAGS -n32"
1242 LDFLAGS="$LDFLAGS -n32"
1247 SHLIB_LD="ld -n32 -shared -rdata_shared"
1248 SHLIB_LD_LIBS='${LIBS}'
1250 DL_OBJS="tclLoadDl.o"
1252 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1254 # Check to enable 64-bit flags for compiler/linker
1256 if test "$do64bit" = "yes" ; then
1257 if test "$GCC" = "yes" ; then
1258 AC_MSG_WARN([64bit mode not supported by gcc])
1261 SHLIB_LD="ld -64 -shared -rdata_shared"
1262 CFLAGS="$CFLAGS -64"
1263 LDFLAGS="$LDFLAGS -64"
1268 SHLIB_CFLAGS="-fPIC"
1269 SHLIB_LD_LIBS='${LIBS}'
1272 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1273 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1274 # when you inline the string and math operations. Turn this off to
1275 # get rid of the warnings.
1277 #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1279 if test "$have_dl" = yes; then
1280 SHLIB_LD="${CC} -shared"
1281 DL_OBJS="tclLoadDl.o"
1283 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1284 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1286 AC_CHECK_HEADER(dld.h, [
1287 SHLIB_LD="ld -shared"
1288 DL_OBJS="tclLoadDld.o"
1290 LD_SEARCH_FLAGS=""])
1292 if test "`uname -m`" = "alpha" ; then
1293 CFLAGS="$CFLAGS -mieee"
1296 # The combo of gcc + glibc has a bug related
1297 # to inlining of functions like strtod(). The
1298 # -fno-builtin flag should address this problem
1299 # but it does not work. The -fno-inline flag
1300 # is kind of overkill but it works.
1301 # Disable inlining only when one of the
1302 # files in compat/*.c is being linked in.
1303 if test x"${USE_COMPAT}" != x ; then
1304 CFLAGS="$CFLAGS -fno-inline"
1309 SHLIB_CFLAGS="-fPIC"
1310 SHLIB_LD_LIBS='${LIBS}'
1313 if test "$have_dl" = yes; then
1314 SHLIB_LD="${CC} -shared"
1317 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1320 AC_CHECK_HEADER(dld.h, [
1321 SHLIB_LD="ld -shared"
1324 LD_SEARCH_FLAGS=""])
1326 if test "`uname -m`" = "alpha" ; then
1327 CFLAGS="$CFLAGS -mieee"
1331 SHLIB_CFLAGS="-K PIC"
1335 DL_OBJS="tclLoadDl.o"
1340 SHLIB_CFLAGS="-K PIC"
1344 DL_OBJS="tclLoadDl.o"
1346 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1349 NetBSD-*|FreeBSD-[[1-2]].*)
1350 # Not available on all versions: check for include file.
1351 AC_CHECK_HEADER(dlfcn.h, [
1352 # NetBSD/SPARC needs -fPIC, -fpic will not do.
1353 SHLIB_CFLAGS="-fPIC"
1354 SHLIB_LD="ld -Bshareable -x"
1357 DL_OBJS="tclLoadDl.o"
1359 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1360 AC_MSG_CHECKING([for ELF])
1366 AC_MSG_RESULT([yes])
1367 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so',
1369 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
1373 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
1374 SHLIB_LD_LIBS='${LIBS}'
1376 DL_OBJS="tclLoadAout.o"
1378 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1379 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1382 # FreeBSD doesn't handle version numbers with dots.
1384 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1385 TCL_LIB_VERSIONS_OK=nodots
1388 SHLIB_LD="${CC} -shared"
1389 SHLIB_LD_LIBS='${LIBS}'
1391 DL_OBJS="tclLoadDl.o"
1394 AC_MSG_CHECKING(for ELF)
1401 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'],
1403 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0']
1406 # OpenBSD doesn't do version numbers with dots.
1407 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1408 TCL_LIB_VERSIONS_OK=nodots
1411 # FreeBSD 3.* and greater have ELF.
1412 SHLIB_CFLAGS="-fPIC"
1413 SHLIB_LD="ld -Bshareable -x"
1414 SHLIB_LD_LIBS='${LIBS}'
1416 DL_OBJS="tclLoadDl.o"
1418 LDFLAGS="$LDFLAGS -export-dynamic"
1419 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1420 if test "${TCL_THREADS}" = "1" ; then
1421 # The -pthread needs to go in the CFLAGS, not LIBS
1422 LIBS=`echo $LIBS | sed s/-pthread//`
1423 CFLAGS="$CFLAGS -pthread"
1424 LDFLAGS="$LDFLAGS -pthread"
1428 # FreeBSD-3 doesn't handle version numbers with dots.
1429 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1430 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1431 TCL_LIB_VERSIONS_OK=nodots
1436 SHLIB_CFLAGS="-fno-common"
1437 SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
1438 SHLIB_LD_LIBS='${LIBS}'
1439 SHLIB_SUFFIX=".dylib"
1440 DL_OBJS="tclLoadDyld.o"
1442 LDFLAGS="$LDFLAGS -prebind -Wl,-search_paths_first"
1444 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1445 CFLAGS_OPTIMIZE="-Os"
1449 SHLIB_LD="cc -nostdlib -r"
1452 DL_OBJS="tclLoadNext.o"
1457 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1458 AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
1460 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1461 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1463 # Hack: make package name same as library name
1464 SHLIB_LD='ld -R -export $@:'
1467 DL_OBJS="tclLoadOSF.o"
1472 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1473 SHLIB_CFLAGS="-fPIC"
1474 if test "$SHARED_BUILD" = "1" ; then
1475 SHLIB_LD="ld -shared"
1477 SHLIB_LD="ld -non_shared"
1481 DL_OBJS="tclLoadDl.o"
1488 if test "$SHARED_BUILD" = "1" ; then
1489 SHLIB_LD='ld -shared -expect_unresolved "*"'
1491 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1495 DL_OBJS="tclLoadDl.o"
1497 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1498 if test "$GCC" = "yes" ; then
1499 CFLAGS="$CFLAGS -mieee"
1501 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
1503 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1504 if test "${TCL_THREADS}" = "1" ; then
1505 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1506 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1507 LIBS=`echo $LIBS | sed s/-lpthreads//`
1508 if test "$GCC" = "yes" ; then
1509 LIBS="$LIBS -lpthread -lmach -lexc"
1511 CFLAGS="$CFLAGS -pthread"
1512 LDFLAGS="$LDFLAGS -pthread"
1519 # This may work for all QNX, but it was only reported for v6.
1520 SHLIB_CFLAGS="-fPIC"
1521 SHLIB_LD="ld -Bshareable -x"
1524 DL_OBJS="tclLoadDl.o"
1525 # dlopen is in -lc on QNX
1531 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1532 SHLIB_LD_LIBS='${LIBS}'
1534 DL_OBJS="tclLoadAout.o"
1536 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1537 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1540 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1541 # this test works, since "uname -s" was non-standard in 3.2.4 and
1543 if test "$GCC" = "yes" ; then
1544 SHLIB_CFLAGS="-fPIC -melf"
1545 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1547 SHLIB_CFLAGS="-Kpic -belf"
1548 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1553 DL_OBJS="tclLoadDl.o"
1558 SHLIB_CFLAGS="-K PIC"
1562 DL_OBJS="tclLoadDl.o"
1571 DL_OBJS="tclLoadDl.o"
1573 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1575 # SunOS can't handle version numbers with dots in them in library
1576 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1577 # requires an extra version number at the end of .so file names.
1578 # So, the library has to have a name like libtcl75.so.1.0
1580 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
1581 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1582 TCL_LIB_VERSIONS_OK=nodots
1586 # Note: If _REENTRANT isn't defined, then Solaris
1587 # won't define thread-safe library routines.
1589 AC_DEFINE(_REENTRANT)
1590 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1592 SHLIB_CFLAGS="-KPIC"
1594 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1595 # symbols when dynamically loaded into tclsh.
1597 SHLIB_LD_LIBS='${LIBS}'
1599 DL_OBJS="tclLoadDl.o"
1601 if test "$GCC" = "yes" ; then
1602 SHLIB_LD="$CC -shared"
1603 LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1605 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1606 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1611 # Note: If _REENTRANT isn't defined, then Solaris
1612 # won't define thread-safe library routines.
1614 AC_DEFINE(_REENTRANT)
1615 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1617 SHLIB_CFLAGS="-KPIC"
1619 # Check to enable 64-bit flags for compiler/linker
1620 if test "$do64bit" = "yes" ; then
1622 if test "$arch" = "sparcv9 sparc" ; then
1623 if test "$GCC" = "yes" ; then
1624 if test "`gcc -dumpversion` | awk -F. '{print $1}'" -lt "3" ; then
1625 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1628 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1629 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1630 SHLIB_CFLAGS="-fPIC"
1634 if test "$do64bitVIS" = "yes" ; then
1635 CFLAGS="$CFLAGS -xarch=v9a"
1636 LDFLAGS="$LDFLAGS -xarch=v9a"
1638 CFLAGS="$CFLAGS -xarch=v9"
1639 LDFLAGS="$LDFLAGS -xarch=v9"
1643 AC_MSG_WARN("64bit mode only supported sparcv9 system")
1647 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1648 # symbols when dynamically loaded into tclsh.
1650 SHLIB_LD_LIBS='${LIBS}'
1652 DL_OBJS="tclLoadDl.o"
1654 if test "$GCC" = "yes" ; then
1655 SHLIB_LD="$CC -shared"
1656 LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1657 if test "$do64bit" = "yes" ; then
1658 # We need to specify -static-libgcc or we need to
1659 # add the path to the sparv9 libgcc.
1660 # JH: static-libgcc is necessary for core Tcl, but may
1661 # not be necessary for extensions.
1662 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1663 # for finding sparcv9 libgcc, get the regular libgcc
1664 # path, remove so name and append 'sparcv9'
1665 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1666 #LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS},-R,$v9gcclibdir"
1669 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1670 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1676 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1677 SHLIB_LD_LIBS='${LIBS}'
1678 DL_OBJS="tclLoadAout.o"
1680 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1681 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1682 if test "$GCC" != "yes" ; then
1683 CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
1686 UNIX_SV* | UnixWare-5*)
1687 SHLIB_CFLAGS="-KPIC"
1691 DL_OBJS="tclLoadDl.o"
1693 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1694 # that don't grok the -Bexport option. Test that it does.
1695 hold_ldflags=$LDFLAGS
1696 AC_MSG_CHECKING(for ld accepts -Bexport flag)
1697 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1698 AC_TRY_LINK(, [int i;], [found=yes],
1699 [LDFLAGS=$hold_ldflags found=no])
1700 AC_MSG_RESULT([$found])
1705 if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
1706 AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform")
1709 # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
1710 # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
1711 # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
1712 # to determine which of several header files defines the a.out file
1713 # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
1714 # support only a file format that is more or less version-7-compatible.
1716 # - a.out files must begin with `struct exec'.
1717 # - the N_TXTOFF on the `struct exec' must compute the seek address
1718 # of the text segment
1719 # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
1720 # and a_entry fields.
1721 # The following compilation should succeed if and only if either sys/exec.h
1722 # or a.out.h is usable for the purpose.
1724 # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
1725 # `struct exec' includes a second header that contains information that
1726 # duplicates the v7 fields that are needed.
1728 if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
1729 AC_MSG_CHECKING([sys/exec.h])
1730 AC_TRY_COMPILE([#include <sys/exec.h>],[
1734 #if defined(__mips) || defined(mips)
1735 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1737 seek = N_TXTOFF (foo);
1739 flag = (foo.a_magic == OMAGIC);
1740 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1741 ], tcl_ok=usable, tcl_ok=unusable)
1742 AC_MSG_RESULT([$tcl_ok])
1743 if test $tcl_ok = usable; then
1744 AC_DEFINE(USE_SYS_EXEC_H)
1746 AC_MSG_CHECKING([a.out.h])
1747 AC_TRY_COMPILE([#include <a.out.h>],[
1751 #if defined(__mips) || defined(mips)
1752 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1754 seek = N_TXTOFF (foo);
1756 flag = (foo.a_magic == OMAGIC);
1757 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1758 ], tcl_ok=usable, tcl_ok=unusable)
1759 AC_MSG_RESULT([$tcl_ok])
1760 if test $tcl_ok = usable; then
1761 AC_DEFINE(USE_A_OUT_H)
1763 AC_MSG_CHECKING([sys/exec_aout.h])
1764 AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
1768 #if defined(__mips) || defined(mips)
1769 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1771 seek = N_TXTOFF (foo);
1773 flag = (foo.a_midmag == OMAGIC);
1774 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1775 ], tcl_ok=usable, tcl_ok=unusable)
1776 AC_MSG_RESULT([$tcl_ok])
1777 if test $tcl_ok = usable; then
1778 AC_DEFINE(USE_SYS_EXEC_AOUT_H)
1786 # Step 5: disable dynamic loading if requested via a command-line switch.
1788 AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
1789 [tcl_ok=$enableval], [tcl_ok=yes])
1790 if test "$tcl_ok" = "no"; then
1794 if test "x$DL_OBJS" != "x" ; then
1795 BUILD_DLTEST="\$(DLTEST_TARGETS)"
1797 echo "Can't figure out how to do dynamic loading or shared libraries"
1798 echo "on this system."
1802 DL_OBJS="tclLoadNone.o"
1804 LDFLAGS="$LDFLAGS_ORIG"
1809 # If we're running gcc, then change the C flags for compiling shared
1810 # libraries to the right flags for gcc, instead of those for the
1811 # standard manufacturer compiler.
1813 if test "$DL_OBJS" != "tclLoadNone.o" ; then
1814 if test "$GCC" = "yes" ; then
1835 SHLIB_CFLAGS="-fPIC"
1841 if test "$SHARED_LIB_SUFFIX" = "" ; then
1842 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
1844 if test "$UNSHARED_LIB_SUFFIX" = "" ; then
1845 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
1849 AC_SUBST(CFLAGS_DEBUG)
1850 AC_SUBST(CFLAGS_OPTIMIZE)
1851 AC_SUBST(CFLAGS_WARNING)
1855 AC_SUBST(SHLIB_CFLAGS)
1856 AC_SUBST(SHLIB_LD_LIBS)
1857 AC_SUBST(LDFLAGS_DEBUG)
1858 AC_SUBST(LDFLAGS_OPTIMIZE)
1859 AC_SUBST(LD_LIBRARY_PATH_VAR)
1861 # These must be called after we do the basic CFLAGS checks and
1862 # verify any possible 64-bit or similar switches are necessary
1867 #--------------------------------------------------------------------
1870 # Determine which interface to use to talk to the serial port.
1871 # Note that #include lines must begin in leftmost column for
1872 # some compilers to recognize them as preprocessor directives,
1873 # and some build environments have stdin not pointing at a
1874 # pseudo-terminal (usually /dev/null instead.)
1881 # Defines only one of the following vars:
1887 #--------------------------------------------------------------------
1889 AC_DEFUN(TEA_SERIAL_PORT, [
1890 AC_CHECK_HEADERS(sys/modem.h)
1891 AC_MSG_CHECKING([termios vs. termio vs. sgtty])
1892 AC_CACHE_VAL(tcl_cv_api_serial, [
1894 #include <termios.h>
1898 if (tcgetattr(0, &t) == 0) {
1900 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
1904 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
1905 if test $tcl_cv_api_serial = no ; then
1911 if (ioctl(0, TCGETA, &t) == 0) {
1912 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
1916 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
1918 if test $tcl_cv_api_serial = no ; then
1924 if (ioctl(0, TIOCGETP, &t) == 0) {
1926 t.sg_flags |= ODDP | EVENP | RAW;
1930 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
1932 if test $tcl_cv_api_serial = no ; then
1934 #include <termios.h>
1939 if (tcgetattr(0, &t) == 0
1940 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
1942 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
1946 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
1948 if test $tcl_cv_api_serial = no; then
1955 if (ioctl(0, TCGETA, &t) == 0
1956 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
1957 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
1961 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
1963 if test $tcl_cv_api_serial = no; then
1970 if (ioctl(0, TIOCGETP, &t) == 0
1971 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
1973 t.sg_flags |= ODDP | EVENP | RAW;
1977 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
1979 case $tcl_cv_api_serial in
1980 termios) AC_DEFINE(USE_TERMIOS);;
1981 termio) AC_DEFINE(USE_TERMIO);;
1982 sgtty) AC_DEFINE(USE_SGTTY);;
1984 AC_MSG_RESULT([$tcl_cv_api_serial])
1987 #--------------------------------------------------------------------
1988 # TEA_MISSING_POSIX_HEADERS
1990 # Supply substitutes for missing POSIX header files. Special
1992 # - stdlib.h doesn't define strtol, strtoul, or
1993 # strtod insome versions of SunOS
1994 # - some versions of string.h don't declare procedures such
2002 # Defines some of the following vars:
2006 # HAVE_LIMITS_H or NO_LIMITS_H
2015 # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and
2017 #--------------------------------------------------------------------
2019 AC_DEFUN(TEA_MISSING_POSIX_HEADERS, [
2020 AC_MSG_CHECKING([dirent.h])
2021 AC_TRY_LINK([#include <sys/types.h>
2022 #include <dirent.h>], [
2023 #ifndef _POSIX_SOURCE
2026 * Generate compilation error to make the test fail: Lynx headers
2027 * are only valid if really in the POSIX environment.
2030 missing_procedure();
2034 struct dirent *entryPtr;
2036 d = opendir("foobar");
2037 entryPtr = readdir(d);
2038 p = entryPtr->d_name;
2040 ], tcl_ok=yes, tcl_ok=no)
2042 if test $tcl_ok = no; then
2043 AC_DEFINE(NO_DIRENT_H)
2046 AC_MSG_RESULT([$tcl_ok])
2047 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
2048 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
2049 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
2050 AC_CHECK_HEADER(limits.h,
2051 [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
2052 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2053 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2054 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2055 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2056 if test $tcl_ok = 0; then
2057 AC_DEFINE(NO_STDLIB_H)
2059 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2060 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2061 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2063 # See also memmove check below for a place where NO_STRING_H can be
2066 if test $tcl_ok = 0; then
2067 AC_DEFINE(NO_STRING_H)
2070 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
2071 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
2073 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2074 AC_HAVE_HEADERS(sys/param.h)
2078 #--------------------------------------------------------------------
2081 # Locate the X11 header files and the X11 library archive. Try
2082 # the ac_path_x macro first, but if it doesn't find the X stuff
2083 # (e.g. because there's no xmkmf program) then check through
2084 # a list of possible directories. Under some conditions the
2085 # autoconf macro will return an include directory that contains
2086 # no include files, so double-check its result just to be safe.
2088 # This should be called after TEA_CONFIG_CFLAGS as setting the
2089 # LIBS line can confuse some configure macro magic.
2096 # Sets the following vars:
2100 # TEA_WINDOWINGSYSTEM
2102 #--------------------------------------------------------------------
2104 AC_DEFUN(TEA_PATH_X, [
2105 if test "${TEA_PLATFORM}" = "unix" ; then
2108 AC_DEFINE(MAC_OSX_TK)
2109 TEA_WINDOWINGSYSTEM="aqua"
2113 TEA_WINDOWINGSYSTEM="x11"
2116 elif test "${TEA_PLATFORM}" = "windows" ; then
2117 TEA_WINDOWINGSYSTEM="windows"
2121 AC_DEFUN(TEA_PATH_UNIX_X, [
2124 if test "$no_x" = ""; then
2125 if test "$x_includes" = ""; then
2126 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2128 if test ! -r $x_includes/X11/Intrinsic.h; then
2129 not_really_there="yes"
2133 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2134 AC_MSG_CHECKING([for X11 header files])
2135 XINCLUDES="# no special path needed"
2136 AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
2137 if test "$XINCLUDES" = nope; then
2138 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"
2140 if test -r $i/X11/Intrinsic.h; then
2148 if test "$x_includes" != ""; then
2149 XINCLUDES=-I$x_includes
2151 XINCLUDES="# no special path needed"
2154 if test "$XINCLUDES" = nope; then
2155 AC_MSG_RESULT([could not find any!])
2156 XINCLUDES="# no include files found"
2159 if test "$no_x" = yes; then
2160 AC_MSG_CHECKING([for X11 libraries])
2162 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"
2164 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
2172 if test "$x_libraries" = ""; then
2175 XLIBSW="-L$x_libraries -lX11"
2178 if test "$XLIBSW" = nope ; then
2179 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2181 if test "$XLIBSW" = nope ; then
2182 AC_MSG_RESULT([could not find any! Using -lX11.])
2185 if test x"${XLIBSW}" != x ; then
2186 PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
2190 #--------------------------------------------------------------------
2191 # TEA_BLOCKING_STYLE
2193 # The statements below check for systems where POSIX-style
2194 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2195 # On these systems (mostly older ones), use the old BSD-style
2196 # FIONBIO approach instead.
2203 # Defines some of the following vars:
2209 #--------------------------------------------------------------------
2211 AC_DEFUN(TEA_BLOCKING_STYLE, [
2212 AC_CHECK_HEADERS(sys/ioctl.h)
2213 AC_CHECK_HEADERS(sys/filio.h)
2214 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2215 if test -f /usr/lib/NextStep/software_version; then
2216 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
2218 system=`uname -s`-`uname -r`
2219 if test "$?" -ne 0 ; then
2222 # Special check for weird MP-RAS system (uname returns weird
2223 # results, and the version is kept in special file).
2225 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
2226 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
2228 if test "`uname -s`" = "AIX" ; then
2229 system=AIX-`uname -v`.`uname -r`
2234 # There used to be code here to use FIONBIO under AIX. However, it
2235 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
2236 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
2237 # code (JO, 5/31/97).
2240 AC_DEFINE(USE_FIONBIO)
2241 AC_MSG_RESULT([FIONBIO])
2244 AC_DEFINE(USE_FIONBIO)
2245 AC_MSG_RESULT([FIONBIO])
2248 AC_DEFINE(USE_FIONBIO)
2249 AC_MSG_RESULT([FIONBIO])
2252 AC_MSG_RESULT([O_NONBLOCK])
2257 #--------------------------------------------------------------------
2260 # Checks how the system deals with time.h, what time structures
2261 # are used on the system, and what fields the structures have.
2268 # Defines some of the following vars:
2274 #--------------------------------------------------------------------
2276 AC_DEFUN(TEA_TIME_HANDLER, [
2277 AC_CHECK_HEADERS(sys/time.h)
2281 AC_CHECK_FUNCS(gmtime_r localtime_r)
2283 AC_MSG_CHECKING([tm_tzadj in struct tm])
2284 AC_CACHE_VAL(tcl_cv_member_tm_tzadj,
2285 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2286 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no))
2287 AC_MSG_RESULT([$tcl_cv_member_tm_tzadj])
2288 if test $tcl_cv_member_tm_tzadj = yes ; then
2289 AC_DEFINE(HAVE_TM_TZADJ)
2292 AC_MSG_CHECKING([tm_gmtoff in struct tm])
2293 AC_CACHE_VAL(tcl_cv_member_tm_gmtoff,
2294 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2295 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no))
2296 AC_MSG_RESULT([$tcl_cv_member_tm_gmtoff])
2297 if test $tcl_cv_member_tm_gmtoff = yes ; then
2298 AC_DEFINE(HAVE_TM_GMTOFF)
2302 # Its important to include time.h in this check, as some systems
2303 # (like convex) have timezone functions, etc.
2305 AC_MSG_CHECKING([long timezone variable])
2306 AC_CACHE_VAL(tcl_cv_var_timezone,
2307 AC_TRY_COMPILE([#include <time.h>],
2308 [extern long timezone;
2311 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no))
2312 AC_MSG_RESULT([$tcl_cv_timezone_long])
2313 if test $tcl_cv_timezone_long = yes ; then
2314 AC_DEFINE(HAVE_TIMEZONE_VAR)
2317 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2319 AC_MSG_CHECKING([time_t timezone variable])
2320 AC_CACHE_VAL(tcl_cv_timezone_time,
2321 AC_TRY_COMPILE([#include <time.h>],
2322 [extern time_t timezone;
2325 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no))
2326 AC_MSG_RESULT([$tcl_cv_timezone_time])
2327 if test $tcl_cv_timezone_time = yes ; then
2328 AC_DEFINE(HAVE_TIMEZONE_VAR)
2333 #--------------------------------------------------------------------
2336 # Under Solaris 2.4, strtod returns the wrong value for the
2337 # terminating character under some conditions. Check for this
2338 # and if the problem exists use a substitute procedure
2339 # "fixstrtod" (provided by Tcl) that corrects the error.
2340 # Also, on Compaq's Tru64 Unix 5.0,
2341 # strtod(" ") returns 0.0 instead of a failure to convert.
2348 # Might defines some of the following vars:
2349 # strtod (=fixstrtod)
2351 #--------------------------------------------------------------------
2353 AC_DEFUN(TEA_BUGGY_STRTOD, [
2354 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2355 if test "$tcl_strtod" = 1; then
2356 AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs])
2358 extern double strtod();
2361 char *string = "NaN", *spaceString = " ";
2364 value = strtod(string, &term);
2365 if ((term != string) && (term[-1] == 0)) {
2368 value = strtod(spaceString, &term);
2369 if (term == (spaceString+1)) {
2373 }], tcl_ok=1, tcl_ok=0, tcl_ok=0)
2374 if test "$tcl_ok" = 1; then
2377 AC_MSG_RESULT([buggy])
2378 #LIBOBJS="$LIBOBJS fixstrtod.o"
2379 AC_LIBOBJ([fixstrtod])
2381 AC_DEFINE(strtod, fixstrtod)
2386 #--------------------------------------------------------------------
2389 # Search for the libraries needed to link the Tcl shell.
2390 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2391 # -lnsl) are dealt with here.
2394 # Requires the following vars to be set in the Makefile:
2401 # Subst's the following var:
2405 # Might append to the following vars:
2408 # Might define the following vars:
2411 #--------------------------------------------------------------------
2413 AC_DEFUN(TEA_TCL_LINK_LIBS, [
2414 #--------------------------------------------------------------------
2415 # On a few very rare systems, all of the libm.a stuff is
2416 # already in libc.a. Set compiler flags accordingly.
2417 # Also, Linux requires the "ieee" library for math to work
2418 # right (and it must appear before "-lm").
2419 #--------------------------------------------------------------------
2421 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2422 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2424 #--------------------------------------------------------------------
2425 # Interactive UNIX requires -linet instead of -lsocket, plus it
2426 # needs net/errno.h to define the socket-related error codes.
2427 #--------------------------------------------------------------------
2429 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2430 AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H))
2432 #--------------------------------------------------------------------
2433 # Check for the existence of the -lsocket and -lnsl libraries.
2434 # The order here is important, so that they end up in the right
2435 # order in the command line generated by make. Here are some
2436 # special considerations:
2437 # 1. Use "connect" and "accept" to check for -lsocket, and
2438 # "gethostbyname" to check for -lnsl.
2439 # 2. Use each function name only once: can't redo a check because
2440 # autoconf caches the results of the last check and won't redo it.
2441 # 3. Use -lnsl and -lsocket only if they supply procedures that
2442 # aren't already present in the normal libraries. This is because
2443 # IRIX 5.2 has libraries, but they aren't needed and they're
2444 # bogus: they goof up name resolution if used.
2445 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2446 # To get around this problem, check for both libraries together
2447 # if -lsocket doesn't work by itself.
2448 #--------------------------------------------------------------------
2451 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2452 if test "$tcl_checkSocket" = 1; then
2453 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2454 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2456 if test "$tcl_checkBoth" = 1; then
2458 LIBS="$LIBS -lsocket -lnsl"
2459 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2461 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2462 [LIBS="$LIBS -lnsl"])])
2464 # Don't perform the eval of the libraries here because DL_LIBS
2465 # won't be set until we call TEA_CONFIG_CFLAGS
2467 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2472 #--------------------------------------------------------------------
2473 # TEA_TCL_EARLY_FLAGS
2475 # Check for what flags are needed to be passed so the correct OS
2476 # features are available.
2483 # Might define the following vars:
2485 # _LARGEFILE64_SOURCE
2487 #--------------------------------------------------------------------
2489 AC_DEFUN(TEA_TCL_EARLY_FLAG,[
2490 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2491 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2492 AC_TRY_COMPILE([[#define ]$1[ 1
2494 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2495 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2496 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2498 tcl_flags="$tcl_flags $1"
2502 AC_DEFUN(TEA_TCL_EARLY_FLAGS,[
2503 AC_MSG_CHECKING([for required early compiler flags])
2505 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2506 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2507 TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2508 [struct stat64 buf; int i = stat64("/", &buf);])
2509 if test "x${tcl_flags}" = "x" ; then
2510 AC_MSG_RESULT([none])
2512 AC_MSG_RESULT([${tcl_flags}])
2516 #--------------------------------------------------------------------
2517 # TEA_TCL_64BIT_FLAGS
2519 # Check for what is defined in the way of 64-bit features.
2526 # Might define the following vars:
2527 # TCL_WIDE_INT_IS_LONG
2529 # HAVE_STRUCT_DIRENT64
2530 # HAVE_STRUCT_STAT64
2533 #--------------------------------------------------------------------
2535 AC_DEFUN(TEA_TCL_64BIT_FLAGS, [
2536 AC_MSG_CHECKING([for 64-bit integer type])
2537 AC_CACHE_VAL(tcl_cv_type_64bit,[
2538 tcl_cv_type_64bit=none
2539 # See if the compiler knows natively about __int64
2540 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2541 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2542 # See if we should use long anyway Note that we substitute in the
2543 # type that is our current guess for a 64-bit type inside this check
2544 # program, so it should be modified only carefully...
2545 AC_TRY_COMPILE(,[switch (0) {
2546 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2547 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2548 if test "${tcl_cv_type_64bit}" = none ; then
2549 AC_DEFINE(TCL_WIDE_INT_IS_LONG)
2550 AC_MSG_RESULT([using long])
2551 elif test "${tcl_cv_type_64bit}" = "__int64" \
2552 -a "${TEA_PLATFORM}" = "windows" ; then
2553 # We actually want to use the default tcl.h checks in this
2554 # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
2555 AC_MSG_RESULT([using Tcl header defaults])
2557 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
2558 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2560 # Now check for auxiliary declarations
2561 AC_MSG_CHECKING([for struct dirent64])
2562 AC_CACHE_VAL(tcl_cv_struct_dirent64,[
2563 AC_TRY_COMPILE([#include <sys/types.h>
2564 #include <sys/dirent.h>],[struct dirent64 p;],
2565 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2566 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2567 AC_DEFINE(HAVE_STRUCT_DIRENT64)
2569 AC_MSG_RESULT([${tcl_cv_struct_dirent64}])
2571 AC_MSG_CHECKING([for struct stat64])
2572 AC_CACHE_VAL(tcl_cv_struct_stat64,[
2573 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2575 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2576 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2577 AC_DEFINE(HAVE_STRUCT_STAT64)
2579 AC_MSG_RESULT([${tcl_cv_struct_stat64}])
2581 AC_MSG_CHECKING([for off64_t])
2582 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2583 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2585 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2586 if test "x${tcl_cv_type_off64_t}" = "xyes" ; then
2587 AC_DEFINE(HAVE_TYPE_OFF64_T)
2589 AC_MSG_RESULT([${tcl_cv_type_off64_t}])
2594 ## Here ends the standard Tcl configuration bits and starts the
2595 ## TEA specific functions
2598 #------------------------------------------------------------------------
2601 # Init various Tcl Extension Architecture (TEA) variables.
2602 # This should be the first called TEA_* macro.
2609 # Defines and substs the following vars:
2614 # TEA_PLATFORM (windows or unix)
2616 # "cygpath" is used on windows to generate native path names for include
2617 # files. These variables should only be used with the compiler and linker
2618 # since they generate native path names.
2621 # Select the executable extension based on the host type. This
2622 # is a lightweight replacement for AC_EXEEXT that doesn't require
2624 #------------------------------------------------------------------------
2626 AC_DEFUN(TEA_INIT, [
2627 # TEA extensions pass this us the version of TEA they think they
2628 # are compatible with.
2631 AC_MSG_CHECKING([for correct TEA configuration])
2632 if test x"${PACKAGE_NAME}" = x ; then
2634 The PACKAGE_NAME variable must be defined by your TEA configure.in])
2636 if test x"$1" = x ; then
2638 TEA version not specified.])
2639 elif test "$1" != "${TEA_VERSION}" ; then
2640 AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"])
2642 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
2644 case "`uname -s`" in
2645 *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*)
2646 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
2648 TEA_PLATFORM="windows"
2657 # Check if exec_prefix is set. If not use fall back to prefix.
2658 # Note when adjusted, so that TEA_PREFIX can correct for this.
2659 # This is needed for recursive configures, since autoconf propagates
2660 # $prefix, but not $exec_prefix (doh!).
2661 if test x$exec_prefix = xNONE ; then
2662 exec_prefix_default=yes
2669 # This package name must be replaced statically for AC_SUBST to work
2670 AC_SUBST(PKG_LIB_FILE)
2671 # Substitute STUB_LIB_FILE in case package creates a stub library too.
2672 AC_SUBST(PKG_STUB_LIB_FILE)
2674 # We AC_SUBST these here to ensure they are subst'ed,
2675 # in case the user doesn't call TEA_ADD_...
2676 AC_SUBST(PKG_STUB_SOURCES)
2677 AC_SUBST(PKG_STUB_OBJECTS)
2678 AC_SUBST(PKG_TCL_SOURCES)
2679 AC_SUBST(PKG_HEADERS)
2680 AC_SUBST(PKG_INCLUDES)
2682 AC_SUBST(PKG_CFLAGS)
2685 #------------------------------------------------------------------------
2686 # TEA_ADD_SOURCES --
2688 # Specify one or more source files. Users should check for
2689 # the right platform before adding to their list.
2690 # It is not important to specify the directory, as long as it is
2691 # in the generic, win or unix subdirectory of $(srcdir).
2694 # one or more file names
2698 # Defines and substs the following vars:
2701 #------------------------------------------------------------------------
2702 AC_DEFUN(TEA_ADD_SOURCES, [
2708 PKG_SOURCES="$PKG_SOURCES $i"
2709 PKG_OBJECTS="$PKG_OBJECTS $i"
2712 # check for existence - allows for generic/win/unix VPATH
2713 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2714 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2716 AC_MSG_ERROR([could not find source file '$i'])
2718 PKG_SOURCES="$PKG_SOURCES $i"
2719 # this assumes it is in a VPATH dir
2721 # handle user calling this before or after TEA_SETUP_COMPILER
2722 if test x"${OBJEXT}" != x ; then
2723 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2725 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2727 PKG_OBJECTS="$PKG_OBJECTS $j"
2731 AC_SUBST(PKG_SOURCES)
2732 AC_SUBST(PKG_OBJECTS)
2735 #------------------------------------------------------------------------
2736 # TEA_ADD_STUB_SOURCES --
2738 # Specify one or more source files. Users should check for
2739 # the right platform before adding to their list.
2740 # It is not important to specify the directory, as long as it is
2741 # in the generic, win or unix subdirectory of $(srcdir).
2744 # one or more file names
2748 # Defines and substs the following vars:
2751 #------------------------------------------------------------------------
2752 AC_DEFUN(TEA_ADD_STUB_SOURCES, [
2755 # check for existence - allows for generic/win/unix VPATH
2756 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2757 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2759 AC_MSG_ERROR([could not find stub source file '$i'])
2761 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
2762 # this assumes it is in a VPATH dir
2764 # handle user calling this before or after TEA_SETUP_COMPILER
2765 if test x"${OBJEXT}" != x ; then
2766 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2768 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2770 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
2772 AC_SUBST(PKG_STUB_SOURCES)
2773 AC_SUBST(PKG_STUB_OBJECTS)
2776 #------------------------------------------------------------------------
2777 # TEA_ADD_TCL_SOURCES --
2779 # Specify one or more Tcl source files. These should be platform
2780 # independent runtime files.
2783 # one or more file names
2787 # Defines and substs the following vars:
2789 #------------------------------------------------------------------------
2790 AC_DEFUN(TEA_ADD_TCL_SOURCES, [
2793 # check for existence, be strict because it is installed
2794 if test ! -f "${srcdir}/$i" ; then
2795 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
2797 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
2799 AC_SUBST(PKG_TCL_SOURCES)
2802 #------------------------------------------------------------------------
2803 # TEA_ADD_HEADERS --
2805 # Specify one or more source headers. Users should check for
2806 # the right platform before adding to their list.
2809 # one or more file names
2813 # Defines and substs the following vars:
2815 #------------------------------------------------------------------------
2816 AC_DEFUN(TEA_ADD_HEADERS, [
2819 # check for existence, be strict because it is installed
2820 if test ! -f "${srcdir}/$i" ; then
2821 AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
2823 PKG_HEADERS="$PKG_HEADERS $i"
2825 AC_SUBST(PKG_HEADERS)
2828 #------------------------------------------------------------------------
2829 # TEA_ADD_INCLUDES --
2831 # Specify one or more include dirs. Users should check for
2832 # the right platform before adding to their list.
2835 # one or more file names
2839 # Defines and substs the following vars:
2841 #------------------------------------------------------------------------
2842 AC_DEFUN(TEA_ADD_INCLUDES, [
2845 PKG_INCLUDES="$PKG_INCLUDES $i"
2847 AC_SUBST(PKG_INCLUDES)
2850 #------------------------------------------------------------------------
2853 # Specify one or more libraries. Users should check for
2854 # the right platform before adding to their list. For Windows,
2855 # libraries provided in "foo.lib" format will be converted to
2856 # "-lfoo" when using GCC (mingw).
2859 # one or more file names
2863 # Defines and substs the following vars:
2865 #------------------------------------------------------------------------
2866 AC_DEFUN(TEA_ADD_LIBS, [
2869 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
2870 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
2871 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'`
2873 PKG_LIBS="$PKG_LIBS $i"
2878 #------------------------------------------------------------------------
2881 # Specify one or more CFLAGS. Users should check for
2882 # the right platform before adding to their list.
2885 # one or more file names
2889 # Defines and substs the following vars:
2891 #------------------------------------------------------------------------
2892 AC_DEFUN(TEA_ADD_CFLAGS, [
2893 PKG_CFLAGS="$PKG_CFLAGS $@"
2894 AC_SUBST(PKG_CFLAGS)
2897 #------------------------------------------------------------------------
2900 # Handle the --prefix=... option by defaulting to what Tcl gave
2907 # If --prefix or --exec-prefix was not specified, $prefix and
2908 # $exec_prefix will be set to the values given to Tcl when it was
2910 #------------------------------------------------------------------------
2911 AC_DEFUN(TEA_PREFIX, [
2912 if test "${prefix}" = "NONE"; then
2914 if test x"${TCL_PREFIX}" != x; then
2915 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
2916 prefix=${TCL_PREFIX}
2918 AC_MSG_NOTICE([--prefix defaulting to /usr/local])
2922 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
2923 -o x"${exec_prefix_default}" = x"yes" ; then
2924 if test x"${TCL_EXEC_PREFIX}" != x; then
2925 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
2926 exec_prefix=${TCL_EXEC_PREFIX}
2928 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
2934 #------------------------------------------------------------------------
2935 # TEA_SETUP_COMPILER_CC --
2937 # Do compiler checks the way we want. This is just a replacement
2938 # for AC_PROG_CC in TEA configure.in files to make them cleaner.
2945 # Sets up CC var and other standard bits we need to make executables.
2946 #------------------------------------------------------------------------
2947 AC_DEFUN(TEA_SETUP_COMPILER_CC, [
2948 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
2949 # in this macro, they need to go into TEA_SETUP_COMPILER instead.
2951 # If the user did not set CFLAGS, set it now to keep
2952 # the AC_PROG_CC macro from adding "-g -O2".
2953 if test "${CFLAGS+set}" != "set" ; then
2962 #--------------------------------------------------------------------
2963 # Checks to see if the make program sets the $MAKE variable.
2964 #--------------------------------------------------------------------
2968 #--------------------------------------------------------------------
2970 #--------------------------------------------------------------------
2974 #--------------------------------------------------------------------
2975 # Determines the correct binary file extension (.o, .obj, .exe etc.)
2976 #--------------------------------------------------------------------
2982 #------------------------------------------------------------------------
2983 # TEA_SETUP_COMPILER --
2985 # Do compiler checks that use the compiler. This must go after
2986 # TEA_SETUP_COMPILER_CC, which does the actual compiler check.
2993 # Sets up CC var and other standard bits we need to make executables.
2994 #------------------------------------------------------------------------
2995 AC_DEFUN(TEA_SETUP_COMPILER, [
2996 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
2997 AC_REQUIRE([TEA_SETUP_COMPILER_CC])
2999 #------------------------------------------------------------------------
3000 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
3001 # It makes compiling go faster. (This is only a performance feature.)
3002 #------------------------------------------------------------------------
3004 if test -z "$no_pipe" -a -n "$GCC"; then
3005 AC_MSG_CHECKING([if the compiler understands -pipe])
3008 AC_TRY_COMPILE(,, AC_MSG_RESULT([yes]), CC="$OLDCC"
3009 AC_MSG_RESULT([no]))
3012 #--------------------------------------------------------------------
3013 # Common compiler flag setup
3014 #--------------------------------------------------------------------
3017 if test "${TEA_PLATFORM}" = "unix" ; then
3019 TEA_MISSING_POSIX_HEADERS
3020 # Let the user call this, because if it triggers, they will
3021 # need a compat/strtod.c that is correct. Users can also
3022 # use Tcl_GetDouble(FromObj) instead.
3027 #------------------------------------------------------------------------
3030 # Generate a line that can be used to build a shared/unshared library
3031 # in a platform independent manner.
3040 # Defines the following vars:
3041 # CFLAGS - Done late here to note disturb other AC macros
3042 # MAKE_LIB - Command to execute to build the Tcl library;
3043 # differs depending on whether or not Tcl is being
3044 # compiled as a shared library.
3045 # MAKE_SHARED_LIB Makefile rule for building a shared library
3046 # MAKE_STATIC_LIB Makefile rule for building a static library
3047 # MAKE_STUB_LIB Makefile rule for building a stub library
3048 #------------------------------------------------------------------------
3050 AC_DEFUN(TEA_MAKE_LIB, [
3051 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
3052 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
3053 MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
3054 MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)"
3056 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
3057 MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3058 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
3061 if test "${SHARED_BUILD}" = "1" ; then
3062 MAKE_LIB="${MAKE_SHARED_LIB} "
3064 MAKE_LIB="${MAKE_STATIC_LIB} "
3067 #--------------------------------------------------------------------
3068 # Shared libraries and static libraries have different names.
3069 # Use the double eval to make sure any variables in the suffix is
3070 # substituted. (@@@ Might not be necessary anymore)
3071 #--------------------------------------------------------------------
3073 if test "${TEA_PLATFORM}" = "windows" ; then
3074 if test "${SHARED_BUILD}" = "1" ; then
3075 # We force the unresolved linking of symbols that are really in
3076 # the private libraries of Tcl and Tk.
3077 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
3078 if test x"${TK_BIN_DIR}" != x ; then
3079 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
3081 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3083 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3085 # Some packages build there own stubs libraries
3086 if test "$GCC" = "yes"; then
3087 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3089 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3092 # These aren't needed on Windows (either MSVC or gcc)
3096 RANLIB_STUB="${RANLIB}"
3097 if test "${SHARED_BUILD}" = "1" ; then
3098 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
3099 if test x"${TK_BIN_DIR}" != x ; then
3100 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
3102 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3105 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3107 # Some packages build there own stubs libraries
3108 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3111 # These are escaped so that only CFLAGS is picked up at configure time.
3112 # The other values will be substituted at make time.
3113 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
3114 if test "${SHARED_BUILD}" = "1" ; then
3115 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
3119 AC_SUBST(MAKE_SHARED_LIB)
3120 AC_SUBST(MAKE_STATIC_LIB)
3121 AC_SUBST(MAKE_STUB_LIB)
3122 AC_SUBST(RANLIB_STUB)
3125 #------------------------------------------------------------------------
3128 # Compute the name of an existing object library located in libdir
3129 # from the given base name and produce the appropriate linker flags.
3132 # basename The base name of the library without version
3133 # numbers, extensions, or "lib" prefixes.
3134 # extra_dir Extra directory in which to search for the
3135 # library. This location is used first, then
3136 # $prefix/$exec-prefix, then some defaults.
3139 # TEA_INIT and TEA_PREFIX must be called first.
3143 # Defines the following vars:
3144 # ${basename}_LIB_NAME The computed library name.
3145 # ${basename}_LIB_SPEC The computed linker flags.
3146 #------------------------------------------------------------------------
3148 AC_DEFUN(TEA_LIB_SPEC, [
3149 AC_MSG_CHECKING([for $1 library])
3151 # Look in exec-prefix for the library (defined by TEA_PREFIX).
3153 tea_lib_name_dir="${exec_prefix}/lib"
3155 # Or in a user-specified location.
3157 if test x"$2" != x ; then
3158 tea_extra_lib_dir=$2
3160 tea_extra_lib_dir=NONE
3164 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3165 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3166 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3167 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3168 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3169 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
3170 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3171 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
3172 if test -f "$i" ; then
3173 tea_lib_name_dir=`dirname $i`
3174 $1_LIB_NAME=`basename $i`
3180 if test "${TEA_PLATFORM}" = "windows"; then
3181 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
3183 # Strip off the leading "lib" and trailing ".a" or ".so"
3185 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
3186 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
3189 if test "x${$1_LIB_NAME}" = x ; then
3190 AC_MSG_ERROR([not found])
3192 AC_MSG_RESULT([${$1_LIB_SPEC}])
3196 #------------------------------------------------------------------------
3197 # TEA_PRIVATE_TCL_HEADERS --
3199 # Locate the private Tcl include files
3204 # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
3205 # already been called.
3209 # Substs the following vars:
3210 # TCL_TOP_DIR_NATIVE
3211 # TCL_GENERIC_DIR_NATIVE
3212 # TCL_UNIX_DIR_NATIVE
3213 # TCL_WIN_DIR_NATIVE
3214 # TCL_BMAP_DIR_NATIVE
3215 # TCL_TOOL_DIR_NATIVE
3216 # TCL_PLATFORM_DIR_NATIVE
3217 # TCL_BIN_DIR_NATIVE
3219 #------------------------------------------------------------------------
3221 AC_DEFUN(TEA_PRIVATE_TCL_HEADERS, [
3222 AC_MSG_CHECKING([for Tcl private include files])
3224 if test "${TEA_PLATFORM}" = "windows"; then
3225 TCL_TOP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}`\"
3226 TCL_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/generic`\"
3227 TCL_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/unix`\"
3228 TCL_WIN_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/win`\"
3229 TCL_BMAP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/bitmaps`\"
3230 TCL_TOOL_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/tools`\"
3231 TCL_COMPAT_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/compat`\"
3232 TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE}
3234 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
3236 TCL_TOP_DIR_NATIVE='$(TCL_SRC_DIR)'
3237 TCL_GENERIC_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/generic'
3238 TCL_UNIX_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/unix'
3239 TCL_WIN_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/win'
3240 TCL_BMAP_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/bitmaps'
3241 TCL_TOOL_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/tools'
3242 TCL_COMPAT_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/compat'
3243 TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE}
3245 # substitute these in "relaxed" so that TCL_INCLUDES still works
3246 # without requiring the other vars to be defined in the Makefile
3247 eval "TCL_INCLUDES=\"-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}\""
3250 AC_SUBST(TCL_TOP_DIR_NATIVE)
3251 AC_SUBST(TCL_GENERIC_DIR_NATIVE)
3252 AC_SUBST(TCL_UNIX_DIR_NATIVE)
3253 AC_SUBST(TCL_WIN_DIR_NATIVE)
3254 AC_SUBST(TCL_BMAP_DIR_NATIVE)
3255 AC_SUBST(TCL_TOOL_DIR_NATIVE)
3256 AC_SUBST(TCL_PLATFORM_DIR_NATIVE)
3258 AC_SUBST(TCL_INCLUDES)
3259 AC_MSG_RESULT([Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}])
3262 #------------------------------------------------------------------------
3263 # TEA_PUBLIC_TCL_HEADERS --
3265 # Locate the installed public Tcl header files
3271 # CYGPATH must be set
3275 # Adds a --with-tclinclude switch to configure.
3278 # Substs the following vars:
3280 #------------------------------------------------------------------------
3282 AC_DEFUN(TEA_PUBLIC_TCL_HEADERS, [
3283 AC_MSG_CHECKING([for Tcl public headers])
3285 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
3287 AC_CACHE_VAL(ac_cv_c_tclh, [
3288 # Use the value from --with-tclinclude, if it was given
3290 if test x"${with_tclinclude}" != x ; then
3291 if test -f "${with_tclinclude}/tcl.h" ; then
3292 ac_cv_c_tclh=${with_tclinclude}
3294 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
3297 # Check order: pkg --prefix location, Tcl's --prefix location,
3298 # directory of tclConfig.sh, and Tcl source directory.
3299 # Looking in the source dir is not ideal, but OK.
3301 eval "temp_includedir=${includedir}"
3302 list="`ls -d ${temp_includedir} 2>/dev/null` \
3303 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3304 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \
3305 `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
3306 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3307 list="$list /usr/local/include /usr/include"
3310 if test -f "$i/tcl.h" ; then
3318 # Print a message based on how we determined the include path
3320 if test x"${ac_cv_c_tclh}" = x ; then
3321 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
3323 AC_MSG_RESULT([${ac_cv_c_tclh}])
3326 # Convert to a native path and substitute into the output files.
3328 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
3330 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3332 AC_SUBST(TCL_INCLUDES)
3335 #------------------------------------------------------------------------
3336 # TEA_PRIVATE_TK_HEADERS --
3338 # Locate the private Tk include files
3343 # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
3344 # already been called.
3348 # Substs the following vars:
3350 #------------------------------------------------------------------------
3352 AC_DEFUN(TEA_PRIVATE_TK_HEADERS, [
3353 AC_MSG_CHECKING([for Tk private include files])
3355 if test "${TEA_PLATFORM}" = "windows"; then
3356 TK_TOP_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}`\"
3357 TK_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/unix`\"
3358 TK_WIN_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/win`\"
3359 TK_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/generic`\"
3360 TK_XLIB_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/xlib`\"
3361 TK_PLATFORM_DIR_NATIVE=${TK_WIN_DIR_NATIVE}
3363 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE} -I${TK_XLIB_DIR_NATIVE}"
3365 TK_TOP_DIR_NATIVE='${TK_SRC_DIR}'
3366 TK_GENERIC_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/generic'
3367 TK_UNIX_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/unix'
3368 TK_WIN_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/win'
3369 TK_PLATFORM_DIR_NATIVE=${TK_UNIX_DIR_NATIVE}
3371 # substitute these in "relaxed" so that TK_INCLUDES still works
3372 # without requiring the other vars to be defined in the Makefile
3373 eval "TK_INCLUDES=\"-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}\""
3376 AC_SUBST(TK_TOP_DIR_NATIVE)
3377 AC_SUBST(TK_UNIX_DIR_NATIVE)
3378 AC_SUBST(TK_WIN_DIR_NATIVE)
3379 AC_SUBST(TK_GENERIC_DIR_NATIVE)
3380 AC_SUBST(TK_XLIB_DIR_NATIVE)
3381 AC_SUBST(TK_PLATFORM_DIR_NATIVE)
3383 AC_SUBST(TK_INCLUDES)
3384 AC_MSG_RESULT([Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}])
3387 #------------------------------------------------------------------------
3388 # TEA_PUBLIC_TK_HEADERS --
3390 # Locate the installed public Tk header files
3396 # CYGPATH must be set
3400 # Adds a --with-tkinclude switch to configure.
3403 # Substs the following vars:
3405 #------------------------------------------------------------------------
3407 AC_DEFUN(TEA_PUBLIC_TK_HEADERS, [
3408 AC_MSG_CHECKING([for Tk public headers])
3410 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files.], with_tkinclude=${withval})
3412 AC_CACHE_VAL(ac_cv_c_tkh, [
3413 # Use the value from --with-tkinclude, if it was given
3415 if test x"${with_tkinclude}" != x ; then
3416 if test -f "${with_tkinclude}/tk.h" ; then
3417 ac_cv_c_tkh=${with_tkinclude}
3419 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
3422 # Check order: pkg --prefix location, Tcl's --prefix location,
3423 # directory of tclConfig.sh, and Tcl source directory.
3424 # Looking in the source dir is not ideal, but OK.
3426 eval "temp_includedir=${includedir}"
3427 list="`ls -d ${temp_includedir} 2>/dev/null` \
3428 `ls -d ${TK_PREFIX}/include 2>/dev/null` \
3429 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3430 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \
3431 `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
3432 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3433 list="$list /usr/local/include /usr/include"
3436 if test -f "$i/tk.h" ; then
3444 # Print a message based on how we determined the include path
3446 if test x"${ac_cv_c_tkh}" = x ; then
3447 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
3449 AC_MSG_RESULT([${ac_cv_c_tkh}])
3452 # Convert to a native path and substitute into the output files.
3454 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
3456 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3458 AC_SUBST(TK_INCLUDES)
3460 if test "${TEA_PLATFORM}" = "windows" ; then
3461 # On Windows, we need the X compat headers
3462 AC_MSG_CHECKING([for X11 header files])
3463 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
3464 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
3465 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3466 AC_SUBST(TK_XINCLUDES)
3468 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
3472 #------------------------------------------------------------------------
3474 # Locate a tclsh shell in the following directories:
3475 # ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin
3476 # ${exec_prefix}/bin ${prefix}/bin
3483 # Subst's the following values:
3485 #------------------------------------------------------------------------
3487 AC_DEFUN(TEA_PROG_TCLSH, [
3488 # Allow the user to provide this setting in the env
3489 if test "x${TCLSH_PROG}" = "x" ; then
3490 AC_MSG_CHECKING([for tclsh])
3492 AC_CACHE_VAL(ac_cv_path_tclsh, [
3493 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
3494 if test "${TEA_PLATFORM}" != "windows" -o \
3495 \( "$do64bit_ok" = "no" -a "$doWince" = "no" \) ; then
3496 # Do not allow target tclsh in known cross-compile builds,
3497 # as we need one we can run on this system
3498 search_path="${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin ${exec_prefix}/bin ${prefix}/bin ${search_path}"
3500 for dir in $search_path ; do
3501 for j in `ls -r $dir/tclsh[[8-9]]*${EXEEXT} 2> /dev/null` \
3502 `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do
3503 if test x"$ac_cv_path_tclsh" = x ; then
3504 if test -f "$j" ; then
3513 if test -f "$ac_cv_path_tclsh" ; then
3514 TCLSH_PROG=$ac_cv_path_tclsh
3515 AC_MSG_RESULT([$TCLSH_PROG])
3517 AC_MSG_ERROR([No tclsh found in PATH: $search_path])
3520 AC_SUBST(TCLSH_PROG)
3523 #------------------------------------------------------------------------
3525 # Locate a wish shell in the following directories:
3526 # ${TK_BIN_DIR} ${TK_BIN_DIR}/../bin
3527 # ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin
3528 # ${exec_prefix}/bin ${prefix}/bin
3535 # Subst's the following values:
3537 #------------------------------------------------------------------------
3539 AC_DEFUN(TEA_PROG_WISH, [
3540 # Allow the user to provide this setting in the env
3541 if test "x${WISH_PROG}" = "x" ; then
3542 AC_MSG_CHECKING([for wish])
3544 AC_CACHE_VAL(ac_cv_path_wish, [
3545 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
3546 if test "${TEA_PLATFORM}" != "windows" -o \
3547 \( "$do64bit_ok" = "no" -a "$doWince" = "no" \) ; then
3548 # Do not allow target wish in known cross-compile builds,
3549 # as we need one we can run on this system
3550 search_path="${TK_BIN_DIR} ${TK_BIN_DIR}/../bin ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin ${exec_prefix}/bin ${prefix}/bin ${search_path}"
3552 for dir in $search_path ; do
3553 for j in `ls -r $dir/wish[[8-9]]*${EXEEXT} 2> /dev/null` \
3554 `ls -r $dir/wish*${EXEEXT} 2> /dev/null` ; do
3555 if test x"$ac_cv_path_wish" = x ; then
3556 if test -f "$j" ; then
3565 if test -f "$ac_cv_path_wish" ; then
3566 WISH_PROG=$ac_cv_path_wish
3567 AC_MSG_RESULT([$WISH_PROG])
3569 AC_MSG_ERROR([No wish found in PATH: $search_path])
3575 #------------------------------------------------------------------------
3576 # TEA_PATH_CONFIG --
3578 # Locate the ${1}Config.sh file and perform a sanity check on
3579 # the ${1} compile flags. These are used by packages like
3580 # [incr Tk] that load *Config.sh files from more than Tcl and Tk.
3587 # Adds the following arguments to configure:
3590 # Defines the following vars:
3591 # $1_BIN_DIR Full path to the directory containing
3592 # the $1Config.sh file
3593 #------------------------------------------------------------------------
3595 AC_DEFUN(TEA_PATH_CONFIG, [
3597 # Ok, lets find the $1 configuration
3598 # First, look for one uninstalled.
3599 # the alternative search directory is invoked by --with-$1
3602 if test x"${no_$1}" = x ; then
3603 # we reset no_$1 in case something fails here
3605 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
3606 AC_MSG_CHECKING([for $1 configuration])
3607 AC_CACHE_VAL(ac_cv_c_$1config,[
3609 # First check to see if --with-$1 was specified.
3610 if test x"${with_$1config}" != x ; then
3611 case ${with_$1config} in
3613 if test -f ${with_$1config}; then
3614 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
3615 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
3618 if test -f "${with_$1config}/$1Config.sh" ; then
3619 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
3621 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
3625 # then check for a private $1 installation
3626 if test x"${ac_cv_c_$1config}" = x ; then
3629 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3630 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3631 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3632 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3634 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3635 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3636 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3637 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3639 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3640 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3641 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3642 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3644 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3645 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3646 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3647 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3649 if test -f "$i/$1Config.sh" ; then
3650 ac_cv_c_$1config=`(cd $i; pwd)`
3653 if test -f "$i/unix/$1Config.sh" ; then
3654 ac_cv_c_$1config=`(cd $i/unix; pwd)`
3660 # check in a few common install locations
3661 if test x"${ac_cv_c_$1config}" = x ; then
3662 for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \
3663 `ls -d ${prefix}/lib 2>/dev/null` \
3664 `ls -d /usr/local/lib 2>/dev/null` \
3665 `ls -d /usr/contrib/lib 2>/dev/null` \
3666 `ls -d /usr/lib 2>/dev/null` \
3668 if test -f "$i/$1Config.sh" ; then
3669 ac_cv_c_$1config=`(cd $i; pwd)`
3676 if test x"${ac_cv_c_$1config}" = x ; then
3677 $1_BIN_DIR="# no $1 configs found"
3678 AC_MSG_WARN("Cannot find $1 configuration definitions")
3682 $1_BIN_DIR=${ac_cv_c_$1config}
3683 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
3688 #------------------------------------------------------------------------
3689 # TEA_LOAD_CONFIG --
3691 # Load the $1Config.sh file
3695 # Requires the following vars to be set:
3700 # Subst the following vars:
3705 #------------------------------------------------------------------------
3707 AC_DEFUN(TEA_LOAD_CONFIG, [
3708 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
3710 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
3711 AC_MSG_RESULT([loading])
3712 . ${$1_BIN_DIR}/$1Config.sh
3714 AC_MSG_RESULT([file not found])
3718 # If the $1_BIN_DIR is the build directory (not the install directory),
3719 # then set the common variable name to the value of the build variables.
3720 # For example, the variable $1_LIB_SPEC will be set to the value
3721 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
3722 # instead of $1_BUILD_LIB_SPEC since it will work with both an
3723 # installed and uninstalled version of Tcl.
3726 if test -f ${$1_BIN_DIR}/Makefile ; then
3727 AC_MSG_WARN([Found Makefile - using build library specs for $1])
3728 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
3729 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
3730 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
3733 AC_SUBST($1_VERSION)
3734 AC_SUBST($1_BIN_DIR)
3735 AC_SUBST($1_SRC_DIR)
3737 AC_SUBST($1_LIB_FILE)
3738 AC_SUBST($1_LIB_SPEC)
3740 AC_SUBST($1_STUB_LIB_FILE)
3741 AC_SUBST($1_STUB_LIB_SPEC)
3742 AC_SUBST($1_STUB_LIB_PATH)
3745 #------------------------------------------------------------------------
3748 # Locate Keuchel's celib emulation layer for targeting Win/CE
3755 # Adds the following arguments to configure:
3758 # Defines the following vars:
3759 # CELIB_DIR Full path to the directory containing
3760 # the include and platform lib files
3761 #------------------------------------------------------------------------
3763 AC_DEFUN(TEA_PATH_CELIB, [
3764 # First, look for one uninstalled.
3765 # the alternative search directory is invoked by --with-celib
3767 if test x"${no_celib}" = x ; then
3768 # we reset no_celib in case something fails here
3770 AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval})
3771 AC_MSG_CHECKING([for Windows/CE celib directory])
3772 AC_CACHE_VAL(ac_cv_c_celibconfig,[
3773 # First check to see if --with-celibconfig was specified.
3774 if test x"${with_celibconfig}" != x ; then
3775 if test -d "${with_celibconfig}/inc" ; then
3776 ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)`
3778 AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory])
3782 # then check for a celib library
3783 if test x"${ac_cv_c_celibconfig}" = x ; then
3787 ../../celib-palm-3.0 \
3789 `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \
3790 ${srcdir}/../celib-palm-3.0 \
3791 ${srcdir}/../celib \
3792 `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \
3794 if test -d "$i/inc" ; then
3795 ac_cv_c_celibconfig=`(cd $i; pwd)`
3801 if test x"${ac_cv_c_celibconfig}" = x ; then
3802 AC_MSG_ERROR([Cannot find celib support library directory])
3805 CELIB_DIR=${ac_cv_c_celibconfig}
3806 AC_MSG_RESULT([found $CELIB_DIR])
3807 TEA_PATH_NOSPACE(CELIB_DIR, ${ac_cv_c_celibconfig})
3812 #------------------------------------------------------------------------
3814 # Ensure that the given path has no spaces. This is necessary for
3815 # CC (and consitutuent vars that build it up) to work in the
3816 # tortured autoconf environment. Currently only for Windows use.
3819 # VAR - name of the variable to set
3820 # PATH - path to ensure no spaces in
3823 # Sets $VAR to short path of $PATH if it can be found.
3824 #------------------------------------------------------------------------
3826 AC_DEFUN([TEA_PATH_NOSPACE], [
3827 if test "${TEA_PLATFORM}" = "windows" ; then
3828 # we need TCLSH_PROG defined to get Windows short pathnames
3829 AC_REQUIRE([TEA_PROG_TCLSH])
3831 AC_MSG_CHECKING([short pathname for $1 ($2)])
3836 # Only do this if we need to.
3837 shortpath=`echo "puts [[file attributes {$2} -shortname]] ; exit" | ${TCLSH_PROG} 2>/dev/null`
3840 if test "x${shortpath}" = "x" ; then
3841 AC_MSG_RESULT([not changed])
3844 AC_MSG_RESULT([${$1}])