os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/tcl.m4
First public contribution.
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, [
1647 hold_libs=$LIBS; hold_cflags=$CFLAGS
1648 if test "$fat_32_64" = yes; then
1649 # On Tiger there is no 64-bit CF, so remove 64-bit archs
1650 # from CFLAGS while testing for presence of CF.
1651 # 64-bit CF is disabled in tclUnixPort.h if necessary.
1652 CFLAGS="`echo "$CFLAGS " | 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 LIBS=$hold_libs; CFLAGS=$hold_cflags])
1659 if test $tcl_cv_lib_corefoundation = yes; then
1660 LIBS="$LIBS -framework CoreFoundation"
1661 AC_DEFINE(HAVE_COREFOUNDATION)
1663 tcl_corefoundation=no
1665 if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
1666 AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [
1668 CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc / /g' -e 's/-arch i386 / /g'`"
1669 AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
1670 [CFBundleRef b = CFBundleGetMainBundle();],
1671 tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no)
1672 CFLAGS=$hold_cflags])
1673 if test $tcl_cv_lib_corefoundation_64 = no; then
1674 AC_DEFINE(NO_COREFOUNDATION_64)
1678 AC_DEFINE(MAC_OSX_TCL)
1682 SHLIB_LD="cc -nostdlib -r"
1685 DL_OBJS="tclLoadNext.o"
1691 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1692 AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
1694 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1695 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1697 # Hack: make package name same as library name
1698 SHLIB_LD='ld -R -export $@:'
1701 DL_OBJS="tclLoadOSF.o"
1707 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1708 SHLIB_CFLAGS="-fPIC"
1709 if test "$SHARED_BUILD" = "1" ; then
1710 SHLIB_LD="ld -shared"
1712 SHLIB_LD="ld -non_shared"
1716 DL_OBJS="tclLoadDl.o"
1724 if test "$SHARED_BUILD" = "1" ; then
1725 SHLIB_LD='ld -shared -expect_unresolved "*"'
1727 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1731 DL_OBJS="tclLoadDl.o"
1733 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1734 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1735 if test "$GCC" = "yes" ; then
1736 CFLAGS="$CFLAGS -mieee"
1738 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
1740 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1741 if test "${TCL_THREADS}" = "1" ; then
1742 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1743 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1744 LIBS=`echo $LIBS | sed s/-lpthreads//`
1745 if test "$GCC" = "yes" ; then
1746 LIBS="$LIBS -lpthread -lmach -lexc"
1748 CFLAGS="$CFLAGS -pthread"
1749 LDFLAGS="$LDFLAGS -pthread"
1756 # This may work for all QNX, but it was only reported for v6.
1757 SHLIB_CFLAGS="-fPIC"
1758 SHLIB_LD="ld -Bshareable -x"
1761 DL_OBJS="tclLoadDl.o"
1762 # dlopen is in -lc on QNX
1769 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1770 SHLIB_LD_LIBS='${LIBS}'
1772 DL_OBJS="tclLoadAout.o"
1774 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1775 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1776 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1779 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1780 # this test works, since "uname -s" was non-standard in 3.2.4 and
1782 if test "$GCC" = "yes" ; then
1783 SHLIB_CFLAGS="-fPIC -melf"
1784 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1786 SHLIB_CFLAGS="-Kpic -belf"
1787 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1792 DL_OBJS="tclLoadDl.o"
1798 SHLIB_CFLAGS="-K PIC"
1802 DL_OBJS="tclLoadDl.o"
1812 DL_OBJS="tclLoadDl.o"
1814 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1815 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1817 # SunOS can't handle version numbers with dots in them in library
1818 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1819 # requires an extra version number at the end of .so file names.
1820 # So, the library has to have a name like libtcl75.so.1.0
1822 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1823 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1824 TCL_LIB_VERSIONS_OK=nodots
1827 # Careful to not let 5.10+ fall into this case
1829 # Note: If _REENTRANT isn't defined, then Solaris
1830 # won't define thread-safe library routines.
1832 AC_DEFINE(_REENTRANT)
1833 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1835 SHLIB_CFLAGS="-KPIC"
1837 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1838 # symbols when dynamically loaded into tclsh.
1840 SHLIB_LD_LIBS='${LIBS}'
1842 DL_OBJS="tclLoadDl.o"
1844 if test "$GCC" = "yes" ; then
1845 SHLIB_LD="$CC -shared"
1846 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1847 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1849 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1850 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1851 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1855 # Note: If _REENTRANT isn't defined, then Solaris
1856 # won't define thread-safe library routines.
1858 AC_DEFINE(_REENTRANT)
1859 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1861 SHLIB_CFLAGS="-KPIC"
1863 # Check to enable 64-bit flags for compiler/linker
1864 if test "$do64bit" = "yes" ; then
1866 if test "$arch" = "sparcv9 sparc" ; then
1867 if test "$GCC" = "yes" ; then
1868 if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
1869 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1872 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1873 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1874 SHLIB_CFLAGS="-fPIC"
1878 if test "$do64bitVIS" = "yes" ; then
1879 CFLAGS="$CFLAGS -xarch=v9a"
1880 LDFLAGS="$LDFLAGS -xarch=v9a"
1882 CFLAGS="$CFLAGS -xarch=v9"
1883 LDFLAGS="$LDFLAGS -xarch=v9"
1885 # Solaris 64 uses this as well
1886 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1888 elif test "$arch" = "amd64 i386" ; then
1889 if test "$GCC" = "yes" ; then
1890 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1893 CFLAGS="$CFLAGS -xarch=amd64"
1894 LDFLAGS="$LDFLAGS -xarch=amd64"
1897 AC_MSG_WARN([64bit mode not supported for $arch])
1901 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1902 # symbols when dynamically loaded into tclsh.
1904 SHLIB_LD_LIBS='${LIBS}'
1906 DL_OBJS="tclLoadDl.o"
1908 if test "$GCC" = "yes" ; then
1909 SHLIB_LD="$CC -shared"
1910 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1911 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1912 if test "$do64bit_ok" = "yes" ; then
1913 # We need to specify -static-libgcc or we need to
1914 # add the path to the sparv9 libgcc.
1915 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1916 # for finding sparcv9 libgcc, get the regular libgcc
1917 # path, remove so name and append 'sparcv9'
1918 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1919 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1922 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1923 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1924 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1930 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1931 SHLIB_LD_LIBS='${LIBS}'
1932 DL_OBJS="tclLoadAout.o"
1934 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1935 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1936 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1937 if test "$GCC" != "yes" ; then
1938 CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
1941 UNIX_SV* | UnixWare-5*)
1942 SHLIB_CFLAGS="-KPIC"
1946 DL_OBJS="tclLoadDl.o"
1948 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1949 # that don't grok the -Bexport option. Test that it does.
1950 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1951 hold_ldflags=$LDFLAGS
1952 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1953 AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
1954 LDFLAGS=$hold_ldflags])
1955 if test $tcl_cv_ld_Bexport = yes; then
1956 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1963 if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
1964 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1967 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1968 dnl # until the end of configure, as configure's compile and link tests use
1969 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1970 dnl # preprocessing tests use only CPPFLAGS.
1971 SC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1973 # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
1974 # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
1975 # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
1976 # to determine which of several header files defines the a.out file
1977 # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
1978 # support only a file format that is more or less version-7-compatible.
1980 # - a.out files must begin with `struct exec'.
1981 # - the N_TXTOFF on the `struct exec' must compute the seek address
1982 # of the text segment
1983 # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
1984 # and a_entry fields.
1985 # The following compilation should succeed if and only if either sys/exec.h
1986 # or a.out.h is usable for the purpose.
1988 # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
1989 # `struct exec' includes a second header that contains information that
1990 # duplicates the v7 fields that are needed.
1992 if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
1993 AC_CACHE_CHECK([sys/exec.h], tcl_cv_sysexec_h, [
1994 AC_TRY_COMPILE([#include <sys/exec.h>],[
1998 #if defined(__mips) || defined(mips)
1999 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2001 seek = N_TXTOFF (foo);
2003 flag = (foo.a_magic == OMAGIC);
2004 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2005 ], tcl_cv_sysexec_h=usable, tcl_cv_sysexec_h=unusable)])
2006 if test $tcl_cv_sysexec_h = usable; then
2007 AC_DEFINE(USE_SYS_EXEC_H)
2009 AC_CACHE_CHECK([a.out.h], tcl_cv_aout_h, [
2010 AC_TRY_COMPILE([#include <a.out.h>],[
2014 #if defined(__mips) || defined(mips)
2015 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2017 seek = N_TXTOFF (foo);
2019 flag = (foo.a_magic == OMAGIC);
2020 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2021 ], tcl_cv_aout_h=usable, tcl_cv_aout_h=unusable)])
2022 if test $tcl_cv_aout_h = usable; then
2023 AC_DEFINE(USE_A_OUT_H)
2025 AC_CACHE_CHECK([sys/exec_aout.h], tcl_cv_sysexecaout_h, [
2026 AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
2030 #if defined(__mips) || defined(mips)
2031 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2033 seek = N_TXTOFF (foo);
2035 flag = (foo.a_midmag == OMAGIC);
2036 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2037 ], tcl_cv_sysexecaout_h=usable, tcl_cv_sysexecaout_h=unusable)])
2038 if test $tcl_cv_sysexecaout_h = usable; then
2039 AC_DEFINE(USE_SYS_EXEC_AOUT_H)
2047 # Step 5: disable dynamic loading if requested via a command-line switch.
2049 AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
2050 [tcl_ok=$enableval], [tcl_ok=yes])
2051 if test "$tcl_ok" = "no"; then
2055 if test "x$DL_OBJS" != "x" ; then
2056 BUILD_DLTEST="\$(DLTEST_TARGETS)"
2058 echo "Can't figure out how to do dynamic loading or shared libraries"
2059 echo "on this system."
2063 DL_OBJS="tclLoadNone.o"
2065 LDFLAGS="$LDFLAGS_ORIG"
2071 # If we're running gcc, then change the C flags for compiling shared
2072 # libraries to the right flags for gcc, instead of those for the
2073 # standard manufacturer compiler.
2075 if test "$DL_OBJS" != "tclLoadNone.o" ; then
2076 if test "$GCC" = "yes" ; then
2084 NetBSD-*|FreeBSD-*|OpenBSD-*)
2095 SHLIB_CFLAGS="-fPIC"
2101 if test "$SHARED_LIB_SUFFIX" = "" ; then
2102 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
2104 if test "$UNSHARED_LIB_SUFFIX" = "" ; then
2105 UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
2108 if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
2109 LIB_SUFFIX=${SHARED_LIB_SUFFIX}
2110 MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
2111 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
2113 LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
2115 if test "$RANLIB" = "" ; then
2116 MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
2117 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
2119 MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
2120 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
2123 dnl Not at all clear what this was doing in Tcl's configure.in
2124 dnl or why it was needed was needed. In any event, this sort of
2125 dnl things needs to be done in the big loop above.
2126 dnl REMOVE THIS BLOCK LATER! (mdejong)
2133 dnl SHLIB_LD_LIBS=""
2139 # Stub lib does not depend on shared/static configuration
2140 if test "$RANLIB" = "" ; then
2141 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
2142 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
2144 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
2145 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
2155 AC_SUBST(CFLAGS_DEBUG)
2156 AC_SUBST(CFLAGS_OPTIMIZE)
2157 AC_SUBST(CFLAGS_WARNING)
2160 AC_SUBST(LDFLAGS_DEBUG)
2161 AC_SUBST(LDFLAGS_OPTIMIZE)
2162 AC_SUBST(CC_SEARCH_FLAGS)
2163 AC_SUBST(LD_SEARCH_FLAGS)
2167 AC_SUBST(TCL_SHLIB_LD_EXTRAS)
2168 AC_SUBST(TK_SHLIB_LD_EXTRAS)
2169 AC_SUBST(SHLIB_LD_LIBS)
2170 AC_SUBST(SHLIB_CFLAGS)
2171 AC_SUBST(SHLIB_SUFFIX)
2174 AC_SUBST(MAKE_STUB_LIB)
2175 AC_SUBST(INSTALL_LIB)
2176 AC_SUBST(INSTALL_STUB_LIB)
2180 #--------------------------------------------------------------------
2183 # Determine which interface to use to talk to the serial port.
2184 # Note that #include lines must begin in leftmost column for
2185 # some compilers to recognize them as preprocessor directives,
2186 # and some build environments have stdin not pointing at a
2187 # pseudo-terminal (usually /dev/null instead.)
2194 # Defines only one of the following vars:
2200 #--------------------------------------------------------------------
2202 AC_DEFUN([SC_SERIAL_PORT], [
2203 AC_CHECK_HEADERS(sys/modem.h)
2204 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2206 #include <termios.h>
2210 if (tcgetattr(0, &t) == 0) {
2212 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2216 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2217 if test $tcl_cv_api_serial = no ; then
2223 if (ioctl(0, TCGETA, &t) == 0) {
2224 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2228 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2230 if test $tcl_cv_api_serial = no ; then
2236 if (ioctl(0, TIOCGETP, &t) == 0) {
2238 t.sg_flags |= ODDP | EVENP | RAW;
2242 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2244 if test $tcl_cv_api_serial = no ; then
2246 #include <termios.h>
2251 if (tcgetattr(0, &t) == 0
2252 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2254 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2258 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2260 if test $tcl_cv_api_serial = no; then
2267 if (ioctl(0, TCGETA, &t) == 0
2268 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2269 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2273 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2275 if test $tcl_cv_api_serial = no; then
2282 if (ioctl(0, TIOCGETP, &t) == 0
2283 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2285 t.sg_flags |= ODDP | EVENP | RAW;
2289 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2291 case $tcl_cv_api_serial in
2292 termios) AC_DEFINE(USE_TERMIOS);;
2293 termio) AC_DEFINE(USE_TERMIO);;
2294 sgtty) AC_DEFINE(USE_SGTTY);;
2298 #--------------------------------------------------------------------
2299 # SC_MISSING_POSIX_HEADERS
2301 # Supply substitutes for missing POSIX header files. Special
2303 # - stdlib.h doesn't define strtol, strtoul, or
2304 # strtod insome versions of SunOS
2305 # - some versions of string.h don't declare procedures such
2313 # Defines some of the following vars:
2317 # HAVE_LIMITS_H or NO_LIMITS_H
2327 #--------------------------------------------------------------------
2329 AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
2330 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2331 AC_TRY_LINK([#include <sys/types.h>
2332 #include <dirent.h>], [
2333 #ifndef _POSIX_SOURCE
2336 * Generate compilation error to make the test fail: Lynx headers
2337 * are only valid if really in the POSIX environment.
2340 missing_procedure();
2344 struct dirent *entryPtr;
2346 d = opendir("foobar");
2347 entryPtr = readdir(d);
2348 p = entryPtr->d_name;
2350 ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
2352 if test $tcl_cv_dirent_h = no; then
2353 AC_DEFINE(NO_DIRENT_H)
2356 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
2357 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
2358 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
2359 AC_CHECK_HEADER(limits.h,
2360 [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
2361 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2362 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2363 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2364 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2365 if test $tcl_ok = 0; then
2366 AC_DEFINE(NO_STDLIB_H)
2368 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2369 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2370 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2372 # See also memmove check below for a place where NO_STRING_H can be
2375 if test $tcl_ok = 0; then
2376 AC_DEFINE(NO_STRING_H)
2379 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
2380 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
2382 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2383 AC_HAVE_HEADERS(unistd.h sys/param.h)
2386 #--------------------------------------------------------------------
2389 # Locate the X11 header files and the X11 library archive. Try
2390 # the ac_path_x macro first, but if it doesn't find the X stuff
2391 # (e.g. because there's no xmkmf program) then check through
2392 # a list of possible directories. Under some conditions the
2393 # autoconf macro will return an include directory that contains
2394 # no include files, so double-check its result just to be safe.
2401 # Sets the the following vars:
2405 #--------------------------------------------------------------------
2407 AC_DEFUN([SC_PATH_X], [
2410 if test "$no_x" = ""; then
2411 if test "$x_includes" = ""; then
2412 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2414 if test ! -r $x_includes/X11/Intrinsic.h; then
2415 not_really_there="yes"
2419 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2420 AC_MSG_CHECKING([for X11 header files])
2421 found_xincludes="no"
2422 AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2423 if test "$found_xincludes" = "no"; then
2424 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"
2426 if test -r $i/X11/Intrinsic.h; then
2429 found_xincludes="yes"
2435 if test "$x_includes" != ""; then
2436 XINCLUDES="-I$x_includes"
2437 found_xincludes="yes"
2440 if test found_xincludes = "no"; then
2441 AC_MSG_RESULT([couldn't find any!])
2444 if test "$no_x" = yes; then
2445 AC_MSG_CHECKING([for X11 libraries])
2447 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"
2449 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
2457 if test "$x_libraries" = ""; then
2460 XLIBSW="-L$x_libraries -lX11"
2463 if test "$XLIBSW" = nope ; then
2464 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2466 if test "$XLIBSW" = nope ; then
2467 AC_MSG_RESULT([could not find any! Using -lX11.])
2472 #--------------------------------------------------------------------
2475 # The statements below check for systems where POSIX-style
2476 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2477 # On these systems (mostly older ones), use the old BSD-style
2478 # FIONBIO approach instead.
2485 # Defines some of the following vars:
2491 #--------------------------------------------------------------------
2493 AC_DEFUN([SC_BLOCKING_STYLE], [
2494 AC_CHECK_HEADERS(sys/ioctl.h)
2495 AC_CHECK_HEADERS(sys/filio.h)
2497 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2499 # There used to be code here to use FIONBIO under AIX. However, it
2500 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
2501 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
2502 # code (JO, 5/31/97).
2505 AC_DEFINE(USE_FIONBIO)
2506 AC_MSG_RESULT([FIONBIO])
2509 AC_DEFINE(USE_FIONBIO)
2510 AC_MSG_RESULT([FIONBIO])
2513 AC_DEFINE(USE_FIONBIO)
2514 AC_MSG_RESULT([FIONBIO])
2517 AC_MSG_RESULT([O_NONBLOCK])
2522 #--------------------------------------------------------------------
2525 # Checks how the system deals with time.h, what time structures
2526 # are used on the system, and what fields the structures have.
2533 # Defines some of the following vars:
2539 #--------------------------------------------------------------------
2541 AC_DEFUN([SC_TIME_HANDLER], [
2542 AC_CHECK_HEADERS(sys/time.h)
2546 AC_CHECK_FUNCS(gmtime_r localtime_r)
2548 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2549 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2550 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
2551 if test $tcl_cv_member_tm_tzadj = yes ; then
2552 AC_DEFINE(HAVE_TM_TZADJ)
2555 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2556 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2557 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
2558 if test $tcl_cv_member_tm_gmtoff = yes ; then
2559 AC_DEFINE(HAVE_TM_GMTOFF)
2563 # Its important to include time.h in this check, as some systems
2564 # (like convex) have timezone functions, etc.
2566 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2567 AC_TRY_COMPILE([#include <time.h>],
2568 [extern long timezone;
2571 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
2572 if test $tcl_cv_timezone_long = yes ; then
2573 AC_DEFINE(HAVE_TIMEZONE_VAR)
2576 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2578 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2579 AC_TRY_COMPILE([#include <time.h>],
2580 [extern time_t timezone;
2583 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
2584 if test $tcl_cv_timezone_time = yes ; then
2585 AC_DEFINE(HAVE_TIMEZONE_VAR)
2590 #--------------------------------------------------------------------
2593 # Under Solaris 2.4, strtod returns the wrong value for the
2594 # terminating character under some conditions. Check for this
2595 # and if the problem exists use a substitute procedure
2596 # "fixstrtod" (provided by Tcl) that corrects the error.
2597 # Also, on Compaq's Tru64 Unix 5.0,
2598 # strtod(" ") returns 0.0 instead of a failure to convert.
2605 # Might defines some of the following vars:
2606 # strtod (=fixstrtod)
2608 #--------------------------------------------------------------------
2610 AC_DEFUN([SC_BUGGY_STRTOD], [
2611 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2612 if test "$tcl_strtod" = 1; then
2613 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2615 extern double strtod();
2617 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2620 value = strtod(infString, &term);
2621 if ((term != infString) && (term[-1] == 0)) {
2624 value = strtod(nanString, &term);
2625 if ((term != nanString) && (term[-1] == 0)) {
2628 value = strtod(spaceString, &term);
2629 if (term == (spaceString+1)) {
2633 }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2634 tcl_cv_strtod_buggy=buggy)])
2635 if test "$tcl_cv_strtod_buggy" = buggy; then
2636 LIBOBJS="$LIBOBJS fixstrtod.o"
2637 AC_DEFINE(strtod, fixstrtod)
2642 #--------------------------------------------------------------------
2645 # Search for the libraries needed to link the Tcl shell.
2646 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2647 # -lnsl) are dealt with here.
2650 # Requires the following vars to be set in the Makefile:
2657 # Subst's the following var:
2661 # Might append to the following vars:
2664 # Might define the following vars:
2667 #--------------------------------------------------------------------
2669 AC_DEFUN([SC_TCL_LINK_LIBS], [
2670 #--------------------------------------------------------------------
2671 # On a few very rare systems, all of the libm.a stuff is
2672 # already in libc.a. Set compiler flags accordingly.
2673 # Also, Linux requires the "ieee" library for math to work
2674 # right (and it must appear before "-lm").
2675 #--------------------------------------------------------------------
2677 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2678 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2680 #--------------------------------------------------------------------
2681 # Interactive UNIX requires -linet instead of -lsocket, plus it
2682 # needs net/errno.h to define the socket-related error codes.
2683 #--------------------------------------------------------------------
2685 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2686 AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
2688 #--------------------------------------------------------------------
2689 # Check for the existence of the -lsocket and -lnsl libraries.
2690 # The order here is important, so that they end up in the right
2691 # order in the command line generated by make. Here are some
2692 # special considerations:
2693 # 1. Use "connect" and "accept" to check for -lsocket, and
2694 # "gethostbyname" to check for -lnsl.
2695 # 2. Use each function name only once: can't redo a check because
2696 # autoconf caches the results of the last check and won't redo it.
2697 # 3. Use -lnsl and -lsocket only if they supply procedures that
2698 # aren't already present in the normal libraries. This is because
2699 # IRIX 5.2 has libraries, but they aren't needed and they're
2700 # bogus: they goof up name resolution if used.
2701 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2702 # To get around this problem, check for both libraries together
2703 # if -lsocket doesn't work by itself.
2704 #--------------------------------------------------------------------
2707 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2708 if test "$tcl_checkSocket" = 1; then
2709 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2710 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2712 if test "$tcl_checkBoth" = 1; then
2714 LIBS="$LIBS -lsocket -lnsl"
2715 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2717 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2718 [LIBS="$LIBS -lnsl"])])
2720 # Don't perform the eval of the libraries here because DL_LIBS
2721 # won't be set until we call SC_CONFIG_CFLAGS
2723 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2728 #--------------------------------------------------------------------
2729 # SC_TCL_EARLY_FLAGS
2731 # Check for what flags are needed to be passed so the correct OS
2732 # features are available.
2739 # Might define the following vars:
2741 # _LARGEFILE64_SOURCE
2742 # _LARGEFILE_SOURCE64
2744 #--------------------------------------------------------------------
2746 AC_DEFUN([SC_TCL_EARLY_FLAG],[
2747 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2748 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2749 AC_TRY_COMPILE([[#define ]$1[ 1
2751 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2752 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2753 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2755 tcl_flags="$tcl_flags $1"
2759 AC_DEFUN([SC_TCL_EARLY_FLAGS],[
2760 AC_MSG_CHECKING([for required early compiler flags])
2762 SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2763 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2764 SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2765 [struct stat64 buf; int i = stat64("/", &buf);])
2766 SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2767 [char *p = (char *)open64;])
2768 if test "x${tcl_flags}" = "x" ; then
2769 AC_MSG_RESULT([none])
2771 AC_MSG_RESULT([${tcl_flags}])
2775 #--------------------------------------------------------------------
2776 # SC_TCL_64BIT_FLAGS
2778 # Check for what is defined in the way of 64-bit features.
2785 # Might define the following vars:
2786 # TCL_WIDE_INT_IS_LONG
2788 # HAVE_STRUCT_DIRENT64
2789 # HAVE_STRUCT_STAT64
2792 #--------------------------------------------------------------------
2794 AC_DEFUN([SC_TCL_64BIT_FLAGS], [
2795 AC_MSG_CHECKING([for 64-bit integer type])
2796 AC_CACHE_VAL(tcl_cv_type_64bit,[
2797 tcl_cv_type_64bit=none
2798 # See if the compiler knows natively about __int64
2799 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2800 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2801 # See if we should use long anyway Note that we substitute in the
2802 # type that is our current guess for a 64-bit type inside this check
2803 # program, so it should be modified only carefully...
2804 AC_TRY_COMPILE(,[switch (0) {
2805 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2806 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2807 if test "${tcl_cv_type_64bit}" = none ; then
2808 AC_DEFINE(TCL_WIDE_INT_IS_LONG)
2809 AC_MSG_RESULT([using long])
2811 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
2812 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2814 # Now check for auxiliary declarations
2815 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2816 AC_TRY_COMPILE([#include <sys/types.h>
2817 #include <sys/dirent.h>],[struct dirent64 p;],
2818 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2819 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2820 AC_DEFINE(HAVE_STRUCT_DIRENT64)
2823 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2824 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2826 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2827 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2828 AC_DEFINE(HAVE_STRUCT_STAT64)
2831 AC_CHECK_FUNCS(open64 lseek64)
2832 AC_MSG_CHECKING([for off64_t])
2833 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2834 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2836 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2837 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2838 dnl functions lseek64 and open64 are defined.
2839 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2840 test "x${ac_cv_func_lseek64}" = "xyes" && \
2841 test "x${ac_cv_func_open64}" = "xyes" ; then
2842 AC_DEFINE(HAVE_TYPE_OFF64_T)
2843 AC_MSG_RESULT([yes])
2850 #--------------------------------------------------------------------
2851 # SC_TCL_GETHOSTBYADDR_R
2853 # Check if we have MT-safe variant of gethostbyaddr().
2860 # Might define the following vars:
2861 # HAVE_GETHOSTBYADDR_R
2862 # HAVE_GETHOSTBYADDR_R_7
2863 # HAVE_GETHOSTBYADDR_R_8
2865 #--------------------------------------------------------------------
2867 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
2868 AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
2875 struct hostent *result;
2880 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2882 ], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)])
2883 tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
2884 if test "$tcl_ok" = yes; then
2885 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
2887 AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
2894 struct hostent *result, *resultp;
2899 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2900 &resultp, &h_errnop);
2901 ], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)])
2902 tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
2903 if test "$tcl_ok" = yes; then
2904 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
2907 if test "$tcl_ok" = yes; then
2908 AC_DEFINE(HAVE_GETHOSTBYADDR_R)
2912 #--------------------------------------------------------------------
2913 # SC_TCL_GETHOSTBYNAME_R
2915 # Check to see what variant of gethostbyname_r() we have.
2916 # Based on David Arnold's example from the comp.programming.threads
2924 # Might define the following vars:
2925 # HAVE_GETHOSTBYADDR_R
2926 # HAVE_GETHOSTBYADDR_R_3
2927 # HAVE_GETHOSTBYADDR_R_5
2928 # HAVE_GETHOSTBYADDR_R_6
2930 #--------------------------------------------------------------------
2932 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
2933 AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
2938 struct hostent *he, *res;
2943 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
2944 ], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)])
2945 tcl_ok=$tcl_cv_api_gethostbyname_r_6
2946 if test "$tcl_ok" = yes; then
2947 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
2949 AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
2959 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
2960 ], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)])
2961 tcl_ok=$tcl_cv_api_gethostbyname_r_5
2962 if test "$tcl_ok" = yes; then
2963 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
2965 AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
2971 struct hostent_data data;
2973 (void) gethostbyname_r(name, he, &data);
2974 ], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)])
2975 tcl_ok=$tcl_cv_api_gethostbyname_r_3
2976 if test "$tcl_ok" = yes; then
2977 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
2981 if test "$tcl_ok" = yes; then
2982 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2986 #--------------------------------------------------------------------
2989 # Check if we have MT-safe variant of getpwuid() and if yes,
2990 # which one exactly.
2997 # Might define the following vars:
3002 #--------------------------------------------------------------------
3004 AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
3005 AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
3007 #include <sys/types.h>
3011 struct passwd pw, *pwp;
3015 (void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
3016 ], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)])
3017 tcl_ok=$tcl_cv_api_getpwuid_r_5
3018 if test "$tcl_ok" = yes; then
3019 AC_DEFINE(HAVE_GETPWUID_R_5)
3021 AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
3023 #include <sys/types.h>
3031 (void)getpwnam_r(uid, &pw, buf, buflen);
3032 ], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)])
3033 tcl_ok=$tcl_cv_api_getpwuid_r_4
3034 if test "$tcl_ok" = yes; then
3035 AC_DEFINE(HAVE_GETPWUID_R_4)
3038 if test "$tcl_ok" = yes; then
3039 AC_DEFINE(HAVE_GETPWUID_R)
3043 #--------------------------------------------------------------------
3046 # Check if we have MT-safe variant of getpwnam() and if yes,
3047 # which one exactly.
3054 # Might define the following vars:
3059 #--------------------------------------------------------------------
3061 AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
3062 AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
3064 #include <sys/types.h>
3068 struct passwd pw, *pwp;
3072 (void) getpwnam_r(name, &pw, buf, buflen, &pwp);
3073 ], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)])
3074 tcl_ok=$tcl_cv_api_getpwnam_r_5
3075 if test "$tcl_ok" = yes; then
3076 AC_DEFINE(HAVE_GETPWNAM_R_5)
3078 AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
3080 #include <sys/types.h>
3088 (void)getpwnam_r(name, &pw, buf, buflen);
3089 ], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)])
3090 tcl_ok=$tcl_cv_api_getpwnam_r_4
3091 if test "$tcl_ok" = yes; then
3092 AC_DEFINE(HAVE_GETPWNAM_R_4)
3095 if test "$tcl_ok" = yes; then
3096 AC_DEFINE(HAVE_GETPWNAM_R)
3100 #--------------------------------------------------------------------
3103 # Check if we have MT-safe variant of getgrgid() and if yes,
3104 # which one exactly.
3111 # Might define the following vars:
3116 #--------------------------------------------------------------------
3118 AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
3119 AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
3121 #include <sys/types.h>
3125 struct group gr, *grp;
3129 (void) getgrgid_r(gid, &gr, buf, buflen, &grp);
3130 ], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)])
3131 tcl_ok=$tcl_cv_api_getgrgid_r_5
3132 if test "$tcl_ok" = yes; then
3133 AC_DEFINE(HAVE_GETGRGID_R_5)
3135 AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
3137 #include <sys/types.h>
3145 (void)getgrgid_r(gid, &gr, buf, buflen);
3146 ], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)])
3147 tcl_ok=$tcl_cv_api_getgrgid_r_4
3148 if test "$tcl_ok" = yes; then
3149 AC_DEFINE(HAVE_GETGRGID_R_4)
3152 if test "$tcl_ok" = yes; then
3153 AC_DEFINE(HAVE_GETGRGID_R)
3157 #--------------------------------------------------------------------
3160 # Check if we have MT-safe variant of getgrnam() and if yes,
3161 # which one exactly.
3168 # Might define the following vars:
3173 #--------------------------------------------------------------------
3175 AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
3176 AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
3178 #include <sys/types.h>
3182 struct group gr, *grp;
3186 (void) getgrnam_r(name, &gr, buf, buflen, &grp);
3187 ], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)])
3188 tcl_ok=$tcl_cv_api_getgrnam_r_5
3189 if test "$tcl_ok" = yes; then
3190 AC_DEFINE(HAVE_GETGRNAM_R_5)
3192 AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
3194 #include <sys/types.h>
3202 (void)getgrnam_r(name, &gr, buf, buflen);
3203 ], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)])
3204 tcl_ok=$tcl_cv_api_getgrnam_r_4
3205 if test "$tcl_ok" = yes; then
3206 AC_DEFINE(HAVE_GETGRNAM_R_4)
3209 if test "$tcl_ok" = yes; then
3210 AC_DEFINE(HAVE_GETGRNAM_R)
3214 #--------------------------------------------------------------------
3215 # SC_CONFIG_COMMANDS_PRE(CMDS)
3217 # Replacement for autoconf 2.5x AC_COMMANDS_PRE:
3218 # Commands to run right before config.status is
3219 # created. Accumulates.
3221 # Requires presence of SC_OUTPUT_COMMANDS_PRE at the end
3222 # of configure.in (right before AC_OUTPUT).
3224 #--------------------------------------------------------------------
3226 AC_DEFUN([SC_CONFIG_COMMANDS_PRE], [
3227 define([SC_OUTPUT_COMMANDS_PRE], defn([SC_OUTPUT_COMMANDS_PRE])[$1
3229 AC_DEFUN([SC_OUTPUT_COMMANDS_PRE])