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
30 AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
31 AC_MSG_CHECKING([for Tcl configuration])
32 AC_CACHE_VAL(ac_cv_c_tclconfig,[
34 # First check to see if --with-tcl was specified.
35 if test x"${with_tclconfig}" != x ; then
36 if test -f "${with_tclconfig}/tclConfig.sh" ; then
37 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
39 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
43 # then check for a private Tcl installation
44 if test x"${ac_cv_c_tclconfig}" = x ; then
47 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
48 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
49 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
51 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
52 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
53 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
55 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
56 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
57 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
58 if test -f "$i/unix/tclConfig.sh" ; then
59 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
65 # on Darwin, check in Framework installation locations
66 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
67 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
68 `ls -d /Library/Frameworks 2>/dev/null` \
69 `ls -d /Network/Library/Frameworks 2>/dev/null` \
70 `ls -d /System/Library/Frameworks 2>/dev/null` \
72 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
73 ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
79 # check in a few common install locations
80 if test x"${ac_cv_c_tclconfig}" = x ; then
81 for i in `ls -d ${libdir} 2>/dev/null` \
82 `ls -d ${exec_prefix}/lib 2>/dev/null` \
83 `ls -d ${prefix}/lib 2>/dev/null` \
84 `ls -d /usr/local/lib 2>/dev/null` \
85 `ls -d /usr/contrib/lib 2>/dev/null` \
86 `ls -d /usr/lib 2>/dev/null` \
88 if test -f "$i/tclConfig.sh" ; then
89 ac_cv_c_tclconfig=`(cd $i; pwd)`
95 # check in a few other private locations
96 if test x"${ac_cv_c_tclconfig}" = x ; then
99 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
100 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
101 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
102 if test -f "$i/unix/tclConfig.sh" ; then
103 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
110 if test x"${ac_cv_c_tclconfig}" = x ; then
111 TCL_BIN_DIR="# no Tcl configs found"
112 AC_MSG_WARN([Can't find Tcl configuration definitions])
116 TCL_BIN_DIR=${ac_cv_c_tclconfig}
117 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
122 #------------------------------------------------------------------------
123 # SC_PATH_TKCONFIG --
125 # Locate the tkConfig.sh file
132 # Adds the following arguments to configure:
135 # Defines the following vars:
136 # TK_BIN_DIR Full path to the directory containing
137 # the tkConfig.sh file
138 #------------------------------------------------------------------------
140 AC_DEFUN([SC_PATH_TKCONFIG], [
142 # Ok, lets find the tk configuration
143 # First, look for one uninstalled.
144 # the alternative search directory is invoked by --with-tk
147 if test x"${no_tk}" = x ; then
148 # we reset no_tk in case something fails here
150 AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
151 AC_MSG_CHECKING([for Tk configuration])
152 AC_CACHE_VAL(ac_cv_c_tkconfig,[
154 # First check to see if --with-tkconfig was specified.
155 if test x"${with_tkconfig}" != x ; then
156 if test -f "${with_tkconfig}/tkConfig.sh" ; then
157 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
159 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
163 # then check for a private Tk library
164 if test x"${ac_cv_c_tkconfig}" = x ; then
167 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
168 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
169 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
171 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
172 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
173 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
175 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
176 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
177 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
178 if test -f "$i/unix/tkConfig.sh" ; then
179 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
185 # on Darwin, check in Framework installation locations
186 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
187 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
188 `ls -d /Library/Frameworks 2>/dev/null` \
189 `ls -d /Network/Library/Frameworks 2>/dev/null` \
190 `ls -d /System/Library/Frameworks 2>/dev/null` \
192 if test -f "$i/Tk.framework/tkConfig.sh" ; then
193 ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)`
199 # check in a few common install locations
200 if test x"${ac_cv_c_tkconfig}" = x ; then
201 for i in `ls -d ${libdir} 2>/dev/null` \
202 `ls -d ${exec_prefix}/lib 2>/dev/null` \
203 `ls -d ${prefix}/lib 2>/dev/null` \
204 `ls -d /usr/local/lib 2>/dev/null` \
205 `ls -d /usr/contrib/lib 2>/dev/null` \
206 `ls -d /usr/lib 2>/dev/null` \
208 if test -f "$i/tkConfig.sh" ; then
209 ac_cv_c_tkconfig=`(cd $i; pwd)`
214 # check in a few other private locations
215 if test x"${ac_cv_c_tkconfig}" = x ; then
218 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
219 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
220 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
221 if test -f "$i/unix/tkConfig.sh" ; then
222 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
229 if test x"${ac_cv_c_tkconfig}" = x ; then
230 TK_BIN_DIR="# no Tk configs found"
231 AC_MSG_WARN([Can't find Tk configuration definitions])
235 TK_BIN_DIR=${ac_cv_c_tkconfig}
236 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
241 #------------------------------------------------------------------------
242 # SC_LOAD_TCLCONFIG --
244 # Load the tclConfig.sh file
248 # Requires the following vars to be set:
253 # Subst the following vars:
258 #------------------------------------------------------------------------
260 AC_DEFUN([SC_LOAD_TCLCONFIG], [
261 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
263 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
264 AC_MSG_RESULT([loading])
265 . ${TCL_BIN_DIR}/tclConfig.sh
267 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
270 # eval is required to do the TCL_DBGX substitution
271 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
272 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
274 # If the TCL_BIN_DIR is the build directory (not the install directory),
275 # then set the common variable name to the value of the build variables.
276 # For example, the variable TCL_LIB_SPEC will be set to the value
277 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
278 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
279 # installed and uninstalled version of Tcl.
280 if test -f ${TCL_BIN_DIR}/Makefile ; then
281 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
282 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
283 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
284 elif test "`uname -s`" = "Darwin"; then
285 # If Tcl was built as a framework, attempt to use the libraries
286 # from the framework at the given location so that linking works
287 # against Tcl.framework installed in an arbitary location.
290 if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
291 for i in "`cd ${TCL_BIN_DIR}; pwd`" \
292 "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
293 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
294 TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
299 if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
300 TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
301 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
307 # eval is required to do the TCL_DBGX substitution
308 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
309 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
310 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
311 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
313 AC_SUBST(TCL_VERSION)
314 AC_SUBST(TCL_PATCH_LEVEL)
315 AC_SUBST(TCL_BIN_DIR)
316 AC_SUBST(TCL_SRC_DIR)
318 AC_SUBST(TCL_LIB_FILE)
319 AC_SUBST(TCL_LIB_FLAG)
320 AC_SUBST(TCL_LIB_SPEC)
322 AC_SUBST(TCL_STUB_LIB_FILE)
323 AC_SUBST(TCL_STUB_LIB_FLAG)
324 AC_SUBST(TCL_STUB_LIB_SPEC)
327 #------------------------------------------------------------------------
328 # SC_LOAD_TKCONFIG --
330 # Load the tkConfig.sh file
334 # Requires the following vars to be set:
339 # Sets the following vars that should be in tkConfig.sh:
341 #------------------------------------------------------------------------
343 AC_DEFUN([SC_LOAD_TKCONFIG], [
344 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
346 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
347 AC_MSG_RESULT([loading])
348 . ${TK_BIN_DIR}/tkConfig.sh
350 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
353 # eval is required to do the TK_DBGX substitution
354 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
355 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
357 # If the TK_BIN_DIR is the build directory (not the install directory),
358 # then set the common variable name to the value of the build variables.
359 # For example, the variable TK_LIB_SPEC will be set to the value
360 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
361 # instead of TK_BUILD_LIB_SPEC since it will work with both an
362 # installed and uninstalled version of Tcl.
363 if test -f ${TK_BIN_DIR}/Makefile ; then
364 TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
365 TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
366 TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
367 elif test "`uname -s`" = "Darwin"; then
368 # If Tk was built as a framework, attempt to use the libraries
369 # from the framework at the given location so that linking works
370 # against Tk.framework installed in an arbitary location.
373 if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then
374 for i in "`cd ${TK_BIN_DIR}; pwd`" \
375 "`cd ${TK_BIN_DIR}/../..; pwd`"; do
376 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
377 TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}"
382 if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then
383 TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
384 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
390 # eval is required to do the TK_DBGX substitution
391 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
392 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
393 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
394 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
400 AC_SUBST(TK_LIB_FILE)
401 AC_SUBST(TK_LIB_FLAG)
402 AC_SUBST(TK_LIB_SPEC)
404 AC_SUBST(TK_STUB_LIB_FILE)
405 AC_SUBST(TK_STUB_LIB_FLAG)
406 AC_SUBST(TK_STUB_LIB_SPEC)
409 #------------------------------------------------------------------------
411 # Locate a tclsh shell installed on the system path. This macro
412 # will only find a Tcl shell that already exists on the system.
413 # It will not find a Tcl shell in the Tcl build directory or
414 # a Tcl shell that has been installed from the Tcl build directory.
415 # If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
416 # be set to "". Extensions should take care not to create Makefile
417 # rules that are run by default and depend on TCLSH_PROG. An
418 # extension can't assume that an executable Tcl shell exists at
425 # Subst's the following values:
427 #------------------------------------------------------------------------
429 AC_DEFUN([SC_PROG_TCLSH], [
430 AC_MSG_CHECKING([for tclsh])
431 AC_CACHE_VAL(ac_cv_path_tclsh, [
432 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
433 for dir in $search_path ; do
434 for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \
435 `ls -r $dir/tclsh* 2> /dev/null` ; do
436 if test x"$ac_cv_path_tclsh" = x ; then
437 if test -f "$j" ; then
446 if test -f "$ac_cv_path_tclsh" ; then
447 TCLSH_PROG="$ac_cv_path_tclsh"
448 AC_MSG_RESULT([$TCLSH_PROG])
450 # It is not an error if an installed version of Tcl can't be located.
452 AC_MSG_RESULT([No tclsh found on PATH])
457 #------------------------------------------------------------------------
459 # Determine the fully qualified path name of the tclsh executable
460 # in the Tcl build directory. This macro will correctly determine
461 # the name of the tclsh executable even if tclsh has not yet
462 # been built in the build directory. The build tclsh must be used
463 # when running tests from an extension build directory. It is not
464 # correct to use the TCLSH_PROG in cases like this.
470 # Subst's the following values:
472 #------------------------------------------------------------------------
474 AC_DEFUN([SC_BUILD_TCLSH], [
475 AC_MSG_CHECKING([for tclsh in Tcl build directory])
476 BUILD_TCLSH=${TCL_BIN_DIR}/tclsh
477 AC_MSG_RESULT([$BUILD_TCLSH])
478 AC_SUBST(BUILD_TCLSH)
481 #------------------------------------------------------------------------
482 # SC_ENABLE_SHARED --
484 # Allows the building of shared libraries
491 # Adds the following arguments to configure:
492 # --enable-shared=yes|no
494 # Defines the following vars:
495 # STATIC_BUILD Used for building import/export libraries
498 # Sets the following vars:
499 # SHARED_BUILD Value of 1 or 0
500 #------------------------------------------------------------------------
502 AC_DEFUN([SC_ENABLE_SHARED], [
503 AC_MSG_CHECKING([how to build libraries])
504 AC_ARG_ENABLE(shared,
505 [ --enable-shared build and link with shared libraries [--enable-shared]],
506 [tcl_ok=$enableval], [tcl_ok=yes])
508 if test "${enable_shared+set}" = set; then
509 enableval="$enable_shared"
515 if test "$tcl_ok" = "yes" ; then
516 AC_MSG_RESULT([shared])
519 AC_MSG_RESULT([static])
521 AC_DEFINE(STATIC_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 [ --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]],
547 [enable_framework=$enableval], [enable_framework=no])
548 if test $enable_framework = yes; then
549 if test $SHARED_BUILD = 0; then
550 AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes])
553 if test $tcl_corefoundation = no; then
554 AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available])
558 if test $enable_framework = yes; then
559 AC_MSG_RESULT([framework])
562 if test $SHARED_BUILD = 1; then
563 AC_MSG_RESULT([shared library])
565 AC_MSG_RESULT([static library])
572 #------------------------------------------------------------------------
573 # SC_ENABLE_THREADS --
575 # Specify if thread support should be enabled. TCL_THREADS is
576 # checked so that if you are compiling an extension against a
577 # threaded core, your extension must be compiled threaded as well.
584 # Adds the following arguments to configure:
587 # Sets the following vars:
588 # THREADS_LIBS Thread library(s)
590 # Defines the following vars:
595 #------------------------------------------------------------------------
597 AC_DEFUN([SC_ENABLE_THREADS], [
598 AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
599 [tcl_ok=$enableval], [tcl_ok=no])
601 if test "${TCL_THREADS}" = 1; then
605 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
607 # USE_THREAD_ALLOC tells us to try the special thread-based
608 # allocator that significantly reduces lock contention
609 AC_DEFINE(USE_THREAD_ALLOC)
610 AC_DEFINE(_REENTRANT)
611 if test "`uname -s`" = "SunOS" ; then
612 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
614 AC_DEFINE(_THREAD_SAFE)
615 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
616 if test "$tcl_ok" = "no"; then
617 # Check a little harder for __pthread_mutex_init in the same
618 # library, as some systems hide it there until pthread.h is
619 # defined. We could alternatively do an AC_TRY_COMPILE with
620 # pthread.h, but that will work with libpthread really doesn't
621 # exist, like AIX 4.2. [Bug: 4359]
622 AC_CHECK_LIB(pthread, __pthread_mutex_init,
623 tcl_ok=yes, tcl_ok=no)
626 if test "$tcl_ok" = "yes"; then
627 # The space is needed
628 THREADS_LIBS=" -lpthread"
630 AC_CHECK_LIB(pthreads, pthread_mutex_init,
631 tcl_ok=yes, tcl_ok=no)
632 if test "$tcl_ok" = "yes"; then
633 # The space is needed
634 THREADS_LIBS=" -lpthreads"
636 AC_CHECK_LIB(c, pthread_mutex_init,
637 tcl_ok=yes, tcl_ok=no)
638 if test "$tcl_ok" = "no"; then
639 AC_CHECK_LIB(c_r, pthread_mutex_init,
640 tcl_ok=yes, tcl_ok=no)
641 if test "$tcl_ok" = "yes"; then
642 # The space is needed
643 THREADS_LIBS=" -pthread"
646 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...])
652 # Does the pthread-implementation provide
653 # 'pthread_attr_setstacksize' ?
656 LIBS="$LIBS $THREADS_LIBS"
657 AC_CHECK_FUNCS(pthread_attr_setstacksize)
658 AC_CHECK_FUNCS(pthread_atfork)
663 # Do checking message here to not mess up interleaved configure output
664 AC_MSG_CHECKING([for building with threads])
665 if test "${TCL_THREADS}" = 1; then
666 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
667 if test "${tcl_threaded_core}" = 1; then
668 AC_MSG_RESULT([yes (threaded core)])
673 AC_MSG_RESULT([no (default)])
676 AC_SUBST(TCL_THREADS)
679 #------------------------------------------------------------------------
680 # SC_ENABLE_SYMBOLS --
682 # Specify if debugging symbols should be used.
683 # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
684 # can also be enabled.
689 # Requires the following vars to be set in the Makefile:
697 # Adds the following arguments to configure:
700 # Defines the following vars:
701 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
702 # Sets to $(CFLAGS_OPTIMIZE) if false
703 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
704 # Sets to $(LDFLAGS_OPTIMIZE) if false
705 # DBGX Debug library extension
707 #------------------------------------------------------------------------
709 AC_DEFUN([SC_ENABLE_SYMBOLS], [
710 AC_MSG_CHECKING([for build with symbols])
711 AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
712 # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
713 if test "$tcl_ok" = "no"; then
714 CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
715 LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
719 CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
720 LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
722 if test "$tcl_ok" = "yes"; then
723 AC_MSG_RESULT([yes (standard debugging)])
726 AC_SUBST(CFLAGS_DEFAULT)
727 AC_SUBST(LDFLAGS_DEFAULT)
729 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
730 AC_DEFINE(TCL_MEM_DEBUG)
733 if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
734 AC_DEFINE(TCL_COMPILE_DEBUG)
735 AC_DEFINE(TCL_COMPILE_STATS)
738 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
739 if test "$tcl_ok" = "all"; then
740 AC_MSG_RESULT([enabled symbols mem compile debugging])
742 AC_MSG_RESULT([enabled $tcl_ok debugging])
747 #------------------------------------------------------------------------
748 # SC_ENABLE_LANGINFO --
750 # Allows use of modern nl_langinfo check for better l10n.
751 # This is only relevant for Unix.
758 # Adds the following arguments to configure:
759 # --enable-langinfo=yes|no (default is yes)
761 # Defines the following vars:
762 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
764 #------------------------------------------------------------------------
766 AC_DEFUN([SC_ENABLE_LANGINFO], [
767 AC_ARG_ENABLE(langinfo,
768 [ --enable-langinfo use nl_langinfo if possible to determine
769 encoding at startup, otherwise use old heuristic],
770 [langinfo_ok=$enableval], [langinfo_ok=yes])
773 if test "$langinfo_ok" = "yes"; then
774 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
776 AC_MSG_CHECKING([whether to use nl_langinfo])
777 if test "$langinfo_ok" = "yes"; then
778 AC_CACHE_VAL(tcl_cv_langinfo_h, [
779 AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
780 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
781 AC_MSG_RESULT([$tcl_cv_langinfo_h])
782 if test $tcl_cv_langinfo_h = yes; then
783 AC_DEFINE(HAVE_LANGINFO)
786 AC_MSG_RESULT([$langinfo_ok])
790 #--------------------------------------------------------------------
793 # Decide whether to use symlinks for linking the manpages,
794 # whether to compress the manpages after installation, and
795 # whether to add a package name suffix to the installed
796 # manpages to avoidfile name clashes.
797 # If compression is enabled also find out what file name suffix
798 # the given compression program is using.
805 # Adds the following arguments to configure:
806 # --enable-man-symlinks
807 # --enable-man-compression=PROG
808 # --enable-man-suffix[=STRING]
810 # Defines the following variable:
812 # MAN_FLAGS - The apropriate flags for installManPage
813 # according to the user's selection.
815 #--------------------------------------------------------------------
817 AC_DEFUN([SC_CONFIG_MANPAGES], [
818 AC_MSG_CHECKING([whether to use symlinks for manpages])
819 AC_ARG_ENABLE(man-symlinks,
820 [ --enable-man-symlinks use symlinks for the manpages],
821 test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
823 AC_MSG_RESULT([$enableval])
825 AC_MSG_CHECKING([whether to compress the manpages])
826 AC_ARG_ENABLE(man-compression,
827 [ --enable-man-compression=PROG
828 compress the manpages with PROG],
830 yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
832 *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
835 AC_MSG_RESULT([$enableval])
836 if test "$enableval" != "no"; then
837 AC_MSG_CHECKING([for compressed file suffix])
840 Z=`ls TeST* | sed 's/^....//'`
842 MAN_FLAGS="$MAN_FLAGS --extension $Z"
846 AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
847 AC_ARG_ENABLE(man-suffix,
848 [ --enable-man-suffix=STRING
849 use STRING as a suffix to manpage file names
852 yes) enableval="$1" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
854 *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
857 AC_MSG_RESULT([$enableval])
862 #--------------------------------------------------------------------
865 # Determine what the system is (some things cannot be easily checked
866 # on a feature-driven basis, alas). This can usually be done via the
867 # "uname" command, but there are a few systems, like Next, where
874 # Defines the following var:
876 # system - System/platform/version identification code.
878 #--------------------------------------------------------------------
880 AC_DEFUN([SC_CONFIG_SYSTEM], [
881 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
882 if test -f /usr/lib/NextStep/software_version; then
883 tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
885 tcl_cv_sys_version=`uname -s`-`uname -r`
886 if test "$?" -ne 0 ; then
887 AC_MSG_WARN([can't find uname command])
888 tcl_cv_sys_version=unknown
890 # Special check for weird MP-RAS system (uname returns weird
891 # results, and the version is kept in special file).
893 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
894 tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
896 if test "`uname -s`" = "AIX" ; then
897 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
902 system=$tcl_cv_sys_version
905 #--------------------------------------------------------------------
908 # Try to determine the proper flags to pass to the compiler
909 # for building shared libraries and other such nonsense.
916 # Defines and substitutes the following vars:
918 # DL_OBJS - Name of the object file that implements dynamic
919 # loading for Tcl on this system.
920 # DL_LIBS - Library file(s) to include in tclsh and other base
921 # applications in order for the "load" command to work.
922 # LDFLAGS - Flags to pass to the compiler when linking object
923 # files into an executable application binary such
925 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
926 # that tell the run-time dynamic linker where to look
927 # for shared libraries such as libtcl.so. Depends on
928 # the variable LIB_RUNTIME_DIR in the Makefile. Could
929 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
930 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
931 # that tell the run-time dynamic linker where to look
932 # for shared libraries such as libtcl.so. Depends on
933 # the variable LIB_RUNTIME_DIR in the Makefile.
934 # MAKE_LIB - Command to execute to build the a library;
935 # differs when building shared or static.
937 # Command to execute to build a stub library.
938 # INSTALL_LIB - Command to execute to install a library;
939 # differs when building shared or static.
941 # Command to execute to install a stub library.
942 # STLIB_LD - Base command to use for combining object files
943 # into a static library.
944 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
945 # of a shared library (may request position-independent
946 # code, among other things).
947 # SHLIB_LD - Base command to use for combining object files
948 # into a shared library.
949 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
950 # creating shared libraries. This symbol typically
951 # goes at the end of the "ld" commands that build
952 # shared libraries. The value of the symbol is
953 # "${LIBS}" if all of the dependent libraries should
954 # be specified when creating a shared library. If
955 # dependent libraries should not be specified (as on
956 # SunOS 4.x, where they cause the link to fail, or in
957 # general if Tcl and Tk aren't themselves shared
958 # libraries), then this symbol has an empty string
960 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
961 # extensions. An empty string means we don't know how
962 # to use shared libraries on this platform.
963 # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
964 # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
965 # tclConfig.sh, since they are only used for the build
967 # Examples: MacOS X records the library version and
968 # compatibility version in the shared library. But
969 # of course the Tcl version of this is only used for Tcl.
970 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
971 # in a static or shared library name, using the $VERSION variable
972 # to put the version in the right place. This is used
973 # by platforms that need non-standard library names.
974 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
975 # to have a version after the .so, and ${VERSION}.a
976 # on AIX, since a shared library needs to have
977 # a .a extension whereas shared objects for loadable
978 # extensions have a .so extension. Defaults to
979 # ${VERSION}${SHLIB_SUFFIX}.
980 # TCL_NEEDS_EXP_FILE -
981 # 1 means that an export file is needed to link to a
983 # TCL_EXP_FILE - The name of the installed export / import file which
984 # should be used to link to the Tcl shared library.
985 # Empty if Tcl is unshared.
986 # TCL_BUILD_EXP_FILE -
987 # The name of the built export / import file which
988 # should be used to link to the Tcl shared library.
989 # Empty if Tcl is unshared.
991 # Flags used when running the compiler in debug mode
993 # Flags used when running the compiler in optimize mode
994 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
996 #--------------------------------------------------------------------
998 AC_DEFUN([SC_CONFIG_CFLAGS], [
1000 # Step 0.a: Enable 64 bit support?
1002 AC_MSG_CHECKING([if 64bit support is requested])
1003 AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],
1004 [do64bit=$enableval], [do64bit=no])
1005 AC_MSG_RESULT([$do64bit])
1007 # Step 0.b: Enable Solaris 64 bit VIS support?
1009 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1010 AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],
1011 [do64bitVIS=$enableval], [do64bitVIS=no])
1012 AC_MSG_RESULT([$do64bitVIS])
1014 if test "$do64bitVIS" = "yes"; then
1015 # Force 64bit on with VIS
1019 # Step 1: set the variable "system" to hold the name and version number
1024 # Step 2: check for existence of -ldl library. This is needed because
1025 # Linux can use either -ldl or -ldld for dynamic loading.
1027 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
1029 # Require ranlib early so we can override it in special cases below.
1031 AC_REQUIRE([AC_PROG_RANLIB])
1033 # Step 3: set configuration options based on system name and version.
1036 LDFLAGS_ORIG="$LDFLAGS"
1037 TCL_EXPORT_FILE_SUFFIX=""
1038 UNSHARED_LIB_SUFFIX=""
1039 TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
1040 ECHO_VERSION='`echo ${VERSION}`'
1041 TCL_LIB_VERSIONS_OK=ok
1044 if test "$GCC" = "yes" ; then
1045 CFLAGS_WARNING="-Wall -Wno-implicit-int -fno-strict-aliasing"
1049 TCL_NEEDS_EXP_FILE=0
1050 TCL_BUILD_EXP_FILE=""
1052 dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
1053 dnl AC_CHECK_TOOL(AR, ar)
1054 AC_CHECK_PROG(AR, ar, ar)
1055 if test "${AR}" = "" ; then
1056 AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
1059 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1064 if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
1065 # AIX requires the _r compiler when gcc isn't being used
1074 AC_MSG_RESULT([Using $CC for compiling with threads])
1078 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1079 # symbols when dynamically loaded into tclsh.
1080 SHLIB_LD_LIBS='${LIBS}'
1083 DL_OBJS="tclLoadDl.o"
1084 LD_LIBRARY_PATH_VAR="LIBPATH"
1086 # Check to enable 64-bit flags for compiler/linker on AIX 4+
1087 if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
1088 if test "$GCC" = "yes" ; then
1089 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1092 CFLAGS="$CFLAGS -q64"
1093 LDFLAGS="$LDFLAGS -q64"
1094 RANLIB="${RANLIB} -X64"
1096 SHLIB_LD_FLAGS="-b64"
1100 if test "`uname -m`" = "ia64" ; then
1101 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1102 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1103 # AIX-5 has dl* in libc.so
1105 if test "$GCC" = "yes" ; then
1106 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1108 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1110 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1112 if test "$GCC" = "yes" ; then
1113 SHLIB_LD="gcc -shared"
1115 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
1117 SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1119 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1120 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1121 TCL_NEEDS_EXP_FILE=1
1122 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
1125 # AIX v<=4.1 has some different flags than 4.2+
1126 if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
1127 LIBOBJS="$LIBOBJS tclLoadAix.o"
1131 # On AIX <=v4 systems, libbsd.a has to be linked in to support
1132 # non-blocking file IO. This library has to be linked in after
1133 # the MATH_LIBS or it breaks the pow() function. The way to
1134 # insure proper sequencing, is to add it to the tail of MATH_LIBS.
1135 # This library also supplies gettimeofday.
1137 # AIX does not have a timezone field in struct tm. When the AIX
1138 # bsd library is used, the timezone global and the gettimeofday
1139 # methods are to be avoided for timezone deduction instead, we
1140 # deduce the timezone by comparing the localtime result on a
1143 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
1144 if test $libbsd = yes; then
1145 MATH_LIBS="$MATH_LIBS -lbsd"
1146 AC_DEFINE(USE_DELTA_FOR_TZ)
1150 SHLIB_CFLAGS="-fPIC"
1151 SHLIB_LD="${CC} -nostart"
1152 SHLIB_LD_LIBS='${LIBS}'
1154 DL_OBJS="tclLoadDl.o"
1157 #-----------------------------------------------------------
1158 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1159 # -lsocket, even if the network functions are in -lnet which
1160 # is always linked to, for compatibility.
1161 #-----------------------------------------------------------
1162 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1164 BSD/OS-2.1*|BSD/OS-3*)
1166 SHLIB_LD="shlicc -r"
1167 SHLIB_LD_LIBS='${LIBS}'
1169 DL_OBJS="tclLoadDl.o"
1175 SHLIB_CFLAGS="-export-dynamic -fPIC"
1176 SHLIB_LD="cc -shared"
1177 SHLIB_LD_LIBS='${LIBS}'
1179 DL_OBJS="tclLoadDl.o"
1181 LDFLAGS="$LDFLAGS -export-dynamic"
1186 SHLIB_CFLAGS="-K PIC"
1190 DL_OBJS="tclLoadDl.o"
1196 # Use updated header definitions where possible
1197 AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library
1198 AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
1199 LIBS="$LIBS -lxnet" # Use the XOPEN network library
1201 if test "`uname -m`" = "ia64" ; then
1206 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1207 if test "$tcl_ok" = yes; then
1210 SHLIB_LD_LIBS='${LIBS}'
1211 DL_OBJS="tclLoadShl.o"
1213 LDFLAGS="$LDFLAGS -Wl,-E"
1214 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1215 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1216 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1218 if test "$GCC" = "yes" ; then
1219 SHLIB_LD="gcc -shared"
1220 SHLIB_LD_LIBS='${LIBS}'
1221 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1224 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1225 #CFLAGS="$CFLAGS +DAportable"
1227 # Check to enable 64-bit flags for compiler/linker
1228 if test "$do64bit" = "yes" ; then
1229 if test "$GCC" = "yes" ; then
1230 hpux_arch=`${CC} -dumpmachine`
1233 # 64-bit gcc in use. Fix flags for GNU ld.
1235 SHLIB_LD="${CC} -shared"
1236 SHLIB_LD_LIBS='${LIBS}'
1237 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1238 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1241 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1246 CFLAGS="$CFLAGS +DD64"
1247 LDFLAGS="$LDFLAGS +DD64"
1251 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1253 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1254 if test "$tcl_ok" = yes; then
1258 DL_OBJS="tclLoadShl.o"
1260 LDFLAGS="$LDFLAGS -Wl,-E"
1261 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1262 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1263 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1269 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1270 SHLIB_LD_LIBS='${LIBS}'
1271 DL_OBJS="tclLoadAout.o"
1273 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1274 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1275 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1276 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
1280 SHLIB_LD="ld -shared -rdata_shared"
1281 SHLIB_LD_LIBS='${LIBS}'
1283 DL_OBJS="tclLoadDl.o"
1285 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1286 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1290 SHLIB_LD="ld -n32 -shared -rdata_shared"
1291 SHLIB_LD_LIBS='${LIBS}'
1293 DL_OBJS="tclLoadDl.o"
1295 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1296 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1297 if test "$GCC" = "yes" ; then
1298 CFLAGS="$CFLAGS -mabi=n32"
1299 LDFLAGS="$LDFLAGS -mabi=n32"
1303 # Use to build 6.2 compatible binaries on 6.3.
1304 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1307 CFLAGS="$CFLAGS -n32"
1310 LDFLAGS="$LDFLAGS -n32"
1315 SHLIB_LD="ld -n32 -shared -rdata_shared"
1316 SHLIB_LD_LIBS='${LIBS}'
1318 DL_OBJS="tclLoadDl.o"
1320 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1321 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1323 # Check to enable 64-bit flags for compiler/linker
1325 if test "$do64bit" = "yes" ; then
1326 if test "$GCC" = "yes" ; then
1327 AC_MSG_WARN([64bit mode not supported by gcc])
1330 SHLIB_LD="ld -64 -shared -rdata_shared"
1331 CFLAGS="$CFLAGS -64"
1332 LDFLAGS="$LDFLAGS -64"
1337 SHLIB_CFLAGS="-fPIC"
1338 SHLIB_LD_LIBS='${LIBS}'
1342 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1343 # when you inline the string and math operations. Turn this off to
1344 # get rid of the warnings.
1345 #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1347 if test "$have_dl" = yes; then
1348 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
1349 DL_OBJS="tclLoadDl.o"
1351 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1352 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1353 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1355 AC_CHECK_HEADER(dld.h, [
1356 SHLIB_LD="ld -shared"
1357 DL_OBJS="tclLoadDld.o"
1360 LD_SEARCH_FLAGS=""])
1362 if test "`uname -m`" = "alpha" ; then
1363 CFLAGS="$CFLAGS -mieee"
1365 if test $do64bit = yes; then
1366 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1368 CFLAGS="$CFLAGS -m64"
1369 AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
1370 CFLAGS=$hold_cflags])
1371 if test $tcl_cv_cc_m64 = yes; then
1372 CFLAGS="$CFLAGS -m64"
1377 # The combo of gcc + glibc has a bug related
1378 # to inlining of functions like strtod(). The
1379 # -fno-builtin flag should address this problem
1380 # but it does not work. The -fno-inline flag
1381 # is kind of overkill but it works.
1382 # Disable inlining only when one of the
1383 # files in compat/*.c is being linked in.
1384 if test x"${LIBOBJS}" != x ; then
1385 CFLAGS="$CFLAGS -fno-inline"
1388 # XIM peeking works under XFree86.
1389 AC_DEFINE(PEEK_XCLOSEIM)
1393 SHLIB_CFLAGS="-fPIC"
1394 SHLIB_LD_LIBS='${LIBS}'
1397 if test "$have_dl" = yes; then
1398 SHLIB_LD="${CC} -shared"
1401 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1405 AC_CHECK_HEADER(dld.h, [
1406 SHLIB_LD="ld -shared"
1410 LD_SEARCH_FLAGS=""])
1412 if test "`uname -m`" = "alpha" ; then
1413 CFLAGS="$CFLAGS -mieee"
1417 SHLIB_CFLAGS="-fPIC"
1418 SHLIB_LD_LIBS='${LIBS}'
1421 SHLIB_LD="${CC} -shared "
1422 DL_OBJS="tclLoadDl.o"
1423 DL_LIBS="-mshared -ldl"
1424 LD_FLAGS="-Wl,--export-dynamic"
1425 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1426 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1429 SHLIB_CFLAGS="-K PIC"
1433 DL_OBJS="tclLoadDl.o"
1439 SHLIB_CFLAGS="-K PIC"
1443 DL_OBJS="tclLoadDl.o"
1445 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1449 NetBSD-*|FreeBSD-[[1-2]].*)
1450 # Not available on all versions: check for include file.
1451 AC_CHECK_HEADER(dlfcn.h, [
1452 # NetBSD/SPARC needs -fPIC, -fpic will not do.
1453 SHLIB_CFLAGS="-fPIC"
1454 SHLIB_LD="ld -Bshareable -x"
1455 SHLIB_LD_LIBS='${LIBS}'
1457 DL_OBJS="tclLoadDl.o"
1459 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1460 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1461 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1466 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1467 if test $tcl_cv_ld_elf = yes; then
1468 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
1470 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1474 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
1475 SHLIB_LD_LIBS='${LIBS}'
1477 DL_OBJS="tclLoadAout.o"
1479 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1480 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1481 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1484 # FreeBSD doesn't handle version numbers with dots.
1486 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1487 TCL_LIB_VERSIONS_OK=nodots
1493 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
1494 SHLIB_LD_LIBS='${LIBS}'
1496 DL_OBJS="tclLoadAout.o"
1499 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1500 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1501 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1504 # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
1507 SHLIB_CFLAGS="-fPIC";;
1509 SHLIB_CFLAGS="-fpic";;
1511 SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
1512 SHLIB_LD_LIBS='${LIBS}'
1514 DL_OBJS="tclLoadDl.o"
1516 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1517 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1518 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1519 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1524 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1525 if test $tcl_cv_ld_elf = yes; then
1526 LDFLAGS=-Wl,-export-dynamic
1533 # OpenBSD doesn't do version numbers with dots.
1534 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1535 TCL_LIB_VERSIONS_OK=nodots
1538 # FreeBSD 3.* and greater have ELF.
1539 SHLIB_CFLAGS="-fPIC"
1540 SHLIB_LD="ld -Bshareable -x"
1541 SHLIB_LD_LIBS='${LIBS}'
1543 DL_OBJS="tclLoadDl.o"
1545 LDFLAGS="$LDFLAGS -export-dynamic"
1546 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1547 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1548 if test "${TCL_THREADS}" = "1" ; then
1549 # The -pthread needs to go in the CFLAGS, not LIBS
1550 LIBS=`echo $LIBS | sed s/-pthread//`
1551 CFLAGS="$CFLAGS -pthread"
1552 LDFLAGS="$LDFLAGS -pthread"
1556 # FreeBSD-3 doesn't handle version numbers with dots.
1557 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1558 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
1559 TCL_LIB_VERSIONS_OK=nodots
1564 CFLAGS_OPTIMIZE="-Os"
1565 SHLIB_CFLAGS="-fno-common"
1566 # To avoid discrepancies between what headers configure sees during
1567 # preprocessing tests and compiling tests, move any -isysroot and
1568 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1569 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1570 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1571 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1572 CFLAGS="`echo " ${CFLAGS}" | \
1573 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1574 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1575 if test $do64bit = yes; then
1578 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1579 tcl_cv_cc_arch_ppc64, [
1581 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1582 AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
1583 tcl_cv_cc_arch_ppc64=no)
1584 CFLAGS=$hold_cflags])
1585 if test $tcl_cv_cc_arch_ppc64 = yes; then
1586 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1590 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1591 tcl_cv_cc_arch_x86_64, [
1593 CFLAGS="$CFLAGS -arch x86_64"
1594 AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
1595 tcl_cv_cc_arch_x86_64=no)
1596 CFLAGS=$hold_cflags])
1597 if test $tcl_cv_cc_arch_x86_64 = yes; then
1598 CFLAGS="$CFLAGS -arch x86_64"
1602 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1605 # Check for combined 32-bit and 64-bit fat build
1606 echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
1607 echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
1610 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
1611 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1612 hold_ldflags=$LDFLAGS
1613 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1614 AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
1615 LDFLAGS=$hold_ldflags])
1616 if test $tcl_cv_ld_single_module = yes; then
1617 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1619 SHLIB_LD_LIBS='${LIBS}'
1620 SHLIB_SUFFIX=".dylib"
1621 DL_OBJS="tclLoadDyld.o"
1623 # Don't use -prebind when building for Mac OS X 10.4 or later only:
1624 test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
1625 "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
1626 LDFLAGS="$LDFLAGS -prebind"
1627 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1628 AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
1629 hold_ldflags=$LDFLAGS
1630 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1631 AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
1632 LDFLAGS=$hold_ldflags])
1633 if test $tcl_cv_ld_search_paths_first = yes; then
1634 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1638 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1639 PLAT_OBJS=\$\(MAC\_OSX_OBJS\)
1640 PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
1641 AC_MSG_CHECKING([whether to use CoreFoundation])
1642 AC_ARG_ENABLE(corefoundation, [ --enable-corefoundation use CoreFoundation API [--enable-corefoundation]],
1643 [tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
1644 AC_MSG_RESULT([$tcl_corefoundation])
1645 if test $tcl_corefoundation = yes; then
1646 AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [
1648 if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
1649 # On Tiger there is no 64-bit CF, so remove 64-bit archs
1650 # from CFLAGS et al. while testing for presence of CF.
1651 # 64-bit CF is disabled in tclUnixPort.h if necessary.
1652 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1654 LIBS="$LIBS -framework CoreFoundation"
1655 AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
1656 [CFBundleRef b = CFBundleGetMainBundle();],
1657 tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no)
1658 if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
1659 eval $v'="$hold_'$v'"'
1660 done; fi; LIBS=$hold_libs])
1661 if test $tcl_cv_lib_corefoundation = yes; then
1662 LIBS="$LIBS -framework CoreFoundation"
1663 AC_DEFINE(HAVE_COREFOUNDATION)
1665 tcl_corefoundation=no
1667 if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
1668 AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [
1669 for v in CFLAGS CPPFLAGS LDFLAGS; do
1670 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1672 AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
1673 [CFBundleRef b = CFBundleGetMainBundle();],
1674 tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no)
1675 for v in CFLAGS CPPFLAGS LDFLAGS; do
1676 eval $v'="$hold_'$v'"'
1678 if test $tcl_cv_lib_corefoundation_64 = no; then
1679 AC_DEFINE(NO_COREFOUNDATION_64)
1683 AC_DEFINE(MAC_OSX_TCL)
1687 SHLIB_LD="cc -nostdlib -r"
1690 DL_OBJS="tclLoadNext.o"
1696 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1697 AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
1699 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1700 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1702 # Hack: make package name same as library name
1703 SHLIB_LD='ld -R -export $@:'
1706 DL_OBJS="tclLoadOSF.o"
1712 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1713 SHLIB_CFLAGS="-fPIC"
1714 if test "$SHARED_BUILD" = "1" ; then
1715 SHLIB_LD="ld -shared"
1717 SHLIB_LD="ld -non_shared"
1721 DL_OBJS="tclLoadDl.o"
1729 if test "$SHARED_BUILD" = "1" ; then
1730 SHLIB_LD='ld -shared -expect_unresolved "*"'
1732 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1736 DL_OBJS="tclLoadDl.o"
1738 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1739 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1740 if test "$GCC" = "yes" ; then
1741 CFLAGS="$CFLAGS -mieee"
1743 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
1745 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1746 if test "${TCL_THREADS}" = "1" ; then
1747 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1748 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1749 LIBS=`echo $LIBS | sed s/-lpthreads//`
1750 if test "$GCC" = "yes" ; then
1751 LIBS="$LIBS -lpthread -lmach -lexc"
1753 CFLAGS="$CFLAGS -pthread"
1754 LDFLAGS="$LDFLAGS -pthread"
1761 # This may work for all QNX, but it was only reported for v6.
1762 SHLIB_CFLAGS="-fPIC"
1763 SHLIB_LD="ld -Bshareable -x"
1766 DL_OBJS="tclLoadDl.o"
1767 # dlopen is in -lc on QNX
1774 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1775 SHLIB_LD_LIBS='${LIBS}'
1777 DL_OBJS="tclLoadAout.o"
1779 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1780 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1781 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1784 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1785 # this test works, since "uname -s" was non-standard in 3.2.4 and
1787 if test "$GCC" = "yes" ; then
1788 SHLIB_CFLAGS="-fPIC -melf"
1789 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1791 SHLIB_CFLAGS="-Kpic -belf"
1792 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1797 DL_OBJS="tclLoadDl.o"
1803 SHLIB_CFLAGS="-K PIC"
1807 DL_OBJS="tclLoadDl.o"
1817 DL_OBJS="tclLoadDl.o"
1819 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1820 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1822 # SunOS can't handle version numbers with dots in them in library
1823 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1824 # requires an extra version number at the end of .so file names.
1825 # So, the library has to have a name like libtcl75.so.1.0
1827 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1828 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1829 TCL_LIB_VERSIONS_OK=nodots
1832 # Careful to not let 5.10+ fall into this case
1834 # Note: If _REENTRANT isn't defined, then Solaris
1835 # won't define thread-safe library routines.
1837 AC_DEFINE(_REENTRANT)
1838 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1840 SHLIB_CFLAGS="-KPIC"
1842 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1843 # symbols when dynamically loaded into tclsh.
1845 SHLIB_LD_LIBS='${LIBS}'
1847 DL_OBJS="tclLoadDl.o"
1849 if test "$GCC" = "yes" ; then
1850 SHLIB_LD="$CC -shared"
1851 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1852 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1854 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1855 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1856 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1860 # Note: If _REENTRANT isn't defined, then Solaris
1861 # won't define thread-safe library routines.
1863 AC_DEFINE(_REENTRANT)
1864 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1866 SHLIB_CFLAGS="-KPIC"
1868 # Check to enable 64-bit flags for compiler/linker
1869 if test "$do64bit" = "yes" ; then
1871 if test "$arch" = "sparcv9 sparc" ; then
1872 if test "$GCC" = "yes" ; then
1873 if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
1874 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1877 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1878 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1879 SHLIB_CFLAGS="-fPIC"
1883 if test "$do64bitVIS" = "yes" ; then
1884 CFLAGS="$CFLAGS -xarch=v9a"
1885 LDFLAGS="$LDFLAGS -xarch=v9a"
1887 CFLAGS="$CFLAGS -xarch=v9"
1888 LDFLAGS="$LDFLAGS -xarch=v9"
1890 # Solaris 64 uses this as well
1891 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1893 elif test "$arch" = "amd64 i386" ; then
1894 if test "$GCC" = "yes" ; then
1895 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1898 CFLAGS="$CFLAGS -xarch=amd64"
1899 LDFLAGS="$LDFLAGS -xarch=amd64"
1902 AC_MSG_WARN([64bit mode not supported for $arch])
1906 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1907 # symbols when dynamically loaded into tclsh.
1909 SHLIB_LD_LIBS='${LIBS}'
1911 DL_OBJS="tclLoadDl.o"
1913 if test "$GCC" = "yes" ; then
1914 SHLIB_LD="$CC -shared"
1915 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1916 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1917 if test "$do64bit_ok" = "yes" ; then
1918 # We need to specify -static-libgcc or we need to
1919 # add the path to the sparv9 libgcc.
1920 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1921 # for finding sparcv9 libgcc, get the regular libgcc
1922 # path, remove so name and append 'sparcv9'
1923 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1924 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1928 SunOS-5.[[1-9]][[0-9]]*)
1929 SHLIB_LD='${CC} -G -z text';;
1931 SHLIB_LD="/usr/ccs/bin/ld -G -z text";;
1933 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1934 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1940 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1941 SHLIB_LD_LIBS='${LIBS}'
1942 DL_OBJS="tclLoadAout.o"
1944 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1945 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1946 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1947 if test "$GCC" != "yes" ; then
1948 CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
1951 UNIX_SV* | UnixWare-5*)
1952 SHLIB_CFLAGS="-KPIC"
1956 DL_OBJS="tclLoadDl.o"
1958 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1959 # that don't grok the -Bexport option. Test that it does.
1960 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1961 hold_ldflags=$LDFLAGS
1962 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1963 AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
1964 LDFLAGS=$hold_ldflags])
1965 if test $tcl_cv_ld_Bexport = yes; then
1966 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1973 if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
1974 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1977 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1978 dnl # until the end of configure, as configure's compile and link tests use
1979 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1980 dnl # preprocessing tests use only CPPFLAGS.
1981 SC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1983 # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
1984 # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
1985 # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
1986 # to determine which of several header files defines the a.out file
1987 # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
1988 # support only a file format that is more or less version-7-compatible.
1990 # - a.out files must begin with `struct exec'.
1991 # - the N_TXTOFF on the `struct exec' must compute the seek address
1992 # of the text segment
1993 # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
1994 # and a_entry fields.
1995 # The following compilation should succeed if and only if either sys/exec.h
1996 # or a.out.h is usable for the purpose.
1998 # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
1999 # `struct exec' includes a second header that contains information that
2000 # duplicates the v7 fields that are needed.
2002 if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
2003 AC_CACHE_CHECK([sys/exec.h], tcl_cv_sysexec_h, [
2004 AC_TRY_COMPILE([#include <sys/exec.h>],[
2008 #if defined(__mips) || defined(mips)
2009 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2011 seek = N_TXTOFF (foo);
2013 flag = (foo.a_magic == OMAGIC);
2014 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2015 ], tcl_cv_sysexec_h=usable, tcl_cv_sysexec_h=unusable)])
2016 if test $tcl_cv_sysexec_h = usable; then
2017 AC_DEFINE(USE_SYS_EXEC_H)
2019 AC_CACHE_CHECK([a.out.h], tcl_cv_aout_h, [
2020 AC_TRY_COMPILE([#include <a.out.h>],[
2024 #if defined(__mips) || defined(mips)
2025 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2027 seek = N_TXTOFF (foo);
2029 flag = (foo.a_magic == OMAGIC);
2030 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2031 ], tcl_cv_aout_h=usable, tcl_cv_aout_h=unusable)])
2032 if test $tcl_cv_aout_h = usable; then
2033 AC_DEFINE(USE_A_OUT_H)
2035 AC_CACHE_CHECK([sys/exec_aout.h], tcl_cv_sysexecaout_h, [
2036 AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
2040 #if defined(__mips) || defined(mips)
2041 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2043 seek = N_TXTOFF (foo);
2045 flag = (foo.a_midmag == OMAGIC);
2046 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2047 ], tcl_cv_sysexecaout_h=usable, tcl_cv_sysexecaout_h=unusable)])
2048 if test $tcl_cv_sysexecaout_h = usable; then
2049 AC_DEFINE(USE_SYS_EXEC_AOUT_H)
2057 # Step 5: disable dynamic loading if requested via a command-line switch.
2059 AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
2060 [tcl_ok=$enableval], [tcl_ok=yes])
2061 if test "$tcl_ok" = "no"; then
2065 if test "x$DL_OBJS" != "x" ; then
2066 BUILD_DLTEST="\$(DLTEST_TARGETS)"
2068 echo "Can't figure out how to do dynamic loading or shared libraries"
2069 echo "on this system."
2073 DL_OBJS="tclLoadNone.o"
2075 LDFLAGS="$LDFLAGS_ORIG"
2081 # If we're running gcc, then change the C flags for compiling shared
2082 # libraries to the right flags for gcc, instead of those for the
2083 # standard manufacturer compiler.
2085 if test "$DL_OBJS" != "tclLoadNone.o" ; then
2086 if test "$GCC" = "yes" ; then
2094 NetBSD-*|FreeBSD-*|OpenBSD-*)
2105 SHLIB_CFLAGS="-fPIC"
2111 if test "$SHARED_LIB_SUFFIX" = "" ; then
2112 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
2114 if test "$UNSHARED_LIB_SUFFIX" = "" ; then
2115 UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
2118 if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
2119 LIB_SUFFIX=${SHARED_LIB_SUFFIX}
2120 MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
2121 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
2123 LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
2125 if test "$RANLIB" = "" ; then
2126 MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
2127 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
2129 MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
2130 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
2133 dnl Not at all clear what this was doing in Tcl's configure.in
2134 dnl or why it was needed was needed. In any event, this sort of
2135 dnl things needs to be done in the big loop above.
2136 dnl REMOVE THIS BLOCK LATER! (mdejong)
2143 dnl SHLIB_LD_LIBS=""
2149 # Stub lib does not depend on shared/static configuration
2150 if test "$RANLIB" = "" ; then
2151 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
2152 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
2154 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
2155 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
2165 AC_SUBST(CFLAGS_DEBUG)
2166 AC_SUBST(CFLAGS_OPTIMIZE)
2167 AC_SUBST(CFLAGS_WARNING)
2170 AC_SUBST(LDFLAGS_DEBUG)
2171 AC_SUBST(LDFLAGS_OPTIMIZE)
2172 AC_SUBST(CC_SEARCH_FLAGS)
2173 AC_SUBST(LD_SEARCH_FLAGS)
2177 AC_SUBST(TCL_SHLIB_LD_EXTRAS)
2178 AC_SUBST(TK_SHLIB_LD_EXTRAS)
2179 AC_SUBST(SHLIB_LD_LIBS)
2180 AC_SUBST(SHLIB_CFLAGS)
2181 AC_SUBST(SHLIB_SUFFIX)
2184 AC_SUBST(MAKE_STUB_LIB)
2185 AC_SUBST(INSTALL_LIB)
2186 AC_SUBST(INSTALL_STUB_LIB)
2190 #--------------------------------------------------------------------
2193 # Determine which interface to use to talk to the serial port.
2194 # Note that #include lines must begin in leftmost column for
2195 # some compilers to recognize them as preprocessor directives,
2196 # and some build environments have stdin not pointing at a
2197 # pseudo-terminal (usually /dev/null instead.)
2204 # Defines only one of the following vars:
2210 #--------------------------------------------------------------------
2212 AC_DEFUN([SC_SERIAL_PORT], [
2213 AC_CHECK_HEADERS(sys/modem.h)
2214 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2216 #include <termios.h>
2220 if (tcgetattr(0, &t) == 0) {
2222 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2226 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2227 if test $tcl_cv_api_serial = no ; then
2233 if (ioctl(0, TCGETA, &t) == 0) {
2234 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2238 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2240 if test $tcl_cv_api_serial = no ; then
2246 if (ioctl(0, TIOCGETP, &t) == 0) {
2248 t.sg_flags |= ODDP | EVENP | RAW;
2252 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2254 if test $tcl_cv_api_serial = no ; then
2256 #include <termios.h>
2261 if (tcgetattr(0, &t) == 0
2262 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2264 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2268 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2270 if test $tcl_cv_api_serial = no; then
2277 if (ioctl(0, TCGETA, &t) == 0
2278 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2279 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2283 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2285 if test $tcl_cv_api_serial = no; then
2292 if (ioctl(0, TIOCGETP, &t) == 0
2293 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2295 t.sg_flags |= ODDP | EVENP | RAW;
2299 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2301 case $tcl_cv_api_serial in
2302 termios) AC_DEFINE(USE_TERMIOS);;
2303 termio) AC_DEFINE(USE_TERMIO);;
2304 sgtty) AC_DEFINE(USE_SGTTY);;
2308 #--------------------------------------------------------------------
2309 # SC_MISSING_POSIX_HEADERS
2311 # Supply substitutes for missing POSIX header files. Special
2313 # - stdlib.h doesn't define strtol, strtoul, or
2314 # strtod insome versions of SunOS
2315 # - some versions of string.h don't declare procedures such
2323 # Defines some of the following vars:
2327 # HAVE_LIMITS_H or NO_LIMITS_H
2337 #--------------------------------------------------------------------
2339 AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
2340 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2341 AC_TRY_LINK([#include <sys/types.h>
2342 #include <dirent.h>], [
2343 #ifndef _POSIX_SOURCE
2346 * Generate compilation error to make the test fail: Lynx headers
2347 * are only valid if really in the POSIX environment.
2350 missing_procedure();
2354 struct dirent *entryPtr;
2356 d = opendir("foobar");
2357 entryPtr = readdir(d);
2358 p = entryPtr->d_name;
2360 ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
2362 if test $tcl_cv_dirent_h = no; then
2363 AC_DEFINE(NO_DIRENT_H)
2366 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
2367 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
2368 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
2369 AC_CHECK_HEADER(limits.h,
2370 [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
2371 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2372 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2373 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2374 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2375 if test $tcl_ok = 0; then
2376 AC_DEFINE(NO_STDLIB_H)
2378 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2379 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2380 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2382 # See also memmove check below for a place where NO_STRING_H can be
2385 if test $tcl_ok = 0; then
2386 AC_DEFINE(NO_STRING_H)
2389 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
2390 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
2392 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2393 AC_HAVE_HEADERS(unistd.h sys/param.h)
2396 #--------------------------------------------------------------------
2399 # Locate the X11 header files and the X11 library archive. Try
2400 # the ac_path_x macro first, but if it doesn't find the X stuff
2401 # (e.g. because there's no xmkmf program) then check through
2402 # a list of possible directories. Under some conditions the
2403 # autoconf macro will return an include directory that contains
2404 # no include files, so double-check its result just to be safe.
2411 # Sets the the following vars:
2415 #--------------------------------------------------------------------
2417 AC_DEFUN([SC_PATH_X], [
2420 if test "$no_x" = ""; then
2421 if test "$x_includes" = ""; then
2422 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2424 if test ! -r $x_includes/X11/Intrinsic.h; then
2425 not_really_there="yes"
2429 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2430 AC_MSG_CHECKING([for X11 header files])
2431 found_xincludes="no"
2432 AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2433 if test "$found_xincludes" = "no"; then
2434 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"
2436 if test -r $i/X11/Intrinsic.h; then
2439 found_xincludes="yes"
2445 if test "$x_includes" != ""; then
2446 XINCLUDES="-I$x_includes"
2447 found_xincludes="yes"
2450 if test found_xincludes = "no"; then
2451 AC_MSG_RESULT([couldn't find any!])
2454 if test "$no_x" = yes; then
2455 AC_MSG_CHECKING([for X11 libraries])
2457 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"
2459 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
2467 if test "$x_libraries" = ""; then
2470 XLIBSW="-L$x_libraries -lX11"
2473 if test "$XLIBSW" = nope ; then
2474 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2476 if test "$XLIBSW" = nope ; then
2477 AC_MSG_RESULT([could not find any! Using -lX11.])
2482 #--------------------------------------------------------------------
2485 # The statements below check for systems where POSIX-style
2486 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2487 # On these systems (mostly older ones), use the old BSD-style
2488 # FIONBIO approach instead.
2495 # Defines some of the following vars:
2501 #--------------------------------------------------------------------
2503 AC_DEFUN([SC_BLOCKING_STYLE], [
2504 AC_CHECK_HEADERS(sys/ioctl.h)
2505 AC_CHECK_HEADERS(sys/filio.h)
2507 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2509 # There used to be code here to use FIONBIO under AIX. However, it
2510 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
2511 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
2512 # code (JO, 5/31/97).
2515 AC_DEFINE(USE_FIONBIO)
2516 AC_MSG_RESULT([FIONBIO])
2519 AC_DEFINE(USE_FIONBIO)
2520 AC_MSG_RESULT([FIONBIO])
2523 AC_DEFINE(USE_FIONBIO)
2524 AC_MSG_RESULT([FIONBIO])
2527 AC_MSG_RESULT([O_NONBLOCK])
2532 #--------------------------------------------------------------------
2535 # Checks how the system deals with time.h, what time structures
2536 # are used on the system, and what fields the structures have.
2543 # Defines some of the following vars:
2549 #--------------------------------------------------------------------
2551 AC_DEFUN([SC_TIME_HANDLER], [
2552 AC_CHECK_HEADERS(sys/time.h)
2556 AC_CHECK_FUNCS(gmtime_r localtime_r)
2558 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2559 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2560 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
2561 if test $tcl_cv_member_tm_tzadj = yes ; then
2562 AC_DEFINE(HAVE_TM_TZADJ)
2565 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2566 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2567 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
2568 if test $tcl_cv_member_tm_gmtoff = yes ; then
2569 AC_DEFINE(HAVE_TM_GMTOFF)
2573 # Its important to include time.h in this check, as some systems
2574 # (like convex) have timezone functions, etc.
2576 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2577 AC_TRY_COMPILE([#include <time.h>],
2578 [extern long timezone;
2581 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
2582 if test $tcl_cv_timezone_long = yes ; then
2583 AC_DEFINE(HAVE_TIMEZONE_VAR)
2586 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2588 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2589 AC_TRY_COMPILE([#include <time.h>],
2590 [extern time_t timezone;
2593 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
2594 if test $tcl_cv_timezone_time = yes ; then
2595 AC_DEFINE(HAVE_TIMEZONE_VAR)
2600 #--------------------------------------------------------------------
2603 # Under Solaris 2.4, strtod returns the wrong value for the
2604 # terminating character under some conditions. Check for this
2605 # and if the problem exists use a substitute procedure
2606 # "fixstrtod" (provided by Tcl) that corrects the error.
2607 # Also, on Compaq's Tru64 Unix 5.0,
2608 # strtod(" ") returns 0.0 instead of a failure to convert.
2615 # Might defines some of the following vars:
2616 # strtod (=fixstrtod)
2618 #--------------------------------------------------------------------
2620 AC_DEFUN([SC_BUGGY_STRTOD], [
2621 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2622 if test "$tcl_strtod" = 1; then
2623 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2625 extern double strtod();
2627 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2630 value = strtod(infString, &term);
2631 if ((term != infString) && (term[-1] == 0)) {
2634 value = strtod(nanString, &term);
2635 if ((term != nanString) && (term[-1] == 0)) {
2638 value = strtod(spaceString, &term);
2639 if (term == (spaceString+1)) {
2643 }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2644 tcl_cv_strtod_buggy=buggy)])
2645 if test "$tcl_cv_strtod_buggy" = buggy; then
2646 LIBOBJS="$LIBOBJS fixstrtod.o"
2647 AC_DEFINE(strtod, fixstrtod)
2652 #--------------------------------------------------------------------
2655 # Search for the libraries needed to link the Tcl shell.
2656 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2657 # -lnsl) are dealt with here.
2660 # Requires the following vars to be set in the Makefile:
2667 # Subst's the following var:
2671 # Might append to the following vars:
2674 # Might define the following vars:
2677 #--------------------------------------------------------------------
2679 AC_DEFUN([SC_TCL_LINK_LIBS], [
2680 #--------------------------------------------------------------------
2681 # On a few very rare systems, all of the libm.a stuff is
2682 # already in libc.a. Set compiler flags accordingly.
2683 # Also, Linux requires the "ieee" library for math to work
2684 # right (and it must appear before "-lm").
2685 #--------------------------------------------------------------------
2687 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2688 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2690 #--------------------------------------------------------------------
2691 # Interactive UNIX requires -linet instead of -lsocket, plus it
2692 # needs net/errno.h to define the socket-related error codes.
2693 #--------------------------------------------------------------------
2695 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2696 AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
2698 #--------------------------------------------------------------------
2699 # Check for the existence of the -lsocket and -lnsl libraries.
2700 # The order here is important, so that they end up in the right
2701 # order in the command line generated by make. Here are some
2702 # special considerations:
2703 # 1. Use "connect" and "accept" to check for -lsocket, and
2704 # "gethostbyname" to check for -lnsl.
2705 # 2. Use each function name only once: can't redo a check because
2706 # autoconf caches the results of the last check and won't redo it.
2707 # 3. Use -lnsl and -lsocket only if they supply procedures that
2708 # aren't already present in the normal libraries. This is because
2709 # IRIX 5.2 has libraries, but they aren't needed and they're
2710 # bogus: they goof up name resolution if used.
2711 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2712 # To get around this problem, check for both libraries together
2713 # if -lsocket doesn't work by itself.
2714 #--------------------------------------------------------------------
2717 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2718 if test "$tcl_checkSocket" = 1; then
2719 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2720 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2722 if test "$tcl_checkBoth" = 1; then
2724 LIBS="$LIBS -lsocket -lnsl"
2725 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2727 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2728 [LIBS="$LIBS -lnsl"])])
2730 # Don't perform the eval of the libraries here because DL_LIBS
2731 # won't be set until we call SC_CONFIG_CFLAGS
2733 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2738 #--------------------------------------------------------------------
2739 # SC_TCL_EARLY_FLAGS
2741 # Check for what flags are needed to be passed so the correct OS
2742 # features are available.
2749 # Might define the following vars:
2751 # _LARGEFILE64_SOURCE
2752 # _LARGEFILE_SOURCE64
2754 #--------------------------------------------------------------------
2756 AC_DEFUN([SC_TCL_EARLY_FLAG],[
2757 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2758 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2759 AC_TRY_COMPILE([[#define ]$1[ 1
2761 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2762 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2763 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2765 tcl_flags="$tcl_flags $1"
2769 AC_DEFUN([SC_TCL_EARLY_FLAGS],[
2770 AC_MSG_CHECKING([for required early compiler flags])
2772 SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2773 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2774 SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2775 [struct stat64 buf; int i = stat64("/", &buf);])
2776 SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2777 [char *p = (char *)open64;])
2778 if test "x${tcl_flags}" = "x" ; then
2779 AC_MSG_RESULT([none])
2781 AC_MSG_RESULT([${tcl_flags}])
2785 #--------------------------------------------------------------------
2786 # SC_TCL_64BIT_FLAGS
2788 # Check for what is defined in the way of 64-bit features.
2795 # Might define the following vars:
2796 # TCL_WIDE_INT_IS_LONG
2798 # HAVE_STRUCT_DIRENT64
2799 # HAVE_STRUCT_STAT64
2802 #--------------------------------------------------------------------
2804 AC_DEFUN([SC_TCL_64BIT_FLAGS], [
2805 AC_MSG_CHECKING([for 64-bit integer type])
2806 AC_CACHE_VAL(tcl_cv_type_64bit,[
2807 tcl_cv_type_64bit=none
2808 # See if the compiler knows natively about __int64
2809 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2810 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2811 # See if we should use long anyway Note that we substitute in the
2812 # type that is our current guess for a 64-bit type inside this check
2813 # program, so it should be modified only carefully...
2814 AC_TRY_COMPILE(,[switch (0) {
2815 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2816 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2817 if test "${tcl_cv_type_64bit}" = none ; then
2818 AC_DEFINE(TCL_WIDE_INT_IS_LONG)
2819 AC_MSG_RESULT([using long])
2821 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
2822 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2824 # Now check for auxiliary declarations
2825 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2826 AC_TRY_COMPILE([#include <sys/types.h>
2827 #include <sys/dirent.h>],[struct dirent64 p;],
2828 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2829 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2830 AC_DEFINE(HAVE_STRUCT_DIRENT64)
2833 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2834 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2836 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2837 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2838 AC_DEFINE(HAVE_STRUCT_STAT64)
2841 AC_CHECK_FUNCS(open64 lseek64)
2842 AC_MSG_CHECKING([for off64_t])
2843 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2844 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2846 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2847 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2848 dnl functions lseek64 and open64 are defined.
2849 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2850 test "x${ac_cv_func_lseek64}" = "xyes" && \
2851 test "x${ac_cv_func_open64}" = "xyes" ; then
2852 AC_DEFINE(HAVE_TYPE_OFF64_T)
2853 AC_MSG_RESULT([yes])
2860 #--------------------------------------------------------------------
2861 # SC_TCL_GETHOSTBYADDR_R
2863 # Check if we have MT-safe variant of gethostbyaddr().
2870 # Might define the following vars:
2871 # HAVE_GETHOSTBYADDR_R
2872 # HAVE_GETHOSTBYADDR_R_7
2873 # HAVE_GETHOSTBYADDR_R_8
2875 #--------------------------------------------------------------------
2877 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
2878 AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
2885 struct hostent *result;
2890 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2892 ], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)])
2893 tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
2894 if test "$tcl_ok" = yes; then
2895 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
2897 AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
2904 struct hostent *result, *resultp;
2909 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2910 &resultp, &h_errnop);
2911 ], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)])
2912 tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
2913 if test "$tcl_ok" = yes; then
2914 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
2917 if test "$tcl_ok" = yes; then
2918 AC_DEFINE(HAVE_GETHOSTBYADDR_R)
2922 #--------------------------------------------------------------------
2923 # SC_TCL_GETHOSTBYNAME_R
2925 # Check to see what variant of gethostbyname_r() we have.
2926 # Based on David Arnold's example from the comp.programming.threads
2934 # Might define the following vars:
2935 # HAVE_GETHOSTBYADDR_R
2936 # HAVE_GETHOSTBYADDR_R_3
2937 # HAVE_GETHOSTBYADDR_R_5
2938 # HAVE_GETHOSTBYADDR_R_6
2940 #--------------------------------------------------------------------
2942 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
2943 AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
2948 struct hostent *he, *res;
2953 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
2954 ], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)])
2955 tcl_ok=$tcl_cv_api_gethostbyname_r_6
2956 if test "$tcl_ok" = yes; then
2957 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
2959 AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
2969 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
2970 ], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)])
2971 tcl_ok=$tcl_cv_api_gethostbyname_r_5
2972 if test "$tcl_ok" = yes; then
2973 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
2975 AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
2981 struct hostent_data data;
2983 (void) gethostbyname_r(name, he, &data);
2984 ], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)])
2985 tcl_ok=$tcl_cv_api_gethostbyname_r_3
2986 if test "$tcl_ok" = yes; then
2987 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
2991 if test "$tcl_ok" = yes; then
2992 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2996 #--------------------------------------------------------------------
2999 # Check if we have MT-safe variant of getpwuid() and if yes,
3000 # which one exactly.
3007 # Might define the following vars:
3012 #--------------------------------------------------------------------
3014 AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
3015 AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
3017 #include <sys/types.h>
3021 struct passwd pw, *pwp;
3025 (void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
3026 ], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)])
3027 tcl_ok=$tcl_cv_api_getpwuid_r_5
3028 if test "$tcl_ok" = yes; then
3029 AC_DEFINE(HAVE_GETPWUID_R_5)
3031 AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
3033 #include <sys/types.h>
3041 (void)getpwnam_r(uid, &pw, buf, buflen);
3042 ], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)])
3043 tcl_ok=$tcl_cv_api_getpwuid_r_4
3044 if test "$tcl_ok" = yes; then
3045 AC_DEFINE(HAVE_GETPWUID_R_4)
3048 if test "$tcl_ok" = yes; then
3049 AC_DEFINE(HAVE_GETPWUID_R)
3053 #--------------------------------------------------------------------
3056 # Check if we have MT-safe variant of getpwnam() and if yes,
3057 # which one exactly.
3064 # Might define the following vars:
3069 #--------------------------------------------------------------------
3071 AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
3072 AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
3074 #include <sys/types.h>
3078 struct passwd pw, *pwp;
3082 (void) getpwnam_r(name, &pw, buf, buflen, &pwp);
3083 ], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)])
3084 tcl_ok=$tcl_cv_api_getpwnam_r_5
3085 if test "$tcl_ok" = yes; then
3086 AC_DEFINE(HAVE_GETPWNAM_R_5)
3088 AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
3090 #include <sys/types.h>
3098 (void)getpwnam_r(name, &pw, buf, buflen);
3099 ], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)])
3100 tcl_ok=$tcl_cv_api_getpwnam_r_4
3101 if test "$tcl_ok" = yes; then
3102 AC_DEFINE(HAVE_GETPWNAM_R_4)
3105 if test "$tcl_ok" = yes; then
3106 AC_DEFINE(HAVE_GETPWNAM_R)
3110 #--------------------------------------------------------------------
3113 # Check if we have MT-safe variant of getgrgid() and if yes,
3114 # which one exactly.
3121 # Might define the following vars:
3126 #--------------------------------------------------------------------
3128 AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
3129 AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
3131 #include <sys/types.h>
3135 struct group gr, *grp;
3139 (void) getgrgid_r(gid, &gr, buf, buflen, &grp);
3140 ], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)])
3141 tcl_ok=$tcl_cv_api_getgrgid_r_5
3142 if test "$tcl_ok" = yes; then
3143 AC_DEFINE(HAVE_GETGRGID_R_5)
3145 AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
3147 #include <sys/types.h>
3155 (void)getgrgid_r(gid, &gr, buf, buflen);
3156 ], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)])
3157 tcl_ok=$tcl_cv_api_getgrgid_r_4
3158 if test "$tcl_ok" = yes; then
3159 AC_DEFINE(HAVE_GETGRGID_R_4)
3162 if test "$tcl_ok" = yes; then
3163 AC_DEFINE(HAVE_GETGRGID_R)
3167 #--------------------------------------------------------------------
3170 # Check if we have MT-safe variant of getgrnam() and if yes,
3171 # which one exactly.
3178 # Might define the following vars:
3183 #--------------------------------------------------------------------
3185 AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
3186 AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
3188 #include <sys/types.h>
3192 struct group gr, *grp;
3196 (void) getgrnam_r(name, &gr, buf, buflen, &grp);
3197 ], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)])
3198 tcl_ok=$tcl_cv_api_getgrnam_r_5
3199 if test "$tcl_ok" = yes; then
3200 AC_DEFINE(HAVE_GETGRNAM_R_5)
3202 AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
3204 #include <sys/types.h>
3212 (void)getgrnam_r(name, &gr, buf, buflen);
3213 ], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)])
3214 tcl_ok=$tcl_cv_api_getgrnam_r_4
3215 if test "$tcl_ok" = yes; then
3216 AC_DEFINE(HAVE_GETGRNAM_R_4)
3219 if test "$tcl_ok" = yes; then
3220 AC_DEFINE(HAVE_GETGRNAM_R)
3224 #--------------------------------------------------------------------
3225 # SC_CONFIG_COMMANDS_PRE(CMDS)
3227 # Replacement for autoconf 2.5x AC_COMMANDS_PRE:
3228 # Commands to run right before config.status is
3229 # created. Accumulates.
3231 # Requires presence of SC_OUTPUT_COMMANDS_PRE at the end
3232 # of configure.in (right before AC_OUTPUT).
3234 #--------------------------------------------------------------------
3236 AC_DEFUN([SC_CONFIG_COMMANDS_PRE], [
3237 define([SC_OUTPUT_COMMANDS_PRE], defn([SC_OUTPUT_COMMANDS_PRE])[$1
3239 AC_DEFUN([SC_OUTPUT_COMMANDS_PRE])