1 #------------------------------------------------------------------------
4 # Locate the tclConfig.sh file and perform a sanity check on
5 # the Tcl compile flags
12 # Adds the following arguments to configure:
15 # Defines the following vars:
16 # TCL_BIN_DIR Full path to the directory containing
17 # the tclConfig.sh file
18 #------------------------------------------------------------------------
20 AC_DEFUN([SC_PATH_TCLCONFIG], [
22 # Ok, lets find the tcl configuration
23 # First, look for one uninstalled.
24 # the alternative search directory is invoked by --with-tcl
27 if test x"${no_tcl}" = x ; then
28 # we reset no_tcl in case something fails here
31 AS_HELP_STRING([--with-tcl],
32 [directory containing tcl configuration (tclConfig.sh)]),
33 [with_tclconfig="${withval}"])
34 AC_MSG_CHECKING([for Tcl configuration])
35 AC_CACHE_VAL(ac_cv_c_tclconfig,[
37 # First check to see if --with-tcl was specified.
38 if test x"${with_tclconfig}" != x ; then
39 case "${with_tclconfig}" in
41 if test -f "${with_tclconfig}"; then
42 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
43 with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
46 if test -f "${with_tclconfig}/tclConfig.sh" ; then
47 ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
49 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
53 # then check for a private Tcl installation
54 if test x"${ac_cv_c_tclconfig}" = x ; then
57 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
58 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
59 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
61 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
62 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
63 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
65 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
66 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
67 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
68 if test -f "$i/unix/tclConfig.sh" ; then
69 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
75 # on Darwin, check in Framework installation locations
76 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
77 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
78 `ls -d /Library/Frameworks 2>/dev/null` \
79 `ls -d /Network/Library/Frameworks 2>/dev/null` \
81 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
82 ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
88 # check in a few common install locations
89 if test x"${ac_cv_c_tclconfig}" = x ; then
90 for i in `ls -d ${libdir} 2>/dev/null` \
91 `ls -d ${exec_prefix}/lib 2>/dev/null` \
92 `ls -d ${prefix}/lib 2>/dev/null` \
93 `ls -d /usr/local/lib 2>/dev/null` \
94 `ls -d /usr/contrib/lib 2>/dev/null` \
95 `ls -d /usr/pkg/lib 2>/dev/null` \
96 `ls -d /usr/lib/tcl8.6 2>/dev/null` \
97 `ls -d /usr/lib 2>/dev/null` \
98 `ls -d /usr/lib64 2>/dev/null` \
99 `ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
100 `ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \
102 if test -f "$i/tclConfig.sh" ; then
103 ac_cv_c_tclconfig="`(cd $i; pwd)`"
109 # check in a few other private locations
110 if test x"${ac_cv_c_tclconfig}" = x ; then
113 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
114 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
115 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
116 if test -f "$i/unix/tclConfig.sh" ; then
117 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
124 if test x"${ac_cv_c_tclconfig}" = x ; then
125 TCL_BIN_DIR="# no Tcl configs found"
126 AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh])
129 TCL_BIN_DIR="${ac_cv_c_tclconfig}"
130 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
135 #------------------------------------------------------------------------
136 # SC_PATH_TKCONFIG --
138 # Locate the tkConfig.sh file
145 # Adds the following arguments to configure:
148 # Defines the following vars:
149 # TK_BIN_DIR Full path to the directory containing
150 # the tkConfig.sh file
151 #------------------------------------------------------------------------
153 AC_DEFUN([SC_PATH_TKCONFIG], [
155 # Ok, lets find the tk configuration
156 # First, look for one uninstalled.
157 # the alternative search directory is invoked by --with-tk
160 if test x"${no_tk}" = x ; then
161 # we reset no_tk in case something fails here
164 AS_HELP_STRING([--with-tk],
165 [directory containing tk configuration (tkConfig.sh)]),
166 [with_tkconfig="${withval}"])
167 AC_MSG_CHECKING([for Tk configuration])
168 AC_CACHE_VAL(ac_cv_c_tkconfig,[
170 # First check to see if --with-tkconfig was specified.
171 if test x"${with_tkconfig}" != x ; then
172 case "${with_tkconfig}" in
174 if test -f "${with_tkconfig}"; then
175 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
176 with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
179 if test -f "${with_tkconfig}/tkConfig.sh" ; then
180 ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
182 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
186 # then check for a private Tk library
187 if test x"${ac_cv_c_tkconfig}" = x ; then
190 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
191 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
192 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
194 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
195 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
196 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
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` ; do
201 if test -f "$i/unix/tkConfig.sh" ; then
202 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
208 # on Darwin, check in Framework installation locations
209 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
210 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
211 `ls -d /Library/Frameworks 2>/dev/null` \
212 `ls -d /Network/Library/Frameworks 2>/dev/null` \
214 if test -f "$i/Tk.framework/tkConfig.sh" ; then
215 ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
221 # check in a few common install locations
222 if test x"${ac_cv_c_tkconfig}" = x ; then
223 for i in `ls -d ${libdir} 2>/dev/null` \
224 `ls -d ${exec_prefix}/lib 2>/dev/null` \
225 `ls -d ${prefix}/lib 2>/dev/null` \
226 `ls -d /usr/local/lib 2>/dev/null` \
227 `ls -d /usr/contrib/lib 2>/dev/null` \
228 `ls -d /usr/pkg/lib 2>/dev/null` \
229 `ls -d /usr/lib/tk8.6 2>/dev/null` \
230 `ls -d /usr/lib 2>/dev/null` \
231 `ls -d /usr/lib64 2>/dev/null` \
232 `ls -d /usr/local/lib/tk8.6 2>/dev/null` \
233 `ls -d /usr/local/lib/tcl/tk8.6 2>/dev/null` \
235 if test -f "$i/tkConfig.sh" ; then
236 ac_cv_c_tkconfig="`(cd $i; pwd)`"
242 # check in a few other private locations
243 if test x"${ac_cv_c_tkconfig}" = x ; then
246 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
247 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
248 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
249 if test -f "$i/unix/tkConfig.sh" ; then
250 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
257 if test x"${ac_cv_c_tkconfig}" = x ; then
258 TK_BIN_DIR="# no Tk configs found"
259 AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh])
262 TK_BIN_DIR="${ac_cv_c_tkconfig}"
263 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
268 #------------------------------------------------------------------------
269 # SC_LOAD_TCLCONFIG --
271 # Load the tclConfig.sh file
275 # Requires the following vars to be set:
280 # Substitutes the following vars:
284 #------------------------------------------------------------------------
286 AC_DEFUN([SC_LOAD_TCLCONFIG], [
287 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
289 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
290 AC_MSG_RESULT([loading])
291 . "${TCL_BIN_DIR}/tclConfig.sh"
293 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
296 # If the TCL_BIN_DIR is the build directory (not the install directory),
297 # then set the common variable name to the value of the build variables.
298 # For example, the variable TCL_LIB_SPEC will be set to the value
299 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
300 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
301 # installed and uninstalled version of Tcl.
302 if test -f "${TCL_BIN_DIR}/Makefile" ; then
303 TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
304 TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
305 TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
306 elif test "`uname -s`" = "Darwin"; then
307 # If Tcl was built as a framework, attempt to use the libraries
308 # from the framework at the given location so that linking works
309 # against Tcl.framework installed in an arbitrary location.
312 if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
313 for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
314 "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
315 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
316 TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
321 if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
322 TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
323 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
329 AC_SUBST(TCL_VERSION)
330 AC_SUBST(TCL_PATCH_LEVEL)
331 AC_SUBST(TCL_BIN_DIR)
332 AC_SUBST(TCL_SRC_DIR)
334 AC_SUBST(TCL_LIB_FILE)
335 AC_SUBST(TCL_LIB_FLAG)
336 AC_SUBST(TCL_LIB_SPEC)
338 AC_SUBST(TCL_STUB_LIB_FILE)
339 AC_SUBST(TCL_STUB_LIB_FLAG)
340 AC_SUBST(TCL_STUB_LIB_SPEC)
343 #------------------------------------------------------------------------
344 # SC_LOAD_TKCONFIG --
346 # Load the tkConfig.sh file
350 # Requires the following vars to be set:
355 # Sets the following vars that should be in tkConfig.sh:
357 #------------------------------------------------------------------------
359 AC_DEFUN([SC_LOAD_TKCONFIG], [
360 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
362 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
363 AC_MSG_RESULT([loading])
364 . "${TK_BIN_DIR}/tkConfig.sh"
366 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
369 # If the TK_BIN_DIR is the build directory (not the install directory),
370 # then set the common variable name to the value of the build variables.
371 # For example, the variable TK_LIB_SPEC will be set to the value
372 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
373 # instead of TK_BUILD_LIB_SPEC since it will work with both an
374 # installed and uninstalled version of Tcl.
375 if test -f "${TK_BIN_DIR}/Makefile" ; then
376 TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
377 TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
378 TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
379 elif test "`uname -s`" = "Darwin"; then
380 # If Tk was built as a framework, attempt to use the libraries
381 # from the framework at the given location so that linking works
382 # against Tk.framework installed in an arbitrary location.
385 if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
386 for i in "`cd "${TK_BIN_DIR}"; pwd`" \
387 "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
388 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
389 TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
394 if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
395 TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
396 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
406 AC_SUBST(TK_LIB_FILE)
407 AC_SUBST(TK_LIB_FLAG)
408 AC_SUBST(TK_LIB_SPEC)
410 AC_SUBST(TK_STUB_LIB_FILE)
411 AC_SUBST(TK_STUB_LIB_FLAG)
412 AC_SUBST(TK_STUB_LIB_SPEC)
415 #------------------------------------------------------------------------
417 # Locate a tclsh shell installed on the system path. This macro
418 # will only find a Tcl shell that already exists on the system.
419 # It will not find a Tcl shell in the Tcl build directory or
420 # a Tcl shell that has been installed from the Tcl build directory.
421 # If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
422 # be set to "". Extensions should take care not to create Makefile
423 # rules that are run by default and depend on TCLSH_PROG. An
424 # extension can't assume that an executable Tcl shell exists at
431 # Substitutes the following vars:
433 #------------------------------------------------------------------------
435 AC_DEFUN([SC_PROG_TCLSH], [
436 AC_MSG_CHECKING([for tclsh])
437 AC_CACHE_VAL(ac_cv_path_tclsh, [
438 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
439 for dir in $search_path ; do
440 for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \
441 `ls -r $dir/tclsh* 2> /dev/null` ; do
442 if test x"$ac_cv_path_tclsh" = x ; then
443 if test -f "$j" ; then
452 if test -f "$ac_cv_path_tclsh" ; then
453 TCLSH_PROG="$ac_cv_path_tclsh"
454 AC_MSG_RESULT([$TCLSH_PROG])
456 # It is not an error if an installed version of Tcl can't be located.
458 AC_MSG_RESULT([No tclsh found on PATH])
463 #------------------------------------------------------------------------
465 # Determine the fully qualified path name of the tclsh executable
466 # in the Tcl build directory. This macro will correctly determine
467 # the name of the tclsh executable even if tclsh has not yet
468 # been built in the build directory. The build tclsh must be used
469 # when running tests from an extension build directory. It is not
470 # correct to use the TCLSH_PROG in cases like this.
476 # Substitutes the following values:
478 #------------------------------------------------------------------------
480 AC_DEFUN([SC_BUILD_TCLSH], [
481 AC_MSG_CHECKING([for tclsh in Tcl build directory])
482 BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh
483 AC_MSG_RESULT([$BUILD_TCLSH])
484 AC_SUBST(BUILD_TCLSH)
487 #------------------------------------------------------------------------
488 # SC_ENABLE_SHARED --
490 # Allows the building of shared libraries
497 # Adds the following arguments to configure:
498 # --enable-shared=yes|no
500 # Defines the following vars:
501 # STATIC_BUILD Used for building import/export libraries
504 # Sets the following vars:
505 # SHARED_BUILD Value of 1 or 0
506 #------------------------------------------------------------------------
508 AC_DEFUN([SC_ENABLE_SHARED], [
509 AC_MSG_CHECKING([how to build libraries])
510 AC_ARG_ENABLE(shared,
511 AS_HELP_STRING([--enable-shared],
512 [build and link with shared libraries (default: on)]),
513 [tcl_ok=$enableval], [tcl_ok=yes])
514 if test "$tcl_ok" = "yes" ; then
515 AC_MSG_RESULT([shared])
518 AC_MSG_RESULT([static])
520 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
522 AC_SUBST(SHARED_BUILD)
525 #------------------------------------------------------------------------
526 # SC_ENABLE_FRAMEWORK --
528 # Allows the building of shared libraries into frameworks
535 # Adds the following arguments to configure:
536 # --enable-framework=yes|no
538 # Sets the following vars:
539 # FRAMEWORK_BUILD Value of 1 or 0
540 #------------------------------------------------------------------------
542 AC_DEFUN([SC_ENABLE_FRAMEWORK], [
543 if test "`uname -s`" = "Darwin" ; then
544 AC_MSG_CHECKING([how to package libraries])
545 AC_ARG_ENABLE(framework,
546 AS_HELP_STRING([--enable-framework],
547 [package shared libraries in MacOSX frameworks (default: off)]),
548 [enable_framework=$enableval], [enable_framework=no])
549 if test $enable_framework = yes; then
550 if test $SHARED_BUILD = 0; then
551 AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes])
554 if test $tcl_corefoundation = no; then
555 AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available])
559 if test $enable_framework = yes; then
560 AC_MSG_RESULT([framework])
563 if test $SHARED_BUILD = 1; then
564 AC_MSG_RESULT([shared library])
566 AC_MSG_RESULT([static library])
573 #------------------------------------------------------------------------
574 # SC_ENABLE_THREADS --
576 # Specify if thread support should be enabled
583 # Adds the following arguments to configure:
586 # Sets the following vars:
587 # THREADS_LIBS Thread library(s)
589 # Defines the following vars:
594 #------------------------------------------------------------------------
596 AC_DEFUN([SC_ENABLE_THREADS], [
597 AC_ARG_ENABLE(threads,
598 AS_HELP_STRING([--enable-threads],
599 [build with threads (default: on)]),
600 [tcl_ok=$enableval], [tcl_ok=yes])
602 if test "${TCL_THREADS}" = 1; then
606 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
608 # USE_THREAD_ALLOC tells us to try the special thread-based
609 # allocator that significantly reduces lock contention
610 AC_DEFINE(USE_THREAD_ALLOC, 1,
611 [Do we want to use the threaded memory allocator?])
612 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
613 if test "`uname -s`" = "SunOS" ; then
614 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
615 [Do we really want to follow the standard? Yes we do!])
617 AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
618 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
619 if test "$tcl_ok" = "no"; then
620 # Check a little harder for __pthread_mutex_init in the same
621 # library, as some systems hide it there until pthread.h is
622 # defined. We could alternatively do an AC_TRY_COMPILE with
623 # pthread.h, but that will work with libpthread really doesn't
624 # exist, like AIX 4.2. [Bug: 4359]
625 AC_CHECK_LIB(pthread, __pthread_mutex_init,
626 tcl_ok=yes, tcl_ok=no)
629 if test "$tcl_ok" = "yes"; then
630 # The space is needed
631 THREADS_LIBS=" -lpthread"
633 AC_CHECK_LIB(pthreads, pthread_mutex_init,
634 tcl_ok=yes, tcl_ok=no)
635 if test "$tcl_ok" = "yes"; then
636 # The space is needed
637 THREADS_LIBS=" -lpthreads"
639 AC_CHECK_LIB(c, pthread_mutex_init,
640 tcl_ok=yes, tcl_ok=no)
641 if test "$tcl_ok" = "no"; then
642 AC_CHECK_LIB(c_r, pthread_mutex_init,
643 tcl_ok=yes, tcl_ok=no)
644 if test "$tcl_ok" = "yes"; then
645 # The space is needed
646 THREADS_LIBS=" -pthread"
649 AC_MSG_WARN([Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...])
655 # Does the pthread-implementation provide
656 # 'pthread_attr_setstacksize' ?
659 LIBS="$LIBS $THREADS_LIBS"
660 AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork)
665 # Do checking message here to not mess up interleaved configure output
666 AC_MSG_CHECKING([for building with threads])
667 if test "${TCL_THREADS}" = 1; then
668 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
669 if test "${tcl_threaded_core}" = 1; then
670 AC_MSG_RESULT([yes (threaded core)])
678 AC_SUBST(TCL_THREADS)
681 #------------------------------------------------------------------------
682 # SC_ENABLE_SYMBOLS --
684 # Specify if debugging symbols should be used.
685 # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
686 # can also be enabled.
691 # Requires the following vars to be set in the Makefile:
699 # Adds the following arguments to configure:
702 # Defines the following vars:
703 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
704 # Sets to $(CFLAGS_OPTIMIZE) if false
705 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
706 # Sets to $(LDFLAGS_OPTIMIZE) if false
707 #------------------------------------------------------------------------
709 AC_DEFUN([SC_ENABLE_SYMBOLS], [
710 AC_MSG_CHECKING([for build with symbols])
711 AC_ARG_ENABLE(symbols,
712 AS_HELP_STRING([--enable-symbols],
713 [build with debugging symbols (default: off)]),
714 [tcl_ok=$enableval], [tcl_ok=no])
715 # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
716 if test "$tcl_ok" = "no"; then
717 CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
718 LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
719 AC_DEFINE(NDEBUG, 1, [Is no debugging enabled?])
721 AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
723 CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
724 LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
725 if test "$tcl_ok" = "yes"; then
726 AC_MSG_RESULT([yes (standard debugging)])
729 AC_SUBST(CFLAGS_DEFAULT)
730 AC_SUBST(LDFLAGS_DEFAULT)
732 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
733 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
736 ifelse($1,bccdebug,dnl Only enable 'compile' for the Tcl core itself
737 if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
738 AC_DEFINE(TCL_COMPILE_DEBUG, 1, [Is bytecode debugging enabled?])
739 AC_DEFINE(TCL_COMPILE_STATS, 1, [Are bytecode statistics enabled?])
742 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
743 if test "$tcl_ok" = "all"; then
744 AC_MSG_RESULT([enabled symbols mem ]ifelse($1,bccdebug,[compile ])[debugging])
746 AC_MSG_RESULT([enabled $tcl_ok debugging])
751 #------------------------------------------------------------------------
752 # SC_ENABLE_LANGINFO --
754 # Allows use of modern nl_langinfo check for better l10n.
755 # This is only relevant for Unix.
762 # Adds the following arguments to configure:
763 # --enable-langinfo=yes|no (default is yes)
765 # Defines the following vars:
766 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
767 #------------------------------------------------------------------------
769 AC_DEFUN([SC_ENABLE_LANGINFO], [
770 AC_ARG_ENABLE(langinfo,
771 AS_HELP_STRING([--enable-langinfo],
772 [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
773 [langinfo_ok=$enableval], [langinfo_ok=yes])
776 if test "$langinfo_ok" = "yes"; then
777 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
779 AC_MSG_CHECKING([whether to use nl_langinfo])
780 if test "$langinfo_ok" = "yes"; then
781 AC_CACHE_VAL(tcl_cv_langinfo_h, [
782 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(CODESET);]])],
783 [tcl_cv_langinfo_h=yes], [tcl_cv_langinfo_h=no])])
784 AC_MSG_RESULT([$tcl_cv_langinfo_h])
785 if test $tcl_cv_langinfo_h = yes; then
786 AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
789 AC_MSG_RESULT([$langinfo_ok])
793 #--------------------------------------------------------------------
796 # Decide whether to use symlinks for linking the manpages,
797 # whether to compress the manpages after installation, and
798 # whether to add a package name suffix to the installed
799 # manpages to avoidfile name clashes.
800 # If compression is enabled also find out what file name suffix
801 # the given compression program is using.
808 # Adds the following arguments to configure:
809 # --enable-man-symlinks
810 # --enable-man-compression=PROG
811 # --enable-man-suffix[=STRING]
813 # Defines the following variable:
815 # MAN_FLAGS - The apropriate flags for installManPage
816 # according to the user's selection.
818 #--------------------------------------------------------------------
820 AC_DEFUN([SC_CONFIG_MANPAGES], [
821 AC_MSG_CHECKING([whether to use symlinks for manpages])
822 AC_ARG_ENABLE(man-symlinks,
823 AS_HELP_STRING([--enable-man-symlinks],
824 [use symlinks for the manpages (default: off)]),
825 [test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks"],
827 AC_MSG_RESULT([$enableval])
829 AC_MSG_CHECKING([whether to compress the manpages])
830 AC_ARG_ENABLE(man-compression,
831 AS_HELP_STRING([--enable-man-compression=PROG],
832 [compress the manpages with PROG (default: off)]),
834 yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
836 *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
839 AC_MSG_RESULT([$enableval])
840 if test "$enableval" != "no"; then
841 AC_MSG_CHECKING([for compressed file suffix])
844 Z=`ls TeST* | sed 's/^....//'`
846 MAN_FLAGS="$MAN_FLAGS --extension $Z"
850 AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
851 AC_ARG_ENABLE(man-suffix,
852 AS_HELP_STRING([--enable-man-suffix=STRING],
853 [use STRING as a suffix to manpage file names (default: no, AC_PACKAGE_NAME if enabled without specifying STRING)]),
855 yes) enableval="AC_PACKAGE_NAME" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
857 *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
860 AC_MSG_RESULT([$enableval])
865 #--------------------------------------------------------------------
868 # Determine what the system is (some things cannot be easily checked
869 # on a feature-driven basis, alas). This can usually be done via the
870 # "uname" command, but there are a few systems, like Next, where
877 # Defines the following var:
879 # system - System/platform/version identification code.
881 #--------------------------------------------------------------------
883 AC_DEFUN([SC_CONFIG_SYSTEM], [
884 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
885 if test -f /usr/lib/NextStep/software_version; then
886 tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
888 tcl_cv_sys_version=`uname -s`-`uname -r`
889 if test "$?" -ne 0 ; then
890 AC_MSG_WARN([can't find uname command])
891 tcl_cv_sys_version=unknown
893 # Special check for weird MP-RAS system (uname returns weird
894 # results, and the version is kept in special file).
896 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
897 tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
899 if test "`uname -s`" = "AIX" ; then
900 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
902 if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
903 tcl_cv_sys_version=NetBSD-Debian
908 system=$tcl_cv_sys_version
911 #--------------------------------------------------------------------
914 # Try to determine the proper flags to pass to the compiler
915 # for building shared libraries and other such nonsense.
922 # Defines and substitutes the following vars:
924 # DL_OBJS - Name of the object file that implements dynamic
925 # loading for Tcl on this system.
926 # DL_LIBS - Library file(s) to include in tclsh and other base
927 # applications in order for the "load" command to work.
928 # LDFLAGS - Flags to pass to the compiler when linking object
929 # files into an executable application binary such
931 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
932 # that tell the run-time dynamic linker where to look
933 # for shared libraries such as libtcl.so. Depends on
934 # the variable LIB_RUNTIME_DIR in the Makefile. Could
935 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
936 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
937 # that tell the run-time dynamic linker where to look
938 # for shared libraries such as libtcl.so. Depends on
939 # the variable LIB_RUNTIME_DIR in the Makefile.
940 # MAKE_LIB - Command to execute to build the a library;
941 # differs when building shared or static.
943 # Command to execute to build a stub library.
944 # INSTALL_LIB - Command to execute to install a library;
945 # differs when building shared or static.
947 # Command to execute to install a stub library.
948 # STLIB_LD - Base command to use for combining object files
949 # into a static library.
950 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
951 # of a shared library (may request position-independent
952 # code, among other things).
953 # SHLIB_LD - Base command to use for combining object files
954 # into a shared library.
955 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
956 # creating shared libraries. This symbol typically
957 # goes at the end of the "ld" commands that build
958 # shared libraries. The value of the symbol defaults to
959 # "${LIBS}" if all of the dependent libraries should
960 # be specified when creating a shared library. If
961 # dependent libraries should not be specified (as on
962 # SunOS 4.x, where they cause the link to fail, or in
963 # general if Tcl and Tk aren't themselves shared
964 # libraries), then this symbol has an empty string
966 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
967 # extensions. An empty string means we don't know how
968 # to use shared libraries on this platform.
969 # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
970 # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
971 # tclConfig.sh, since they are only used for the build
973 # Examples: MacOS X records the library version and
974 # compatibility version in the shared library. But
975 # of course the Tcl version of this is only used for Tcl.
976 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
977 # in a static or shared library name, using the $VERSION variable
978 # to put the version in the right place. This is used
979 # by platforms that need non-standard library names.
980 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
981 # to have a version after the .so, and ${VERSION}.a
982 # on AIX, since a shared library needs to have
983 # a .a extension whereas shared objects for loadable
984 # extensions have a .so extension. Defaults to
985 # ${VERSION}${SHLIB_SUFFIX}.
987 # Libs to use when linking Tcl shell or some other
988 # shell that includes Tcl libs.
990 # Flags used when running the compiler in debug mode
992 # Flags used when running the compiler in optimize mode
993 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
995 #--------------------------------------------------------------------
997 AC_DEFUN([SC_CONFIG_CFLAGS], [
999 # Step 0.a: Enable 64 bit support?
1001 AC_MSG_CHECKING([if 64bit support is requested])
1002 AC_ARG_ENABLE(64bit,
1003 AS_HELP_STRING([--enable-64bit],
1004 [enable 64bit support (default: off)]),
1005 [do64bit=$enableval], [do64bit=no])
1006 AC_MSG_RESULT([$do64bit])
1008 # Step 0.b: Enable Solaris 64 bit VIS support?
1010 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1011 AC_ARG_ENABLE(64bit-vis,
1012 AS_HELP_STRING([--enable-64bit-vis],
1013 [enable 64bit Sparc VIS support (default: off)]),
1014 [do64bitVIS=$enableval], [do64bitVIS=no])
1015 AC_MSG_RESULT([$do64bitVIS])
1016 # Force 64bit on with VIS
1017 AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
1019 # Step 0.c: Check if visibility support is available. Do this here so
1020 # that platform specific alternatives can be used below if this fails.
1022 AC_CACHE_CHECK([if compiler supports visibility "hidden"],
1023 tcl_cv_cc_visibility_hidden, [
1024 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
1025 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1026 extern __attribute__((__visibility__("hidden"))) void f(void);
1027 void f(void) {}]], [[f();]])],
1028 [tcl_cv_cc_visibility_hidden=yes],
1029 [tcl_cv_cc_visibility_hidden=no])
1030 CFLAGS=$hold_cflags])
1031 AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
1032 AC_DEFINE(MODULE_SCOPE,
1033 [extern __attribute__((__visibility__("hidden")))],
1034 [Compiler support for module scope symbols])
1035 AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols])
1038 # Step 0.d: Disable -rpath support?
1040 AC_MSG_CHECKING([if rpath support is requested])
1041 AC_ARG_ENABLE(rpath,
1042 AS_HELP_STRING([--disable-rpath],
1043 [disable rpath support (default: on)]),
1044 [doRpath=$enableval], [doRpath=yes])
1045 AC_MSG_RESULT([$doRpath])
1047 # Step 1: set the variable "system" to hold the name and version number
1052 # Step 2: check for existence of -ldl library. This is needed because
1053 # Linux can use either -ldl or -ldld for dynamic loading.
1055 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
1057 # Require ranlib early so we can override it in special cases below.
1059 AC_REQUIRE([AC_PROG_RANLIB])
1061 # Step 3: set configuration options based on system name and version.
1064 # default to '{$LIBS}' and set to "" on per-platform necessary basis
1065 SHLIB_LD_LIBS='${LIBS}'
1066 LDFLAGS_ORIG="$LDFLAGS"
1067 # When ld needs options to work in 64-bit mode, put them in
1068 # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
1069 # is disabled by the user. [Bug 1016796]
1071 UNSHARED_LIB_SUFFIX=""
1072 TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
1073 ECHO_VERSION='`echo ${VERSION}`'
1074 TCL_LIB_VERSIONS_OK=ok
1076 AS_IF([test "$GCC" = yes], [
1078 CFLAGS_WARNING="-Wall -Wpointer-arith"
1083 AC_CHECK_TOOL(AR, ar)
1085 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1089 AS_IF([test "x${SHLIB_VERSION}" = x],[SHLIB_VERSION=".1.0"],[SHLIB_VERSION=".${SHLIB_VERSION}"])
1092 AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
1093 # AIX requires the _r compiler when gcc isn't being used
1099 # Make sure only first arg gets _r
1100 CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
1103 AC_MSG_RESULT([Using $CC for compiling with threads])
1109 DL_OBJS="tclLoadDl.o"
1110 LD_LIBRARY_PATH_VAR="LIBPATH"
1112 # ldAix No longer needed with use of -bexpall/-brtl
1113 # but some extensions may still reference it
1114 LDAIX_SRC='$(UNIX_DIR)/ldAix'
1116 # Check to enable 64-bit flags for compiler/linker
1117 AS_IF([test "$do64bit" = yes], [
1118 AS_IF([test "$GCC" = yes], [
1119 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1122 CFLAGS="$CFLAGS -q64"
1124 RANLIB="${RANLIB} -X64"
1126 SHLIB_LD_FLAGS="-b64"
1130 AS_IF([test "`uname -m`" = ia64], [
1131 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1132 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1133 # AIX-5 has dl* in libc.so
1135 AS_IF([test "$GCC" = yes], [
1136 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1138 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1140 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1142 AS_IF([test "$GCC" = yes], [
1143 SHLIB_LD='${CC} -shared -Wl,-bexpall'
1145 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
1146 LDFLAGS="$LDFLAGS -brtl"
1148 SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1150 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1151 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1155 SHLIB_CFLAGS="-fPIC"
1156 SHLIB_LD='${CC} -nostart'
1158 DL_OBJS="tclLoadDl.o"
1161 #-----------------------------------------------------------
1162 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1163 # -lsocket, even if the network functions are in -lnet which
1164 # is always linked to, for compatibility.
1165 #-----------------------------------------------------------
1166 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1168 BSD/OS-2.1*|BSD/OS-3*)
1170 SHLIB_LD="shlicc -r"
1172 DL_OBJS="tclLoadDl.o"
1178 SHLIB_CFLAGS="-export-dynamic -fPIC"
1179 SHLIB_LD='${CC} -shared'
1181 DL_OBJS="tclLoadDl.o"
1183 LDFLAGS="$LDFLAGS -export-dynamic"
1187 CYGWIN_*|MINGW32_*|MSYS_*)
1189 SHLIB_LD='${CC} -shared'
1191 DL_OBJS="tclLoadDl.o"
1192 PLAT_OBJS='${CYGWIN_OBJS}'
1193 PLAT_SRCS='${CYGWIN_SRCS}'
1197 TCL_NEEDS_EXP_FILE=1
1198 TCL_EXPORT_FILE_SUFFIX='${VERSION}.dll.a'
1199 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$[@].a"
1200 AC_CACHE_CHECK(for Cygwin version of gcc,
1202 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1210 if test "$ac_cv_cygwin" = "no"; then
1211 AC_MSG_ERROR([${CC} is not a cygwin compiler.])
1213 if test "x${TCL_THREADS}" = "x0"; then
1214 AC_MSG_ERROR([CYGWIN compile is only supported with --enable-threads])
1217 if test "x${SHARED_BUILD}" = "x1"; then
1218 echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args"
1219 # The eval makes quoting arguments work.
1220 if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix
1223 { echo "configure: error: configure failed for ../win" 1>&2; exit 1; }
1228 SHLIB_CFLAGS="-K PIC"
1232 DL_OBJS="tclLoadDl.o"
1238 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1239 SHLIB_CFLAGS="-fPIC"
1241 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
1242 DL_OBJS="tclLoadDl.o"
1244 AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
1247 # Use updated header definitions where possible
1248 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1249 AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1250 LIBS="$LIBS -lxnet" # Use the XOPEN network library
1252 AS_IF([test "`uname -m`" = ia64], [
1257 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1258 AS_IF([test "$tcl_ok" = yes], [
1261 DL_OBJS="tclLoadShl.o"
1263 LDFLAGS="$LDFLAGS -Wl,-E"
1264 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1265 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1266 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1268 AS_IF([test "$GCC" = yes], [
1269 SHLIB_LD='${CC} -shared'
1270 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1275 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1276 #CFLAGS="$CFLAGS +DAportable"
1278 # Check to enable 64-bit flags for compiler/linker
1279 AS_IF([test "$do64bit" = "yes"], [
1280 AS_IF([test "$GCC" = yes], [
1281 case `${CC} -dumpmachine` in
1283 # 64-bit gcc in use. Fix flags for GNU ld.
1285 SHLIB_LD='${CC} -shared'
1286 AS_IF([test $doRpath = yes], [
1287 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1288 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1291 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1296 CFLAGS="$CFLAGS +DD64"
1297 LDFLAGS_ARCH="+DD64"
1300 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1302 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1303 AS_IF([test "$tcl_ok" = yes], [
1307 DL_OBJS="tclLoadShl.o"
1309 LDFLAGS="$LDFLAGS -Wl,-E"
1310 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1311 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1312 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1316 SHLIB_LD="ld -shared -rdata_shared"
1318 DL_OBJS="tclLoadDl.o"
1321 AS_IF([test $doRpath = yes], [
1322 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1323 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1327 SHLIB_LD="ld -n32 -shared -rdata_shared"
1329 DL_OBJS="tclLoadDl.o"
1332 AS_IF([test $doRpath = yes], [
1333 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1334 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1335 AS_IF([test "$GCC" = yes], [
1336 CFLAGS="$CFLAGS -mabi=n32"
1337 LDFLAGS="$LDFLAGS -mabi=n32"
1341 # Use to build 6.2 compatible binaries on 6.3.
1342 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1345 CFLAGS="$CFLAGS -n32"
1348 LDFLAGS="$LDFLAGS -n32"
1353 SHLIB_LD="ld -n32 -shared -rdata_shared"
1355 DL_OBJS="tclLoadDl.o"
1358 AS_IF([test $doRpath = yes], [
1359 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1360 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1362 # Check to enable 64-bit flags for compiler/linker
1364 AS_IF([test "$do64bit" = yes], [
1365 AS_IF([test "$GCC" = yes], [
1366 AC_MSG_WARN([64bit mode not supported by gcc])
1369 SHLIB_LD="ld -64 -shared -rdata_shared"
1370 CFLAGS="$CFLAGS -64"
1375 Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
1376 SHLIB_CFLAGS="-fPIC"
1379 CFLAGS_OPTIMIZE="-O2"
1380 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1381 # when you inline the string and math operations. Turn this off to
1382 # get rid of the warnings.
1383 #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1385 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
1386 DL_OBJS="tclLoadDl.o"
1388 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1391 DragonFly-*|FreeBSD-*)
1392 AS_IF([test "${TCL_THREADS}" = "1"], [
1393 # The -pthread needs to go in the LDFLAGS, not LIBS
1394 LIBS=`echo $LIBS | sed s/-pthread//`
1395 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1396 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
1400 AS_IF([test $doRpath = yes], [
1401 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1402 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1403 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1404 AS_IF([test $do64bit = yes], [
1405 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1407 CFLAGS="$CFLAGS -m64"
1408 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1409 [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
1410 CFLAGS=$hold_cflags])
1411 AS_IF([test $tcl_cv_cc_m64 = yes], [
1412 CFLAGS="$CFLAGS -m64"
1417 # The combo of gcc + glibc has a bug related to inlining of
1418 # functions like strtod(). The -fno-builtin flag should address
1419 # this problem but it does not work. The -fno-inline flag is kind
1420 # of overkill but it works. Disable inlining only when one of the
1421 # files in compat/*.c is being linked in.
1423 AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1426 SHLIB_CFLAGS="-fPIC"
1429 SHLIB_LD='${CC} -shared'
1430 DL_OBJS="tclLoadDl.o"
1431 DL_LIBS="-mshared -ldl"
1432 LD_FLAGS="-Wl,--export-dynamic"
1433 AS_IF([test $doRpath = yes], [
1434 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1435 LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1438 SHLIB_CFLAGS="-K PIC"
1442 DL_OBJS="tclLoadDl.o"
1448 SHLIB_CFLAGS="-K PIC"
1452 DL_OBJS="tclLoadDl.o"
1454 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1462 SHLIB_CFLAGS="-fPIC"
1465 SHLIB_CFLAGS="-fpic"
1468 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1470 DL_OBJS="tclLoadDl.o"
1472 AS_IF([test $doRpath = yes], [
1473 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1474 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1475 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
1476 LDFLAGS="-Wl,-export-dynamic"
1477 CFLAGS_OPTIMIZE="-O2"
1478 AS_IF([test "${TCL_THREADS}" = "1"], [
1479 # On OpenBSD: Compile with -pthread
1480 # Don't link with -lpthread
1481 LIBS=`echo $LIBS | sed s/-lpthread//`
1482 CFLAGS="$CFLAGS -pthread"
1484 # OpenBSD doesn't do version numbers with dots.
1485 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1486 TCL_LIB_VERSIONS_OK=nodots
1489 # NetBSD has ELF and can use 'cc -shared' to build shared libs
1490 SHLIB_CFLAGS="-fPIC"
1491 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1493 DL_OBJS="tclLoadDl.o"
1495 LDFLAGS="$LDFLAGS -export-dynamic"
1496 AS_IF([test $doRpath = yes], [
1497 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1498 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1499 AS_IF([test "${TCL_THREADS}" = "1"], [
1500 # The -pthread needs to go in the CFLAGS, not LIBS
1501 LIBS=`echo $LIBS | sed s/-pthread//`
1502 CFLAGS="$CFLAGS -pthread"
1503 LDFLAGS="$LDFLAGS -pthread"
1507 CFLAGS_OPTIMIZE="-Os"
1508 SHLIB_CFLAGS="-fno-common"
1509 # To avoid discrepancies between what headers configure sees during
1510 # preprocessing tests and compiling tests, move any -isysroot and
1511 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1512 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1513 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1514 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1515 CFLAGS="`echo " ${CFLAGS}" | \
1516 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1517 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1518 AS_IF([test $do64bit = yes], [
1521 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1522 tcl_cv_cc_arch_ppc64, [
1524 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1525 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1526 [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no])
1527 CFLAGS=$hold_cflags])
1528 AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1529 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1533 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1534 tcl_cv_cc_arch_x86_64, [
1536 CFLAGS="$CFLAGS -arch x86_64"
1537 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1538 [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no])
1539 CFLAGS=$hold_cflags])
1540 AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1541 CFLAGS="$CFLAGS -arch x86_64"
1545 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1548 # Check for combined 32-bit and 64-bit fat build
1549 AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
1550 && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1553 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
1554 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1555 hold_ldflags=$LDFLAGS
1556 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1557 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_single_module=yes],
1558 [tcl_cv_ld_single_module=no])
1559 LDFLAGS=$hold_ldflags])
1560 AS_IF([test $tcl_cv_ld_single_module = yes], [
1561 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1563 SHLIB_SUFFIX=".dylib"
1564 DL_OBJS="tclLoadDyld.o"
1566 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1567 AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1568 tcl_cv_ld_search_paths_first, [
1569 hold_ldflags=$LDFLAGS
1570 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1571 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_search_paths_first=yes],
1572 [tcl_cv_ld_search_paths_first=no])
1573 LDFLAGS=$hold_ldflags])
1574 AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1575 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1577 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1578 AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1579 [Compiler support for module scope symbols])
1580 tcl_cv_cc_visibility_hidden=yes
1584 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1585 AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?])
1586 PLAT_OBJS='${MAC_OSX_OBJS}'
1587 PLAT_SRCS='${MAC_OSX_SRCS}'
1588 AC_MSG_CHECKING([whether to use CoreFoundation])
1589 AC_ARG_ENABLE(corefoundation,
1590 AS_HELP_STRING([--enable-corefoundation],
1591 [use CoreFoundation API on MacOSX (default: on)]),
1592 [tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
1593 AC_MSG_RESULT([$tcl_corefoundation])
1594 AS_IF([test $tcl_corefoundation = yes], [
1595 AC_CACHE_CHECK([for CoreFoundation.framework],
1596 tcl_cv_lib_corefoundation, [
1598 AS_IF([test "$fat_32_64" = yes], [
1599 for v in CFLAGS CPPFLAGS LDFLAGS; do
1600 # On Tiger there is no 64-bit CF, so remove 64-bit
1601 # archs from CFLAGS et al. while testing for
1602 # presence of CF. 64-bit CF is disabled in
1603 # tclUnixPort.h if necessary.
1604 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1606 LIBS="$LIBS -framework CoreFoundation"
1607 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <CoreFoundation/CoreFoundation.h>]],
1608 [[CFBundleRef b = CFBundleGetMainBundle();]])],
1609 [tcl_cv_lib_corefoundation=yes],
1610 [tcl_cv_lib_corefoundation=no])
1611 AS_IF([test "$fat_32_64" = yes], [
1612 for v in CFLAGS CPPFLAGS LDFLAGS; do
1613 eval $v'="$hold_'$v'"'
1616 AS_IF([test $tcl_cv_lib_corefoundation = yes], [
1617 LIBS="$LIBS -framework CoreFoundation"
1618 AC_DEFINE(HAVE_COREFOUNDATION, 1,
1619 [Do we have access to Darwin CoreFoundation.framework?])
1620 ], [tcl_corefoundation=no])
1621 AS_IF([test "$fat_32_64" = yes -a $tcl_corefoundation = yes],[
1622 AC_CACHE_CHECK([for 64-bit CoreFoundation],
1623 tcl_cv_lib_corefoundation_64, [
1624 for v in CFLAGS CPPFLAGS LDFLAGS; do
1625 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1627 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <CoreFoundation/CoreFoundation.h>]],
1628 [[CFBundleRef b = CFBundleGetMainBundle();]])],
1629 [tcl_cv_lib_corefoundation_64=yes],
1630 [tcl_cv_lib_corefoundation_64=no])
1631 for v in CFLAGS CPPFLAGS LDFLAGS; do
1632 eval $v'="$hold_'$v'"'
1634 AS_IF([test $tcl_cv_lib_corefoundation_64 = no], [
1635 AC_DEFINE(NO_COREFOUNDATION_64, 1,
1636 [Is Darwin CoreFoundation unavailable for 64-bit?])
1637 LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
1644 SHLIB_LD='${CC} -nostdlib -r'
1647 DL_OBJS="tclLoadNext.o"
1654 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1655 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1656 [Should OS/390 do the right thing with sockets?])
1658 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1659 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1661 # Hack: make package name same as library name
1662 SHLIB_LD='ld -R -export $@:'
1665 DL_OBJS="tclLoadOSF.o"
1671 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1672 SHLIB_CFLAGS="-fPIC"
1673 AS_IF([test "$SHARED_BUILD" = 1], [SHLIB_LD="ld -shared"], [
1674 SHLIB_LD="ld -non_shared"
1678 DL_OBJS="tclLoadDl.o"
1686 AS_IF([test "$SHARED_BUILD" = 1], [
1687 SHLIB_LD='ld -shared -expect_unresolved "*"'
1689 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1692 DL_OBJS="tclLoadDl.o"
1694 AS_IF([test $doRpath = yes], [
1695 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1696 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1697 AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1698 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1699 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1700 AS_IF([test "${TCL_THREADS}" = 1], [
1701 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1702 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1703 LIBS=`echo $LIBS | sed s/-lpthreads//`
1704 AS_IF([test "$GCC" = yes], [
1705 LIBS="$LIBS -lpthread -lmach -lexc"
1707 CFLAGS="$CFLAGS -pthread"
1708 LDFLAGS="$LDFLAGS -pthread"
1714 # This may work for all QNX, but it was only reported for v6.
1715 SHLIB_CFLAGS="-fPIC"
1716 SHLIB_LD="ld -Bshareable -x"
1719 DL_OBJS="tclLoadDl.o"
1720 # dlopen is in -lc on QNX
1726 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1727 # this test works, since "uname -s" was non-standard in 3.2.4 and
1729 AS_IF([test "$GCC" = yes], [
1730 SHLIB_CFLAGS="-fPIC -melf"
1731 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1733 SHLIB_CFLAGS="-Kpic -belf"
1734 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1739 DL_OBJS="tclLoadDl.o"
1745 SHLIB_CFLAGS="-K PIC"
1749 DL_OBJS="tclLoadDl.o"
1759 DL_OBJS="tclLoadDl.o"
1761 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1762 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1764 # SunOS can't handle version numbers with dots in them in library
1765 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1766 # requires an extra version number at the end of .so file names.
1767 # So, the library has to have a name like libtcl75.so.1.0
1769 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
1770 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1771 TCL_LIB_VERSIONS_OK=nodots
1774 # Careful to not let 5.10+ fall into this case
1776 # Note: If _REENTRANT isn't defined, then Solaris
1777 # won't define thread-safe library routines.
1779 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1780 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1781 [Do we really want to follow the standard? Yes we do!])
1783 SHLIB_CFLAGS="-KPIC"
1785 DL_OBJS="tclLoadDl.o"
1787 AS_IF([test "$GCC" = yes], [
1788 SHLIB_LD='${CC} -shared'
1789 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1790 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1792 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1793 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1794 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1798 # Note: If _REENTRANT isn't defined, then Solaris
1799 # won't define thread-safe library routines.
1801 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1802 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1803 [Do we really want to follow the standard? Yes we do!])
1805 SHLIB_CFLAGS="-KPIC"
1807 # Check to enable 64-bit flags for compiler/linker
1808 AS_IF([test "$do64bit" = yes], [
1810 AS_IF([test "$arch" = "sparcv9 sparc"], [
1811 AS_IF([test "$GCC" = yes], [
1812 AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
1813 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1816 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1817 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1818 SHLIB_CFLAGS="-fPIC"
1822 AS_IF([test "$do64bitVIS" = yes], [
1823 CFLAGS="$CFLAGS -xarch=v9a"
1824 LDFLAGS_ARCH="-xarch=v9a"
1826 CFLAGS="$CFLAGS -xarch=v9"
1827 LDFLAGS_ARCH="-xarch=v9"
1829 # Solaris 64 uses this as well
1830 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1832 ], [AS_IF([test "$arch" = "amd64 i386"], [
1833 AS_IF([test "$GCC" = yes], [
1835 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1837 CFLAGS="$CFLAGS -m64"
1838 LDFLAGS="$LDFLAGS -m64";;
1840 AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
1845 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1846 CFLAGS="$CFLAGS -m64"
1847 LDFLAGS="$LDFLAGS -m64";;
1849 CFLAGS="$CFLAGS -xarch=amd64"
1850 LDFLAGS="$LDFLAGS -xarch=amd64";;
1853 ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
1856 #--------------------------------------------------------------------
1857 # On Solaris 5.x i386 with the sunpro compiler we need to link
1858 # with sunmath to get floating point rounding control
1859 #--------------------------------------------------------------------
1860 AS_IF([test "$GCC" = yes],[use_sunmath=no],[
1862 AC_MSG_CHECKING([whether to use -lsunmath for fp rounding control])
1863 AS_IF([test "$arch" = "amd64 i386" -o "$arch" = "i386"], [
1864 AC_MSG_RESULT([yes])
1865 MATH_LIBS="-lsunmath $MATH_LIBS"
1866 AC_CHECK_HEADER(sunmath.h)
1874 DL_OBJS="tclLoadDl.o"
1876 AS_IF([test "$GCC" = yes], [
1877 SHLIB_LD='${CC} -shared'
1878 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1879 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1880 AS_IF([test "$do64bit_ok" = yes], [
1881 AS_IF([test "$arch" = "sparcv9 sparc"], [
1882 # We need to specify -static-libgcc or we need to
1883 # add the path to the sparv9 libgcc.
1884 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1885 # for finding sparcv9 libgcc, get the regular libgcc
1886 # path, remove so name and append 'sparcv9'
1887 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1888 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1889 ], [AS_IF([test "$arch" = "amd64 i386"], [
1890 SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
1894 AS_IF([test "$use_sunmath" = yes], [textmode=textoff],[textmode=text])
1896 SunOS-5.[[1-9]][[0-9]]*|SunOS-5.[[7-9]])
1897 SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";;
1899 SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";;
1901 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1902 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1905 UNIX_SV* | UnixWare-5*)
1906 SHLIB_CFLAGS="-KPIC"
1910 DL_OBJS="tclLoadDl.o"
1912 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1913 # that don't grok the -Bexport option. Test that it does.
1914 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1915 hold_ldflags=$LDFLAGS
1916 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1917 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_Bexport=yes],[tcl_cv_ld_Bexport=no])
1918 LDFLAGS=$hold_ldflags])
1919 AS_IF([test $tcl_cv_ld_Bexport = yes], [
1920 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1927 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
1928 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1931 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = yes], [
1932 AC_DEFINE(TCL_CFG_DO64BIT, 1, [Is this a 64-bit build?])
1935 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1936 dnl # until the end of configure, as configure's compile and link tests use
1937 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1938 dnl # preprocessing tests use only CPPFLAGS.
1939 AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1941 # Step 4: disable dynamic loading if requested via a command-line switch.
1944 AS_HELP_STRING([--enable-load],
1945 [allow dynamic loading and "load" command (default: on)]),
1946 [tcl_ok=$enableval], [tcl_ok=yes])
1947 AS_IF([test "$tcl_ok" = no], [DL_OBJS=""])
1949 AS_IF([test "x$DL_OBJS" != x], [BUILD_DLTEST="\$(DLTEST_TARGETS)"], [
1950 AC_MSG_WARN([Can't figure out how to do dynamic loading or shared libraries on this system.])
1954 DL_OBJS="tclLoadNone.o"
1956 LDFLAGS="$LDFLAGS_ORIG"
1961 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
1963 # If we're running gcc, then change the C flags for compiling shared
1964 # libraries to the right flags for gcc, instead of those for the
1965 # standard manufacturer compiler.
1967 AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [
1971 CYGWIN_*|MINGW32_*|MSYS_*) ;;
1975 NetBSD-*|OpenBSD-*) ;;
1978 *) SHLIB_CFLAGS="-fPIC" ;;
1981 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1982 AC_DEFINE(MODULE_SCOPE, [extern],
1983 [No Compiler support for module scope symbols])
1986 AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
1987 SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'])
1988 AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
1989 UNSHARED_LIB_SUFFIX='${VERSION}.a'])
1990 DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
1992 AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
1993 LIB_SUFFIX=${SHARED_LIB_SUFFIX}
1994 MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
1995 AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [
1996 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;'
1997 DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
1999 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
2002 LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
2004 AS_IF([test "$RANLIB" = ""], [
2005 MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
2007 MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
2009 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
2012 # Stub lib does not depend on shared/static configuration
2013 AS_IF([test "$RANLIB" = ""], [
2014 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
2016 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
2018 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
2020 # Define TCL_LIBS now that we know what DL_LIBS is.
2021 # The trick here is that we don't want to change the value of TCL_LIBS if
2022 # it is already set when tclConfig.sh had been loaded by Tk.
2023 AS_IF([test "x${TCL_LIBS}" = x], [
2024 TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"])
2027 # See if the compiler supports casting to a union type.
2028 # This is used to stop gcc from printing a compiler
2029 # warning when initializing a union member.
2031 AC_CACHE_CHECK(for cast to union support,
2032 tcl_cv_cast_to_union,
2033 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2034 union foo { int i; double d; };
2035 union foo f = (union foo) (int) 0;
2037 [tcl_cv_cast_to_union=yes],
2038 [tcl_cv_cast_to_union=no])
2040 if test "$tcl_cv_cast_to_union" = "yes"; then
2041 AC_DEFINE(HAVE_CAST_TO_UNION, 1,
2042 [Defined when compiler supports casting to union type.])
2044 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto"
2045 AC_CACHE_CHECK(for working -fno-lto,
2047 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
2052 if test "$ac_cv_nolto" = "yes" ; then
2053 CFLAGS_NOLTO="-fno-lto"
2058 # FIXME: This subst was left in only because the TCL_DL_LIBS
2059 # entry in tclConfig.sh uses it. It is not clear why someone
2060 # would use TCL_DL_LIBS instead of TCL_LIBS.
2068 AC_SUBST(CFLAGS_DEBUG)
2069 AC_SUBST(CFLAGS_OPTIMIZE)
2070 AC_SUBST(CFLAGS_WARNING)
2071 AC_SUBST(CFLAGS_NOLTO)
2074 AC_SUBST(LDFLAGS_DEBUG)
2075 AC_SUBST(LDFLAGS_OPTIMIZE)
2076 AC_SUBST(CC_SEARCH_FLAGS)
2077 AC_SUBST(LD_SEARCH_FLAGS)
2081 AC_SUBST(TCL_SHLIB_LD_EXTRAS)
2082 AC_SUBST(TK_SHLIB_LD_EXTRAS)
2083 AC_SUBST(SHLIB_LD_LIBS)
2084 AC_SUBST(SHLIB_CFLAGS)
2085 AC_SUBST(SHLIB_SUFFIX)
2086 AC_DEFINE_UNQUOTED(TCL_SHLIB_EXT,"${SHLIB_SUFFIX}",
2087 [What is the default extension for shared libraries?])
2090 AC_SUBST(MAKE_STUB_LIB)
2091 AC_SUBST(INSTALL_LIB)
2092 AC_SUBST(DLL_INSTALL_DIR)
2093 AC_SUBST(INSTALL_STUB_LIB)
2097 #--------------------------------------------------------------------
2098 # SC_MISSING_POSIX_HEADERS
2100 # Supply substitutes for missing POSIX header files. Special
2102 # - stdlib.h doesn't define strtol, strtoul, or
2103 # strtod insome versions of SunOS
2104 # - some versions of string.h don't declare procedures such
2112 # Defines some of the following vars:
2123 #--------------------------------------------------------------------
2125 AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
2126 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2127 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2128 #include <dirent.h>]], [[
2129 #ifndef _POSIX_SOURCE
2132 * Generate compilation error to make the test fail: Lynx headers
2133 * are only valid if really in the POSIX environment.
2136 missing_procedure();
2140 struct dirent *entryPtr;
2142 d = opendir("foobar");
2143 entryPtr = readdir(d);
2144 p = entryPtr->d_name;
2146 ]])],[tcl_cv_dirent_h=yes],[tcl_cv_dirent_h=no])])
2148 if test $tcl_cv_dirent_h = no; then
2149 AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
2152 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
2153 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
2154 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2155 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2156 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2157 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2158 if test $tcl_ok = 0; then
2159 AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
2161 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2162 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2163 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2165 # See also memmove check below for a place where NO_STRING_H can be
2168 if test $tcl_ok = 0; then
2169 AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
2172 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
2173 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
2175 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2176 AC_CHECK_HEADERS([sys/param.h])
2179 #--------------------------------------------------------------------
2182 # Locate the X11 header files and the X11 library archive. Try
2183 # the ac_path_x macro first, but if it doesn't find the X stuff
2184 # (e.g. because there's no xmkmf program) then check through
2185 # a list of possible directories. Under some conditions the
2186 # autoconf macro will return an include directory that contains
2187 # no include files, so double-check its result just to be safe.
2194 # Sets the following vars:
2198 #--------------------------------------------------------------------
2200 AC_DEFUN([SC_PATH_X], [
2203 if test "$no_x" = ""; then
2204 if test "$x_includes" = ""; then
2205 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[],[not_really_there="yes"])
2207 if test ! -r $x_includes/X11/Xlib.h; then
2208 not_really_there="yes"
2212 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2213 AC_MSG_CHECKING([for X11 header files])
2214 found_xincludes="no"
2215 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[found_xincludes="yes"],[found_xincludes="no"])
2216 if test "$found_xincludes" = "no"; then
2217 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"
2219 if test -r $i/X11/Xlib.h; then
2222 found_xincludes="yes"
2228 if test "$x_includes" != ""; then
2229 XINCLUDES="-I$x_includes"
2230 found_xincludes="yes"
2233 if test "$found_xincludes" = "no"; then
2234 AC_MSG_RESULT([couldn't find any!])
2237 if test "$no_x" = yes; then
2238 AC_MSG_CHECKING([for X11 libraries])
2240 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"
2242 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2250 if test "$x_libraries" = ""; then
2253 XLIBSW="-L$x_libraries -lX11"
2256 if test "$XLIBSW" = nope ; then
2257 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2259 if test "$XLIBSW" = nope ; then
2260 AC_MSG_RESULT([could not find any! Using -lX11.])
2265 #--------------------------------------------------------------------
2268 # The statements below check for systems where POSIX-style
2269 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2270 # On these systems (mostly older ones), use the old BSD-style
2271 # FIONBIO approach instead.
2278 # Defines some of the following vars:
2284 #--------------------------------------------------------------------
2286 AC_DEFUN([SC_BLOCKING_STYLE], [
2287 AC_CHECK_HEADERS(sys/ioctl.h)
2288 AC_CHECK_HEADERS(sys/filio.h)
2290 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2293 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2294 AC_MSG_RESULT([FIONBIO])
2297 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2298 AC_MSG_RESULT([FIONBIO])
2301 AC_MSG_RESULT([O_NONBLOCK])
2306 #--------------------------------------------------------------------
2309 # Checks how the system deals with time.h, what time structures
2310 # are used on the system, and what fields the structures have.
2317 # Defines some of the following vars:
2323 #--------------------------------------------------------------------
2325 AC_DEFUN([SC_TIME_HANDLER], [
2326 AC_CHECK_HEADERS(sys/time.h)
2329 AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
2331 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2332 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_tzadj;]])],
2333 [tcl_cv_member_tm_tzadj=yes],
2334 [tcl_cv_member_tm_tzadj=no])])
2335 if test $tcl_cv_member_tm_tzadj = yes ; then
2336 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2339 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2340 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_gmtoff;]])],
2341 [tcl_cv_member_tm_gmtoff=yes],
2342 [tcl_cv_member_tm_gmtoff=no])])
2343 if test $tcl_cv_member_tm_gmtoff = yes ; then
2344 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2348 # Its important to include time.h in this check, as some systems
2349 # (like convex) have timezone functions, etc.
2351 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2352 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
2353 [[extern long timezone;
2356 [tcl_cv_timezone_long=yes], [tcl_cv_timezone_long=no])])
2357 if test $tcl_cv_timezone_long = yes ; then
2358 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2361 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2363 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2364 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
2365 [[extern time_t timezone;
2368 [tcl_cv_timezone_time=yes], [tcl_cv_timezone_time=no])])
2369 if test $tcl_cv_timezone_time = yes ; then
2370 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2375 #--------------------------------------------------------------------
2378 # Search for the libraries needed to link the Tcl shell.
2379 # Things like the math library (-lm), socket stuff (-lsocket vs.
2380 # -lnsl), zlib (-lz) and libtommath (-ltommath) are dealt with here.
2387 # Might append to the following vars:
2391 # Might define the following vars:
2394 #--------------------------------------------------------------------
2396 AC_DEFUN([SC_TCL_LINK_LIBS], [
2397 #--------------------------------------------------------------------
2398 # On a few very rare systems, all of the libm.a stuff is
2399 # already in libc.a. Set compiler flags accordingly.
2400 #--------------------------------------------------------------------
2402 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2404 #--------------------------------------------------------------------
2405 # Interactive UNIX requires -linet instead of -lsocket, plus it
2406 # needs net/errno.h to define the socket-related error codes.
2407 #--------------------------------------------------------------------
2409 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2410 AC_CHECK_HEADER(net/errno.h, [
2411 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2413 #--------------------------------------------------------------------
2414 # Check for the existence of the -lsocket and -lnsl libraries.
2415 # The order here is important, so that they end up in the right
2416 # order in the command line generated by make. Here are some
2417 # special considerations:
2418 # 1. Use "connect" and "accept" to check for -lsocket, and
2419 # "gethostbyname" to check for -lnsl.
2420 # 2. Use each function name only once: can't redo a check because
2421 # autoconf caches the results of the last check and won't redo it.
2422 # 3. Use -lnsl and -lsocket only if they supply procedures that
2423 # aren't already present in the normal libraries. This is because
2424 # IRIX 5.2 has libraries, but they aren't needed and they're
2425 # bogus: they goof up name resolution if used.
2426 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2427 # To get around this problem, check for both libraries together
2428 # if -lsocket doesn't work by itself.
2429 #--------------------------------------------------------------------
2432 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2433 if test "$tcl_checkSocket" = 1; then
2434 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2435 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2437 if test "$tcl_checkBoth" = 1; then
2439 LIBS="$LIBS -lsocket -lnsl"
2440 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2442 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2443 [LIBS="$LIBS -lnsl"])])
2446 #--------------------------------------------------------------------
2447 # SC_TCL_EARLY_FLAGS
2449 # Check for what flags are needed to be passed so the correct OS
2450 # features are available.
2457 # Might define the following vars:
2459 # _LARGEFILE64_SOURCE
2460 # _LARGEFILE_SOURCE64
2462 #--------------------------------------------------------------------
2464 AC_DEFUN([SC_TCL_EARLY_FLAG],[
2465 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2466 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])],
2467 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[[#define ]$1[ 1
2469 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2470 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)]))
2471 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2472 AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
2473 tcl_flags="$tcl_flags $1"
2477 AC_DEFUN([SC_TCL_EARLY_FLAGS],[
2478 AC_MSG_CHECKING([for required early compiler flags])
2480 SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2481 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2482 SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2483 [struct stat64 buf; int i = stat64("/", &buf);])
2484 SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2485 [char *p = (char *)open64;])
2486 if test "x${tcl_flags}" = "x" ; then
2487 AC_MSG_RESULT([none])
2489 AC_MSG_RESULT([${tcl_flags}])
2493 #--------------------------------------------------------------------
2494 # SC_TCL_64BIT_FLAGS
2496 # Check for what is defined in the way of 64-bit features.
2503 # Might define the following vars:
2504 # TCL_WIDE_INT_IS_LONG
2506 # HAVE_STRUCT_DIRENT64, HAVE_DIR64
2507 # HAVE_STRUCT_STAT64
2510 #--------------------------------------------------------------------
2512 AC_DEFUN([SC_TCL_64BIT_FLAGS], [
2513 AC_MSG_CHECKING([for 64-bit integer type])
2514 AC_CACHE_VAL(tcl_cv_type_64bit,[
2515 tcl_cv_type_64bit=none
2516 # See if the compiler knows natively about __int64
2517 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__int64 value = (__int64) 0;]])],
2518 [tcl_type_64bit=__int64], [tcl_type_64bit="long long"])
2519 # See if we should use long anyway Note that we substitute in the
2520 # type that is our current guess for a 64-bit type inside this check
2521 # program, so it should be modified only carefully...
2522 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) {
2523 case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
2524 }]])],[tcl_cv_type_64bit=${tcl_type_64bit}],[])])
2525 if test "${tcl_cv_type_64bit}" = none ; then
2526 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
2527 AC_MSG_RESULT([using long])
2529 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2530 [What type should be used to define wide integers?])
2531 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2533 # Now check for auxiliary declarations
2534 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2535 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2536 #include <dirent.h>]], [[struct dirent64 p;]])],
2537 [tcl_cv_struct_dirent64=yes],[tcl_cv_struct_dirent64=no])])
2538 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2539 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2542 AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[
2543 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2544 #include <dirent.h>]], [[struct dirent64 *p; DIR64 d = opendir64(".");
2545 p = readdir64(d); rewinddir64(d); closedir64(d);]])],
2546 [tcl_cv_DIR64=yes], [tcl_cv_DIR64=no])])
2547 if test "x${tcl_cv_DIR64}" = "xyes" ; then
2548 AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?])
2551 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2552 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat64 p;
2554 [tcl_cv_struct_stat64=yes], [tcl_cv_struct_stat64=no])])
2555 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2556 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2559 AC_CHECK_FUNCS(open64 lseek64)
2560 AC_MSG_CHECKING([for off64_t])
2561 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2562 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[off64_t offset;
2564 [tcl_cv_type_off64_t=yes], [tcl_cv_type_off64_t=no])])
2565 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2566 dnl functions lseek64 and open64 are defined.
2567 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2568 test "x${ac_cv_func_lseek64}" = "xyes" && \
2569 test "x${ac_cv_func_open64}" = "xyes" ; then
2570 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2571 AC_MSG_RESULT([yes])
2578 #--------------------------------------------------------------------
2579 # SC_TCL_CFG_ENCODING TIP #59
2581 # Declare the encoding to use for embedded configuration information.
2587 # Might append to the following vars:
2590 # Will define the following vars:
2591 # TCL_CFGVAL_ENCODING
2593 #--------------------------------------------------------------------
2595 AC_DEFUN([SC_TCL_CFG_ENCODING], [
2596 AC_ARG_WITH(encoding,
2597 AS_HELP_STRING([--with-encoding],
2598 [encoding for configuration values (default: iso8859-1)]),
2599 [with_tcencoding=${withval}])
2601 if test x"${with_tcencoding}" != x ; then
2602 AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}",
2603 [What encoding should be used for embedded configuration info?])
2605 AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1",
2606 [What encoding should be used for embedded configuration info?])
2610 #--------------------------------------------------------------------
2611 # SC_TCL_CHECK_BROKEN_FUNC
2613 # Check for broken function.
2616 # funcName - function to test for
2617 # advancedTest - the advanced test to run if the function is present
2620 # Might cause compatibility versions of the function to be used.
2621 # Might affect the following vars:
2622 # USE_COMPAT (implicit)
2624 #--------------------------------------------------------------------
2626 AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
2627 AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0)
2628 if test ["$tcl_ok"] = 1; then
2629 AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken],
2630 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
2633 int main() {]$2[}]]])],[tcl_cv_$1_unbroken=ok],
2634 [tcl_cv_$1_unbroken=broken],[tcl_cv_$1_unbroken=unknown]))
2635 if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then
2641 if test ["$tcl_ok"] = 0; then
2647 #--------------------------------------------------------------------
2648 # SC_TCL_GETHOSTBYADDR_R
2650 # Check if we have MT-safe variant of gethostbyaddr().
2657 # Might define the following vars:
2658 # HAVE_GETHOSTBYADDR_R
2659 # HAVE_GETHOSTBYADDR_R_7
2660 # HAVE_GETHOSTBYADDR_R_8
2662 #--------------------------------------------------------------------
2664 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [
2665 # Avoids picking hidden internal symbol from libc
2666 SC_TCL_GETHOSTBYADDR_R_DECL
2668 if test "$tcl_cv_api_gethostbyaddr_r" = yes; then
2669 SC_TCL_GETHOSTBYADDR_R_TYPE
2673 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_DECL], [AC_CHECK_DECLS(gethostbyaddr_r, [
2674 tcl_cv_api_gethostbyaddr_r=yes],[tcl_cv_api_gethostbyaddr_r=no],[#include <netdb.h>])
2677 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_TYPE], [AC_CHECK_FUNC(gethostbyaddr_r, [
2678 AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
2679 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2685 struct hostent *result;
2690 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2692 ]])],[tcl_cv_api_gethostbyaddr_r_7=yes],[tcl_cv_api_gethostbyaddr_r_7=no])])
2693 tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
2694 if test "$tcl_ok" = yes; then
2695 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1,
2696 [Define to 1 if gethostbyaddr_r takes 7 args.])
2698 AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
2699 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2705 struct hostent *result, *resultp;
2710 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2711 &resultp, &h_errnop);
2712 ]])],[tcl_cv_api_gethostbyaddr_r_8=yes],[tcl_cv_api_gethostbyaddr_r_8=no])])
2713 tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
2714 if test "$tcl_ok" = yes; then
2715 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1,
2716 [Define to 1 if gethostbyaddr_r takes 8 args.])
2719 if test "$tcl_ok" = yes; then
2720 AC_DEFINE(HAVE_GETHOSTBYADDR_R, 1,
2721 [Define to 1 if gethostbyaddr_r is available.])
2725 #--------------------------------------------------------------------
2726 # SC_TCL_GETHOSTBYNAME_R
2728 # Check to see what variant of gethostbyname_r() we have.
2729 # Based on David Arnold's example from the comp.programming.threads
2737 # Might define the following vars:
2738 # HAVE_GETHOSTBYNAME_R
2739 # HAVE_GETHOSTBYNAME_R_3
2740 # HAVE_GETHOSTBYNAME_R_5
2741 # HAVE_GETHOSTBYNAME_R_6
2743 #--------------------------------------------------------------------
2745 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [
2746 # Avoids picking hidden internal symbol from libc
2747 SC_TCL_GETHOSTBYNAME_R_DECL
2749 if test "$tcl_cv_api_gethostbyname_r" = yes; then
2750 SC_TCL_GETHOSTBYNAME_R_TYPE
2754 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_DECL], [AC_CHECK_DECLS(gethostbyname_r, [
2755 tcl_cv_api_gethostbyname_r=yes],[tcl_cv_api_gethostbyname_r=no],[#include <netdb.h>])
2758 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_TYPE], [AC_CHECK_FUNC(gethostbyname_r, [
2759 AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
2760 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2764 struct hostent *he, *res;
2769 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
2770 ]])],[tcl_cv_api_gethostbyname_r_6=yes],[tcl_cv_api_gethostbyname_r_6=no])])
2771 tcl_ok=$tcl_cv_api_gethostbyname_r_6
2772 if test "$tcl_ok" = yes; then
2773 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1,
2774 [Define to 1 if gethostbyname_r takes 6 args.])
2776 AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
2777 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2786 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
2787 ]])],[tcl_cv_api_gethostbyname_r_5=yes],[tcl_cv_api_gethostbyname_r_5=no])])
2788 tcl_ok=$tcl_cv_api_gethostbyname_r_5
2789 if test "$tcl_ok" = yes; then
2790 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1,
2791 [Define to 1 if gethostbyname_r takes 5 args.])
2793 AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
2794 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2799 struct hostent_data data;
2801 (void) gethostbyname_r(name, he, &data);
2802 ]])],[tcl_cv_api_gethostbyname_r_3=yes],[tcl_cv_api_gethostbyname_r_3=no])])
2803 tcl_ok=$tcl_cv_api_gethostbyname_r_3
2804 if test "$tcl_ok" = yes; then
2805 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1,
2806 [Define to 1 if gethostbyname_r takes 3 args.])
2810 if test "$tcl_ok" = yes; then
2811 AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1,
2812 [Define to 1 if gethostbyname_r is available.])
2816 #--------------------------------------------------------------------
2819 # Check if we have MT-safe variant of getpwuid() and if yes,
2820 # which one exactly.
2827 # Might define the following vars:
2832 #--------------------------------------------------------------------
2834 AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
2835 AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
2836 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2837 #include <sys/types.h>
2841 struct passwd pw, *pwp;
2845 (void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
2846 ]])],[tcl_cv_api_getpwuid_r_5=yes],[tcl_cv_api_getpwuid_r_5=no])])
2847 tcl_ok=$tcl_cv_api_getpwuid_r_5
2848 if test "$tcl_ok" = yes; then
2849 AC_DEFINE(HAVE_GETPWUID_R_5, 1,
2850 [Define to 1 if getpwuid_r takes 5 args.])
2852 AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
2853 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2854 #include <sys/types.h>
2862 (void)getpwnam_r(uid, &pw, buf, buflen);
2863 ]])],[tcl_cv_api_getpwuid_r_4=yes],[tcl_cv_api_getpwuid_r_4=no])])
2864 tcl_ok=$tcl_cv_api_getpwuid_r_4
2865 if test "$tcl_ok" = yes; then
2866 AC_DEFINE(HAVE_GETPWUID_R_4, 1,
2867 [Define to 1 if getpwuid_r takes 4 args.])
2870 if test "$tcl_ok" = yes; then
2871 AC_DEFINE(HAVE_GETPWUID_R, 1,
2872 [Define to 1 if getpwuid_r is available.])
2876 #--------------------------------------------------------------------
2879 # Check if we have MT-safe variant of getpwnam() and if yes,
2880 # which one exactly.
2887 # Might define the following vars:
2892 #--------------------------------------------------------------------
2894 AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
2895 AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
2896 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2897 #include <sys/types.h>
2901 struct passwd pw, *pwp;
2905 (void) getpwnam_r(name, &pw, buf, buflen, &pwp);
2906 ]])],[tcl_cv_api_getpwnam_r_5=yes],[tcl_cv_api_getpwnam_r_5=no])])
2907 tcl_ok=$tcl_cv_api_getpwnam_r_5
2908 if test "$tcl_ok" = yes; then
2909 AC_DEFINE(HAVE_GETPWNAM_R_5, 1,
2910 [Define to 1 if getpwnam_r takes 5 args.])
2912 AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
2913 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2914 #include <sys/types.h>
2922 (void)getpwnam_r(name, &pw, buf, buflen);
2923 ]])],[tcl_cv_api_getpwnam_r_4=yes],[tcl_cv_api_getpwnam_r_4=no])])
2924 tcl_ok=$tcl_cv_api_getpwnam_r_4
2925 if test "$tcl_ok" = yes; then
2926 AC_DEFINE(HAVE_GETPWNAM_R_4, 1,
2927 [Define to 1 if getpwnam_r takes 4 args.])
2930 if test "$tcl_ok" = yes; then
2931 AC_DEFINE(HAVE_GETPWNAM_R, 1,
2932 [Define to 1 if getpwnam_r is available.])
2936 #--------------------------------------------------------------------
2939 # Check if we have MT-safe variant of getgrgid() and if yes,
2940 # which one exactly.
2947 # Might define the following vars:
2952 #--------------------------------------------------------------------
2954 AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
2955 AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
2956 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2957 #include <sys/types.h>
2961 struct group gr, *grp;
2965 (void) getgrgid_r(gid, &gr, buf, buflen, &grp);
2966 ]])],[tcl_cv_api_getgrgid_r_5=yes],[tcl_cv_api_getgrgid_r_5=no])])
2967 tcl_ok=$tcl_cv_api_getgrgid_r_5
2968 if test "$tcl_ok" = yes; then
2969 AC_DEFINE(HAVE_GETGRGID_R_5, 1,
2970 [Define to 1 if getgrgid_r takes 5 args.])
2972 AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
2973 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2974 #include <sys/types.h>
2982 (void)getgrgid_r(gid, &gr, buf, buflen);
2983 ]])],[tcl_cv_api_getgrgid_r_4=yes],[tcl_cv_api_getgrgid_r_4=no])])
2984 tcl_ok=$tcl_cv_api_getgrgid_r_4
2985 if test "$tcl_ok" = yes; then
2986 AC_DEFINE(HAVE_GETGRGID_R_4, 1,
2987 [Define to 1 if getgrgid_r takes 4 args.])
2990 if test "$tcl_ok" = yes; then
2991 AC_DEFINE(HAVE_GETGRGID_R, 1,
2992 [Define to 1 if getgrgid_r is available.])
2996 #--------------------------------------------------------------------
2999 # Check if we have MT-safe variant of getgrnam() and if yes,
3000 # which one exactly.
3007 # Might define the following vars:
3012 #--------------------------------------------------------------------
3014 AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
3015 AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
3016 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3017 #include <sys/types.h>
3021 struct group gr, *grp;
3025 (void) getgrnam_r(name, &gr, buf, buflen, &grp);
3026 ]])],[tcl_cv_api_getgrnam_r_5=yes],[tcl_cv_api_getgrnam_r_5=no])])
3027 tcl_ok=$tcl_cv_api_getgrnam_r_5
3028 if test "$tcl_ok" = yes; then
3029 AC_DEFINE(HAVE_GETGRNAM_R_5, 1,
3030 [Define to 1 if getgrnam_r takes 5 args.])
3032 AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
3033 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3034 #include <sys/types.h>
3042 (void)getgrnam_r(name, &gr, buf, buflen);
3043 ]])],[tcl_cv_api_getgrnam_r_4=yes],[tcl_cv_api_getgrnam_r_4=no])])
3044 tcl_ok=$tcl_cv_api_getgrnam_r_4
3045 if test "$tcl_ok" = yes; then
3046 AC_DEFINE(HAVE_GETGRNAM_R_4, 1,
3047 [Define to 1 if getgrnam_r takes 4 args.])
3050 if test "$tcl_ok" = yes; then
3051 AC_DEFINE(HAVE_GETGRNAM_R, 1,
3052 [Define to 1 if getgrnam_r is available.])
3056 AC_DEFUN([SC_TCL_IPV6],[
3058 AC_CHECK_FUNCS(getnameinfo getaddrinfo freeaddrinfo gai_strerror,,[NEED_FAKE_RFC2553=1])
3062 struct sockaddr_in6,
3063 struct sockaddr_storage],,[NEED_FAKE_RFC2553=1],[[
3064 #include <sys/types.h>
3065 #include <sys/socket.h>
3066 #include <netinet/in.h>
3069 if test "x$NEED_FAKE_RFC2553" = "x1"; then
3070 AC_DEFINE([NEED_FAKE_RFC2553], 1,
3071 [Use compat implementation of getaddrinfo() and friends])
3072 AC_LIBOBJ([fake-rfc2553])
3073 AC_CHECK_FUNC(strlcpy)