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])
119 TCL_BIN_DIR=${ac_cv_c_tclconfig}
120 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
125 #------------------------------------------------------------------------
126 # SC_PATH_TKCONFIG --
128 # Locate the tkConfig.sh file
135 # Adds the following arguments to configure:
138 # Defines the following vars:
139 # TK_BIN_DIR Full path to the directory containing
140 # the tkConfig.sh file
141 #------------------------------------------------------------------------
143 AC_DEFUN([SC_PATH_TKCONFIG], [
145 # Ok, lets find the tk configuration
146 # First, look for one uninstalled.
147 # the alternative search directory is invoked by --with-tk
150 if test x"${no_tk}" = x ; then
151 # we reset no_tk in case something fails here
153 AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
154 AC_MSG_CHECKING([for Tk configuration])
155 AC_CACHE_VAL(ac_cv_c_tkconfig,[
157 # First check to see if --with-tkconfig was specified.
158 if test x"${with_tkconfig}" != x ; then
159 if test -f "${with_tkconfig}/tkConfig.sh" ; then
160 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
162 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
166 # then check for a private Tk library
168 *-*-cygwin*) platDir="win" ;;
171 if test x"${ac_cv_c_tkconfig}" = x ; then
174 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
175 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
176 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
178 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
179 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
180 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
182 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
183 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
184 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
185 if test -f "$i/$platDir/tkConfig.sh" ; then
186 ac_cv_c_tkconfig=`(cd $i/$platDir; pwd)`
192 # on Darwin, check in Framework installation locations
193 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
194 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
195 `ls -d /Library/Frameworks 2>/dev/null` \
196 `ls -d /Network/Library/Frameworks 2>/dev/null` \
197 `ls -d /System/Library/Frameworks 2>/dev/null` \
199 if test -f "$i/Tk.framework/tkConfig.sh" ; then
200 ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)`
206 # check in a few common install locations
207 if test x"${ac_cv_c_tkconfig}" = x ; then
208 for i in `ls -d ${libdir} 2>/dev/null` \
209 `ls -d ${exec_prefix}/lib 2>/dev/null` \
210 `ls -d ${prefix}/lib 2>/dev/null` \
211 `ls -d /usr/local/lib 2>/dev/null` \
212 `ls -d /usr/contrib/lib 2>/dev/null` \
213 `ls -d /usr/lib 2>/dev/null` \
215 if test -f "$i/tkConfig.sh" ; then
216 ac_cv_c_tkconfig=`(cd $i; pwd)`
221 # check in a few other private locations
222 if test x"${ac_cv_c_tkconfig}" = x ; then
225 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
226 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
227 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
228 if test -f "$i/$platDir/tkConfig.sh" ; then
229 ac_cv_c_tkconfig=`(cd $i/$platDir; pwd)`
236 if test x"${ac_cv_c_tkconfig}" = x ; then
237 TK_BIN_DIR="# no Tk configs found"
238 AC_MSG_WARN([Can't find Tk configuration definitions])
241 TK_BIN_DIR=${ac_cv_c_tkconfig}
242 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
247 #------------------------------------------------------------------------
248 # SC_LOAD_TCLCONFIG --
250 # Load the tclConfig.sh file
254 # Requires the following vars to be set:
259 # Subst the following vars:
264 #------------------------------------------------------------------------
266 AC_DEFUN([SC_LOAD_TCLCONFIG], [
267 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
269 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
270 AC_MSG_RESULT([loading])
271 . ${TCL_BIN_DIR}/tclConfig.sh
273 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
276 # eval is required to do the TCL_DBGX substitution
277 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
278 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
280 # If the TCL_BIN_DIR is the build directory (not the install directory),
281 # then set the common variable name to the value of the build variables.
282 # For example, the variable TCL_LIB_SPEC will be set to the value
283 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
284 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
285 # installed and uninstalled version of Tcl.
286 if test -f "${TCL_BIN_DIR}/Makefile" ; then
287 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
288 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
289 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
290 elif test "`uname -s`" = "Darwin"; then
291 # If Tcl was built as a framework, attempt to use the libraries
292 # from the framework at the given location so that linking works
293 # against Tcl.framework installed in an arbitrary location.
296 if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
297 for i in "`cd ${TCL_BIN_DIR}; pwd`" \
298 "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
299 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
300 TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
305 if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
306 TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
307 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
313 # eval is required to do the TCL_DBGX substitution
314 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
315 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
316 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
317 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
319 AC_SUBST(TCL_VERSION)
320 AC_SUBST(TCL_PATCH_LEVEL)
321 AC_SUBST(TCL_BIN_DIR)
322 AC_SUBST(TCL_SRC_DIR)
324 AC_SUBST(TCL_LIB_FILE)
325 AC_SUBST(TCL_LIB_FLAG)
326 AC_SUBST(TCL_LIB_SPEC)
328 AC_SUBST(TCL_STUB_LIB_FILE)
329 AC_SUBST(TCL_STUB_LIB_FLAG)
330 AC_SUBST(TCL_STUB_LIB_SPEC)
333 #------------------------------------------------------------------------
334 # SC_LOAD_TKCONFIG --
336 # Load the tkConfig.sh file
340 # Requires the following vars to be set:
345 # Sets the following vars that should be in tkConfig.sh:
347 #------------------------------------------------------------------------
349 AC_DEFUN([SC_LOAD_TKCONFIG], [
350 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
352 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
353 AC_MSG_RESULT([loading])
354 . ${TK_BIN_DIR}/tkConfig.sh
356 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
359 # eval is required to do the TK_DBGX substitution
360 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
361 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
363 # If the TK_BIN_DIR is the build directory (not the install directory),
364 # then set the common variable name to the value of the build variables.
365 # For example, the variable TK_LIB_SPEC will be set to the value
366 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
367 # instead of TK_BUILD_LIB_SPEC since it will work with both an
368 # installed and uninstalled version of Tcl.
369 if test -f "${TK_BIN_DIR}/Makefile" ; then
370 TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
371 TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
372 TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
373 elif test "`uname -s`" = "Darwin"; then
374 # If Tk was built as a framework, attempt to use the libraries
375 # from the framework at the given location so that linking works
376 # against Tk.framework installed in an arbitrary location.
379 if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
380 for i in "`cd ${TK_BIN_DIR}; pwd`" \
381 "`cd ${TK_BIN_DIR}/../..; pwd`"; do
382 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
383 TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}"
388 if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
389 TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
390 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
396 # eval is required to do the TK_DBGX substitution
397 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
398 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
399 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
400 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
406 AC_SUBST(TK_LIB_FILE)
407 AC_SUBST(TK_LIB_FLAG)
408 AC_SUBST(TK_LIB_SPEC)
410 AC_SUBST(TK_STUB_LIB_FILE)
411 AC_SUBST(TK_STUB_LIB_FLAG)
412 AC_SUBST(TK_STUB_LIB_SPEC)
415 #------------------------------------------------------------------------
417 # Locate a tclsh shell installed on the system path. This macro
418 # will only find a Tcl shell that already exists on the system.
419 # It will not find a Tcl shell in the Tcl build directory or
420 # a Tcl shell that has been installed from the Tcl build directory.
421 # If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
422 # be set to "". Extensions should take care not to create Makefile
423 # rules that are run by default and depend on TCLSH_PROG. An
424 # extension can't assume that an executable Tcl shell exists at
431 # Subst's the following values:
433 #------------------------------------------------------------------------
435 AC_DEFUN([SC_PROG_TCLSH], [
436 AC_MSG_CHECKING([for tclsh])
437 AC_CACHE_VAL(ac_cv_path_tclsh, [
438 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
439 for dir in $search_path ; do
440 for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \
441 `ls -r $dir/tclsh* 2> /dev/null` ; do
442 if test x"$ac_cv_path_tclsh" = x ; then
443 if test -f "$j" ; then
452 if test -f "$ac_cv_path_tclsh" ; then
453 TCLSH_PROG="$ac_cv_path_tclsh"
454 AC_MSG_RESULT([$TCLSH_PROG])
456 # It is not an error if an installed version of Tcl can't be located.
458 AC_MSG_RESULT([No tclsh found on PATH])
463 #------------------------------------------------------------------------
465 # Determine the fully qualified path name of the tclsh executable
466 # in the Tcl build directory. This macro will correctly determine
467 # the name of the tclsh executable even if tclsh has not yet
468 # been built in the build directory. The build tclsh must be used
469 # when running tests from an extension build directory. It is not
470 # correct to use the TCLSH_PROG in cases like this.
476 # Subst's the following values:
478 #------------------------------------------------------------------------
480 AC_DEFUN([SC_BUILD_TCLSH], [
481 AC_MSG_CHECKING([for tclsh in Tcl build directory])
482 BUILD_TCLSH=${TCL_BIN_DIR}/tclsh
483 AC_MSG_RESULT([$BUILD_TCLSH])
484 AC_SUBST(BUILD_TCLSH)
487 #------------------------------------------------------------------------
488 # SC_ENABLE_SHARED --
490 # Allows the building of shared libraries
497 # Adds the following arguments to configure:
498 # --enable-shared=yes|no
500 # Defines the following vars:
501 # STATIC_BUILD Used for building import/export libraries
504 # Sets the following vars:
505 # SHARED_BUILD Value of 1 or 0
506 #------------------------------------------------------------------------
508 AC_DEFUN([SC_ENABLE_SHARED], [
509 AC_MSG_CHECKING([how to build libraries])
510 AC_ARG_ENABLE(shared,
511 [ --enable-shared build and link with shared libraries [--enable-shared]],
512 [tcl_ok=$enableval], [tcl_ok=yes])
514 if test "${enable_shared+set}" = set; then
515 enableval="$enable_shared"
521 if test "$tcl_ok" = "yes" ; then
522 AC_MSG_RESULT([shared])
525 AC_MSG_RESULT([static])
527 AC_DEFINE(STATIC_BUILD)
531 #------------------------------------------------------------------------
532 # SC_ENABLE_FRAMEWORK --
534 # Allows the building of shared libraries into frameworks
541 # Adds the following arguments to configure:
542 # --enable-framework=yes|no
544 # Sets the following vars:
545 # FRAMEWORK_BUILD Value of 1 or 0
546 #------------------------------------------------------------------------
548 AC_DEFUN([SC_ENABLE_FRAMEWORK], [
549 if test "`uname -s`" = "Darwin" ; then
550 AC_MSG_CHECKING([how to package libraries])
551 AC_ARG_ENABLE(framework,
552 [ --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]],
553 [enable_framework=$enableval], [enable_framework=no])
554 if test $enable_framework = yes; then
555 if test $SHARED_BUILD = 0; then
556 AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes])
559 if test $tcl_corefoundation = no; then
560 AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available])
564 if test $enable_framework = yes; then
565 AC_MSG_RESULT([framework])
568 if test $SHARED_BUILD = 1; then
569 AC_MSG_RESULT([shared library])
571 AC_MSG_RESULT([static library])
578 #------------------------------------------------------------------------
579 # SC_ENABLE_THREADS --
581 # Specify if thread support should be enabled. TCL_THREADS is
582 # checked so that if you are compiling an extension against a
583 # threaded core, your extension must be compiled threaded as well.
590 # Adds the following arguments to configure:
593 # Sets the following vars:
594 # THREADS_LIBS Thread library(s)
596 # Defines the following vars:
601 #------------------------------------------------------------------------
603 AC_DEFUN([SC_ENABLE_THREADS], [
604 AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
605 [tcl_ok=$enableval], [tcl_ok=no])
607 if test "${TCL_THREADS}" = 1; then
611 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
613 # USE_THREAD_ALLOC tells us to try the special thread-based
614 # allocator that significantly reduces lock contention
615 AC_DEFINE(USE_THREAD_ALLOC)
616 AC_DEFINE(_REENTRANT)
617 if test "`uname -s`" = "SunOS" ; then
618 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
620 AC_DEFINE(_THREAD_SAFE)
621 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
622 if test "$tcl_ok" = "no"; then
623 # Check a little harder for __pthread_mutex_init in the same
624 # library, as some systems hide it there until pthread.h is
625 # defined. We could alternatively do an AC_TRY_COMPILE with
626 # pthread.h, but that will work with libpthread really doesn't
627 # exist, like AIX 4.2. [Bug: 4359]
628 AC_CHECK_LIB(pthread, __pthread_mutex_init,
629 tcl_ok=yes, tcl_ok=no)
632 if test "$tcl_ok" = "yes"; then
633 # The space is needed
634 THREADS_LIBS=" -lpthread"
636 AC_CHECK_LIB(pthreads, pthread_mutex_init,
637 tcl_ok=yes, tcl_ok=no)
638 if test "$tcl_ok" = "yes"; then
639 # The space is needed
640 THREADS_LIBS=" -lpthreads"
642 AC_CHECK_LIB(c, pthread_mutex_init,
643 tcl_ok=yes, tcl_ok=no)
644 if test "$tcl_ok" = "no"; then
645 AC_CHECK_LIB(c_r, pthread_mutex_init,
646 tcl_ok=yes, tcl_ok=no)
647 if test "$tcl_ok" = "yes"; then
648 # The space is needed
649 THREADS_LIBS=" -pthread"
652 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...])
658 # Does the pthread-implementation provide
659 # 'pthread_attr_setstacksize' ?
662 LIBS="$LIBS $THREADS_LIBS"
663 AC_CHECK_FUNCS(pthread_attr_setstacksize)
664 AC_CHECK_FUNCS(pthread_atfork)
669 # Do checking message here to not mess up interleaved configure output
670 AC_MSG_CHECKING([for building with threads])
671 if test "${TCL_THREADS}" = 1; then
672 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
673 if test "${tcl_threaded_core}" = 1; then
674 AC_MSG_RESULT([yes (threaded core)])
679 AC_MSG_RESULT([no (default)])
682 AC_SUBST(TCL_THREADS)
685 #------------------------------------------------------------------------
686 # SC_ENABLE_SYMBOLS --
688 # Specify if debugging symbols should be used.
689 # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
690 # can also be enabled.
695 # Requires the following vars to be set in the Makefile:
703 # Adds the following arguments to configure:
706 # Defines the following vars:
707 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
708 # Sets to $(CFLAGS_OPTIMIZE) if false
709 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
710 # Sets to $(LDFLAGS_OPTIMIZE) if false
711 # DBGX Debug library extension
713 #------------------------------------------------------------------------
715 AC_DEFUN([SC_ENABLE_SYMBOLS], [
716 AC_MSG_CHECKING([for build with symbols])
717 AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
718 # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
719 if test "$tcl_ok" = "no"; then
720 CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
721 LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
725 CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
726 LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
728 if test "$tcl_ok" = "yes"; then
729 AC_MSG_RESULT([yes (standard debugging)])
732 AC_SUBST(CFLAGS_DEFAULT)
733 AC_SUBST(LDFLAGS_DEFAULT)
735 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
736 AC_DEFINE(TCL_MEM_DEBUG)
739 if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
740 AC_DEFINE(TCL_COMPILE_DEBUG)
741 AC_DEFINE(TCL_COMPILE_STATS)
744 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
745 if test "$tcl_ok" = "all"; then
746 AC_MSG_RESULT([enabled symbols mem compile debugging])
748 AC_MSG_RESULT([enabled $tcl_ok debugging])
753 #------------------------------------------------------------------------
754 # SC_ENABLE_LANGINFO --
756 # Allows use of modern nl_langinfo check for better l10n.
757 # This is only relevant for Unix.
764 # Adds the following arguments to configure:
765 # --enable-langinfo=yes|no (default is yes)
767 # Defines the following vars:
768 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
770 #------------------------------------------------------------------------
772 AC_DEFUN([SC_ENABLE_LANGINFO], [
773 AC_ARG_ENABLE(langinfo,
774 [ --enable-langinfo use nl_langinfo if possible to determine
775 encoding at startup, otherwise use old heuristic],
776 [langinfo_ok=$enableval], [langinfo_ok=yes])
779 if test "$langinfo_ok" = "yes"; then
780 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
782 AC_MSG_CHECKING([whether to use nl_langinfo])
783 if test "$langinfo_ok" = "yes"; then
784 AC_CACHE_VAL(tcl_cv_langinfo_h, [
785 AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
786 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
787 AC_MSG_RESULT([$tcl_cv_langinfo_h])
788 if test $tcl_cv_langinfo_h = yes; then
789 AC_DEFINE(HAVE_LANGINFO)
792 AC_MSG_RESULT([$langinfo_ok])
796 #--------------------------------------------------------------------
799 # Decide whether to use symlinks for linking the manpages,
800 # whether to compress the manpages after installation, and
801 # whether to add a package name suffix to the installed
802 # manpages to avoidfile name clashes.
803 # If compression is enabled also find out what file name suffix
804 # the given compression program is using.
811 # Adds the following arguments to configure:
812 # --enable-man-symlinks
813 # --enable-man-compression=PROG
814 # --enable-man-suffix[=STRING]
816 # Defines the following variable:
818 # MAN_FLAGS - The appropriate flags for installManPage
819 # according to the user's selection.
821 #--------------------------------------------------------------------
823 AC_DEFUN([SC_CONFIG_MANPAGES], [
824 AC_MSG_CHECKING([whether to use symlinks for manpages])
825 AC_ARG_ENABLE(man-symlinks,
826 [ --enable-man-symlinks use symlinks for the manpages],
827 test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
829 AC_MSG_RESULT([$enableval])
831 AC_MSG_CHECKING([whether to compress the manpages])
832 AC_ARG_ENABLE(man-compression,
833 [ --enable-man-compression=PROG
834 compress the manpages with PROG],
836 yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
838 *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
841 AC_MSG_RESULT([$enableval])
842 if test "$enableval" != "no"; then
843 AC_MSG_CHECKING([for compressed file suffix])
846 Z=`ls TeST* | sed 's/^....//'`
848 MAN_FLAGS="$MAN_FLAGS --extension $Z"
852 AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
853 AC_ARG_ENABLE(man-suffix,
854 [ --enable-man-suffix=STRING
855 use STRING as a suffix to manpage file names
858 yes) enableval="$1" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
860 *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
863 AC_MSG_RESULT([$enableval])
868 #--------------------------------------------------------------------
871 # Determine what the system is (some things cannot be easily checked
872 # on a feature-driven basis, alas). This can usually be done via the
873 # "uname" command, but there are a few systems, like Next, where
880 # Defines the following var:
882 # system - System/platform/version identification code.
884 #--------------------------------------------------------------------
886 AC_DEFUN([SC_CONFIG_SYSTEM], [
887 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
888 if test -f /usr/lib/NextStep/software_version; then
889 tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
891 tcl_cv_sys_version=`uname -s`-`uname -r`
892 if test "$?" -ne 0 ; then
893 AC_MSG_WARN([can't find uname command])
894 tcl_cv_sys_version=unknown
896 # Special check for weird MP-RAS system (uname returns weird
897 # results, and the version is kept in special file).
899 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
900 tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
902 if test "`uname -s`" = "AIX" ; then
903 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
908 system=$tcl_cv_sys_version
911 #--------------------------------------------------------------------
914 # Try to determine the proper flags to pass to the compiler
915 # for building shared libraries and other such nonsense.
922 # Defines and substitutes the following vars:
924 # DL_OBJS - Name of the object file that implements dynamic
925 # loading for Tcl on this system.
926 # DL_LIBS - Library file(s) to include in tclsh and other base
927 # applications in order for the "load" command to work.
928 # LDFLAGS - Flags to pass to the compiler when linking object
929 # files into an executable application binary such
931 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
932 # that tell the run-time dynamic linker where to look
933 # for shared libraries such as libtcl.so. Depends on
934 # the variable LIB_RUNTIME_DIR in the Makefile. Could
935 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
936 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
937 # that tell the run-time dynamic linker where to look
938 # for shared libraries such as libtcl.so. Depends on
939 # the variable LIB_RUNTIME_DIR in the Makefile.
940 # MAKE_LIB - Command to execute to build the a library;
941 # differs when building shared or static.
943 # Command to execute to build a stub library.
944 # INSTALL_LIB - Command to execute to install a library;
945 # differs when building shared or static.
947 # Command to execute to install a stub library.
948 # STLIB_LD - Base command to use for combining object files
949 # into a static library.
950 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
951 # of a shared library (may request position-independent
952 # code, among other things).
953 # SHLIB_LD - Base command to use for combining object files
954 # into a shared library.
955 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
956 # creating shared libraries. This symbol typically
957 # goes at the end of the "ld" commands that build
958 # shared libraries. The value of the symbol is
959 # "${LIBS}" if all of the dependent libraries should
960 # be specified when creating a shared library. If
961 # dependent libraries should not be specified (as on
962 # SunOS 4.x, where they cause the link to fail, or in
963 # general if Tcl and Tk aren't themselves shared
964 # libraries), then this symbol has an empty string
966 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
967 # extensions. An empty string means we don't know how
968 # to use shared libraries on this platform.
969 # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
970 # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
971 # tclConfig.sh, since they are only used for the build
973 # Examples: MacOS X records the library version and
974 # compatibility version in the shared library. But
975 # of course the Tcl version of this is only used for Tcl.
976 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
977 # in a static or shared library name, using the $VERSION variable
978 # to put the version in the right place. This is used
979 # by platforms that need non-standard library names.
980 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
981 # to have a version after the .so, and ${VERSION}.a
982 # on AIX, since a shared library needs to have
983 # a .a extension whereas shared objects for loadable
984 # extensions have a .so extension. Defaults to
985 # ${VERSION}${SHLIB_SUFFIX}.
986 # TCL_NEEDS_EXP_FILE -
987 # 1 means that an export file is needed to link to a
989 # TCL_EXP_FILE - The name of the installed export / import file which
990 # should be used to link to the Tcl shared library.
991 # Empty if Tcl is unshared.
992 # TCL_BUILD_EXP_FILE -
993 # The name of the built export / import file which
994 # should be used to link to the Tcl shared library.
995 # Empty if Tcl is unshared.
997 # Flags used when running the compiler in debug mode
999 # Flags used when running the compiler in optimize mode
1000 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
1002 #--------------------------------------------------------------------
1004 AC_DEFUN([SC_CONFIG_CFLAGS], [
1006 # Step 0.a: Enable 64 bit support?
1008 AC_MSG_CHECKING([if 64bit support is requested])
1009 AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],
1010 [do64bit=$enableval], [do64bit=no])
1011 AC_MSG_RESULT([$do64bit])
1013 # Step 0.b: Enable Solaris 64 bit VIS support?
1015 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1016 AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],
1017 [do64bitVIS=$enableval], [do64bitVIS=no])
1018 AC_MSG_RESULT([$do64bitVIS])
1020 if test "$do64bitVIS" = "yes"; then
1021 # Force 64bit on with VIS
1025 # Step 1: set the variable "system" to hold the name and version number
1030 # Step 2: check for existence of -ldl library. This is needed because
1031 # Linux can use either -ldl or -ldld for dynamic loading.
1033 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
1035 # Require ranlib early so we can override it in special cases below.
1037 AC_REQUIRE([AC_PROG_RANLIB])
1039 # Step 3: set configuration options based on system name and version.
1042 LDFLAGS_ORIG="$LDFLAGS"
1043 TCL_EXPORT_FILE_SUFFIX=""
1044 UNSHARED_LIB_SUFFIX=""
1045 TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
1046 ECHO_VERSION='`echo ${VERSION}`'
1047 TCL_LIB_VERSIONS_OK=ok
1050 if test "$GCC" = "yes" ; then
1051 CFLAGS_WARNING="-Wall -Wno-implicit-int -fno-strict-aliasing"
1055 TCL_NEEDS_EXP_FILE=0
1056 TCL_BUILD_EXP_FILE=""
1058 dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
1059 dnl AC_CHECK_TOOL(AR, ar)
1060 AC_CHECK_PROG(AR, ar, ar)
1061 if test "${AR}" = "" ; then
1062 AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
1065 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1070 if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
1071 # AIX requires the _r compiler when gcc isn't being used
1080 AC_MSG_RESULT([Using $CC for compiling with threads])
1084 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1085 # symbols when dynamically loaded into tclsh.
1086 SHLIB_LD_LIBS='${LIBS}'
1089 DL_OBJS="tclLoadDl.o"
1090 LD_LIBRARY_PATH_VAR="LIBPATH"
1092 # Check to enable 64-bit flags for compiler/linker on AIX 4+
1093 if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
1094 if test "$GCC" = "yes" ; then
1095 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1098 CFLAGS="$CFLAGS -q64"
1099 LDFLAGS="$LDFLAGS -q64"
1100 RANLIB="${RANLIB} -X64"
1102 SHLIB_LD_FLAGS="-b64"
1106 if test "`uname -m`" = "ia64" ; then
1107 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1108 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1109 # AIX-5 has dl* in libc.so
1111 if test "$GCC" = "yes" ; then
1112 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1114 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1116 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1118 if test "$GCC" = "yes" ; then
1119 SHLIB_LD="gcc -shared"
1121 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
1123 SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1125 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1126 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1127 TCL_NEEDS_EXP_FILE=1
1128 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
1131 # AIX v<=4.1 has some different flags than 4.2+
1132 if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
1133 LIBOBJS="$LIBOBJS tclLoadAix.o"
1137 # On AIX <=v4 systems, libbsd.a has to be linked in to support
1138 # non-blocking file IO. This library has to be linked in after
1139 # the MATH_LIBS or it breaks the pow() function. The way to
1140 # insure proper sequencing, is to add it to the tail of MATH_LIBS.
1141 # This library also supplies gettimeofday.
1143 # AIX does not have a timezone field in struct tm. When the AIX
1144 # bsd library is used, the timezone global and the gettimeofday
1145 # methods are to be avoided for timezone deduction instead, we
1146 # deduce the timezone by comparing the localtime result on a
1149 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
1150 if test $libbsd = yes; then
1151 MATH_LIBS="$MATH_LIBS -lbsd"
1152 AC_DEFINE(USE_DELTA_FOR_TZ)
1156 SHLIB_CFLAGS="-fPIC"
1157 SHLIB_LD="${CC} -nostart"
1158 SHLIB_LD_LIBS='${LIBS}'
1160 DL_OBJS="tclLoadDl.o"
1163 #-----------------------------------------------------------
1164 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1165 # -lsocket, even if the network functions are in -lnet which
1166 # is always linked to, for compatibility.
1167 #-----------------------------------------------------------
1168 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1170 BSD/OS-2.1*|BSD/OS-3*)
1172 SHLIB_LD="shlicc -r"
1173 SHLIB_LD_LIBS='${LIBS}'
1175 DL_OBJS="tclLoadDl.o"
1181 SHLIB_CFLAGS="-export-dynamic -fPIC"
1182 SHLIB_LD="cc -shared"
1183 SHLIB_LD_LIBS='${LIBS}'
1185 DL_OBJS="tclLoadDl.o"
1187 LDFLAGS="$LDFLAGS -export-dynamic"
1192 SHLIB_CFLAGS="-K PIC"
1196 DL_OBJS="tclLoadDl.o"
1202 # Use updated header definitions where possible
1203 AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library
1204 AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
1205 LIBS="$LIBS -lxnet" # Use the XOPEN network library
1207 if test "`uname -m`" = "ia64" ; then
1212 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1213 if test "$tcl_ok" = yes; then
1216 SHLIB_LD_LIBS='${LIBS}'
1217 DL_OBJS="tclLoadShl.o"
1219 LDFLAGS="$LDFLAGS -Wl,-E"
1220 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1221 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1222 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1224 if test "$GCC" = "yes" ; then
1225 SHLIB_LD="gcc -shared"
1226 SHLIB_LD_LIBS='${LIBS}'
1227 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1230 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1231 #CFLAGS="$CFLAGS +DAportable"
1233 # Check to enable 64-bit flags for compiler/linker
1234 if test "$do64bit" = "yes" ; then
1235 if test "$GCC" = "yes" ; then
1236 hpux_arch=`${CC} -dumpmachine`
1239 # 64-bit gcc in use. Fix flags for GNU ld.
1241 SHLIB_LD="${CC} -shared"
1242 SHLIB_LD_LIBS='${LIBS}'
1243 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1244 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1247 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1252 CFLAGS="$CFLAGS +DD64"
1253 LDFLAGS="$LDFLAGS +DD64"
1257 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1259 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1260 if test "$tcl_ok" = yes; then
1264 DL_OBJS="tclLoadShl.o"
1266 LDFLAGS="$LDFLAGS -Wl,-E"
1267 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1268 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1269 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1275 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1276 SHLIB_LD_LIBS='${LIBS}'
1277 DL_OBJS="tclLoadAout.o"
1279 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1280 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1281 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1282 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
1286 SHLIB_LD="ld -shared -rdata_shared"
1287 SHLIB_LD_LIBS='${LIBS}'
1289 DL_OBJS="tclLoadDl.o"
1291 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1292 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1296 SHLIB_LD="ld -n32 -shared -rdata_shared"
1297 SHLIB_LD_LIBS='${LIBS}'
1299 DL_OBJS="tclLoadDl.o"
1301 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1302 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1303 if test "$GCC" = "yes" ; then
1304 CFLAGS="$CFLAGS -mabi=n32"
1305 LDFLAGS="$LDFLAGS -mabi=n32"
1309 # Use to build 6.2 compatible binaries on 6.3.
1310 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1313 CFLAGS="$CFLAGS -n32"
1316 LDFLAGS="$LDFLAGS -n32"
1321 SHLIB_LD="ld -n32 -shared -rdata_shared"
1322 SHLIB_LD_LIBS='${LIBS}'
1324 DL_OBJS="tclLoadDl.o"
1326 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1327 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1329 # Check to enable 64-bit flags for compiler/linker
1331 if test "$do64bit" = "yes" ; then
1332 if test "$GCC" = "yes" ; then
1333 AC_MSG_WARN([64bit mode not supported by gcc])
1336 SHLIB_LD="ld -64 -shared -rdata_shared"
1337 CFLAGS="$CFLAGS -64"
1338 LDFLAGS="$LDFLAGS -64"
1343 SHLIB_CFLAGS="-fPIC"
1344 SHLIB_LD_LIBS='${LIBS}'
1348 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1349 # when you inline the string and math operations. Turn this off to
1350 # get rid of the warnings.
1351 #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1353 if test "$have_dl" = yes; then
1354 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
1355 DL_OBJS="tclLoadDl.o"
1357 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1358 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1359 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1361 AC_CHECK_HEADER(dld.h, [
1362 SHLIB_LD="ld -shared"
1363 DL_OBJS="tclLoadDld.o"
1366 LD_SEARCH_FLAGS=""])
1368 if test "`uname -m`" = "alpha" ; then
1369 CFLAGS="$CFLAGS -mieee"
1371 if test $do64bit = yes; then
1372 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1374 CFLAGS="$CFLAGS -m64"
1375 AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
1376 CFLAGS=$hold_cflags])
1377 if test $tcl_cv_cc_m64 = yes; then
1378 CFLAGS="$CFLAGS -m64"
1383 # The combo of gcc + glibc has a bug related
1384 # to inlining of functions like strtod(). The
1385 # -fno-builtin flag should address this problem
1386 # but it does not work. The -fno-inline flag
1387 # is kind of overkill but it works.
1388 # Disable inlining only when one of the
1389 # files in compat/*.c is being linked in.
1390 if test x"${LIBOBJS}" != x ; then
1391 CFLAGS="$CFLAGS -fno-inline"
1394 # XIM peeking works under XFree86.
1395 AC_DEFINE(PEEK_XCLOSEIM)
1399 SHLIB_CFLAGS="-fPIC"
1400 SHLIB_LD_LIBS='${LIBS}'
1403 if test "$have_dl" = yes; then
1404 SHLIB_LD="${CC} -shared"
1407 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1411 AC_CHECK_HEADER(dld.h, [
1412 SHLIB_LD="ld -shared"
1416 LD_SEARCH_FLAGS=""])
1418 if test "`uname -m`" = "alpha" ; then
1419 CFLAGS="$CFLAGS -mieee"
1423 SHLIB_CFLAGS="-fPIC"
1424 SHLIB_LD_LIBS='${LIBS}'
1427 SHLIB_LD="${CC} -shared "
1428 DL_OBJS="tclLoadDl.o"
1429 DL_LIBS="-mshared -ldl"
1430 LD_FLAGS="-Wl,--export-dynamic"
1431 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1432 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1435 SHLIB_CFLAGS="-K PIC"
1439 DL_OBJS="tclLoadDl.o"
1445 SHLIB_CFLAGS="-K PIC"
1449 DL_OBJS="tclLoadDl.o"
1451 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1455 NetBSD-*|FreeBSD-[[1-2]].*)
1456 # Not available on all versions: check for include file.
1457 AC_CHECK_HEADER(dlfcn.h, [
1458 # NetBSD/SPARC needs -fPIC, -fpic will not do.
1459 SHLIB_CFLAGS="-fPIC"
1460 SHLIB_LD="ld -Bshareable -x"
1461 SHLIB_LD_LIBS='${LIBS}'
1463 DL_OBJS="tclLoadDl.o"
1465 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1466 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1467 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1472 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1473 if test $tcl_cv_ld_elf = yes; then
1474 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
1476 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1480 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
1481 SHLIB_LD_LIBS='${LIBS}'
1483 DL_OBJS="tclLoadAout.o"
1485 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1486 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1487 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1490 # FreeBSD doesn't handle version numbers with dots.
1492 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1493 TCL_LIB_VERSIONS_OK=nodots
1499 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
1500 SHLIB_LD_LIBS='${LIBS}'
1502 DL_OBJS="tclLoadAout.o"
1505 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1506 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1507 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1510 # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
1513 SHLIB_CFLAGS="-fPIC";;
1515 SHLIB_CFLAGS="-fpic";;
1517 SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
1518 SHLIB_LD_LIBS='${LIBS}'
1520 DL_OBJS="tclLoadDl.o"
1522 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1523 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1524 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1525 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1530 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1531 if test $tcl_cv_ld_elf = yes; then
1532 LDFLAGS=-Wl,-export-dynamic
1539 # OpenBSD doesn't do version numbers with dots.
1540 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1541 TCL_LIB_VERSIONS_OK=nodots
1544 # FreeBSD 3.* and greater have ELF.
1545 SHLIB_CFLAGS="-fPIC"
1546 SHLIB_LD="ld -Bshareable -x"
1547 SHLIB_LD_LIBS='${LIBS}'
1549 DL_OBJS="tclLoadDl.o"
1551 LDFLAGS="$LDFLAGS -export-dynamic"
1552 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1553 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1554 if test "${TCL_THREADS}" = "1" ; then
1555 # The -pthread needs to go in the CFLAGS, not LIBS
1556 LIBS=`echo $LIBS | sed s/-pthread//`
1557 CFLAGS="$CFLAGS -pthread"
1558 LDFLAGS="$LDFLAGS -pthread"
1562 # FreeBSD-3 doesn't handle version numbers with dots.
1563 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1564 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
1565 TCL_LIB_VERSIONS_OK=nodots
1570 CFLAGS_OPTIMIZE="-Os"
1571 SHLIB_CFLAGS="-fno-common"
1572 # To avoid discrepancies between what headers configure sees during
1573 # preprocessing tests and compiling tests, move any -isysroot and
1574 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1575 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1576 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1577 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1578 CFLAGS="`echo " ${CFLAGS}" | \
1579 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1580 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1581 if test $do64bit = yes; then
1584 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1585 tcl_cv_cc_arch_ppc64, [
1587 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1588 AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
1589 tcl_cv_cc_arch_ppc64=no)
1590 CFLAGS=$hold_cflags])
1591 if test $tcl_cv_cc_arch_ppc64 = yes; then
1592 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1596 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1597 tcl_cv_cc_arch_x86_64, [
1599 CFLAGS="$CFLAGS -arch x86_64"
1600 AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
1601 tcl_cv_cc_arch_x86_64=no)
1602 CFLAGS=$hold_cflags])
1603 if test $tcl_cv_cc_arch_x86_64 = yes; then
1604 CFLAGS="$CFLAGS -arch x86_64"
1608 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1611 # Check for combined 32-bit and 64-bit fat build
1612 echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
1613 echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
1616 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
1617 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1618 hold_ldflags=$LDFLAGS
1619 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1620 AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
1621 LDFLAGS=$hold_ldflags])
1622 if test $tcl_cv_ld_single_module = yes; then
1623 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1625 SHLIB_LD_LIBS='${LIBS}'
1626 SHLIB_SUFFIX=".dylib"
1627 DL_OBJS="tclLoadDyld.o"
1629 # Don't use -prebind when building for Mac OS X 10.4 or later only:
1630 test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
1631 "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
1632 LDFLAGS="$LDFLAGS -prebind"
1633 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1634 AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
1635 hold_ldflags=$LDFLAGS
1636 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1637 AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
1638 LDFLAGS=$hold_ldflags])
1639 if test $tcl_cv_ld_search_paths_first = yes; then
1640 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1644 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1645 PLAT_OBJS=\$\(MAC\_OSX_OBJS\)
1646 PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
1647 AC_MSG_CHECKING([whether to use CoreFoundation])
1648 AC_ARG_ENABLE(corefoundation, [ --enable-corefoundation use CoreFoundation API [--enable-corefoundation]],
1649 [tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
1650 AC_MSG_RESULT([$tcl_corefoundation])
1651 if test $tcl_corefoundation = yes; then
1652 AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [
1654 if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
1655 # On Tiger there is no 64-bit CF, so remove 64-bit archs
1656 # from CFLAGS et al. while testing for presence of CF.
1657 # 64-bit CF is disabled in tclUnixPort.h if necessary.
1658 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1660 LIBS="$LIBS -framework CoreFoundation"
1661 AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
1662 [CFBundleRef b = CFBundleGetMainBundle();],
1663 tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no)
1664 if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
1665 eval $v'="$hold_'$v'"'
1666 done; fi; LIBS=$hold_libs])
1667 if test $tcl_cv_lib_corefoundation = yes; then
1668 LIBS="$LIBS -framework CoreFoundation"
1669 AC_DEFINE(HAVE_COREFOUNDATION)
1671 tcl_corefoundation=no
1673 if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
1674 AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [
1675 for v in CFLAGS CPPFLAGS LDFLAGS; do
1676 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1678 AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
1679 [CFBundleRef b = CFBundleGetMainBundle();],
1680 tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no)
1681 for v in CFLAGS CPPFLAGS LDFLAGS; do
1682 eval $v'="$hold_'$v'"'
1684 if test $tcl_cv_lib_corefoundation_64 = no; then
1685 AC_DEFINE(NO_COREFOUNDATION_64)
1689 AC_DEFINE(MAC_OSX_TCL)
1693 SHLIB_LD="cc -nostdlib -r"
1696 DL_OBJS="tclLoadNext.o"
1702 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1703 AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
1705 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1706 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1708 # Hack: make package name same as library name
1709 SHLIB_LD='ld -R -export $@:'
1712 DL_OBJS="tclLoadOSF.o"
1718 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1719 SHLIB_CFLAGS="-fPIC"
1720 if test "$SHARED_BUILD" = "1" ; then
1721 SHLIB_LD="ld -shared"
1723 SHLIB_LD="ld -non_shared"
1727 DL_OBJS="tclLoadDl.o"
1735 if test "$SHARED_BUILD" = "1" ; then
1736 SHLIB_LD='ld -shared -expect_unresolved "*"'
1738 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1742 DL_OBJS="tclLoadDl.o"
1744 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1745 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1746 if test "$GCC" = "yes" ; then
1747 CFLAGS="$CFLAGS -mieee"
1749 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
1751 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1752 if test "${TCL_THREADS}" = "1" ; then
1753 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1754 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1755 LIBS=`echo $LIBS | sed s/-lpthreads//`
1756 if test "$GCC" = "yes" ; then
1757 LIBS="$LIBS -lpthread -lmach -lexc"
1759 CFLAGS="$CFLAGS -pthread"
1760 LDFLAGS="$LDFLAGS -pthread"
1767 # This may work for all QNX, but it was only reported for v6.
1768 SHLIB_CFLAGS="-fPIC"
1769 SHLIB_LD="ld -Bshareable -x"
1772 DL_OBJS="tclLoadDl.o"
1773 # dlopen is in -lc on QNX
1780 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1781 SHLIB_LD_LIBS='${LIBS}'
1783 DL_OBJS="tclLoadAout.o"
1785 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1786 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1787 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1790 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1791 # this test works, since "uname -s" was non-standard in 3.2.4 and
1793 if test "$GCC" = "yes" ; then
1794 SHLIB_CFLAGS="-fPIC -melf"
1795 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1797 SHLIB_CFLAGS="-Kpic -belf"
1798 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1803 DL_OBJS="tclLoadDl.o"
1809 SHLIB_CFLAGS="-K PIC"
1813 DL_OBJS="tclLoadDl.o"
1823 DL_OBJS="tclLoadDl.o"
1825 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1826 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1828 # SunOS can't handle version numbers with dots in them in library
1829 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1830 # requires an extra version number at the end of .so file names.
1831 # So, the library has to have a name like libtcl75.so.1.0
1833 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1834 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1835 TCL_LIB_VERSIONS_OK=nodots
1838 # Careful to not let 5.10+ fall into this case
1840 # Note: If _REENTRANT isn't defined, then Solaris
1841 # won't define thread-safe library routines.
1843 AC_DEFINE(_REENTRANT)
1844 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1846 SHLIB_CFLAGS="-KPIC"
1848 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1849 # symbols when dynamically loaded into tclsh.
1851 SHLIB_LD_LIBS='${LIBS}'
1853 DL_OBJS="tclLoadDl.o"
1855 if test "$GCC" = "yes" ; then
1856 SHLIB_LD="$CC -shared"
1857 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1858 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1860 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1861 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1862 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1866 # Note: If _REENTRANT isn't defined, then Solaris
1867 # won't define thread-safe library routines.
1869 AC_DEFINE(_REENTRANT)
1870 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1872 SHLIB_CFLAGS="-KPIC"
1874 # Check to enable 64-bit flags for compiler/linker
1875 if test "$do64bit" = "yes" ; then
1877 if test "$arch" = "sparcv9 sparc" ; then
1878 if test "$GCC" = "yes" ; then
1879 if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
1880 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1883 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1884 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1885 SHLIB_CFLAGS="-fPIC"
1889 if test "$do64bitVIS" = "yes" ; then
1890 CFLAGS="$CFLAGS -xarch=v9a"
1891 LDFLAGS="$LDFLAGS -xarch=v9a"
1893 CFLAGS="$CFLAGS -xarch=v9"
1894 LDFLAGS="$LDFLAGS -xarch=v9"
1896 # Solaris 64 uses this as well
1897 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1899 elif test "$arch" = "amd64 i386" ; then
1900 if test "$GCC" = "yes" ; then
1901 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1904 CFLAGS="$CFLAGS -xarch=amd64"
1905 LDFLAGS="$LDFLAGS -xarch=amd64"
1908 AC_MSG_WARN([64bit mode not supported for $arch])
1912 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1913 # symbols when dynamically loaded into tclsh.
1915 SHLIB_LD_LIBS='${LIBS}'
1917 DL_OBJS="tclLoadDl.o"
1919 if test "$GCC" = "yes" ; then
1920 SHLIB_LD="$CC -shared"
1921 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1922 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1923 if test "$do64bit_ok" = "yes" ; then
1924 # We need to specify -static-libgcc or we need to
1925 # add the path to the sparv9 libgcc.
1926 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1927 # for finding sparcv9 libgcc, get the regular libgcc
1928 # path, remove so name and append 'sparcv9'
1929 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1930 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1934 SunOS-5.[[1-9]][[0-9]]*)
1935 SHLIB_LD='${CC} -G -z text';;
1937 SHLIB_LD="/usr/ccs/bin/ld -G -z text";;
1939 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1940 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1946 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1947 SHLIB_LD_LIBS='${LIBS}'
1948 DL_OBJS="tclLoadAout.o"
1950 LDFLAGS="$LDFLAGS -Wl,-D,08000000"
1951 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1952 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1953 if test "$GCC" != "yes" ; then
1954 CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
1957 UNIX_SV* | UnixWare-5*)
1958 SHLIB_CFLAGS="-KPIC"
1962 DL_OBJS="tclLoadDl.o"
1964 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1965 # that don't grok the -Bexport option. Test that it does.
1966 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1967 hold_ldflags=$LDFLAGS
1968 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1969 AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
1970 LDFLAGS=$hold_ldflags])
1971 if test $tcl_cv_ld_Bexport = yes; then
1972 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1979 if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
1980 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1983 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1984 dnl # until the end of configure, as configure's compile and link tests use
1985 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1986 dnl # preprocessing tests use only CPPFLAGS.
1987 SC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1989 # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
1990 # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
1991 # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
1992 # to determine which of several header files defines the a.out file
1993 # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
1994 # support only a file format that is more or less version-7-compatible.
1996 # - a.out files must begin with `struct exec'.
1997 # - the N_TXTOFF on the `struct exec' must compute the seek address
1998 # of the text segment
1999 # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
2000 # and a_entry fields.
2001 # The following compilation should succeed if and only if either sys/exec.h
2002 # or a.out.h is usable for the purpose.
2004 # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
2005 # `struct exec' includes a second header that contains information that
2006 # duplicates the v7 fields that are needed.
2008 if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
2009 AC_CACHE_CHECK([sys/exec.h], tcl_cv_sysexec_h, [
2010 AC_TRY_COMPILE([#include <sys/exec.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_sysexec_h=usable, tcl_cv_sysexec_h=unusable)])
2022 if test $tcl_cv_sysexec_h = usable; then
2023 AC_DEFINE(USE_SYS_EXEC_H)
2025 AC_CACHE_CHECK([a.out.h], tcl_cv_aout_h, [
2026 AC_TRY_COMPILE([#include <a.out.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_magic == OMAGIC);
2036 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2037 ], tcl_cv_aout_h=usable, tcl_cv_aout_h=unusable)])
2038 if test $tcl_cv_aout_h = usable; then
2039 AC_DEFINE(USE_A_OUT_H)
2041 AC_CACHE_CHECK([sys/exec_aout.h], tcl_cv_sysexecaout_h, [
2042 AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
2046 #if defined(__mips) || defined(mips)
2047 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
2049 seek = N_TXTOFF (foo);
2051 flag = (foo.a_midmag == OMAGIC);
2052 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
2053 ], tcl_cv_sysexecaout_h=usable, tcl_cv_sysexecaout_h=unusable)])
2054 if test $tcl_cv_sysexecaout_h = usable; then
2055 AC_DEFINE(USE_SYS_EXEC_AOUT_H)
2063 # Step 5: disable dynamic loading if requested via a command-line switch.
2065 AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
2066 [tcl_ok=$enableval], [tcl_ok=yes])
2067 if test "$tcl_ok" = "no"; then
2071 if test "x$DL_OBJS" != "x" ; then
2072 BUILD_DLTEST="\$(DLTEST_TARGETS)"
2074 echo "Can't figure out how to do dynamic loading or shared libraries"
2075 echo "on this system."
2079 DL_OBJS="tclLoadNone.o"
2081 LDFLAGS="$LDFLAGS_ORIG"
2087 # If we're running gcc, then change the C flags for compiling shared
2088 # libraries to the right flags for gcc, instead of those for the
2089 # standard manufacturer compiler.
2091 if test "$DL_OBJS" != "tclLoadNone.o" ; then
2092 if test "$GCC" = "yes" ; then
2100 NetBSD-*|FreeBSD-*|OpenBSD-*)
2111 SHLIB_CFLAGS="-fPIC"
2117 if test "$SHARED_LIB_SUFFIX" = "" ; then
2118 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
2120 if test "$UNSHARED_LIB_SUFFIX" = "" ; then
2121 UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
2124 if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
2125 LIB_SUFFIX=${SHARED_LIB_SUFFIX}
2126 MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
2127 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
2129 LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
2131 if test "$RANLIB" = "" ; then
2132 MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
2133 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
2135 MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
2136 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
2139 dnl Not at all clear what this was doing in Tcl's configure.in
2140 dnl or why it was needed was needed. In any event, this sort of
2141 dnl things needs to be done in the big loop above.
2142 dnl REMOVE THIS BLOCK LATER! (mdejong)
2149 dnl SHLIB_LD_LIBS=""
2155 # Stub lib does not depend on shared/static configuration
2156 if test "$RANLIB" = "" ; then
2157 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
2158 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
2160 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
2161 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
2171 AC_SUBST(CFLAGS_DEBUG)
2172 AC_SUBST(CFLAGS_OPTIMIZE)
2173 AC_SUBST(CFLAGS_WARNING)
2176 AC_SUBST(LDFLAGS_DEBUG)
2177 AC_SUBST(LDFLAGS_OPTIMIZE)
2178 AC_SUBST(CC_SEARCH_FLAGS)
2179 AC_SUBST(LD_SEARCH_FLAGS)
2183 AC_SUBST(TCL_SHLIB_LD_EXTRAS)
2184 AC_SUBST(TK_SHLIB_LD_EXTRAS)
2185 AC_SUBST(SHLIB_LD_LIBS)
2186 AC_SUBST(SHLIB_CFLAGS)
2187 AC_SUBST(SHLIB_SUFFIX)
2190 AC_SUBST(MAKE_STUB_LIB)
2191 AC_SUBST(INSTALL_LIB)
2192 AC_SUBST(INSTALL_STUB_LIB)
2196 #--------------------------------------------------------------------
2199 # Determine which interface to use to talk to the serial port.
2200 # Note that #include lines must begin in leftmost column for
2201 # some compilers to recognize them as preprocessor directives,
2202 # and some build environments have stdin not pointing at a
2203 # pseudo-terminal (usually /dev/null instead.)
2210 # Defines only one of the following vars:
2216 #--------------------------------------------------------------------
2218 AC_DEFUN([SC_SERIAL_PORT], [
2219 AC_CHECK_HEADERS(sys/modem.h)
2220 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2222 #include <termios.h>
2226 if (tcgetattr(0, &t) == 0) {
2228 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2232 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2233 if test $tcl_cv_api_serial = no ; then
2239 if (ioctl(0, TCGETA, &t) == 0) {
2240 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2244 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2246 if test $tcl_cv_api_serial = no ; then
2252 if (ioctl(0, TIOCGETP, &t) == 0) {
2254 t.sg_flags |= ODDP | EVENP | RAW;
2258 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2260 if test $tcl_cv_api_serial = no ; then
2262 #include <termios.h>
2267 if (tcgetattr(0, &t) == 0
2268 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2270 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2274 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2276 if test $tcl_cv_api_serial = no; then
2283 if (ioctl(0, TCGETA, &t) == 0
2284 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2285 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2289 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2291 if test $tcl_cv_api_serial = no; then
2298 if (ioctl(0, TIOCGETP, &t) == 0
2299 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2301 t.sg_flags |= ODDP | EVENP | RAW;
2305 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2307 case $tcl_cv_api_serial in
2308 termios) AC_DEFINE(USE_TERMIOS);;
2309 termio) AC_DEFINE(USE_TERMIO);;
2310 sgtty) AC_DEFINE(USE_SGTTY);;
2314 #--------------------------------------------------------------------
2315 # SC_MISSING_POSIX_HEADERS
2317 # Supply substitutes for missing POSIX header files. Special
2319 # - stdlib.h doesn't define strtol, strtoul, or
2320 # strtod insome versions of SunOS
2321 # - some versions of string.h don't declare procedures such
2329 # Defines some of the following vars:
2333 # HAVE_LIMITS_H or NO_LIMITS_H
2343 #--------------------------------------------------------------------
2345 AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
2346 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2347 AC_TRY_LINK([#include <sys/types.h>
2348 #include <dirent.h>], [
2349 #ifndef _POSIX_SOURCE
2352 * Generate compilation error to make the test fail: Lynx headers
2353 * are only valid if really in the POSIX environment.
2356 missing_procedure();
2360 struct dirent *entryPtr;
2362 d = opendir("foobar");
2363 entryPtr = readdir(d);
2364 p = entryPtr->d_name;
2366 ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
2368 if test $tcl_cv_dirent_h = no; then
2369 AC_DEFINE(NO_DIRENT_H)
2372 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
2373 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
2374 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
2375 AC_CHECK_HEADER(limits.h,
2376 [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
2377 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2378 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2379 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2380 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2381 if test $tcl_ok = 0; then
2382 AC_DEFINE(NO_STDLIB_H)
2384 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2385 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2386 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2388 # See also memmove check below for a place where NO_STRING_H can be
2391 if test $tcl_ok = 0; then
2392 AC_DEFINE(NO_STRING_H)
2395 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
2396 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
2398 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2399 AC_HAVE_HEADERS(unistd.h sys/param.h)
2402 #--------------------------------------------------------------------
2405 # Locate the X11 header files and the X11 library archive. Try
2406 # the ac_path_x macro first, but if it doesn't find the X stuff
2407 # (e.g. because there's no xmkmf program) then check through
2408 # a list of possible directories. Under some conditions the
2409 # autoconf macro will return an include directory that contains
2410 # no include files, so double-check its result just to be safe.
2417 # Sets the the following vars:
2421 #--------------------------------------------------------------------
2423 AC_DEFUN([SC_PATH_X], [
2426 if test "$no_x" = ""; then
2427 if test "$x_includes" = ""; then
2428 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2430 if test ! -r $x_includes/X11/Intrinsic.h; then
2431 not_really_there="yes"
2435 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2436 AC_MSG_CHECKING([for X11 header files])
2437 found_xincludes="no"
2438 AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2439 if test "$found_xincludes" = "no"; then
2440 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"
2442 if test -r $i/X11/Intrinsic.h; then
2445 found_xincludes="yes"
2451 if test "$x_includes" != ""; then
2452 XINCLUDES="-I$x_includes"
2453 found_xincludes="yes"
2456 if test found_xincludes = "no"; then
2457 AC_MSG_RESULT([couldn't find any!])
2460 if test "$no_x" = yes; then
2461 AC_MSG_CHECKING([for X11 libraries])
2463 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"
2465 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
2473 if test "$x_libraries" = ""; then
2476 XLIBSW="-L$x_libraries -lX11"
2479 if test "$XLIBSW" = nope ; then
2480 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2482 if test "$XLIBSW" = nope ; then
2483 AC_MSG_RESULT([could not find any! Using -lX11.])
2488 #--------------------------------------------------------------------
2491 # The statements below check for systems where POSIX-style
2492 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2493 # On these systems (mostly older ones), use the old BSD-style
2494 # FIONBIO approach instead.
2501 # Defines some of the following vars:
2507 #--------------------------------------------------------------------
2509 AC_DEFUN([SC_BLOCKING_STYLE], [
2510 AC_CHECK_HEADERS(sys/ioctl.h)
2511 AC_CHECK_HEADERS(sys/filio.h)
2513 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2515 # There used to be code here to use FIONBIO under AIX. However, it
2516 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
2517 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
2518 # code (JO, 5/31/97).
2521 AC_DEFINE(USE_FIONBIO)
2522 AC_MSG_RESULT([FIONBIO])
2525 AC_DEFINE(USE_FIONBIO)
2526 AC_MSG_RESULT([FIONBIO])
2529 AC_DEFINE(USE_FIONBIO)
2530 AC_MSG_RESULT([FIONBIO])
2533 AC_MSG_RESULT([O_NONBLOCK])
2538 #--------------------------------------------------------------------
2541 # Checks how the system deals with time.h, what time structures
2542 # are used on the system, and what fields the structures have.
2549 # Defines some of the following vars:
2555 #--------------------------------------------------------------------
2557 AC_DEFUN([SC_TIME_HANDLER], [
2558 AC_CHECK_HEADERS(sys/time.h)
2562 AC_CHECK_FUNCS(gmtime_r localtime_r)
2564 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2565 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2566 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
2567 if test $tcl_cv_member_tm_tzadj = yes ; then
2568 AC_DEFINE(HAVE_TM_TZADJ)
2571 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2572 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2573 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
2574 if test $tcl_cv_member_tm_gmtoff = yes ; then
2575 AC_DEFINE(HAVE_TM_GMTOFF)
2579 # Its important to include time.h in this check, as some systems
2580 # (like convex) have timezone functions, etc.
2582 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2583 AC_TRY_COMPILE([#include <time.h>],
2584 [extern long timezone;
2587 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
2588 if test $tcl_cv_timezone_long = yes ; then
2589 AC_DEFINE(HAVE_TIMEZONE_VAR)
2592 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2594 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2595 AC_TRY_COMPILE([#include <time.h>],
2596 [extern time_t timezone;
2599 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
2600 if test $tcl_cv_timezone_time = yes ; then
2601 AC_DEFINE(HAVE_TIMEZONE_VAR)
2606 #--------------------------------------------------------------------
2609 # Under Solaris 2.4, strtod returns the wrong value for the
2610 # terminating character under some conditions. Check for this
2611 # and if the problem exists use a substitute procedure
2612 # "fixstrtod" (provided by Tcl) that corrects the error.
2613 # Also, on Compaq's Tru64 Unix 5.0,
2614 # strtod(" ") returns 0.0 instead of a failure to convert.
2621 # Might defines some of the following vars:
2622 # strtod (=fixstrtod)
2624 #--------------------------------------------------------------------
2626 AC_DEFUN([SC_BUGGY_STRTOD], [
2627 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2628 if test "$tcl_strtod" = 1; then
2629 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2631 extern double strtod();
2633 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2636 value = strtod(infString, &term);
2637 if ((term != infString) && (term[-1] == 0)) {
2640 value = strtod(nanString, &term);
2641 if ((term != nanString) && (term[-1] == 0)) {
2644 value = strtod(spaceString, &term);
2645 if (term == (spaceString+1)) {
2649 }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2650 tcl_cv_strtod_buggy=buggy)])
2651 if test "$tcl_cv_strtod_buggy" = buggy; then
2652 LIBOBJS="$LIBOBJS fixstrtod.o"
2653 AC_DEFINE(strtod, fixstrtod)
2658 #--------------------------------------------------------------------
2661 # Search for the libraries needed to link the Tcl shell.
2662 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2663 # -lnsl) are dealt with here.
2666 # Requires the following vars to be set in the Makefile:
2673 # Subst's the following var:
2677 # Might append to the following vars:
2680 # Might define the following vars:
2683 #--------------------------------------------------------------------
2685 AC_DEFUN([SC_TCL_LINK_LIBS], [
2686 #--------------------------------------------------------------------
2687 # On a few very rare systems, all of the libm.a stuff is
2688 # already in libc.a. Set compiler flags accordingly.
2689 # Also, Linux requires the "ieee" library for math to work
2690 # right (and it must appear before "-lm").
2691 #--------------------------------------------------------------------
2693 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2694 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2696 #--------------------------------------------------------------------
2697 # Interactive UNIX requires -linet instead of -lsocket, plus it
2698 # needs net/errno.h to define the socket-related error codes.
2699 #--------------------------------------------------------------------
2701 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2702 AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
2704 #--------------------------------------------------------------------
2705 # Check for the existence of the -lsocket and -lnsl libraries.
2706 # The order here is important, so that they end up in the right
2707 # order in the command line generated by make. Here are some
2708 # special considerations:
2709 # 1. Use "connect" and "accept" to check for -lsocket, and
2710 # "gethostbyname" to check for -lnsl.
2711 # 2. Use each function name only once: can't redo a check because
2712 # autoconf caches the results of the last check and won't redo it.
2713 # 3. Use -lnsl and -lsocket only if they supply procedures that
2714 # aren't already present in the normal libraries. This is because
2715 # IRIX 5.2 has libraries, but they aren't needed and they're
2716 # bogus: they goof up name resolution if used.
2717 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2718 # To get around this problem, check for both libraries together
2719 # if -lsocket doesn't work by itself.
2720 #--------------------------------------------------------------------
2723 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2724 if test "$tcl_checkSocket" = 1; then
2725 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2726 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2728 if test "$tcl_checkBoth" = 1; then
2730 LIBS="$LIBS -lsocket -lnsl"
2731 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2733 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2734 [LIBS="$LIBS -lnsl"])])
2736 # Don't perform the eval of the libraries here because DL_LIBS
2737 # won't be set until we call SC_CONFIG_CFLAGS
2739 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2744 #--------------------------------------------------------------------
2745 # SC_TCL_EARLY_FLAGS
2747 # Check for what flags are needed to be passed so the correct OS
2748 # features are available.
2755 # Might define the following vars:
2757 # _LARGEFILE64_SOURCE
2758 # _LARGEFILE_SOURCE64
2760 #--------------------------------------------------------------------
2762 AC_DEFUN([SC_TCL_EARLY_FLAG],[
2763 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2764 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2765 AC_TRY_COMPILE([[#define ]$1[ 1
2767 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2768 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2769 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2771 tcl_flags="$tcl_flags $1"
2775 AC_DEFUN([SC_TCL_EARLY_FLAGS],[
2776 AC_MSG_CHECKING([for required early compiler flags])
2778 SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2779 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2780 SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2781 [struct stat64 buf; int i = stat64("/", &buf);])
2782 SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2783 [char *p = (char *)open64;])
2784 if test "x${tcl_flags}" = "x" ; then
2785 AC_MSG_RESULT([none])
2787 AC_MSG_RESULT([${tcl_flags}])
2791 #--------------------------------------------------------------------
2792 # SC_TCL_64BIT_FLAGS
2794 # Check for what is defined in the way of 64-bit features.
2801 # Might define the following vars:
2802 # TCL_WIDE_INT_IS_LONG
2804 # HAVE_STRUCT_DIRENT64
2805 # HAVE_STRUCT_STAT64
2808 #--------------------------------------------------------------------
2810 AC_DEFUN([SC_TCL_64BIT_FLAGS], [
2811 AC_MSG_CHECKING([for 64-bit integer type])
2812 AC_CACHE_VAL(tcl_cv_type_64bit,[
2813 tcl_cv_type_64bit=none
2814 # See if the compiler knows natively about __int64
2815 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2816 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2817 # See if we should use long anyway Note that we substitute in the
2818 # type that is our current guess for a 64-bit type inside this check
2819 # program, so it should be modified only carefully...
2820 AC_TRY_COMPILE(,[switch (0) {
2821 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2822 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2823 if test "${tcl_cv_type_64bit}" = none ; then
2824 AC_DEFINE(TCL_WIDE_INT_IS_LONG)
2825 AC_MSG_RESULT([using long])
2827 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
2828 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2830 # Now check for auxiliary declarations
2831 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2832 AC_TRY_COMPILE([#include <sys/types.h>
2833 #include <sys/dirent.h>],[struct dirent64 p;],
2834 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2835 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2836 AC_DEFINE(HAVE_STRUCT_DIRENT64)
2839 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2840 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2842 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2843 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2844 AC_DEFINE(HAVE_STRUCT_STAT64)
2847 AC_CHECK_FUNCS(open64 lseek64)
2848 AC_MSG_CHECKING([for off64_t])
2849 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2850 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2852 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2853 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2854 dnl functions lseek64 and open64 are defined.
2855 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2856 test "x${ac_cv_func_lseek64}" = "xyes" && \
2857 test "x${ac_cv_func_open64}" = "xyes" ; then
2858 AC_DEFINE(HAVE_TYPE_OFF64_T)
2859 AC_MSG_RESULT([yes])
2866 #--------------------------------------------------------------------
2867 # SC_TCL_GETHOSTBYADDR_R
2869 # Check if we have MT-safe variant of gethostbyaddr().
2876 # Might define the following vars:
2877 # HAVE_GETHOSTBYADDR_R
2878 # HAVE_GETHOSTBYADDR_R_7
2879 # HAVE_GETHOSTBYADDR_R_8
2881 #--------------------------------------------------------------------
2883 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
2884 AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
2891 struct hostent *result;
2896 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2898 ], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)])
2899 tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
2900 if test "$tcl_ok" = yes; then
2901 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
2903 AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
2910 struct hostent *result, *resultp;
2915 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2916 &resultp, &h_errnop);
2917 ], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)])
2918 tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
2919 if test "$tcl_ok" = yes; then
2920 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
2923 if test "$tcl_ok" = yes; then
2924 AC_DEFINE(HAVE_GETHOSTBYADDR_R)
2928 #--------------------------------------------------------------------
2929 # SC_TCL_GETHOSTBYNAME_R
2931 # Check to see what variant of gethostbyname_r() we have.
2932 # Based on David Arnold's example from the comp.programming.threads
2940 # Might define the following vars:
2941 # HAVE_GETHOSTBYADDR_R
2942 # HAVE_GETHOSTBYADDR_R_3
2943 # HAVE_GETHOSTBYADDR_R_5
2944 # HAVE_GETHOSTBYADDR_R_6
2946 #--------------------------------------------------------------------
2948 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
2949 AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
2954 struct hostent *he, *res;
2959 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
2960 ], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)])
2961 tcl_ok=$tcl_cv_api_gethostbyname_r_6
2962 if test "$tcl_ok" = yes; then
2963 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
2965 AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
2975 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
2976 ], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)])
2977 tcl_ok=$tcl_cv_api_gethostbyname_r_5
2978 if test "$tcl_ok" = yes; then
2979 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
2981 AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
2987 struct hostent_data data;
2989 (void) gethostbyname_r(name, he, &data);
2990 ], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)])
2991 tcl_ok=$tcl_cv_api_gethostbyname_r_3
2992 if test "$tcl_ok" = yes; then
2993 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
2997 if test "$tcl_ok" = yes; then
2998 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3002 #--------------------------------------------------------------------
3005 # Check if we have MT-safe variant of getpwuid() and if yes,
3006 # which one exactly.
3013 # Might define the following vars:
3018 #--------------------------------------------------------------------
3020 AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
3021 AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
3023 #include <sys/types.h>
3027 struct passwd pw, *pwp;
3031 (void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
3032 ], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)])
3033 tcl_ok=$tcl_cv_api_getpwuid_r_5
3034 if test "$tcl_ok" = yes; then
3035 AC_DEFINE(HAVE_GETPWUID_R_5)
3037 AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
3039 #include <sys/types.h>
3047 (void)getpwnam_r(uid, &pw, buf, buflen);
3048 ], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)])
3049 tcl_ok=$tcl_cv_api_getpwuid_r_4
3050 if test "$tcl_ok" = yes; then
3051 AC_DEFINE(HAVE_GETPWUID_R_4)
3054 if test "$tcl_ok" = yes; then
3055 AC_DEFINE(HAVE_GETPWUID_R)
3059 #--------------------------------------------------------------------
3062 # Check if we have MT-safe variant of getpwnam() and if yes,
3063 # which one exactly.
3070 # Might define the following vars:
3075 #--------------------------------------------------------------------
3077 AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
3078 AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
3080 #include <sys/types.h>
3084 struct passwd pw, *pwp;
3088 (void) getpwnam_r(name, &pw, buf, buflen, &pwp);
3089 ], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)])
3090 tcl_ok=$tcl_cv_api_getpwnam_r_5
3091 if test "$tcl_ok" = yes; then
3092 AC_DEFINE(HAVE_GETPWNAM_R_5)
3094 AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
3096 #include <sys/types.h>
3104 (void)getpwnam_r(name, &pw, buf, buflen);
3105 ], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)])
3106 tcl_ok=$tcl_cv_api_getpwnam_r_4
3107 if test "$tcl_ok" = yes; then
3108 AC_DEFINE(HAVE_GETPWNAM_R_4)
3111 if test "$tcl_ok" = yes; then
3112 AC_DEFINE(HAVE_GETPWNAM_R)
3116 #--------------------------------------------------------------------
3119 # Check if we have MT-safe variant of getgrgid() and if yes,
3120 # which one exactly.
3127 # Might define the following vars:
3132 #--------------------------------------------------------------------
3134 AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
3135 AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
3137 #include <sys/types.h>
3141 struct group gr, *grp;
3145 (void) getgrgid_r(gid, &gr, buf, buflen, &grp);
3146 ], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)])
3147 tcl_ok=$tcl_cv_api_getgrgid_r_5
3148 if test "$tcl_ok" = yes; then
3149 AC_DEFINE(HAVE_GETGRGID_R_5)
3151 AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
3153 #include <sys/types.h>
3161 (void)getgrgid_r(gid, &gr, buf, buflen);
3162 ], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)])
3163 tcl_ok=$tcl_cv_api_getgrgid_r_4
3164 if test "$tcl_ok" = yes; then
3165 AC_DEFINE(HAVE_GETGRGID_R_4)
3168 if test "$tcl_ok" = yes; then
3169 AC_DEFINE(HAVE_GETGRGID_R)
3173 #--------------------------------------------------------------------
3176 # Check if we have MT-safe variant of getgrnam() and if yes,
3177 # which one exactly.
3184 # Might define the following vars:
3189 #--------------------------------------------------------------------
3191 AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
3192 AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
3194 #include <sys/types.h>
3198 struct group gr, *grp;
3202 (void) getgrnam_r(name, &gr, buf, buflen, &grp);
3203 ], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)])
3204 tcl_ok=$tcl_cv_api_getgrnam_r_5
3205 if test "$tcl_ok" = yes; then
3206 AC_DEFINE(HAVE_GETGRNAM_R_5)
3208 AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
3210 #include <sys/types.h>
3218 (void)getgrnam_r(name, &gr, buf, buflen);
3219 ], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)])
3220 tcl_ok=$tcl_cv_api_getgrnam_r_4
3221 if test "$tcl_ok" = yes; then
3222 AC_DEFINE(HAVE_GETGRNAM_R_4)
3225 if test "$tcl_ok" = yes; then
3226 AC_DEFINE(HAVE_GETGRNAM_R)
3230 #--------------------------------------------------------------------
3231 # SC_CONFIG_COMMANDS_PRE(CMDS)
3233 # Replacement for autoconf 2.5x AC_COMMANDS_PRE:
3234 # Commands to run right before config.status is
3235 # created. Accumulates.
3237 # Requires presence of SC_OUTPUT_COMMANDS_PRE at the end
3238 # of configure.in (right before AC_OUTPUT).
3240 #--------------------------------------------------------------------
3242 AC_DEFUN([SC_CONFIG_COMMANDS_PRE], [
3243 define([SC_OUTPUT_COMMANDS_PRE], defn([SC_OUTPUT_COMMANDS_PRE])[$1
3245 AC_DEFUN([SC_OUTPUT_COMMANDS_PRE])