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.
36 *-*-cygwin*) platDir="win" ;;
39 if test x"${with_tclconfig}" != x ; then
40 if test -f "${with_tclconfig}/tclConfig.sh" ; then
41 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
43 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
47 # then check for a private Tcl installation
48 if test x"${ac_cv_c_tclconfig}" = x ; then
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` \
59 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
60 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
61 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
62 if test -f "$i/$platDir/tclConfig.sh" ; then
63 ac_cv_c_tclconfig=`(cd $i/$platDir; pwd)`
69 # on Darwin, check in Framework installation locations
70 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
71 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
72 `ls -d /Library/Frameworks 2>/dev/null` \
73 `ls -d /Network/Library/Frameworks 2>/dev/null` \
74 `ls -d /System/Library/Frameworks 2>/dev/null` \
76 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
77 ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
83 # check in a few common install locations
84 if test x"${ac_cv_c_tclconfig}" = x ; then
85 for i in `ls -d ${libdir} 2>/dev/null` \
86 `ls -d ${exec_prefix}/lib 2>/dev/null` \
87 `ls -d ${prefix}/lib 2>/dev/null` \
88 `ls -d /usr/local/lib 2>/dev/null` \
89 `ls -d /usr/contrib/lib 2>/dev/null` \
90 `ls -d /usr/lib 2>/dev/null` \
92 if test -f "$i/tclConfig.sh" ; then
93 ac_cv_c_tclconfig=`(cd $i; pwd)`
99 # check in a few other private locations
100 if test x"${ac_cv_c_tclconfig}" = x ; then
103 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
104 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
105 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
106 if test -f "$i/$platDir/tclConfig.sh" ; then
107 ac_cv_c_tclconfig=`(cd $i/$platDir; pwd)`
114 if test x"${ac_cv_c_tclconfig}" = x ; then
115 TCL_BIN_DIR="# no Tcl configs found"
116 AC_MSG_WARN([Can't find Tcl configuration definitions])
120 TCL_BIN_DIR=${ac_cv_c_tclconfig}
121 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
126 #------------------------------------------------------------------------
127 # SC_PATH_TKCONFIG --
129 # Locate the tkConfig.sh file
136 # Adds the following arguments to configure:
139 # Defines the following vars:
140 # TK_BIN_DIR Full path to the directory containing
141 # the tkConfig.sh file
142 #------------------------------------------------------------------------
144 AC_DEFUN([SC_PATH_TKCONFIG], [
146 # Ok, lets find the tk configuration
147 # First, look for one uninstalled.
148 # the alternative search directory is invoked by --with-tk
151 if test x"${no_tk}" = x ; then
152 # we reset no_tk in case something fails here
154 AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
155 AC_MSG_CHECKING([for Tk configuration])
156 AC_CACHE_VAL(ac_cv_c_tkconfig,[
158 # First check to see if --with-tkconfig was specified.
159 if test x"${with_tkconfig}" != x ; then
160 if test -f "${with_tkconfig}/tkConfig.sh" ; then
161 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
163 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
167 # then check for a private Tk library
169 *-*-cygwin*) platDir="win" ;;
172 if test x"${ac_cv_c_tkconfig}" = x ; then
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` \
179 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
180 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
181 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
183 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
184 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
185 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
186 if test -f "$i/$platDir/tkConfig.sh" ; then
187 ac_cv_c_tkconfig=`(cd $i/$platDir; pwd)`
193 # on Darwin, check in Framework installation locations
194 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
195 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
196 `ls -d /Library/Frameworks 2>/dev/null` \
197 `ls -d /Network/Library/Frameworks 2>/dev/null` \
198 `ls -d /System/Library/Frameworks 2>/dev/null` \
200 if test -f "$i/Tk.framework/tkConfig.sh" ; then
201 ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)`
207 # check in a few common install locations
208 if test x"${ac_cv_c_tkconfig}" = x ; then
209 for i in `ls -d ${libdir} 2>/dev/null` \
210 `ls -d ${exec_prefix}/lib 2>/dev/null` \
211 `ls -d ${prefix}/lib 2>/dev/null` \
212 `ls -d /usr/local/lib 2>/dev/null` \
213 `ls -d /usr/contrib/lib 2>/dev/null` \
214 `ls -d /usr/lib 2>/dev/null` \
216 if test -f "$i/tkConfig.sh" ; then
217 ac_cv_c_tkconfig=`(cd $i; pwd)`
222 # check in a few other private locations
223 if test x"${ac_cv_c_tkconfig}" = x ; then
226 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
227 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
228 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
229 if test -f "$i/$platDir/tkConfig.sh" ; then
230 ac_cv_c_tkconfig=`(cd $i/$platDir; pwd)`
237 if test x"${ac_cv_c_tkconfig}" = x ; then
238 TK_BIN_DIR="# no Tk configs found"
239 AC_MSG_WARN([Can't find Tk configuration definitions])
243 TK_BIN_DIR=${ac_cv_c_tkconfig}
244 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
249 #------------------------------------------------------------------------
250 # SC_LOAD_TCLCONFIG --
252 # Load the tclConfig.sh file
256 # Requires the following vars to be set:
261 # Subst the following vars:
266 #------------------------------------------------------------------------
268 AC_DEFUN([SC_LOAD_TCLCONFIG], [
269 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
271 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
272 AC_MSG_RESULT([loading])
273 . ${TCL_BIN_DIR}/tclConfig.sh
275 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
278 # eval is required to do the TCL_DBGX substitution
279 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
280 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
282 # If the TCL_BIN_DIR is the build directory (not the install directory),
283 # then set the common variable name to the value of the build variables.
284 # For example, the variable TCL_LIB_SPEC will be set to the value
285 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
286 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
287 # installed and uninstalled version of Tcl.
288 if test -f ${TCL_BIN_DIR}/Makefile ; then
289 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
290 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
291 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
292 elif test "`uname -s`" = "Darwin"; then
293 # If Tcl was built as a framework, attempt to use the libraries
294 # from the framework at the given location so that linking works
295 # against Tcl.framework installed in an arbitary location.
298 if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
299 for i in "`cd ${TCL_BIN_DIR}; pwd`" \
300 "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
301 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
302 TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
307 if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
308 TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
309 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
315 # eval is required to do the TCL_DBGX substitution
316 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
317 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
318 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
319 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
321 AC_SUBST(TCL_VERSION)
322 AC_SUBST(TCL_PATCH_LEVEL)
323 AC_SUBST(TCL_BIN_DIR)
324 AC_SUBST(TCL_SRC_DIR)
326 AC_SUBST(TCL_LIB_FILE)
327 AC_SUBST(TCL_LIB_FLAG)
328 AC_SUBST(TCL_LIB_SPEC)
330 AC_SUBST(TCL_STUB_LIB_FILE)
331 AC_SUBST(TCL_STUB_LIB_FLAG)
332 AC_SUBST(TCL_STUB_LIB_SPEC)
335 #------------------------------------------------------------------------
336 # SC_LOAD_TKCONFIG --
338 # Load the tkConfig.sh file
342 # Requires the following vars to be set:
347 # Sets the following vars that should be in tkConfig.sh:
349 #------------------------------------------------------------------------
351 AC_DEFUN([SC_LOAD_TKCONFIG], [
352 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
354 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
355 AC_MSG_RESULT([loading])
356 . ${TK_BIN_DIR}/tkConfig.sh
358 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
361 # eval is required to do the TK_DBGX substitution
362 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
363 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
365 # If the TK_BIN_DIR is the build directory (not the install directory),
366 # then set the common variable name to the value of the build variables.
367 # For example, the variable TK_LIB_SPEC will be set to the value
368 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
369 # instead of TK_BUILD_LIB_SPEC since it will work with both an
370 # installed and uninstalled version of Tcl.
371 if test -f ${TK_BIN_DIR}/Makefile ; then
372 TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
373 TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
374 TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
375 elif test "`uname -s`" = "Darwin"; then
376 # If Tk was built as a framework, attempt to use the libraries
377 # from the framework at the given location so that linking works
378 # against Tk.framework installed in an arbitary location.
381 if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then
382 for i in "`cd ${TK_BIN_DIR}; pwd`" \
383 "`cd ${TK_BIN_DIR}/../..; pwd`"; do
384 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
385 TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}"
390 if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then
391 TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
392 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
398 # eval is required to do the TK_DBGX substitution
399 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
400 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
401 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
402 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
408 AC_SUBST(TK_LIB_FILE)
409 AC_SUBST(TK_LIB_FLAG)
410 AC_SUBST(TK_LIB_SPEC)
412 AC_SUBST(TK_STUB_LIB_FILE)
413 AC_SUBST(TK_STUB_LIB_FLAG)
414 AC_SUBST(TK_STUB_LIB_SPEC)
417 #------------------------------------------------------------------------
419 # Locate a tclsh shell installed on the system path. This macro
420 # will only find a Tcl shell that already exists on the system.
421 # It will not find a Tcl shell in the Tcl build directory or
422 # a Tcl shell that has been installed from the Tcl build directory.
423 # If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
424 # be set to "". Extensions should take care not to create Makefile
425 # rules that are run by default and depend on TCLSH_PROG. An
426 # extension can't assume that an executable Tcl shell exists at
433 # Subst's the following values:
435 #------------------------------------------------------------------------
437 AC_DEFUN([SC_PROG_TCLSH], [
438 AC_MSG_CHECKING([for tclsh])
439 AC_CACHE_VAL(ac_cv_path_tclsh, [
440 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
441 for dir in $search_path ; do
442 for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \
443 `ls -r $dir/tclsh* 2> /dev/null` ; do
444 if test x"$ac_cv_path_tclsh" = x ; then
445 if test -f "$j" ; then
454 if test -f "$ac_cv_path_tclsh" ; then
455 TCLSH_PROG="$ac_cv_path_tclsh"
456 AC_MSG_RESULT([$TCLSH_PROG])
458 # It is not an error if an installed version of Tcl can't be located.
460 AC_MSG_RESULT([No tclsh found on PATH])
465 #------------------------------------------------------------------------
467 # Determine the fully qualified path name of the tclsh executable
468 # in the Tcl build directory. This macro will correctly determine
469 # the name of the tclsh executable even if tclsh has not yet
470 # been built in the build directory. The build tclsh must be used
471 # when running tests from an extension build directory. It is not
472 # correct to use the TCLSH_PROG in cases like this.
478 # Subst's the following values:
480 #------------------------------------------------------------------------
482 AC_DEFUN([SC_BUILD_TCLSH], [
483 AC_MSG_CHECKING([for tclsh in Tcl build directory])
484 BUILD_TCLSH=${TCL_BIN_DIR}/tclsh
485 AC_MSG_RESULT([$BUILD_TCLSH])
486 AC_SUBST(BUILD_TCLSH)
489 #------------------------------------------------------------------------
490 # SC_ENABLE_SHARED --
492 # Allows the building of shared libraries
499 # Adds the following arguments to configure:
500 # --enable-shared=yes|no
502 # Defines the following vars:
503 # STATIC_BUILD Used for building import/export libraries
506 # Sets the following vars:
507 # SHARED_BUILD Value of 1 or 0
508 #------------------------------------------------------------------------
510 AC_DEFUN([SC_ENABLE_SHARED], [
511 AC_MSG_CHECKING([how to build libraries])
512 AC_ARG_ENABLE(shared,
513 [ --enable-shared build and link with shared libraries [--enable-shared]],
514 [tcl_ok=$enableval], [tcl_ok=yes])
516 if test "${enable_shared+set}" = set; then
517 enableval="$enable_shared"
523 if test "$tcl_ok" = "yes" ; then
524 AC_MSG_RESULT([shared])
527 AC_MSG_RESULT([static])
529 AC_DEFINE(STATIC_BUILD)
533 #------------------------------------------------------------------------
534 # SC_ENABLE_FRAMEWORK --
536 # Allows the building of shared libraries into frameworks
543 # Adds the following arguments to configure:
544 # --enable-framework=yes|no
546 # Sets the following vars:
547 # FRAMEWORK_BUILD Value of 1 or 0
548 #------------------------------------------------------------------------
550 AC_DEFUN([SC_ENABLE_FRAMEWORK], [
551 if test "`uname -s`" = "Darwin" ; then
552 AC_MSG_CHECKING([how to package libraries])
553 AC_ARG_ENABLE(framework,
554 [ --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]],
555 [enable_framework=$enableval], [enable_framework=no])
556 if test $enable_framework = yes; then
557 if test $SHARED_BUILD = 0; then
558 AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes])
561 if test $tcl_corefoundation = no; then
562 AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available])
566 if test $enable_framework = yes; then
567 AC_MSG_RESULT([framework])
570 if test $SHARED_BUILD = 1; then
571 AC_MSG_RESULT([shared library])
573 AC_MSG_RESULT([static library])
580 #------------------------------------------------------------------------
581 # SC_ENABLE_THREADS --
583 # Specify if thread support should be enabled. TCL_THREADS is
584 # checked so that if you are compiling an extension against a
585 # threaded core, your extension must be compiled threaded as well.
592 # Adds the following arguments to configure:
595 # Sets the following vars:
596 # THREADS_LIBS Thread library(s)
598 # Defines the following vars:
603 #------------------------------------------------------------------------
605 AC_DEFUN([SC_ENABLE_THREADS], [
606 AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
607 [tcl_ok=$enableval], [tcl_ok=no])
609 if test "${TCL_THREADS}" = 1; then
613 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
615 # USE_THREAD_ALLOC tells us to try the special thread-based
616 # allocator that significantly reduces lock contention
617 AC_DEFINE(USE_THREAD_ALLOC)
618 AC_DEFINE(_REENTRANT)
619 if test "`uname -s`" = "SunOS" ; then
620 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
622 AC_DEFINE(_THREAD_SAFE)
623 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
624 if test "$tcl_ok" = "no"; then
625 # Check a little harder for __pthread_mutex_init in the same
626 # library, as some systems hide it there until pthread.h is
627 # defined. We could alternatively do an AC_TRY_COMPILE with
628 # pthread.h, but that will work with libpthread really doesn't
629 # exist, like AIX 4.2. [Bug: 4359]
630 AC_CHECK_LIB(pthread, __pthread_mutex_init,
631 tcl_ok=yes, tcl_ok=no)
634 if test "$tcl_ok" = "yes"; then
635 # The space is needed
636 THREADS_LIBS=" -lpthread"
638 AC_CHECK_LIB(pthreads, pthread_mutex_init,
639 tcl_ok=yes, tcl_ok=no)
640 if test "$tcl_ok" = "yes"; then
641 # The space is needed
642 THREADS_LIBS=" -lpthreads"
644 AC_CHECK_LIB(c, pthread_mutex_init,
645 tcl_ok=yes, tcl_ok=no)
646 if test "$tcl_ok" = "no"; then
647 AC_CHECK_LIB(c_r, pthread_mutex_init,
648 tcl_ok=yes, tcl_ok=no)
649 if test "$tcl_ok" = "yes"; then
650 # The space is needed
651 THREADS_LIBS=" -pthread"
654 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...])
660 # Does the pthread-implementation provide
661 # 'pthread_attr_setstacksize' ?
664 LIBS="$LIBS $THREADS_LIBS"
665 AC_CHECK_FUNCS(pthread_attr_setstacksize)
666 AC_CHECK_FUNCS(pthread_atfork)
671 # Do checking message here to not mess up interleaved configure output
672 AC_MSG_CHECKING([for building with threads])
673 if test "${TCL_THREADS}" = 1; then
674 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
675 if test "${tcl_threaded_core}" = 1; then
676 AC_MSG_RESULT([yes (threaded core)])
681 AC_MSG_RESULT([no (default)])
684 AC_SUBST(TCL_THREADS)
687 #------------------------------------------------------------------------
688 # SC_ENABLE_SYMBOLS --
690 # Specify if debugging symbols should be used.
691 # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
692 # can also be enabled.
697 # Requires the following vars to be set in the Makefile:
705 # Adds the following arguments to configure:
708 # Defines the following vars:
709 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
710 # Sets to $(CFLAGS_OPTIMIZE) if false
711 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
712 # Sets to $(LDFLAGS_OPTIMIZE) if false
713 # DBGX Debug library extension
715 #------------------------------------------------------------------------
717 AC_DEFUN([SC_ENABLE_SYMBOLS], [
718 AC_MSG_CHECKING([for build with symbols])
719 AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
720 # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
721 if test "$tcl_ok" = "no"; then
722 CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
723 LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
727 CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
728 LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
730 if test "$tcl_ok" = "yes"; then
731 AC_MSG_RESULT([yes (standard debugging)])
734 AC_SUBST(CFLAGS_DEFAULT)
735 AC_SUBST(LDFLAGS_DEFAULT)
737 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
738 AC_DEFINE(TCL_MEM_DEBUG)
741 if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
742 AC_DEFINE(TCL_COMPILE_DEBUG)
743 AC_DEFINE(TCL_COMPILE_STATS)
746 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
747 if test "$tcl_ok" = "all"; then
748 AC_MSG_RESULT([enabled symbols mem compile debugging])
750 AC_MSG_RESULT([enabled $tcl_ok debugging])
755 #------------------------------------------------------------------------
756 # SC_ENABLE_LANGINFO --
758 # Allows use of modern nl_langinfo check for better l10n.
759 # This is only relevant for Unix.
766 # Adds the following arguments to configure:
767 # --enable-langinfo=yes|no (default is yes)
769 # Defines the following vars:
770 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
772 #------------------------------------------------------------------------
774 AC_DEFUN([SC_ENABLE_LANGINFO], [
775 AC_ARG_ENABLE(langinfo,
776 [ --enable-langinfo use nl_langinfo if possible to determine
777 encoding at startup, otherwise use old heuristic],
778 [langinfo_ok=$enableval], [langinfo_ok=yes])
781 if test "$langinfo_ok" = "yes"; then
782 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
784 AC_MSG_CHECKING([whether to use nl_langinfo])
785 if test "$langinfo_ok" = "yes"; then
786 AC_CACHE_VAL(tcl_cv_langinfo_h, [
787 AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
788 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
789 AC_MSG_RESULT([$tcl_cv_langinfo_h])
790 if test $tcl_cv_langinfo_h = yes; then
791 AC_DEFINE(HAVE_LANGINFO)
794 AC_MSG_RESULT([$langinfo_ok])
798 #--------------------------------------------------------------------
801 # Decide whether to use symlinks for linking the manpages,
802 # whether to compress the manpages after installation, and
803 # whether to add a package name suffix to the installed
804 # manpages to avoidfile name clashes.
805 # If compression is enabled also find out what file name suffix
806 # the given compression program is using.
813 # Adds the following arguments to configure:
814 # --enable-man-symlinks
815 # --enable-man-compression=PROG
816 # --enable-man-suffix[=STRING]
818 # Defines the following variable:
820 # MAN_FLAGS - The apropriate flags for installManPage
821 # according to the user's selection.
823 #--------------------------------------------------------------------
825 AC_DEFUN([SC_CONFIG_MANPAGES], [
826 AC_MSG_CHECKING([whether to use symlinks for manpages])
827 AC_ARG_ENABLE(man-symlinks,
828 [ --enable-man-symlinks use symlinks for the manpages],
829 test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
831 AC_MSG_RESULT([$enableval])
833 AC_MSG_CHECKING([whether to compress the manpages])
834 AC_ARG_ENABLE(man-compression,
835 [ --enable-man-compression=PROG
836 compress the manpages with PROG],
838 yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
840 *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
843 AC_MSG_RESULT([$enableval])
844 if test "$enableval" != "no"; then
845 AC_MSG_CHECKING([for compressed file suffix])
848 Z=`ls TeST* | sed 's/^....//'`
850 MAN_FLAGS="$MAN_FLAGS --extension $Z"
854 AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
855 AC_ARG_ENABLE(man-suffix,
856 [ --enable-man-suffix=STRING
857 use STRING as a suffix to manpage file names
860 yes) enableval="$1" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
862 *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
865 AC_MSG_RESULT([$enableval])
870 #--------------------------------------------------------------------
873 # Determine what the system is (some things cannot be easily checked
874 # on a feature-driven basis, alas). This can usually be done via the
875 # "uname" command, but there are a few systems, like Next, where
882 # Defines the following var:
884 # system - System/platform/version identification code.
886 #--------------------------------------------------------------------
888 AC_DEFUN([SC_CONFIG_SYSTEM], [
889 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
890 if test -f /usr/lib/NextStep/software_version; then
891 tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
893 tcl_cv_sys_version=`uname -s`-`uname -r`
894 if test "$?" -ne 0 ; then
895 AC_MSG_WARN([can't find uname command])
896 tcl_cv_sys_version=unknown
898 # Special check for weird MP-RAS system (uname returns weird
899 # results, and the version is kept in special file).
901 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
902 tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
904 if test "`uname -s`" = "AIX" ; then
905 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
910 system=$tcl_cv_sys_version
913 #--------------------------------------------------------------------
916 # Try to determine the proper flags to pass to the compiler
917 # for building shared libraries and other such nonsense.
924 # Defines and substitutes the following vars:
926 # DL_OBJS - Name of the object file that implements dynamic
927 # loading for Tcl on this system.
928 # DL_LIBS - Library file(s) to include in tclsh and other base
929 # applications in order for the "load" command to work.
930 # LDFLAGS - Flags to pass to the compiler when linking object
931 # files into an executable application binary such
933 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
934 # that tell the run-time dynamic linker where to look
935 # for shared libraries such as libtcl.so. Depends on
936 # the variable LIB_RUNTIME_DIR in the Makefile. Could
937 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
938 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
939 # that tell the run-time dynamic linker where to look
940 # for shared libraries such as libtcl.so. Depends on
941 # the variable LIB_RUNTIME_DIR in the Makefile.
942 # MAKE_LIB - Command to execute to build the a library;
943 # differs when building shared or static.
945 # Command to execute to build a stub library.
946 # INSTALL_LIB - Command to execute to install a library;
947 # differs when building shared or static.
949 # Command to execute to install a stub library.
950 # STLIB_LD - Base command to use for combining object files
951 # into a static library.
952 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
953 # of a shared library (may request position-independent
954 # code, among other things).
955 # SHLIB_LD - Base command to use for combining object files
956 # into a shared library.
957 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
958 # creating shared libraries. This symbol typically
959 # goes at the end of the "ld" commands that build
960 # shared libraries. The value of the symbol is
961 # "${LIBS}" if all of the dependent libraries should
962 # be specified when creating a shared library. If
963 # dependent libraries should not be specified (as on
964 # SunOS 4.x, where they cause the link to fail, or in
965 # general if Tcl and Tk aren't themselves shared
966 # libraries), then this symbol has an empty string
968 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
969 # extensions. An empty string means we don't know how
970 # to use shared libraries on this platform.
971 # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
972 # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
973 # tclConfig.sh, since they are only used for the build
975 # Examples: MacOS X records the library version and
976 # compatibility version in the shared library. But
977 # of course the Tcl version of this is only used for Tcl.
978 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
979 # in a static or shared library name, using the $VERSION variable
980 # to put the version in the right place. This is used
981 # by platforms that need non-standard library names.
982 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
983 # to have a version after the .so, and ${VERSION}.a
984 # on AIX, since a shared library needs to have
985 # a .a extension whereas shared objects for loadable
986 # extensions have a .so extension. Defaults to
987 # ${VERSION}${SHLIB_SUFFIX}.
988 # TCL_NEEDS_EXP_FILE -
989 # 1 means that an export file is needed to link to a
991 # TCL_EXP_FILE - The name of the installed export / import file which
992 # should be used to link to the Tcl shared library.
993 # Empty if Tcl is unshared.
994 # TCL_BUILD_EXP_FILE -
995 # The name of the built export / import file which
996 # should be used to link to the Tcl shared library.
997 # Empty if Tcl is unshared.
999 # Flags used when running the compiler in debug mode
1001 # Flags used when running the compiler in optimize mode
1002 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
1004 #--------------------------------------------------------------------
1006 AC_DEFUN([SC_CONFIG_CFLAGS], [
1008 # Step 0.a: Enable 64 bit support?
1010 AC_MSG_CHECKING([if 64bit support is requested])
1011 AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],
1012 [do64bit=$enableval], [do64bit=no])
1013 AC_MSG_RESULT([$do64bit])
1015 # Step 0.b: Enable Solaris 64 bit VIS support?
1017 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1018 AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],
1019 [do64bitVIS=$enableval], [do64bitVIS=no])
1020 AC_MSG_RESULT([$do64bitVIS])
1022 if test "$do64bitVIS" = "yes"; then
1023 # Force 64bit on with VIS
1027 # Step 1: set the variable "system" to hold the name and version number
1032 # Step 2: check for existence of -ldl library. This is needed because
1033 # Linux can use either -ldl or -ldld for dynamic loading.
1035 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
1037 # Require ranlib early so we can override it in special cases below.
1039 AC_REQUIRE([AC_PROG_RANLIB])
1041 # Step 3: set configuration options based on system name and version.
1044 LDFLAGS_ORIG="$LDFLAGS"
1045 TCL_EXPORT_FILE_SUFFIX=""
1046 UNSHARED_LIB_SUFFIX=""
1047 TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
1048 ECHO_VERSION='`echo ${VERSION}`'
1049 TCL_LIB_VERSIONS_OK=ok
1052 if test "$GCC" = "yes" ; then
1053 CFLAGS_WARNING="-Wall -Wno-implicit-int -fno-strict-aliasing"
1057 TCL_NEEDS_EXP_FILE=0
1058 TCL_BUILD_EXP_FILE=""
1060 dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
1061 dnl AC_CHECK_TOOL(AR, ar)
1062 AC_CHECK_PROG(AR, ar, ar)
1063 if test "${AR}" = "" ; then
1064 AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
1067 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1072 if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
1073 # AIX requires the _r compiler when gcc isn't being used
1082 AC_MSG_RESULT([Using $CC for compiling with threads])
1086 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1087 # symbols when dynamically loaded into tclsh.
1088 SHLIB_LD_LIBS='${LIBS}'
1091 DL_OBJS="tclLoadDl.o"
1092 LD_LIBRARY_PATH_VAR="LIBPATH"
1094 # Check to enable 64-bit flags for compiler/linker on AIX 4+
1095 if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
1096 if test "$GCC" = "yes" ; then
1097 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1100 CFLAGS="$CFLAGS -q64"
1101 LDFLAGS="$LDFLAGS -q64"
1102 RANLIB="${RANLIB} -X64"
1104 SHLIB_LD_FLAGS="-b64"
1108 if test "`uname -m`" = "ia64" ; then
1109 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1110 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1111 # AIX-5 has dl* in libc.so
1113 if test "$GCC" = "yes" ; then
1114 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1116 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1118 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1120 if test "$GCC" = "yes" ; then
1121 SHLIB_LD="gcc -shared"
1123 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
1125 SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1127 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1128 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1129 TCL_NEEDS_EXP_FILE=1
1130 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
1133 # AIX v<=4.1 has some different flags than 4.2+
1134 if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
1135 LIBOBJS="$LIBOBJS tclLoadAix.o"
1139 # On AIX <=v4 systems, libbsd.a has to be linked in to support
1140 # non-blocking file IO. This library has to be linked in after
1141 # the MATH_LIBS or it breaks the pow() function. The way to
1142 # insure proper sequencing, is to add it to the tail of MATH_LIBS.
1143 # This library also supplies gettimeofday.
1145 # AIX does not have a timezone field in struct tm. When the AIX
1146 # bsd library is used, the timezone global and the gettimeofday
1147 # methods are to be avoided for timezone deduction instead, we
1148 # deduce the timezone by comparing the localtime result on a
1151 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
1152 if test $libbsd = yes; then
1153 MATH_LIBS="$MATH_LIBS -lbsd"
1154 AC_DEFINE(USE_DELTA_FOR_TZ)
1158 SHLIB_CFLAGS="-fPIC"
1159 SHLIB_LD="${CC} -nostart"
1160 SHLIB_LD_LIBS='${LIBS}'
1162 DL_OBJS="tclLoadDl.o"
1165 #-----------------------------------------------------------
1166 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1167 # -lsocket, even if the network functions are in -lnet which
1168 # is always linked to, for compatibility.
1169 #-----------------------------------------------------------
1170 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1172 BSD/OS-2.1*|BSD/OS-3*)
1174 SHLIB_LD="shlicc -r"
1175 SHLIB_LD_LIBS='${LIBS}'
1177 DL_OBJS="tclLoadDl.o"
1183 SHLIB_CFLAGS="-export-dynamic -fPIC"
1184 SHLIB_LD="cc -shared"
1185 SHLIB_LD_LIBS='${LIBS}'
1187 DL_OBJS="tclLoadDl.o"
1189 LDFLAGS="$LDFLAGS -export-dynamic"
1194 SHLIB_CFLAGS="-K PIC"
1198 DL_OBJS="tclLoadDl.o"
1204 # Use updated header definitions where possible
1205 AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library
1206 AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
1207 LIBS="$LIBS -lxnet" # Use the XOPEN network library
1209 if test "`uname -m`" = "ia64" ; then
1214 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1215 if test "$tcl_ok" = yes; then
1218 SHLIB_LD_LIBS='${LIBS}'
1219 DL_OBJS="tclLoadShl.o"
1221 LDFLAGS="$LDFLAGS -Wl,-E"
1222 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1223 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1224 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1226 if test "$GCC" = "yes" ; then
1227 SHLIB_LD="gcc -shared"
1228 SHLIB_LD_LIBS='${LIBS}'
1229 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1232 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1233 #CFLAGS="$CFLAGS +DAportable"
1235 # Check to enable 64-bit flags for compiler/linker
1236 if test "$do64bit" = "yes" ; then
1237 if test "$GCC" = "yes" ; then
1238 hpux_arch=`${CC} -dumpmachine`
1241 # 64-bit gcc in use. Fix flags for GNU ld.
1243 SHLIB_LD="${CC} -shared"
1244 SHLIB_LD_LIBS='${LIBS}'
1245 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1246 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1249 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1254 CFLAGS="$CFLAGS +DD64"
1255 LDFLAGS="$LDFLAGS +DD64"
1259 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1261 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1262 if test "$tcl_ok" = yes; then
1266 DL_OBJS="tclLoadShl.o"
1268 LDFLAGS="$LDFLAGS -Wl,-E"
1269 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1270 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1271 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1277 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1278 SHLIB_LD_LIBS='${LIBS}'
1279 DL_OBJS="tclLoadAout.o"
1281 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1282 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1283 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1284 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
1288 SHLIB_LD="ld -shared -rdata_shared"
1289 SHLIB_LD_LIBS='${LIBS}'
1291 DL_OBJS="tclLoadDl.o"
1293 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1294 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1298 SHLIB_LD="ld -n32 -shared -rdata_shared"
1299 SHLIB_LD_LIBS='${LIBS}'
1301 DL_OBJS="tclLoadDl.o"
1303 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1304 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1305 if test "$GCC" = "yes" ; then
1306 CFLAGS="$CFLAGS -mabi=n32"
1307 LDFLAGS="$LDFLAGS -mabi=n32"
1311 # Use to build 6.2 compatible binaries on 6.3.
1312 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1315 CFLAGS="$CFLAGS -n32"
1318 LDFLAGS="$LDFLAGS -n32"
1323 SHLIB_LD="ld -n32 -shared -rdata_shared"
1324 SHLIB_LD_LIBS='${LIBS}'
1326 DL_OBJS="tclLoadDl.o"
1328 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1329 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1331 # Check to enable 64-bit flags for compiler/linker
1333 if test "$do64bit" = "yes" ; then
1334 if test "$GCC" = "yes" ; then
1335 AC_MSG_WARN([64bit mode not supported by gcc])
1338 SHLIB_LD="ld -64 -shared -rdata_shared"
1339 CFLAGS="$CFLAGS -64"
1340 LDFLAGS="$LDFLAGS -64"
1345 SHLIB_CFLAGS="-fPIC"
1346 SHLIB_LD_LIBS='${LIBS}'
1350 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1351 # when you inline the string and math operations. Turn this off to
1352 # get rid of the warnings.
1353 #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1355 if test "$have_dl" = yes; then
1356 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
1357 DL_OBJS="tclLoadDl.o"
1359 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1360 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1361 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1363 AC_CHECK_HEADER(dld.h, [
1364 SHLIB_LD="ld -shared"
1365 DL_OBJS="tclLoadDld.o"
1368 LD_SEARCH_FLAGS=""])
1370 if test "`uname -m`" = "alpha" ; then
1371 CFLAGS="$CFLAGS -mieee"
1373 if test $do64bit = yes; then
1374 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1376 CFLAGS="$CFLAGS -m64"
1377 AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
1378 CFLAGS=$hold_cflags])
1379 if test $tcl_cv_cc_m64 = yes; then
1380 CFLAGS="$CFLAGS -m64"
1385 # The combo of gcc + glibc has a bug related
1386 # to inlining of functions like strtod(). The
1387 # -fno-builtin flag should address this problem
1388 # but it does not work. The -fno-inline flag
1389 # is kind of overkill but it works.
1390 # Disable inlining only when one of the
1391 # files in compat/*.c is being linked in.
1392 if test x"${LIBOBJS}" != x ; then
1393 CFLAGS="$CFLAGS -fno-inline"
1396 # XIM peeking works under XFree86.
1397 AC_DEFINE(PEEK_XCLOSEIM)
1401 SHLIB_CFLAGS="-fPIC"
1402 SHLIB_LD_LIBS='${LIBS}'
1405 if test "$have_dl" = yes; then
1406 SHLIB_LD="${CC} -shared"
1409 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1413 AC_CHECK_HEADER(dld.h, [
1414 SHLIB_LD="ld -shared"
1418 LD_SEARCH_FLAGS=""])
1420 if test "`uname -m`" = "alpha" ; then
1421 CFLAGS="$CFLAGS -mieee"
1425 SHLIB_CFLAGS="-fPIC"
1426 SHLIB_LD_LIBS='${LIBS}'
1429 SHLIB_LD="${CC} -shared "
1430 DL_OBJS="tclLoadDl.o"
1431 DL_LIBS="-mshared -ldl"
1432 LD_FLAGS="-Wl,--export-dynamic"
1433 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1434 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1437 SHLIB_CFLAGS="-K PIC"
1441 DL_OBJS="tclLoadDl.o"
1447 SHLIB_CFLAGS="-K PIC"
1451 DL_OBJS="tclLoadDl.o"
1453 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1457 NetBSD-*|FreeBSD-[[1-2]].*)
1458 # Not available on all versions: check for include file.
1459 AC_CHECK_HEADER(dlfcn.h, [
1460 # NetBSD/SPARC needs -fPIC, -fpic will not do.
1461 SHLIB_CFLAGS="-fPIC"
1462 SHLIB_LD="ld -Bshareable -x"
1463 SHLIB_LD_LIBS='${LIBS}'
1465 DL_OBJS="tclLoadDl.o"
1467 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1468 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1469 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1474 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1475 if test $tcl_cv_ld_elf = yes; then
1476 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
1478 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1482 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
1483 SHLIB_LD_LIBS='${LIBS}'
1485 DL_OBJS="tclLoadAout.o"
1487 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1488 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1489 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1492 # FreeBSD doesn't handle version numbers with dots.
1494 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1495 TCL_LIB_VERSIONS_OK=nodots
1501 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
1502 SHLIB_LD_LIBS='${LIBS}'
1504 DL_OBJS="tclLoadAout.o"
1507 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1508 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1509 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1512 # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
1515 SHLIB_CFLAGS="-fPIC";;
1517 SHLIB_CFLAGS="-fpic";;
1519 SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
1520 SHLIB_LD_LIBS='${LIBS}'
1522 DL_OBJS="tclLoadDl.o"
1524 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1525 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1526 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1527 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1532 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1533 if test $tcl_cv_ld_elf = yes; then
1534 LDFLAGS=-Wl,-export-dynamic
1541 # OpenBSD doesn't do version numbers with dots.
1542 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1543 TCL_LIB_VERSIONS_OK=nodots
1546 # FreeBSD 3.* and greater have ELF.
1547 SHLIB_CFLAGS="-fPIC"
1548 SHLIB_LD="ld -Bshareable -x"
1549 SHLIB_LD_LIBS='${LIBS}'
1551 DL_OBJS="tclLoadDl.o"
1553 LDFLAGS="$LDFLAGS -export-dynamic"
1554 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1555 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1556 if test "${TCL_THREADS}" = "1" ; then
1557 # The -pthread needs to go in the CFLAGS, not LIBS
1558 LIBS=`echo $LIBS | sed s/-pthread//`
1559 CFLAGS="$CFLAGS -pthread"
1560 LDFLAGS="$LDFLAGS -pthread"
1564 # FreeBSD-3 doesn't handle version numbers with dots.
1565 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1566 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
1567 TCL_LIB_VERSIONS_OK=nodots
1572 CFLAGS_OPTIMIZE="-Os"
1573 SHLIB_CFLAGS="-fno-common"
1574 # To avoid discrepancies between what headers configure sees during
1575 # preprocessing tests and compiling tests, move any -isysroot and
1576 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1577 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1578 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1579 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1580 CFLAGS="`echo " ${CFLAGS}" | \
1581 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1582 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1583 if test $do64bit = yes; then
1586 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1587 tcl_cv_cc_arch_ppc64, [
1589 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1590 AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
1591 tcl_cv_cc_arch_ppc64=no)
1592 CFLAGS=$hold_cflags])
1593 if test $tcl_cv_cc_arch_ppc64 = yes; then
1594 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1598 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1599 tcl_cv_cc_arch_x86_64, [
1601 CFLAGS="$CFLAGS -arch x86_64"
1602 AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
1603 tcl_cv_cc_arch_x86_64=no)
1604 CFLAGS=$hold_cflags])
1605 if test $tcl_cv_cc_arch_x86_64 = yes; then
1606 CFLAGS="$CFLAGS -arch x86_64"
1610 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1613 # Check for combined 32-bit and 64-bit fat build
1614 echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
1615 echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
1618 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
1619 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1620 hold_ldflags=$LDFLAGS
1621 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1622 AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
1623 LDFLAGS=$hold_ldflags])
1624 if test $tcl_cv_ld_single_module = yes; then
1625 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1627 SHLIB_LD_LIBS='${LIBS}'
1628 SHLIB_SUFFIX=".dylib"
1629 DL_OBJS="tclLoadDyld.o"
1631 # Don't use -prebind when building for Mac OS X 10.4 or later only:
1632 test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
1633 "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
1634 LDFLAGS="$LDFLAGS -prebind"
1635 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1636 AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
1637 hold_ldflags=$LDFLAGS
1638 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1639 AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
1640 LDFLAGS=$hold_ldflags])
1641 if test $tcl_cv_ld_search_paths_first = yes; then
1642 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1646 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1647 PLAT_OBJS=\$\(MAC\_OSX_OBJS\)
1648 PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
1649 AC_MSG_CHECKING([whether to use CoreFoundation])
1650 AC_ARG_ENABLE(corefoundation, [ --enable-corefoundation use CoreFoundation API [--enable-corefoundation]],
1651 [tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
1652 AC_MSG_RESULT([$tcl_corefoundation])
1653 if test $tcl_corefoundation = yes; then
1654 AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [
1656 if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
1657 # On Tiger there is no 64-bit CF, so remove 64-bit archs
1658 # from CFLAGS et al. while testing for presence of CF.
1659 # 64-bit CF is disabled in tclUnixPort.h if necessary.
1660 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1662 LIBS="$LIBS -framework CoreFoundation"
1663 AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
1664 [CFBundleRef b = CFBundleGetMainBundle();],
1665 tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no)
1666 if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
1667 eval $v'="$hold_'$v'"'
1668 done; fi; LIBS=$hold_libs])
1669 if test $tcl_cv_lib_corefoundation = yes; then
1670 LIBS="$LIBS -framework CoreFoundation"
1671 AC_DEFINE(HAVE_COREFOUNDATION)
1673 tcl_corefoundation=no
1675 if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
1676 AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [
1677 for v in CFLAGS CPPFLAGS LDFLAGS; do
1678 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1680 AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
1681 [CFBundleRef b = CFBundleGetMainBundle();],
1682 tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no)
1683 for v in CFLAGS CPPFLAGS LDFLAGS; do
1684 eval $v'="$hold_'$v'"'
1686 if test $tcl_cv_lib_corefoundation_64 = no; then
1687 AC_DEFINE(NO_COREFOUNDATION_64)
1691 AC_DEFINE(MAC_OSX_TCL)
1695 SHLIB_LD="cc -nostdlib -r"
1698 DL_OBJS="tclLoadNext.o"
1704 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1705 AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
1707 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1708 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1710 # Hack: make package name same as library name
1711 SHLIB_LD='ld -R -export $@:'
1714 DL_OBJS="tclLoadOSF.o"
1720 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1721 SHLIB_CFLAGS="-fPIC"
1722 if test "$SHARED_BUILD" = "1" ; then
1723 SHLIB_LD="ld -shared"
1725 SHLIB_LD="ld -non_shared"
1729 DL_OBJS="tclLoadDl.o"
1737 if test "$SHARED_BUILD" = "1" ; then
1738 SHLIB_LD='ld -shared -expect_unresolved "*"'
1740 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1744 DL_OBJS="tclLoadDl.o"
1746 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1747 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1748 if test "$GCC" = "yes" ; then
1749 CFLAGS="$CFLAGS -mieee"
1751 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
1753 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1754 if test "${TCL_THREADS}" = "1" ; then
1755 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1756 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1757 LIBS=`echo $LIBS | sed s/-lpthreads//`
1758 if test "$GCC" = "yes" ; then
1759 LIBS="$LIBS -lpthread -lmach -lexc"
1761 CFLAGS="$CFLAGS -pthread"
1762 LDFLAGS="$LDFLAGS -pthread"
1769 # This may work for all QNX, but it was only reported for v6.
1770 SHLIB_CFLAGS="-fPIC"
1771 SHLIB_LD="ld -Bshareable -x"
1774 DL_OBJS="tclLoadDl.o"
1775 # dlopen is in -lc on QNX
1782 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1783 SHLIB_LD_LIBS='${LIBS}'
1785 DL_OBJS="tclLoadAout.o"
1787 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1788 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1789 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1792 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1793 # this test works, since "uname -s" was non-standard in 3.2.4 and
1795 if test "$GCC" = "yes" ; then
1796 SHLIB_CFLAGS="-fPIC -melf"
1797 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1799 SHLIB_CFLAGS="-Kpic -belf"
1800 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1805 DL_OBJS="tclLoadDl.o"
1811 SHLIB_CFLAGS="-K PIC"
1815 DL_OBJS="tclLoadDl.o"
1825 DL_OBJS="tclLoadDl.o"
1827 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1828 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1830 # SunOS can't handle version numbers with dots in them in library
1831 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1832 # requires an extra version number at the end of .so file names.
1833 # So, the library has to have a name like libtcl75.so.1.0
1835 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1836 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1837 TCL_LIB_VERSIONS_OK=nodots
1840 # Careful to not let 5.10+ fall into this case
1842 # Note: If _REENTRANT isn't defined, then Solaris
1843 # won't define thread-safe library routines.
1845 AC_DEFINE(_REENTRANT)
1846 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1848 SHLIB_CFLAGS="-KPIC"
1850 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1851 # symbols when dynamically loaded into tclsh.
1853 SHLIB_LD_LIBS='${LIBS}'
1855 DL_OBJS="tclLoadDl.o"
1857 if test "$GCC" = "yes" ; then
1858 SHLIB_LD="$CC -shared"
1859 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1860 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1862 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1863 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1864 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1868 # Note: If _REENTRANT isn't defined, then Solaris
1869 # won't define thread-safe library routines.
1871 AC_DEFINE(_REENTRANT)
1872 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1874 SHLIB_CFLAGS="-KPIC"
1876 # Check to enable 64-bit flags for compiler/linker
1877 if test "$do64bit" = "yes" ; then
1879 if test "$arch" = "sparcv9 sparc" ; then
1880 if test "$GCC" = "yes" ; then
1881 if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
1882 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1885 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1886 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1887 SHLIB_CFLAGS="-fPIC"
1891 if test "$do64bitVIS" = "yes" ; then
1892 CFLAGS="$CFLAGS -xarch=v9a"
1893 LDFLAGS="$LDFLAGS -xarch=v9a"
1895 CFLAGS="$CFLAGS -xarch=v9"
1896 LDFLAGS="$LDFLAGS -xarch=v9"
1898 # Solaris 64 uses this as well
1899 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1901 elif test "$arch" = "amd64 i386" ; then
1902 if test "$GCC" = "yes" ; then
1903 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1906 CFLAGS="$CFLAGS -xarch=amd64"
1907 LDFLAGS="$LDFLAGS -xarch=amd64"
1910 AC_MSG_WARN([64bit mode not supported for $arch])
1914 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1915 # symbols when dynamically loaded into tclsh.
1917 SHLIB_LD_LIBS='${LIBS}'
1919 DL_OBJS="tclLoadDl.o"
1921 if test "$GCC" = "yes" ; then
1922 SHLIB_LD="$CC -shared"
1923 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1924 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1925 if test "$do64bit_ok" = "yes" ; then
1926 # We need to specify -static-libgcc or we need to
1927 # add the path to the sparv9 libgcc.
1928 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1929 # for finding sparcv9 libgcc, get the regular libgcc
1930 # path, remove so name and append 'sparcv9'
1931 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1932 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1936 SunOS-5.[[1-9]][[0-9]]*)
1937 SHLIB_LD='${CC} -G -z text';;
1939 SHLIB_LD="/usr/ccs/bin/ld -G -z text";;
1941 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1942 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1948 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1949 SHLIB_LD_LIBS='${LIBS}'
1950 DL_OBJS="tclLoadAout.o"
1952 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1953 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1954 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1955 if test "$GCC" != "yes" ; then
1956 CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
1959 UNIX_SV* | UnixWare-5*)
1960 SHLIB_CFLAGS="-KPIC"
1964 DL_OBJS="tclLoadDl.o"
1966 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1967 # that don't grok the -Bexport option. Test that it does.
1968 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1969 hold_ldflags=$LDFLAGS
1970 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1971 AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
1972 LDFLAGS=$hold_ldflags])
1973 if test $tcl_cv_ld_Bexport = yes; then
1974 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1981 if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
1982 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1985 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1986 dnl # until the end of configure, as configure's compile and link tests use
1987 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1988 dnl # preprocessing tests use only CPPFLAGS.
1989 SC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1991 # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
1992 # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
1993 # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
1994 # to determine which of several header files defines the a.out file
1995 # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
1996 # support only a file format that is more or less version-7-compatible.
1998 # - a.out files must begin with `struct exec'.
1999 # - the N_TXTOFF on the `struct exec' must compute the seek address
2000 # of the text segment
2001 # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
2002 # and a_entry fields.
2003 # The following compilation should succeed if and only if either sys/exec.h
2004 # or a.out.h is usable for the purpose.
2006 # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
2007 # `struct exec' includes a second header that contains information that
2008 # duplicates the v7 fields that are needed.
2010 if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
2011 AC_CACHE_CHECK([sys/exec.h], tcl_cv_sysexec_h, [
2012 AC_TRY_COMPILE([#include <sys/exec.h>],[
2016 #if defined(__mips) || defined(mips)
2017 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2019 seek = N_TXTOFF (foo);
2021 flag = (foo.a_magic == OMAGIC);
2022 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2023 ], tcl_cv_sysexec_h=usable, tcl_cv_sysexec_h=unusable)])
2024 if test $tcl_cv_sysexec_h = usable; then
2025 AC_DEFINE(USE_SYS_EXEC_H)
2027 AC_CACHE_CHECK([a.out.h], tcl_cv_aout_h, [
2028 AC_TRY_COMPILE([#include <a.out.h>],[
2032 #if defined(__mips) || defined(mips)
2033 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2035 seek = N_TXTOFF (foo);
2037 flag = (foo.a_magic == OMAGIC);
2038 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2039 ], tcl_cv_aout_h=usable, tcl_cv_aout_h=unusable)])
2040 if test $tcl_cv_aout_h = usable; then
2041 AC_DEFINE(USE_A_OUT_H)
2043 AC_CACHE_CHECK([sys/exec_aout.h], tcl_cv_sysexecaout_h, [
2044 AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
2048 #if defined(__mips) || defined(mips)
2049 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2051 seek = N_TXTOFF (foo);
2053 flag = (foo.a_midmag == OMAGIC);
2054 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2055 ], tcl_cv_sysexecaout_h=usable, tcl_cv_sysexecaout_h=unusable)])
2056 if test $tcl_cv_sysexecaout_h = usable; then
2057 AC_DEFINE(USE_SYS_EXEC_AOUT_H)
2065 # Step 5: disable dynamic loading if requested via a command-line switch.
2067 AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
2068 [tcl_ok=$enableval], [tcl_ok=yes])
2069 if test "$tcl_ok" = "no"; then
2073 if test "x$DL_OBJS" != "x" ; then
2074 BUILD_DLTEST="\$(DLTEST_TARGETS)"
2076 echo "Can't figure out how to do dynamic loading or shared libraries"
2077 echo "on this system."
2081 DL_OBJS="tclLoadNone.o"
2083 LDFLAGS="$LDFLAGS_ORIG"
2089 # If we're running gcc, then change the C flags for compiling shared
2090 # libraries to the right flags for gcc, instead of those for the
2091 # standard manufacturer compiler.
2093 if test "$DL_OBJS" != "tclLoadNone.o" ; then
2094 if test "$GCC" = "yes" ; then
2102 NetBSD-*|FreeBSD-*|OpenBSD-*)
2113 SHLIB_CFLAGS="-fPIC"
2119 if test "$SHARED_LIB_SUFFIX" = "" ; then
2120 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
2122 if test "$UNSHARED_LIB_SUFFIX" = "" ; then
2123 UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
2126 if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
2127 LIB_SUFFIX=${SHARED_LIB_SUFFIX}
2128 MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
2129 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
2131 LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
2133 if test "$RANLIB" = "" ; then
2134 MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
2135 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
2137 MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
2138 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
2141 dnl Not at all clear what this was doing in Tcl's configure.in
2142 dnl or why it was needed was needed. In any event, this sort of
2143 dnl things needs to be done in the big loop above.
2144 dnl REMOVE THIS BLOCK LATER! (mdejong)
2151 dnl SHLIB_LD_LIBS=""
2157 # Stub lib does not depend on shared/static configuration
2158 if test "$RANLIB" = "" ; then
2159 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
2160 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
2162 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
2163 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
2173 AC_SUBST(CFLAGS_DEBUG)
2174 AC_SUBST(CFLAGS_OPTIMIZE)
2175 AC_SUBST(CFLAGS_WARNING)
2178 AC_SUBST(LDFLAGS_DEBUG)
2179 AC_SUBST(LDFLAGS_OPTIMIZE)
2180 AC_SUBST(CC_SEARCH_FLAGS)
2181 AC_SUBST(LD_SEARCH_FLAGS)
2185 AC_SUBST(TCL_SHLIB_LD_EXTRAS)
2186 AC_SUBST(TK_SHLIB_LD_EXTRAS)
2187 AC_SUBST(SHLIB_LD_LIBS)
2188 AC_SUBST(SHLIB_CFLAGS)
2189 AC_SUBST(SHLIB_SUFFIX)
2192 AC_SUBST(MAKE_STUB_LIB)
2193 AC_SUBST(INSTALL_LIB)
2194 AC_SUBST(INSTALL_STUB_LIB)
2198 #--------------------------------------------------------------------
2201 # Determine which interface to use to talk to the serial port.
2202 # Note that #include lines must begin in leftmost column for
2203 # some compilers to recognize them as preprocessor directives,
2204 # and some build environments have stdin not pointing at a
2205 # pseudo-terminal (usually /dev/null instead.)
2212 # Defines only one of the following vars:
2218 #--------------------------------------------------------------------
2220 AC_DEFUN([SC_SERIAL_PORT], [
2221 AC_CHECK_HEADERS(sys/modem.h)
2222 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2224 #include <termios.h>
2228 if (tcgetattr(0, &t) == 0) {
2230 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2234 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2235 if test $tcl_cv_api_serial = no ; then
2241 if (ioctl(0, TCGETA, &t) == 0) {
2242 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2246 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2248 if test $tcl_cv_api_serial = no ; then
2254 if (ioctl(0, TIOCGETP, &t) == 0) {
2256 t.sg_flags |= ODDP | EVENP | RAW;
2260 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2262 if test $tcl_cv_api_serial = no ; then
2264 #include <termios.h>
2269 if (tcgetattr(0, &t) == 0
2270 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2272 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2276 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2278 if test $tcl_cv_api_serial = no; then
2285 if (ioctl(0, TCGETA, &t) == 0
2286 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2287 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2291 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2293 if test $tcl_cv_api_serial = no; then
2300 if (ioctl(0, TIOCGETP, &t) == 0
2301 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2303 t.sg_flags |= ODDP | EVENP | RAW;
2307 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2309 case $tcl_cv_api_serial in
2310 termios) AC_DEFINE(USE_TERMIOS);;
2311 termio) AC_DEFINE(USE_TERMIO);;
2312 sgtty) AC_DEFINE(USE_SGTTY);;
2316 #--------------------------------------------------------------------
2317 # SC_MISSING_POSIX_HEADERS
2319 # Supply substitutes for missing POSIX header files. Special
2321 # - stdlib.h doesn't define strtol, strtoul, or
2322 # strtod insome versions of SunOS
2323 # - some versions of string.h don't declare procedures such
2331 # Defines some of the following vars:
2335 # HAVE_LIMITS_H or NO_LIMITS_H
2345 #--------------------------------------------------------------------
2347 AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
2348 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2349 AC_TRY_LINK([#include <sys/types.h>
2350 #include <dirent.h>], [
2351 #ifndef _POSIX_SOURCE
2354 * Generate compilation error to make the test fail: Lynx headers
2355 * are only valid if really in the POSIX environment.
2358 missing_procedure();
2362 struct dirent *entryPtr;
2364 d = opendir("foobar");
2365 entryPtr = readdir(d);
2366 p = entryPtr->d_name;
2368 ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
2370 if test $tcl_cv_dirent_h = no; then
2371 AC_DEFINE(NO_DIRENT_H)
2374 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
2375 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
2376 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
2377 AC_CHECK_HEADER(limits.h,
2378 [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
2379 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2380 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2381 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2382 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2383 if test $tcl_ok = 0; then
2384 AC_DEFINE(NO_STDLIB_H)
2386 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2387 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2388 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2390 # See also memmove check below for a place where NO_STRING_H can be
2393 if test $tcl_ok = 0; then
2394 AC_DEFINE(NO_STRING_H)
2397 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
2398 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
2400 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2401 AC_HAVE_HEADERS(unistd.h sys/param.h)
2404 #--------------------------------------------------------------------
2407 # Locate the X11 header files and the X11 library archive. Try
2408 # the ac_path_x macro first, but if it doesn't find the X stuff
2409 # (e.g. because there's no xmkmf program) then check through
2410 # a list of possible directories. Under some conditions the
2411 # autoconf macro will return an include directory that contains
2412 # no include files, so double-check its result just to be safe.
2419 # Sets the the following vars:
2423 #--------------------------------------------------------------------
2425 AC_DEFUN([SC_PATH_X], [
2428 if test "$no_x" = ""; then
2429 if test "$x_includes" = ""; then
2430 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2432 if test ! -r $x_includes/X11/Intrinsic.h; then
2433 not_really_there="yes"
2437 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2438 AC_MSG_CHECKING([for X11 header files])
2439 found_xincludes="no"
2440 AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2441 if test "$found_xincludes" = "no"; then
2442 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"
2444 if test -r $i/X11/Intrinsic.h; then
2447 found_xincludes="yes"
2453 if test "$x_includes" != ""; then
2454 XINCLUDES="-I$x_includes"
2455 found_xincludes="yes"
2458 if test found_xincludes = "no"; then
2459 AC_MSG_RESULT([couldn't find any!])
2462 if test "$no_x" = yes; then
2463 AC_MSG_CHECKING([for X11 libraries])
2465 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"
2467 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
2475 if test "$x_libraries" = ""; then
2478 XLIBSW="-L$x_libraries -lX11"
2481 if test "$XLIBSW" = nope ; then
2482 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2484 if test "$XLIBSW" = nope ; then
2485 AC_MSG_RESULT([could not find any! Using -lX11.])
2490 #--------------------------------------------------------------------
2493 # The statements below check for systems where POSIX-style
2494 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2495 # On these systems (mostly older ones), use the old BSD-style
2496 # FIONBIO approach instead.
2503 # Defines some of the following vars:
2509 #--------------------------------------------------------------------
2511 AC_DEFUN([SC_BLOCKING_STYLE], [
2512 AC_CHECK_HEADERS(sys/ioctl.h)
2513 AC_CHECK_HEADERS(sys/filio.h)
2515 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2517 # There used to be code here to use FIONBIO under AIX. However, it
2518 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
2519 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
2520 # code (JO, 5/31/97).
2523 AC_DEFINE(USE_FIONBIO)
2524 AC_MSG_RESULT([FIONBIO])
2527 AC_DEFINE(USE_FIONBIO)
2528 AC_MSG_RESULT([FIONBIO])
2531 AC_DEFINE(USE_FIONBIO)
2532 AC_MSG_RESULT([FIONBIO])
2535 AC_MSG_RESULT([O_NONBLOCK])
2540 #--------------------------------------------------------------------
2543 # Checks how the system deals with time.h, what time structures
2544 # are used on the system, and what fields the structures have.
2551 # Defines some of the following vars:
2557 #--------------------------------------------------------------------
2559 AC_DEFUN([SC_TIME_HANDLER], [
2560 AC_CHECK_HEADERS(sys/time.h)
2564 AC_CHECK_FUNCS(gmtime_r localtime_r)
2566 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2567 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2568 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
2569 if test $tcl_cv_member_tm_tzadj = yes ; then
2570 AC_DEFINE(HAVE_TM_TZADJ)
2573 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2574 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2575 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
2576 if test $tcl_cv_member_tm_gmtoff = yes ; then
2577 AC_DEFINE(HAVE_TM_GMTOFF)
2581 # Its important to include time.h in this check, as some systems
2582 # (like convex) have timezone functions, etc.
2584 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2585 AC_TRY_COMPILE([#include <time.h>],
2586 [extern long timezone;
2589 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
2590 if test $tcl_cv_timezone_long = yes ; then
2591 AC_DEFINE(HAVE_TIMEZONE_VAR)
2594 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2596 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2597 AC_TRY_COMPILE([#include <time.h>],
2598 [extern time_t timezone;
2601 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
2602 if test $tcl_cv_timezone_time = yes ; then
2603 AC_DEFINE(HAVE_TIMEZONE_VAR)
2608 #--------------------------------------------------------------------
2611 # Under Solaris 2.4, strtod returns the wrong value for the
2612 # terminating character under some conditions. Check for this
2613 # and if the problem exists use a substitute procedure
2614 # "fixstrtod" (provided by Tcl) that corrects the error.
2615 # Also, on Compaq's Tru64 Unix 5.0,
2616 # strtod(" ") returns 0.0 instead of a failure to convert.
2623 # Might defines some of the following vars:
2624 # strtod (=fixstrtod)
2626 #--------------------------------------------------------------------
2628 AC_DEFUN([SC_BUGGY_STRTOD], [
2629 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2630 if test "$tcl_strtod" = 1; then
2631 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2633 extern double strtod();
2635 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2638 value = strtod(infString, &term);
2639 if ((term != infString) && (term[-1] == 0)) {
2642 value = strtod(nanString, &term);
2643 if ((term != nanString) && (term[-1] == 0)) {
2646 value = strtod(spaceString, &term);
2647 if (term == (spaceString+1)) {
2651 }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2652 tcl_cv_strtod_buggy=buggy)])
2653 if test "$tcl_cv_strtod_buggy" = buggy; then
2654 LIBOBJS="$LIBOBJS fixstrtod.o"
2655 AC_DEFINE(strtod, fixstrtod)
2660 #--------------------------------------------------------------------
2663 # Search for the libraries needed to link the Tcl shell.
2664 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2665 # -lnsl) are dealt with here.
2668 # Requires the following vars to be set in the Makefile:
2675 # Subst's the following var:
2679 # Might append to the following vars:
2682 # Might define the following vars:
2685 #--------------------------------------------------------------------
2687 AC_DEFUN([SC_TCL_LINK_LIBS], [
2688 #--------------------------------------------------------------------
2689 # On a few very rare systems, all of the libm.a stuff is
2690 # already in libc.a. Set compiler flags accordingly.
2691 # Also, Linux requires the "ieee" library for math to work
2692 # right (and it must appear before "-lm").
2693 #--------------------------------------------------------------------
2695 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2696 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2698 #--------------------------------------------------------------------
2699 # Interactive UNIX requires -linet instead of -lsocket, plus it
2700 # needs net/errno.h to define the socket-related error codes.
2701 #--------------------------------------------------------------------
2703 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2704 AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
2706 #--------------------------------------------------------------------
2707 # Check for the existence of the -lsocket and -lnsl libraries.
2708 # The order here is important, so that they end up in the right
2709 # order in the command line generated by make. Here are some
2710 # special considerations:
2711 # 1. Use "connect" and "accept" to check for -lsocket, and
2712 # "gethostbyname" to check for -lnsl.
2713 # 2. Use each function name only once: can't redo a check because
2714 # autoconf caches the results of the last check and won't redo it.
2715 # 3. Use -lnsl and -lsocket only if they supply procedures that
2716 # aren't already present in the normal libraries. This is because
2717 # IRIX 5.2 has libraries, but they aren't needed and they're
2718 # bogus: they goof up name resolution if used.
2719 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2720 # To get around this problem, check for both libraries together
2721 # if -lsocket doesn't work by itself.
2722 #--------------------------------------------------------------------
2725 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2726 if test "$tcl_checkSocket" = 1; then
2727 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2728 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2730 if test "$tcl_checkBoth" = 1; then
2732 LIBS="$LIBS -lsocket -lnsl"
2733 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2735 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2736 [LIBS="$LIBS -lnsl"])])
2738 # Don't perform the eval of the libraries here because DL_LIBS
2739 # won't be set until we call SC_CONFIG_CFLAGS
2741 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2746 #--------------------------------------------------------------------
2747 # SC_TCL_EARLY_FLAGS
2749 # Check for what flags are needed to be passed so the correct OS
2750 # features are available.
2757 # Might define the following vars:
2759 # _LARGEFILE64_SOURCE
2760 # _LARGEFILE_SOURCE64
2762 #--------------------------------------------------------------------
2764 AC_DEFUN([SC_TCL_EARLY_FLAG],[
2765 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2766 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2767 AC_TRY_COMPILE([[#define ]$1[ 1
2769 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2770 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2771 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2773 tcl_flags="$tcl_flags $1"
2777 AC_DEFUN([SC_TCL_EARLY_FLAGS],[
2778 AC_MSG_CHECKING([for required early compiler flags])
2780 SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2781 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2782 SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2783 [struct stat64 buf; int i = stat64("/", &buf);])
2784 SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2785 [char *p = (char *)open64;])
2786 if test "x${tcl_flags}" = "x" ; then
2787 AC_MSG_RESULT([none])
2789 AC_MSG_RESULT([${tcl_flags}])
2793 #--------------------------------------------------------------------
2794 # SC_TCL_64BIT_FLAGS
2796 # Check for what is defined in the way of 64-bit features.
2803 # Might define the following vars:
2804 # TCL_WIDE_INT_IS_LONG
2806 # HAVE_STRUCT_DIRENT64
2807 # HAVE_STRUCT_STAT64
2810 #--------------------------------------------------------------------
2812 AC_DEFUN([SC_TCL_64BIT_FLAGS], [
2813 AC_MSG_CHECKING([for 64-bit integer type])
2814 AC_CACHE_VAL(tcl_cv_type_64bit,[
2815 tcl_cv_type_64bit=none
2816 # See if the compiler knows natively about __int64
2817 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2818 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2819 # See if we should use long anyway Note that we substitute in the
2820 # type that is our current guess for a 64-bit type inside this check
2821 # program, so it should be modified only carefully...
2822 AC_TRY_COMPILE(,[switch (0) {
2823 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2824 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2825 if test "${tcl_cv_type_64bit}" = none ; then
2826 AC_DEFINE(TCL_WIDE_INT_IS_LONG)
2827 AC_MSG_RESULT([using long])
2829 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
2830 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2832 # Now check for auxiliary declarations
2833 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2834 AC_TRY_COMPILE([#include <sys/types.h>
2835 #include <sys/dirent.h>],[struct dirent64 p;],
2836 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2837 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2838 AC_DEFINE(HAVE_STRUCT_DIRENT64)
2841 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2842 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2844 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2845 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2846 AC_DEFINE(HAVE_STRUCT_STAT64)
2849 AC_CHECK_FUNCS(open64 lseek64)
2850 AC_MSG_CHECKING([for off64_t])
2851 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2852 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2854 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2855 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2856 dnl functions lseek64 and open64 are defined.
2857 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2858 test "x${ac_cv_func_lseek64}" = "xyes" && \
2859 test "x${ac_cv_func_open64}" = "xyes" ; then
2860 AC_DEFINE(HAVE_TYPE_OFF64_T)
2861 AC_MSG_RESULT([yes])
2868 #--------------------------------------------------------------------
2869 # SC_TCL_GETHOSTBYADDR_R
2871 # Check if we have MT-safe variant of gethostbyaddr().
2878 # Might define the following vars:
2879 # HAVE_GETHOSTBYADDR_R
2880 # HAVE_GETHOSTBYADDR_R_7
2881 # HAVE_GETHOSTBYADDR_R_8
2883 #--------------------------------------------------------------------
2885 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
2886 AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
2893 struct hostent *result;
2898 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2900 ], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)])
2901 tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
2902 if test "$tcl_ok" = yes; then
2903 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
2905 AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
2912 struct hostent *result, *resultp;
2917 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2918 &resultp, &h_errnop);
2919 ], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)])
2920 tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
2921 if test "$tcl_ok" = yes; then
2922 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
2925 if test "$tcl_ok" = yes; then
2926 AC_DEFINE(HAVE_GETHOSTBYADDR_R)
2930 #--------------------------------------------------------------------
2931 # SC_TCL_GETHOSTBYNAME_R
2933 # Check to see what variant of gethostbyname_r() we have.
2934 # Based on David Arnold's example from the comp.programming.threads
2942 # Might define the following vars:
2943 # HAVE_GETHOSTBYADDR_R
2944 # HAVE_GETHOSTBYADDR_R_3
2945 # HAVE_GETHOSTBYADDR_R_5
2946 # HAVE_GETHOSTBYADDR_R_6
2948 #--------------------------------------------------------------------
2950 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
2951 AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
2956 struct hostent *he, *res;
2961 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
2962 ], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)])
2963 tcl_ok=$tcl_cv_api_gethostbyname_r_6
2964 if test "$tcl_ok" = yes; then
2965 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
2967 AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
2977 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
2978 ], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)])
2979 tcl_ok=$tcl_cv_api_gethostbyname_r_5
2980 if test "$tcl_ok" = yes; then
2981 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
2983 AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
2989 struct hostent_data data;
2991 (void) gethostbyname_r(name, he, &data);
2992 ], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)])
2993 tcl_ok=$tcl_cv_api_gethostbyname_r_3
2994 if test "$tcl_ok" = yes; then
2995 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
2999 if test "$tcl_ok" = yes; then
3000 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3004 #--------------------------------------------------------------------
3007 # Check if we have MT-safe variant of getpwuid() and if yes,
3008 # which one exactly.
3015 # Might define the following vars:
3020 #--------------------------------------------------------------------
3022 AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
3023 AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
3025 #include <sys/types.h>
3029 struct passwd pw, *pwp;
3033 (void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
3034 ], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)])
3035 tcl_ok=$tcl_cv_api_getpwuid_r_5
3036 if test "$tcl_ok" = yes; then
3037 AC_DEFINE(HAVE_GETPWUID_R_5)
3039 AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
3041 #include <sys/types.h>
3049 (void)getpwnam_r(uid, &pw, buf, buflen);
3050 ], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)])
3051 tcl_ok=$tcl_cv_api_getpwuid_r_4
3052 if test "$tcl_ok" = yes; then
3053 AC_DEFINE(HAVE_GETPWUID_R_4)
3056 if test "$tcl_ok" = yes; then
3057 AC_DEFINE(HAVE_GETPWUID_R)
3061 #--------------------------------------------------------------------
3064 # Check if we have MT-safe variant of getpwnam() and if yes,
3065 # which one exactly.
3072 # Might define the following vars:
3077 #--------------------------------------------------------------------
3079 AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
3080 AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
3082 #include <sys/types.h>
3086 struct passwd pw, *pwp;
3090 (void) getpwnam_r(name, &pw, buf, buflen, &pwp);
3091 ], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)])
3092 tcl_ok=$tcl_cv_api_getpwnam_r_5
3093 if test "$tcl_ok" = yes; then
3094 AC_DEFINE(HAVE_GETPWNAM_R_5)
3096 AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
3098 #include <sys/types.h>
3106 (void)getpwnam_r(name, &pw, buf, buflen);
3107 ], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)])
3108 tcl_ok=$tcl_cv_api_getpwnam_r_4
3109 if test "$tcl_ok" = yes; then
3110 AC_DEFINE(HAVE_GETPWNAM_R_4)
3113 if test "$tcl_ok" = yes; then
3114 AC_DEFINE(HAVE_GETPWNAM_R)
3118 #--------------------------------------------------------------------
3121 # Check if we have MT-safe variant of getgrgid() and if yes,
3122 # which one exactly.
3129 # Might define the following vars:
3134 #--------------------------------------------------------------------
3136 AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
3137 AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
3139 #include <sys/types.h>
3143 struct group gr, *grp;
3147 (void) getgrgid_r(gid, &gr, buf, buflen, &grp);
3148 ], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)])
3149 tcl_ok=$tcl_cv_api_getgrgid_r_5
3150 if test "$tcl_ok" = yes; then
3151 AC_DEFINE(HAVE_GETGRGID_R_5)
3153 AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
3155 #include <sys/types.h>
3163 (void)getgrgid_r(gid, &gr, buf, buflen);
3164 ], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)])
3165 tcl_ok=$tcl_cv_api_getgrgid_r_4
3166 if test "$tcl_ok" = yes; then
3167 AC_DEFINE(HAVE_GETGRGID_R_4)
3170 if test "$tcl_ok" = yes; then
3171 AC_DEFINE(HAVE_GETGRGID_R)
3175 #--------------------------------------------------------------------
3178 # Check if we have MT-safe variant of getgrnam() and if yes,
3179 # which one exactly.
3186 # Might define the following vars:
3191 #--------------------------------------------------------------------
3193 AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
3194 AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
3196 #include <sys/types.h>
3200 struct group gr, *grp;
3204 (void) getgrnam_r(name, &gr, buf, buflen, &grp);
3205 ], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)])
3206 tcl_ok=$tcl_cv_api_getgrnam_r_5
3207 if test "$tcl_ok" = yes; then
3208 AC_DEFINE(HAVE_GETGRNAM_R_5)
3210 AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
3212 #include <sys/types.h>
3220 (void)getgrnam_r(name, &gr, buf, buflen);
3221 ], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)])
3222 tcl_ok=$tcl_cv_api_getgrnam_r_4
3223 if test "$tcl_ok" = yes; then
3224 AC_DEFINE(HAVE_GETGRNAM_R_4)
3227 if test "$tcl_ok" = yes; then
3228 AC_DEFINE(HAVE_GETGRNAM_R)
3232 #--------------------------------------------------------------------
3233 # SC_CONFIG_COMMANDS_PRE(CMDS)
3235 # Replacement for autoconf 2.5x AC_COMMANDS_PRE:
3236 # Commands to run right before config.status is
3237 # created. Accumulates.
3239 # Requires presence of SC_OUTPUT_COMMANDS_PRE at the end
3240 # of configure.in (right before AC_OUTPUT).
3242 #--------------------------------------------------------------------
3244 AC_DEFUN([SC_CONFIG_COMMANDS_PRE], [
3245 define([SC_OUTPUT_COMMANDS_PRE], defn([SC_OUTPUT_COMMANDS_PRE])[$1
3247 AC_DEFUN([SC_OUTPUT_COMMANDS_PRE])