1# tcl.m4 -- 2# 3# This file provides a set of autoconf macros to help TEA-enable 4# a Tcl extension. 5# 6# Copyright (c) 1999-2000 Ajuba Solutions. 7# Copyright (c) 2002-2005 ActiveState Corporation. 8# 9# See the file "license.terms" for information on usage and redistribution 10# of this file, and for a DISCLAIMER OF ALL WARRANTIES. 11# 12# RCS: @(#) $Id: tcl.m4,v 1.6 2005/03/25 19:40:47 dgp Exp $ 13 14AC_PREREQ(2.50) 15 16#------------------------------------------------------------------------ 17# TEA_PATH_TCLCONFIG -- 18# 19# Locate the tclConfig.sh file and perform a sanity check on 20# the Tcl compile flags 21# 22# Arguments: 23# none 24# 25# Results: 26# 27# Adds the following arguments to configure: 28# --with-tcl=... 29# 30# Defines the following vars: 31# TCL_BIN_DIR Full path to the directory containing 32# the tclConfig.sh file 33#------------------------------------------------------------------------ 34 35AC_DEFUN(TEA_PATH_TCLCONFIG, [ 36 dnl Make sure we are initialized 37 AC_REQUIRE([TEA_INIT]) 38 # 39 # Ok, lets find the tcl configuration 40 # First, look for one uninstalled. 41 # the alternative search directory is invoked by --with-tcl 42 # 43 44 if test x"${no_tcl}" = x ; then 45 # we reset no_tcl in case something fails here 46 no_tcl=true 47 AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval}) 48 AC_MSG_CHECKING([for Tcl configuration]) 49 AC_CACHE_VAL(ac_cv_c_tclconfig,[ 50 51 # First check to see if --with-tcl was specified. 52 if test x"${with_tclconfig}" != x ; then 53 case ${with_tclconfig} in 54 */tclConfig.sh ) 55 if test -f ${with_tclconfig}; then 56 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself]) 57 with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'` 58 fi ;; 59 esac 60 if test -f "${with_tclconfig}/tclConfig.sh" ; then 61 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` 62 else 63 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) 64 fi 65 fi 66 67 # then check for a private Tcl installation 68 if test x"${ac_cv_c_tclconfig}" = x ; then 69 for i in \ 70 ../tcl \ 71 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 72 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ 73 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ 74 ../../tcl \ 75 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 76 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ 77 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ 78 ../../../tcl \ 79 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 80 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ 81 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do 82 if test -f "$i/unix/tclConfig.sh" ; then 83 ac_cv_c_tclconfig=`(cd $i/unix; pwd)` 84 break 85 fi 86 done 87 fi 88 89 # check in a few common install locations 90 if test x"${ac_cv_c_tclconfig}" = x ; then 91 for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ 92 `ls -d ${prefix}/lib 2>/dev/null` \ 93 `ls -d /usr/local/lib 2>/dev/null` \ 94 `ls -d /usr/contrib/lib 2>/dev/null` \ 95 `ls -d /usr/lib 2>/dev/null` \ 96 ; do 97 if test -f "$i/tclConfig.sh" ; then 98 ac_cv_c_tclconfig=`(cd $i; pwd)` 99 break 100 fi 101 done 102 fi 103 104 # check in a few other private locations 105 if test x"${ac_cv_c_tclconfig}" = x ; then 106 for i in \ 107 ${srcdir}/../tcl \ 108 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 109 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ 110 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do 111 if test -f "$i/unix/tclConfig.sh" ; then 112 ac_cv_c_tclconfig=`(cd $i/unix; pwd)` 113 break 114 fi 115 done 116 fi 117 ]) 118 119 if test x"${ac_cv_c_tclconfig}" = x ; then 120 TCL_BIN_DIR="# no Tcl configs found" 121 AC_MSG_WARN("Cannot find Tcl configuration definitions") 122 exit 0 123 else 124 no_tcl= 125 TCL_BIN_DIR=${ac_cv_c_tclconfig} 126 AC_MSG_RESULT([found $TCL_BIN_DIR/tclConfig.sh]) 127 fi 128 fi 129]) 130 131#------------------------------------------------------------------------ 132# TEA_PATH_TKCONFIG -- 133# 134# Locate the tkConfig.sh file 135# 136# Arguments: 137# none 138# 139# Results: 140# 141# Adds the following arguments to configure: 142# --with-tk=... 143# 144# Defines the following vars: 145# TK_BIN_DIR Full path to the directory containing 146# the tkConfig.sh file 147#------------------------------------------------------------------------ 148 149AC_DEFUN(TEA_PATH_TKCONFIG, [ 150 # 151 # Ok, lets find the tk configuration 152 # First, look for one uninstalled. 153 # the alternative search directory is invoked by --with-tk 154 # 155 156 if test x"${no_tk}" = x ; then 157 # we reset no_tk in case something fails here 158 no_tk=true 159 AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval}) 160 AC_MSG_CHECKING([for Tk configuration]) 161 AC_CACHE_VAL(ac_cv_c_tkconfig,[ 162 163 # First check to see if --with-tkconfig was specified. 164 if test x"${with_tkconfig}" != x ; then 165 case ${with_tkconfig} in 166 */tkConfig.sh ) 167 if test -f ${with_tkconfig}; then 168 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself]) 169 with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'` 170 fi ;; 171 esac 172 if test -f "${with_tkconfig}/tkConfig.sh" ; then 173 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` 174 else 175 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh]) 176 fi 177 fi 178 179 # then check for a private Tk library 180 if test x"${ac_cv_c_tkconfig}" = x ; then 181 for i in \ 182 ../tk \ 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` \ 186 ../../tk \ 187 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 188 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \ 189 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ 190 ../../../tk \ 191 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 192 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \ 193 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do 194 if test -f "$i/unix/tkConfig.sh" ; then 195 ac_cv_c_tkconfig=`(cd $i/unix; pwd)` 196 break 197 fi 198 done 199 fi 200 # check in a few common install locations 201 if test x"${ac_cv_c_tkconfig}" = x ; then 202 for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ 203 `ls -d ${prefix}/lib 2>/dev/null` \ 204 `ls -d /usr/local/lib 2>/dev/null` \ 205 `ls -d /usr/contrib/lib 2>/dev/null` \ 206 `ls -d /usr/lib 2>/dev/null` \ 207 ; do 208 if test -f "$i/tkConfig.sh" ; then 209 ac_cv_c_tkconfig=`(cd $i; pwd)` 210 break 211 fi 212 done 213 fi 214 # check in a few other private locations 215 if test x"${ac_cv_c_tkconfig}" = x ; then 216 for i in \ 217 ${srcdir}/../tk \ 218 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 219 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \ 220 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do 221 if test -f "$i/unix/tkConfig.sh" ; then 222 ac_cv_c_tkconfig=`(cd $i/unix; pwd)` 223 break 224 fi 225 done 226 fi 227 ]) 228 if test x"${ac_cv_c_tkconfig}" = x ; then 229 TK_BIN_DIR="# no Tk configs found" 230 AC_MSG_WARN("Cannot find Tk configuration definitions") 231 exit 0 232 else 233 no_tk= 234 TK_BIN_DIR=${ac_cv_c_tkconfig} 235 AC_MSG_RESULT([found $TK_BIN_DIR/tkConfig.sh]) 236 fi 237 fi 238 239]) 240 241#------------------------------------------------------------------------ 242# TEA_LOAD_TCLCONFIG -- 243# 244# Load the tclConfig.sh file 245# 246# Arguments: 247# 248# Requires the following vars to be set: 249# TCL_BIN_DIR 250# 251# Results: 252# 253# Subst the following vars: 254# TCL_BIN_DIR 255# TCL_SRC_DIR 256# TCL_LIB_FILE 257# 258#------------------------------------------------------------------------ 259 260AC_DEFUN(TEA_LOAD_TCLCONFIG, [ 261 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) 262 263 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then 264 AC_MSG_RESULT([loading]) 265 . $TCL_BIN_DIR/tclConfig.sh 266 else 267 AC_MSG_RESULT([file not found]) 268 fi 269 270 # 271 # If the TCL_BIN_DIR is the build directory (not the install directory), 272 # then set the common variable name to the value of the build variables. 273 # For example, the variable TCL_LIB_SPEC will be set to the value 274 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC 275 # instead of TCL_BUILD_LIB_SPEC since it will work with both an 276 # installed and uninstalled version of Tcl. 277 # 278 279 if test -f $TCL_BIN_DIR/Makefile ; then 280 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} 281 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} 282 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} 283 fi 284 285 # 286 # eval is required to do the TCL_DBGX substitution 287 # 288 289 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" 290 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" 291 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" 292 293 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" 294 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" 295 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" 296 297 AC_SUBST(TCL_VERSION) 298 AC_SUBST(TCL_BIN_DIR) 299 AC_SUBST(TCL_SRC_DIR) 300 301 AC_SUBST(TCL_LIB_FILE) 302 AC_SUBST(TCL_LIB_FLAG) 303 AC_SUBST(TCL_LIB_SPEC) 304 305 AC_SUBST(TCL_STUB_LIB_FILE) 306 AC_SUBST(TCL_STUB_LIB_FLAG) 307 AC_SUBST(TCL_STUB_LIB_SPEC) 308 309 AC_SUBST(TCL_LIBS) 310 AC_SUBST(TCL_DEFS) 311 AC_SUBST(TCL_EXTRA_CFLAGS) 312 AC_SUBST(TCL_LD_FLAGS) 313 AC_SUBST(TCL_SHLIB_LD_LIBS) 314 #AC_SUBST(TCL_BUILD_LIB_SPEC) 315 #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) 316]) 317 318#------------------------------------------------------------------------ 319# TEA_LOAD_TKCONFIG -- 320# 321# Load the tkConfig.sh file 322# 323# Arguments: 324# 325# Requires the following vars to be set: 326# TK_BIN_DIR 327# 328# Results: 329# 330# Sets the following vars that should be in tkConfig.sh: 331# TK_BIN_DIR 332#------------------------------------------------------------------------ 333 334AC_DEFUN(TEA_LOAD_TKCONFIG, [ 335 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh]) 336 337 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then 338 AC_MSG_RESULT([loading]) 339 . $TK_BIN_DIR/tkConfig.sh 340 else 341 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh]) 342 fi 343 344 # 345 # If the TK_BIN_DIR is the build directory (not the install directory), 346 # then set the common variable name to the value of the build variables. 347 # For example, the variable TK_LIB_SPEC will be set to the value 348 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC 349 # instead of TK_BUILD_LIB_SPEC since it will work with both an 350 # installed and uninstalled version of Tcl. 351 # 352 353 if test -f $TK_BIN_DIR/Makefile ; then 354 TK_LIB_SPEC=${TK_BUILD_LIB_SPEC} 355 TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC} 356 TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH} 357 fi 358 359 # 360 # eval is required to do the TK_DBGX substitution 361 # 362 363 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\"" 364 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\"" 365 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\"" 366 367 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\"" 368 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\"" 369 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\"" 370 371 AC_SUBST(TK_VERSION) 372 AC_SUBST(TK_BIN_DIR) 373 AC_SUBST(TK_SRC_DIR) 374 375 AC_SUBST(TK_LIB_FILE) 376 AC_SUBST(TK_LIB_FLAG) 377 AC_SUBST(TK_LIB_SPEC) 378 379 AC_SUBST(TK_STUB_LIB_FILE) 380 AC_SUBST(TK_STUB_LIB_FLAG) 381 AC_SUBST(TK_STUB_LIB_SPEC) 382 383 AC_SUBST(TK_LIBS) 384 AC_SUBST(TK_XINCLUDES) 385]) 386 387#------------------------------------------------------------------------ 388# TEA_ENABLE_SHARED -- 389# 390# Allows the building of shared libraries 391# 392# Arguments: 393# none 394# 395# Results: 396# 397# Adds the following arguments to configure: 398# --enable-shared=yes|no 399# 400# Defines the following vars: 401# STATIC_BUILD Used for building import/export libraries 402# on Windows. 403# 404# Sets the following vars: 405# SHARED_BUILD Value of 1 or 0 406#------------------------------------------------------------------------ 407 408AC_DEFUN(TEA_ENABLE_SHARED, [ 409 AC_MSG_CHECKING([how to build libraries]) 410 AC_ARG_ENABLE(shared, 411 [ --enable-shared build and link with shared libraries [--enable-shared]], 412 [tcl_ok=$enableval], [tcl_ok=yes]) 413 414 if test "${enable_shared+set}" = set; then 415 enableval="$enable_shared" 416 tcl_ok=$enableval 417 else 418 tcl_ok=yes 419 fi 420 421 if test "$tcl_ok" = "yes" ; then 422 AC_MSG_RESULT([shared]) 423 SHARED_BUILD=1 424 else 425 AC_MSG_RESULT([static]) 426 SHARED_BUILD=0 427 AC_DEFINE(STATIC_BUILD) 428 fi 429 AC_SUBST(SHARED_BUILD) 430]) 431 432#------------------------------------------------------------------------ 433# TEA_ENABLE_THREADS -- 434# 435# Specify if thread support should be enabled. If "yes" is 436# specified as an arg (optional), threads are enabled by default. 437# TCL_THREADS is checked so that if you are compiling an extension 438# against a threaded core, your extension must be compiled threaded 439# as well. 440# 441# Arguments: 442# none 443# 444# Results: 445# 446# Adds the following arguments to configure: 447# --enable-threads 448# 449# Sets the following vars: 450# THREADS_LIBS Thread library(s) 451# 452# Defines the following vars: 453# TCL_THREADS 454# _REENTRANT 455# 456#------------------------------------------------------------------------ 457 458AC_DEFUN(TEA_ENABLE_THREADS, [ 459 AC_ARG_ENABLE(threads, [ --enable-threads build with threads], 460 [tcl_ok=$enableval], [tcl_ok=$1]) 461 462 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then 463 TCL_THREADS=1 464 465 if test "${TEA_PLATFORM}" != "windows" ; then 466 # We are always OK on Windows, so check what this platform wants. 467 AC_DEFINE(USE_THREAD_ALLOC) 468 AC_DEFINE(_REENTRANT) 469 AC_DEFINE(_THREAD_SAFE) 470 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) 471 if test "$tcl_ok" = "no"; then 472 # Check a little harder for __pthread_mutex_init in the 473 # same library, as some systems hide it there until 474 # pthread.h is defined. We could alternatively do an 475 # AC_TRY_COMPILE with pthread.h, but that will work with 476 # libpthread really doesn't exist, like AIX 4.2. 477 # [Bug: 4359] 478 AC_CHECK_LIB(pthread, __pthread_mutex_init, 479 tcl_ok=yes, tcl_ok=no) 480 fi 481 482 if test "$tcl_ok" = "yes"; then 483 # The space is needed 484 THREADS_LIBS=" -lpthread" 485 else 486 AC_CHECK_LIB(pthreads, pthread_mutex_init, 487 tcl_ok=yes, tcl_ok=no) 488 if test "$tcl_ok" = "yes"; then 489 # The space is needed 490 THREADS_LIBS=" -lpthreads" 491 else 492 AC_CHECK_LIB(c, pthread_mutex_init, 493 tcl_ok=yes, tcl_ok=no) 494 if test "$tcl_ok" = "no"; then 495 AC_CHECK_LIB(c_r, pthread_mutex_init, 496 tcl_ok=yes, tcl_ok=no) 497 if test "$tcl_ok" = "yes"; then 498 # The space is needed 499 THREADS_LIBS=" -pthread" 500 else 501 TCL_THREADS=0 502 AC_MSG_WARN("Don t know how to find pthread lib on your system - thread support disabled") 503 fi 504 fi 505 fi 506 fi 507 508 # Does the pthread-implementation provide 509 # 'pthread_attr_setstacksize' ? 510 511 ac_saved_libs=$LIBS 512 LIBS="$LIBS $THREADS_LIBS" 513 AC_CHECK_FUNCS(pthread_attr_setstacksize) 514 LIBS=$ac_saved_libs 515 AC_CHECK_FUNCS(readdir_r) 516 fi 517 else 518 TCL_THREADS=0 519 fi 520 # Do checking message here to not mess up interleaved configure output 521 AC_MSG_CHECKING([for building with threads]) 522 if test "${TCL_THREADS}" = "1"; then 523 AC_DEFINE(TCL_THREADS) 524 #LIBS="$LIBS $THREADS_LIBS" 525 AC_MSG_RESULT([yes]) 526 else 527 AC_MSG_RESULT([no (default)]) 528 fi 529 # TCL_THREADS sanity checking. See if our request for building with 530 # threads is the same as the way Tcl was built. If not, warn the user. 531 case ${TCL_DEFS} in 532 *THREADS=1*) 533 if test "${TCL_THREADS}" = "0"; then 534 AC_MSG_WARN([ 535 Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl 536 that IS thread-enabled.]) 537 fi 538 ;; 539 *) 540 if test "${TCL_THREADS}" = "1"; then 541 AC_MSG_WARN([ 542 --enable-threads requested, but attempting building against a Tcl 543 that is NOT thread-enabled.]) 544 fi 545 ;; 546 esac 547 AC_SUBST(TCL_THREADS) 548]) 549 550#------------------------------------------------------------------------ 551# TEA_ENABLE_SYMBOLS -- 552# 553# Specify if debugging symbols should be used 554# Memory (TCL_MEM_DEBUG) debugging can also be enabled. 555# 556# Arguments: 557# none 558# 559# Requires the following vars to be set: 560# CFLAGS_DEBUG 561# CFLAGS_OPTIMIZE 562# LDFLAGS_DEBUG 563# LDFLAGS_OPTIMIZE 564# 565# Results: 566# 567# Adds the following arguments to configure: 568# --enable-symbols 569# 570# Defines the following vars: 571# CFLAGS_DEFAULT Sets to CFLAGS_DEBUG if true 572# Sets to CFLAGS_OPTIMIZE if false 573# LDFLAGS_DEFAULT Sets to LDFLAGS_DEBUG if true 574# Sets to LDFLAGS_OPTIMIZE if false 575# DBGX Formerly used as debug library extension; 576# always blank now. 577# 578#------------------------------------------------------------------------ 579 580AC_DEFUN(TEA_ENABLE_SYMBOLS, [ 581 dnl Make sure we are initialized 582 AC_REQUIRE([TEA_CONFIG_CFLAGS]) 583 584 DBGX="" 585 586 AC_MSG_CHECKING([for build with symbols]) 587 AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no]) 588 if test "$tcl_ok" = "no"; then 589 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" 590 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" 591 AC_MSG_RESULT([no]) 592 else 593 CFLAGS_DEFAULT="${CFLAGS_DEBUG}" 594 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" 595 if test "$tcl_ok" = "yes"; then 596 AC_MSG_RESULT([yes (standard debugging)]) 597 fi 598 fi 599 if test "${TEA_PLATFORM}" != "windows" ; then 600 LDFLAGS_DEFAULT="${LDFLAGS}" 601 fi 602 603 AC_SUBST(TCL_DBGX) 604 AC_SUBST(CFLAGS_DEFAULT) 605 AC_SUBST(LDFLAGS_DEFAULT) 606 607 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then 608 AC_DEFINE(TCL_MEM_DEBUG) 609 fi 610 611 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then 612 if test "$tcl_ok" = "all"; then 613 AC_MSG_RESULT([enabled symbols mem debugging]) 614 else 615 AC_MSG_RESULT([enabled $tcl_ok debugging]) 616 fi 617 fi 618]) 619 620#------------------------------------------------------------------------ 621# TEA_ENABLE_LANGINFO -- 622# 623# Allows use of modern nl_langinfo check for better l10n. 624# This is only relevant for Unix. 625# 626# Arguments: 627# none 628# 629# Results: 630# 631# Adds the following arguments to configure: 632# --enable-langinfo=yes|no (default is yes) 633# 634# Defines the following vars: 635# HAVE_LANGINFO Triggers use of nl_langinfo if defined. 636# 637#------------------------------------------------------------------------ 638 639AC_DEFUN(TEA_ENABLE_LANGINFO, [ 640 AC_ARG_ENABLE(langinfo, 641 [ --enable-langinfo use nl_langinfo if possible to determine 642 encoding at startup, otherwise use old heuristic], 643 [langinfo_ok=$enableval], [langinfo_ok=yes]) 644 645 HAVE_LANGINFO=0 646 if test "$langinfo_ok" = "yes"; then 647 if test "$langinfo_ok" = "yes"; then 648 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no]) 649 fi 650 fi 651 AC_MSG_CHECKING([whether to use nl_langinfo]) 652 if test "$langinfo_ok" = "yes"; then 653 AC_TRY_COMPILE([#include <langinfo.h>], 654 [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no]) 655 if test "$langinfo_ok" = "no"; then 656 langinfo_ok="no (could not compile with nl_langinfo)"; 657 fi 658 if test "$langinfo_ok" = "yes"; then 659 AC_DEFINE(HAVE_LANGINFO) 660 fi 661 fi 662 AC_MSG_RESULT([$langinfo_ok]) 663]) 664 665#-------------------------------------------------------------------- 666# TEA_CONFIG_CFLAGS 667# 668# Try to determine the proper flags to pass to the compiler 669# for building shared libraries and other such nonsense. 670# 671# Arguments: 672# none 673# 674# Results: 675# 676# Defines the following vars: 677# 678# DL_OBJS - Name of the object file that implements dynamic 679# loading for Tcl on this system. 680# DL_LIBS - Library file(s) to include in tclsh and other base 681# applications in order for the "load" command to work. 682# LDFLAGS - Flags to pass to the compiler when linking object 683# files into an executable application binary such 684# as tclsh. 685# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib", 686# that tell the run-time dynamic linker where to look 687# for shared libraries such as libtcl.so. Depends on 688# the variable LIB_RUNTIME_DIR in the Makefile. 689# SHLIB_CFLAGS - Flags to pass to cc when compiling the components 690# of a shared library (may request position-independent 691# code, among other things). 692# SHLIB_LD - Base command to use for combining object files 693# into a shared library. 694# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when 695# creating shared libraries. This symbol typically 696# goes at the end of the "ld" commands that build 697# shared libraries. The value of the symbol is 698# "${LIBS}" if all of the dependent libraries should 699# be specified when creating a shared library. If 700# dependent libraries should not be specified (as on 701# SunOS 4.x, where they cause the link to fail, or in 702# general if Tcl and Tk aren't themselves shared 703# libraries), then this symbol has an empty string 704# as its value. 705# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable 706# extensions. An empty string means we don't know how 707# to use shared libraries on this platform. 708# TCL_LIB_FILE - Name of the file that contains the Tcl library, such 709# as libtcl7.8.so or libtcl7.8.a. 710# TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl" 711# in the shared library name, using the 712# ${PACKAGE_VERSION} variable to put the version in 713# the right place. This is used by platforms that 714# need non-standard library names. 715# Examples: ${PACKAGE_VERSION}.so.1.1 on NetBSD, 716# since it needs to have a version after the .so, and 717# ${PACKAGE_VERSION}.a on AIX, since the Tcl shared 718# library needs to have a .a extension whereas shared 719# objects for loadable extensions have a .so 720# extension. Defaults to 721# ${PACKAGE_VERSION}${SHLIB_SUFFIX}. 722# TCL_NEEDS_EXP_FILE - 723# 1 means that an export file is needed to link to a 724# shared library. 725# TCL_EXP_FILE - The name of the installed export / import file which 726# should be used to link to the Tcl shared library. 727# Empty if Tcl is unshared. 728# TCL_BUILD_EXP_FILE - 729# The name of the built export / import file which 730# should be used to link to the Tcl shared library. 731# Empty if Tcl is unshared. 732# CFLAGS_DEBUG - 733# Flags used when running the compiler in debug mode 734# CFLAGS_OPTIMIZE - 735# Flags used when running the compiler in optimize mode 736# CFLAGS - We add CFLAGS to pass to the compiler 737# 738# Subst's the following vars: 739# DL_LIBS 740# CFLAGS_DEBUG 741# CFLAGS_OPTIMIZE 742# CFLAGS_WARNING 743# 744# STLIB_LD 745# SHLIB_LD 746# SHLIB_CFLAGS 747# LDFLAGS_DEBUG 748# LDFLAGS_OPTIMIZE 749#-------------------------------------------------------------------- 750 751AC_DEFUN(TEA_CONFIG_CFLAGS, [ 752 dnl Make sure we are initialized 753 AC_REQUIRE([TEA_INIT]) 754 755 # Step 0: Enable 64 bit support? 756 757 AC_MSG_CHECKING([if 64bit support is enabled]) 758 AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no]) 759 AC_MSG_RESULT([$do64bit]) 760 761 # Step 0.b: Enable Solaris 64 bit VIS support? 762 763 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested]) 764 AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support], [do64bitVIS=$enableval], [do64bitVIS=no]) 765 AC_MSG_RESULT([$do64bitVIS]) 766 767 if test "$do64bitVIS" = "yes"; then 768 # Force 64bit on with VIS 769 do64bit=yes 770 fi 771 772 # Step 0.c: Cross-compiling options for Windows/CE builds? 773 774 if test "${TEA_PLATFORM}" = "windows" ; then 775 AC_MSG_CHECKING([if Windows/CE build is requested]) 776 AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no]) 777 AC_MSG_RESULT($doWince) 778 fi 779 780 # Step 1: set the variable "system" to hold the name and version number 781 # for the system. This can usually be done via the "uname" command, but 782 # there are a few systems, like Next, where this doesn't work. 783 784 AC_MSG_CHECKING([system version (for dynamic loading)]) 785 if test -f /usr/lib/NextStep/software_version; then 786 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` 787 else 788 system=`uname -s`-`uname -r` 789 if test "$?" -ne 0 ; then 790 AC_MSG_RESULT([unknown (can't find uname command)]) 791 system=unknown 792 else 793 # Special check for weird MP-RAS system (uname returns weird 794 # results, and the version is kept in special file). 795 796 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then 797 system=MP-RAS-`awk '{print $3}' /etc/.relid'` 798 fi 799 if test "`uname -s`" = "AIX" ; then 800 system=AIX-`uname -v`.`uname -r` 801 fi 802 if test "${TEA_PLATFORM}" = "windows" ; then 803 system=windows 804 fi 805 AC_MSG_RESULT([$system]) 806 fi 807 fi 808 809 # Step 2: check for existence of -ldl library. This is needed because 810 # Linux can use either -ldl or -ldld for dynamic loading. 811 812 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) 813 814 # Step 3: set configuration options based on system name and version. 815 # This is similar to Tcl's unix/tcl.m4 except that we've added a 816 # "windows" case and CC_SEARCH_FLAGS becomes LD_SEARCH_FLAGS for us 817 # (and we have no CC_SEARCH_FLAGS). 818 819 do64bit_ok=no 820 LDFLAGS_ORIG="$LDFLAGS" 821 TCL_EXPORT_FILE_SUFFIX="" 822 UNSHARED_LIB_SUFFIX="" 823 TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' 824 ECHO_VERSION='`echo ${PACKAGE_VERSION}`' 825 TCL_LIB_VERSIONS_OK=ok 826 CFLAGS_DEBUG=-g 827 if test "$GCC" = "yes" ; then 828 CFLAGS_OPTIMIZE=-O2 829 CFLAGS_WARNING="-Wall -Wno-implicit-int" 830 else 831 CFLAGS_OPTIMIZE=-O 832 CFLAGS_WARNING="" 833 fi 834 TCL_NEEDS_EXP_FILE=0 835 TCL_BUILD_EXP_FILE="" 836 TCL_EXP_FILE="" 837dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed. 838dnl AC_CHECK_TOOL(AR, ar, :) 839 AC_CHECK_PROG(AR, ar, ar) 840 STLIB_LD='${AR} cr' 841 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" 842 case $system in 843 windows) 844 # This is a 2-stage check to make sure we have the 64-bit SDK 845 # We have to know where the SDK is installed. 846 if test "$do64bit" = "yes" ; then 847 if test "x${MSSDK}x" = "xx" ; then 848 MSSDK="C:/Progra~1/Microsoft SDK" 849 fi 850 # Ensure that this path has no spaces to work in autoconf 851 TEA_PATH_NOSPACE(MSSDK, ${MSSDK}) 852 if test ! -d "${MSSDK}/bin/win64" ; then 853 AC_MSG_WARN([could not find 64-bit SDK to enable 64bit mode]) 854 do64bit="no" 855 else 856 do64bit_ok="yes" 857 fi 858 fi 859 860 if test "$doWince" != "no" ; then 861 if test "$do64bit" = "yes" ; then 862 AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible]) 863 fi 864 if test "$GCC" = "yes" ; then 865 AC_MSG_ERROR([Windows/CE and GCC builds incompatible]) 866 fi 867 TEA_PATH_CELIB 868 # Set defaults for common evc4/PPC2003 setup 869 # Currently Tcl requires 300+, possibly 420+ for sockets 870 CEVERSION=420; # could be 211 300 301 400 420 ... 871 TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... 872 ARCH=ARM; # could be ARM MIPS X86EM ... 873 PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" 874 if test "$doWince" != "yes"; then 875 # If !yes then the user specified something 876 # Reset ARCH to allow user to skip specifying it 877 ARCH= 878 eval `echo $doWince | awk -F, '{ \ 879 if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \ 880 if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ 881 if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \ 882 if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \ 883 if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \ 884 }'` 885 if test "x${ARCH}" = "x" ; then 886 ARCH=$TARGETCPU; 887 fi 888 fi 889 OSVERSION=WCE$CEVERSION; 890 if test "x${WCEROOT}" = "x" ; then 891 WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" 892 if test ! -d "${WCEROOT}" ; then 893 WCEROOT="C:/Program Files/Microsoft eMbedded Tools" 894 fi 895 fi 896 if test "x${SDKROOT}" = "x" ; then 897 SDKROOT="C:/Program Files/Windows CE Tools" 898 if test ! -d "${SDKROOT}" ; then 899 SDKROOT="C:/Windows CE Tools" 900 fi 901 fi 902 # Ensure that this path has no spaces to work in autoconf 903 TEA_PATH_NOSPACE(WCEROOT, ${WCEROOT}) 904 TEA_PATH_NOSPACE(SDKROOT, ${SDKROOT}) 905 if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ 906 -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then 907 AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]]) 908 doWince="no" 909 else 910 # We could PATH_NOSPACE these, but that's not important, 911 # as long as we quote them when used. 912 CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" 913 if test -d "${CEINCLUDE}/${TARGETCPU}" ; then 914 CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" 915 fi 916 CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" 917 fi 918 fi 919 920 if test "$GCC" != "yes" ; then 921 if test "${SHARED_BUILD}" = "0" ; then 922 runtime=-MT 923 else 924 runtime=-MD 925 fi 926 927 if test "$do64bit" = "yes" ; then 928 # All this magic is necessary for the Win64 SDK RC1 - hobbs 929 CC="${MSSDK}/Bin/Win64/cl.exe" 930 CFLAGS="${CFLAGS} -I${MSSDK}/Include/prerelease \ 931 -I${MSSDK}/Include/Win64/crt \ 932 -I${MSSDK}/Include" 933 RC="${MSSDK}/bin/rc.exe" 934 lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \ 935 -LIBPATH:${MSSDK}/Lib/Prerelease/IA64 -nologo" 936 LINKBIN="${MSSDK}/bin/win64/link.exe" 937 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" 938 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" 939 elif test "$doWince" != "no" ; then 940 CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" 941 if test "${TARGETCPU}" = "X86"; then 942 CC="${CEBINROOT}/cl.exe" 943 else 944 CC="${CEBINROOT}/cl${ARCH}.exe" 945 fi 946 CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" 947 RC="${WCEROOT}/Common/EVC/bin/rc.exe" 948 arch=`echo ${ARCH} | awk '{print tolower([$]0)}'` 949 defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS" 950 if test "${SHARED_BUILD}" = "1" ; then 951 # Static CE builds require static celib as well 952 defs="${defs} _DLL" 953 fi 954 for i in $defs ; do 955 AC_DEFINE_UNQUOTED($i) 956 done 957 AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION) 958 AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION) 959 CFLAGS_DEBUG="-nologo -Zi -Od" 960 CFLAGS_OPTIMIZE="-nologo -Ox" 961 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` 962 lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" 963 LINKBIN="${CEBINROOT}/link.exe" 964 AC_SUBST(CELIB_DIR) 965 else 966 RC="rc" 967 lflags="-nologo" 968 LINKBIN="link" 969 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" 970 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" 971 fi 972 fi 973 974 if test "$GCC" = "yes"; then 975 # mingw gcc mode 976 RC="windres" 977 CFLAGS_DEBUG="-g" 978 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" 979 SHLIB_LD="$CC -shared" 980 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 981 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" 982 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" 983 else 984 SHLIB_LD="${LINKBIN} -dll ${lflags}" 985 # link -lib only works when -lib is the first arg 986 STLIB_LD="${LINKBIN} -lib ${lflags}" 987 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib' 988 PATHTYPE=-w 989 # For information on what debugtype is most useful, see: 990 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp 991 # This essentially turns it all on. 992 LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" 993 LDFLAGS_OPTIMIZE="-release" 994 if test "$doWince" != "no" ; then 995 LDFLAGS_CONSOLE="-link ${lflags}" 996 LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} 997 else 998 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" 999 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" 1000 fi 1001 fi 1002 1003 SHLIB_LD_LIBS='${LIBS}' 1004 SHLIB_SUFFIX=".dll" 1005 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll' 1006 1007 TCL_LIB_VERSIONS_OK=nodots 1008 # Bogus to avoid getting this turned off 1009 DL_OBJS="tclLoadNone.obj" 1010 ;; 1011 AIX-*) 1012 if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then 1013 # AIX requires the _r compiler when gcc isn't being used 1014 if test "${CC}" != "cc_r" ; then 1015 CC=${CC}_r 1016 fi 1017 AC_MSG_RESULT([Using $CC for compiling with threads]) 1018 fi 1019 LIBS="$LIBS -lc" 1020 SHLIB_CFLAGS="" 1021 SHLIB_SUFFIX=".so" 1022 SHLIB_LD_LIBS='${LIBS}' 1023 1024 DL_OBJS="tclLoadDl.o" 1025 LD_LIBRARY_PATH_VAR="LIBPATH" 1026 1027 # AIX v<=4.1 has some different flags than 4.2+ 1028 if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then 1029 #LIBOBJS="$LIBOBJS tclLoadAix.o" 1030 AC_LIBOBJ([tclLoadAix]) 1031 DL_LIBS="-lld" 1032 fi 1033 1034 # Check to enable 64-bit flags for compiler/linker on AIX 4+ 1035 if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then 1036 if test "$GCC" = "yes" ; then 1037 AC_MSG_WARN("64bit mode not supported with GCC on $system") 1038 else 1039 do64bit_ok=yes 1040 CFLAGS="$CFLAGS -q64" 1041 LDFLAGS="$LDFLAGS -q64" 1042 RANLIB="${RANLIB} -X64" 1043 AR="${AR} -X64" 1044 SHLIB_LD_FLAGS="-b64" 1045 fi 1046 fi 1047 1048 if test "`uname -m`" = "ia64" ; then 1049 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC 1050 SHLIB_LD="/usr/ccs/bin/ld -G -z text" 1051 # AIX-5 has dl* in libc.so 1052 DL_LIBS="" 1053 if test "$GCC" = "yes" ; then 1054 LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' 1055 else 1056 LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' 1057 fi 1058 else 1059 if test "$GCC" = "yes" ; then 1060 SHLIB_LD="gcc -shared" 1061 else 1062 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" 1063 fi 1064 SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}" 1065 DL_LIBS="-ldl" 1066 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 1067 TCL_NEEDS_EXP_FILE=1 1068 TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp' 1069 fi 1070 1071 # On AIX <=v4 systems, libbsd.a has to be linked in to support 1072 # non-blocking file IO. This library has to be linked in after 1073 # the MATH_LIBS or it breaks the pow() function. The way to 1074 # insure proper sequencing, is to add it to the tail of MATH_LIBS. 1075 # This library also supplies gettimeofday. 1076 # 1077 # AIX does not have a timezone field in struct tm. When the AIX 1078 # bsd library is used, the timezone global and the gettimeofday 1079 # methods are to be avoided for timezone deduction instead, we 1080 # deduce the timezone by comparing the localtime result on a 1081 # known GMT value. 1082 1083 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no) 1084 if test $libbsd = yes; then 1085 MATH_LIBS="$MATH_LIBS -lbsd" 1086 AC_DEFINE(USE_DELTA_FOR_TZ) 1087 fi 1088 ;; 1089 BeOS*) 1090 SHLIB_CFLAGS="-fPIC" 1091 SHLIB_LD="${CC} -nostart" 1092 SHLIB_LD_LIBS='${LIBS}' 1093 SHLIB_SUFFIX=".so" 1094 DL_OBJS="tclLoadDl.o" 1095 DL_LIBS="-ldl" 1096 ;; 1097 BSD/OS-2.1*|BSD/OS-3*) 1098 SHLIB_CFLAGS="" 1099 SHLIB_LD="shlicc -r" 1100 SHLIB_LD_LIBS='${LIBS}' 1101 SHLIB_SUFFIX=".so" 1102 DL_OBJS="tclLoadDl.o" 1103 DL_LIBS="-ldl" 1104 LD_SEARCH_FLAGS="" 1105 ;; 1106 BSD/OS-4.*) 1107 SHLIB_CFLAGS="-export-dynamic -fPIC" 1108 SHLIB_LD="cc -shared" 1109 SHLIB_LD_LIBS='${LIBS}' 1110 SHLIB_SUFFIX=".so" 1111 DL_OBJS="tclLoadDl.o" 1112 DL_LIBS="-ldl" 1113 LDFLAGS="$LDFLAGS -export-dynamic" 1114 LD_SEARCH_FLAGS="" 1115 ;; 1116 dgux*) 1117 SHLIB_CFLAGS="-K PIC" 1118 SHLIB_LD="cc -G" 1119 SHLIB_LD_LIBS="" 1120 SHLIB_SUFFIX=".so" 1121 DL_OBJS="tclLoadDl.o" 1122 DL_LIBS="-ldl" 1123 LD_SEARCH_FLAGS="" 1124 ;; 1125 HP-UX-*.11.*) 1126 # Use updated header definitions where possible 1127 AC_DEFINE(_XOPEN_SOURCE_EXTENDED) 1128 1129 SHLIB_SUFFIX=".sl" 1130 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) 1131 if test "$tcl_ok" = yes; then 1132 SHLIB_CFLAGS="+z" 1133 SHLIB_LD="ld -b" 1134 SHLIB_LD_LIBS='${LIBS}' 1135 DL_OBJS="tclLoadShl.o" 1136 DL_LIBS="-ldld" 1137 LDFLAGS="$LDFLAGS -Wl,-E" 1138 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' 1139 LD_LIBRARY_PATH_VAR="SHLIB_PATH" 1140 fi 1141 if test "$GCC" = "yes" ; then 1142 SHLIB_LD="gcc -shared" 1143 SHLIB_LD_LIBS='${LIBS}' 1144 LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' 1145 fi 1146 1147 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc 1148 #CFLAGS="$CFLAGS +DAportable" 1149 1150 # Check to enable 64-bit flags for compiler/linker 1151 if test "$do64bit" = "yes" ; then 1152 if test "$GCC" = "yes" ; then 1153 hpux_arch=`${CC} -dumpmachine` 1154 case $hpux_arch in 1155 hppa64*) 1156 # 64-bit gcc in use. Fix flags for GNU ld. 1157 do64bit_ok=yes 1158 SHLIB_LD="${CC} -shared" 1159 SHLIB_LD_LIBS='${LIBS}' 1160 ;; 1161 *) 1162 AC_MSG_WARN("64bit mode not supported with GCC on $system") 1163 ;; 1164 esac 1165 else 1166 do64bit_ok=yes 1167 CFLAGS="$CFLAGS +DD64" 1168 LDFLAGS="$LDFLAGS +DD64" 1169 fi 1170 fi 1171 ;; 1172 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) 1173 SHLIB_SUFFIX=".sl" 1174 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) 1175 if test "$tcl_ok" = yes; then 1176 SHLIB_CFLAGS="+z" 1177 SHLIB_LD="ld -b" 1178 SHLIB_LD_LIBS="" 1179 DL_OBJS="tclLoadShl.o" 1180 DL_LIBS="-ldld" 1181 LDFLAGS="$LDFLAGS -Wl,-E" 1182 LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' 1183 fi 1184 LD_LIBRARY_PATH_VAR="SHLIB_PATH" 1185 ;; 1186 IRIX-4.*) 1187 SHLIB_CFLAGS="-G 0" 1188 SHLIB_SUFFIX=".a" 1189 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" 1190 SHLIB_LD_LIBS='${LIBS}' 1191 DL_OBJS="tclLoadAout.o" 1192 DL_LIBS="" 1193 LDFLAGS="$LDFLAGS -Wl,-D,08000000" 1194 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 1195 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' 1196 ;; 1197 IRIX-5.*) 1198 SHLIB_CFLAGS="" 1199 SHLIB_LD="ld -shared -rdata_shared" 1200 SHLIB_LD_LIBS='${LIBS}' 1201 SHLIB_SUFFIX=".so" 1202 DL_OBJS="tclLoadDl.o" 1203 DL_LIBS="" 1204 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 1205 ;; 1206 IRIX-6.*|IRIX64-6.5*) 1207 SHLIB_CFLAGS="" 1208 SHLIB_LD="ld -n32 -shared -rdata_shared" 1209 SHLIB_LD_LIBS='${LIBS}' 1210 SHLIB_SUFFIX=".so" 1211 DL_OBJS="tclLoadDl.o" 1212 DL_LIBS="" 1213 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 1214 if test "$GCC" = "yes" ; then 1215 CFLAGS="$CFLAGS -mabi=n32" 1216 LDFLAGS="$LDFLAGS -mabi=n32" 1217 else 1218 case $system in 1219 IRIX-6.3) 1220 # Use to build 6.2 compatible binaries on 6.3. 1221 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" 1222 ;; 1223 *) 1224 CFLAGS="$CFLAGS -n32" 1225 ;; 1226 esac 1227 LDFLAGS="$LDFLAGS -n32" 1228 fi 1229 ;; 1230 IRIX64-6.*) 1231 SHLIB_CFLAGS="" 1232 SHLIB_LD="ld -n32 -shared -rdata_shared" 1233 SHLIB_LD_LIBS='${LIBS}' 1234 SHLIB_SUFFIX=".so" 1235 DL_OBJS="tclLoadDl.o" 1236 DL_LIBS="" 1237 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 1238 1239 # Check to enable 64-bit flags for compiler/linker 1240 1241 if test "$do64bit" = "yes" ; then 1242 if test "$GCC" = "yes" ; then 1243 AC_MSG_WARN([64bit mode not supported by gcc]) 1244 else 1245 do64bit_ok=yes 1246 SHLIB_LD="ld -64 -shared -rdata_shared" 1247 CFLAGS="$CFLAGS -64" 1248 LDFLAGS="$LDFLAGS -64" 1249 fi 1250 fi 1251 ;; 1252 Linux*) 1253 SHLIB_CFLAGS="-fPIC" 1254 SHLIB_LD_LIBS='${LIBS}' 1255 SHLIB_SUFFIX=".so" 1256 1257 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" 1258 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings 1259 # when you inline the string and math operations. Turn this off to 1260 # get rid of the warnings. 1261 1262 #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" 1263 1264 if test "$have_dl" = yes; then 1265 SHLIB_LD="${CC} -shared" 1266 DL_OBJS="tclLoadDl.o" 1267 DL_LIBS="-ldl" 1268 LDFLAGS="$LDFLAGS -Wl,--export-dynamic" 1269 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 1270 else 1271 AC_CHECK_HEADER(dld.h, [ 1272 SHLIB_LD="ld -shared" 1273 DL_OBJS="tclLoadDld.o" 1274 DL_LIBS="-ldld" 1275 LD_SEARCH_FLAGS=""]) 1276 fi 1277 if test "`uname -m`" = "alpha" ; then 1278 CFLAGS="$CFLAGS -mieee" 1279 fi 1280 1281 # The combo of gcc + glibc has a bug related 1282 # to inlining of functions like strtod(). The 1283 # -fno-builtin flag should address this problem 1284 # but it does not work. The -fno-inline flag 1285 # is kind of overkill but it works. 1286 # Disable inlining only when one of the 1287 # files in compat/*.c is being linked in. 1288 if test x"${USE_COMPAT}" != x ; then 1289 CFLAGS="$CFLAGS -fno-inline" 1290 fi 1291 1292 ;; 1293 GNU*) 1294 SHLIB_CFLAGS="-fPIC" 1295 SHLIB_LD_LIBS='${LIBS}' 1296 SHLIB_SUFFIX=".so" 1297 1298 if test "$have_dl" = yes; then 1299 SHLIB_LD="${CC} -shared" 1300 DL_OBJS="" 1301 DL_LIBS="-ldl" 1302 LDFLAGS="$LDFLAGS -Wl,--export-dynamic" 1303 LD_SEARCH_FLAGS="" 1304 else 1305 AC_CHECK_HEADER(dld.h, [ 1306 SHLIB_LD="ld -shared" 1307 DL_OBJS="" 1308 DL_LIBS="-ldld" 1309 LD_SEARCH_FLAGS=""]) 1310 fi 1311 if test "`uname -m`" = "alpha" ; then 1312 CFLAGS="$CFLAGS -mieee" 1313 fi 1314 ;; 1315 MP-RAS-02*) 1316 SHLIB_CFLAGS="-K PIC" 1317 SHLIB_LD="cc -G" 1318 SHLIB_LD_LIBS="" 1319 SHLIB_SUFFIX=".so" 1320 DL_OBJS="tclLoadDl.o" 1321 DL_LIBS="-ldl" 1322 LD_SEARCH_FLAGS="" 1323 ;; 1324 MP-RAS-*) 1325 SHLIB_CFLAGS="-K PIC" 1326 SHLIB_LD="cc -G" 1327 SHLIB_LD_LIBS="" 1328 SHLIB_SUFFIX=".so" 1329 DL_OBJS="tclLoadDl.o" 1330 DL_LIBS="-ldl" 1331 LDFLAGS="$LDFLAGS -Wl,-Bexport" 1332 LD_SEARCH_FLAGS="" 1333 ;; 1334 NetBSD-*|FreeBSD-[[1-2]].*) 1335 # Not available on all versions: check for include file. 1336 AC_CHECK_HEADER(dlfcn.h, [ 1337 # NetBSD/SPARC needs -fPIC, -fpic will not do. 1338 SHLIB_CFLAGS="-fPIC" 1339 SHLIB_LD="ld -Bshareable -x" 1340 SHLIB_LD_LIBS="" 1341 SHLIB_SUFFIX=".so" 1342 DL_OBJS="tclLoadDl.o" 1343 DL_LIBS="" 1344 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 1345 AC_MSG_CHECKING([for ELF]) 1346 AC_EGREP_CPP(yes, [ 1347#ifdef __ELF__ 1348 yes 1349#endif 1350 ], 1351 AC_MSG_RESULT([yes]) 1352 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so', 1353 AC_MSG_RESULT([no]) 1354 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' 1355 ) 1356 ], [ 1357 SHLIB_CFLAGS="" 1358 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" 1359 SHLIB_LD_LIBS='${LIBS}' 1360 SHLIB_SUFFIX=".a" 1361 DL_OBJS="tclLoadAout.o" 1362 DL_LIBS="" 1363 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 1364 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 1365 ]) 1366 1367 # FreeBSD doesn't handle version numbers with dots. 1368 1369 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 1370 TCL_LIB_VERSIONS_OK=nodots 1371 ;; 1372 OpenBSD-*) 1373 SHLIB_LD="${CC} -shared" 1374 SHLIB_LD_LIBS='${LIBS}' 1375 SHLIB_SUFFIX=".so" 1376 DL_OBJS="tclLoadDl.o" 1377 DL_LIBS="" 1378 LD_SEARCH_FLAGS="" 1379 AC_MSG_CHECKING(for ELF) 1380 AC_EGREP_CPP(yes, [ 1381#ifdef __ELF__ 1382 yes 1383#endif 1384 ], 1385 [AC_MSG_RESULT(yes) 1386 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'], 1387 [AC_MSG_RESULT(no) 1388 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'] 1389 ) 1390 1391 # OpenBSD doesn't do version numbers with dots. 1392 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 1393 TCL_LIB_VERSIONS_OK=nodots 1394 ;; 1395 FreeBSD-*) 1396 # FreeBSD 3.* and greater have ELF. 1397 SHLIB_CFLAGS="-fPIC" 1398 SHLIB_LD="ld -Bshareable -x" 1399 SHLIB_LD_LIBS='${LIBS}' 1400 SHLIB_SUFFIX=".so" 1401 DL_OBJS="tclLoadDl.o" 1402 DL_LIBS="" 1403 LDFLAGS="$LDFLAGS -export-dynamic" 1404 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 1405 if test "${TCL_THREADS}" = "1" ; then 1406 # The -pthread needs to go in the CFLAGS, not LIBS 1407 LIBS=`echo $LIBS | sed s/-pthread//` 1408 CFLAGS="$CFLAGS -pthread" 1409 LDFLAGS="$LDFLAGS -pthread" 1410 fi 1411 case $system in 1412 FreeBSD-3.*) 1413 # FreeBSD-3 doesn't handle version numbers with dots. 1414 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 1415 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' 1416 TCL_LIB_VERSIONS_OK=nodots 1417 ;; 1418 esac 1419 ;; 1420 Darwin-*) 1421 SHLIB_CFLAGS="-fno-common" 1422 SHLIB_LD="cc -dynamiclib \${LDFLAGS}" 1423 SHLIB_LD_LIBS='${LIBS}' 1424 SHLIB_SUFFIX=".dylib" 1425 DL_OBJS="tclLoadDyld.o" 1426 DL_LIBS="" 1427 LDFLAGS="$LDFLAGS -prebind -Wl,-search_paths_first" 1428 LD_SEARCH_FLAGS="" 1429 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" 1430 CFLAGS_OPTIMIZE="-Os" 1431 ;; 1432 NEXTSTEP-*) 1433 SHLIB_CFLAGS="" 1434 SHLIB_LD="cc -nostdlib -r" 1435 SHLIB_LD_LIBS="" 1436 SHLIB_SUFFIX=".so" 1437 DL_OBJS="tclLoadNext.o" 1438 DL_LIBS="" 1439 LD_SEARCH_FLAGS="" 1440 ;; 1441 OS/390-*) 1442 CFLAGS_OPTIMIZE="" # Optimizer is buggy 1443 AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h 1444 ;; 1445 OSF1-1.0|OSF1-1.1|OSF1-1.2) 1446 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 1447 SHLIB_CFLAGS="" 1448 # Hack: make package name same as library name 1449 SHLIB_LD='ld -R -export $@:' 1450 SHLIB_LD_LIBS="" 1451 SHLIB_SUFFIX=".so" 1452 DL_OBJS="tclLoadOSF.o" 1453 DL_LIBS="" 1454 LD_SEARCH_FLAGS="" 1455 ;; 1456 OSF1-1.*) 1457 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 1458 SHLIB_CFLAGS="-fPIC" 1459 if test "$SHARED_BUILD" = "1" ; then 1460 SHLIB_LD="ld -shared" 1461 else 1462 SHLIB_LD="ld -non_shared" 1463 fi 1464 SHLIB_LD_LIBS="" 1465 SHLIB_SUFFIX=".so" 1466 DL_OBJS="tclLoadDl.o" 1467 DL_LIBS="" 1468 LD_SEARCH_FLAGS="" 1469 ;; 1470 OSF1-V*) 1471 # Digital OSF/1 1472 SHLIB_CFLAGS="" 1473 if test "$SHARED_BUILD" = "1" ; then 1474 SHLIB_LD='ld -shared -expect_unresolved "*"' 1475 else 1476 SHLIB_LD='ld -non_shared -expect_unresolved "*"' 1477 fi 1478 SHLIB_LD_LIBS="" 1479 SHLIB_SUFFIX=".so" 1480 DL_OBJS="tclLoadDl.o" 1481 DL_LIBS="" 1482 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' 1483 if test "$GCC" = "yes" ; then 1484 CFLAGS="$CFLAGS -mieee" 1485 else 1486 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" 1487 fi 1488 # see pthread_intro(3) for pthread support on osf1, k.furukawa 1489 if test "${TCL_THREADS}" = "1" ; then 1490 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" 1491 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" 1492 LIBS=`echo $LIBS | sed s/-lpthreads//` 1493 if test "$GCC" = "yes" ; then 1494 LIBS="$LIBS -lpthread -lmach -lexc" 1495 else 1496 CFLAGS="$CFLAGS -pthread" 1497 LDFLAGS="$LDFLAGS -pthread" 1498 fi 1499 fi 1500 1501 ;; 1502 QNX-6*) 1503 # QNX RTP 1504 # This may work for all QNX, but it was only reported for v6. 1505 SHLIB_CFLAGS="-fPIC" 1506 SHLIB_LD="ld -Bshareable -x" 1507 SHLIB_LD_LIBS="" 1508 SHLIB_SUFFIX=".so" 1509 DL_OBJS="tclLoadDl.o" 1510 # dlopen is in -lc on QNX 1511 DL_LIBS="" 1512 LD_SEARCH_FLAGS="" 1513 ;; 1514 RISCos-*) 1515 SHLIB_CFLAGS="-G 0" 1516 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" 1517 SHLIB_LD_LIBS='${LIBS}' 1518 SHLIB_SUFFIX=".a" 1519 DL_OBJS="tclLoadAout.o" 1520 DL_LIBS="" 1521 LDFLAGS="$LDFLAGS -Wl,-D,08000000" 1522 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 1523 ;; 1524 SCO_SV-3.2*) 1525 # Note, dlopen is available only on SCO 3.2.5 and greater. However, 1526 # this test works, since "uname -s" was non-standard in 3.2.4 and 1527 # below. 1528 if test "$GCC" = "yes" ; then 1529 SHLIB_CFLAGS="-fPIC -melf" 1530 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" 1531 else 1532 SHLIB_CFLAGS="-Kpic -belf" 1533 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" 1534 fi 1535 SHLIB_LD="ld -G" 1536 SHLIB_LD_LIBS="" 1537 SHLIB_SUFFIX=".so" 1538 DL_OBJS="tclLoadDl.o" 1539 DL_LIBS="" 1540 LD_SEARCH_FLAGS="" 1541 ;; 1542 SINIX*5.4*) 1543 SHLIB_CFLAGS="-K PIC" 1544 SHLIB_LD="cc -G" 1545 SHLIB_LD_LIBS="" 1546 SHLIB_SUFFIX=".so" 1547 DL_OBJS="tclLoadDl.o" 1548 DL_LIBS="-ldl" 1549 LD_SEARCH_FLAGS="" 1550 ;; 1551 SunOS-4*) 1552 SHLIB_CFLAGS="-PIC" 1553 SHLIB_LD="ld" 1554 SHLIB_LD_LIBS="" 1555 SHLIB_SUFFIX=".so" 1556 DL_OBJS="tclLoadDl.o" 1557 DL_LIBS="-ldl" 1558 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 1559 1560 # SunOS can't handle version numbers with dots in them in library 1561 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it 1562 # requires an extra version number at the end of .so file names. 1563 # So, the library has to have a name like libtcl75.so.1.0 1564 1565 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' 1566 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' 1567 TCL_LIB_VERSIONS_OK=nodots 1568 ;; 1569 SunOS-5.[[0-6]]*) 1570 1571 # Note: If _REENTRANT isn't defined, then Solaris 1572 # won't define thread-safe library routines. 1573 1574 AC_DEFINE(_REENTRANT) 1575 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) 1576 1577 SHLIB_CFLAGS="-KPIC" 1578 1579 # Note: need the LIBS below, otherwise Tk won't find Tcl's 1580 # symbols when dynamically loaded into tclsh. 1581 1582 SHLIB_LD_LIBS='${LIBS}' 1583 SHLIB_SUFFIX=".so" 1584 DL_OBJS="tclLoadDl.o" 1585 DL_LIBS="-ldl" 1586 if test "$GCC" = "yes" ; then 1587 SHLIB_LD="$CC -shared" 1588 LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' 1589 else 1590 SHLIB_LD="/usr/ccs/bin/ld -G -z text" 1591 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' 1592 fi 1593 ;; 1594 SunOS-5*) 1595 1596 # Note: If _REENTRANT isn't defined, then Solaris 1597 # won't define thread-safe library routines. 1598 1599 AC_DEFINE(_REENTRANT) 1600 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) 1601 1602 SHLIB_CFLAGS="-KPIC" 1603 1604 # Check to enable 64-bit flags for compiler/linker 1605 if test "$do64bit" = "yes" ; then 1606 arch=`isainfo` 1607 if test "$arch" = "sparcv9 sparc" ; then 1608 if test "$GCC" = "yes" ; then 1609 if test "`gcc -dumpversion` | awk -F. '{print $1}'" -lt "3" ; then 1610 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system]) 1611 else 1612 do64bit_ok=yes 1613 CFLAGS="$CFLAGS -m64 -mcpu=v9" 1614 LDFLAGS="$LDFLAGS -m64 -mcpu=v9" 1615 SHLIB_CFLAGS="-fPIC" 1616 fi 1617 else 1618 do64bit_ok=yes 1619 if test "$do64bitVIS" = "yes" ; then 1620 CFLAGS="$CFLAGS -xarch=v9a" 1621 LDFLAGS="$LDFLAGS -xarch=v9a" 1622 else 1623 CFLAGS="$CFLAGS -xarch=v9" 1624 LDFLAGS="$LDFLAGS -xarch=v9" 1625 fi 1626 fi 1627 else 1628 AC_MSG_WARN("64bit mode only supported sparcv9 system") 1629 fi 1630 fi 1631 1632 # Note: need the LIBS below, otherwise Tk won't find Tcl's 1633 # symbols when dynamically loaded into tclsh. 1634 1635 SHLIB_LD_LIBS='${LIBS}' 1636 SHLIB_SUFFIX=".so" 1637 DL_OBJS="tclLoadDl.o" 1638 DL_LIBS="-ldl" 1639 if test "$GCC" = "yes" ; then 1640 SHLIB_LD="$CC -shared" 1641 LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' 1642 if test "$do64bit" = "yes" ; then 1643 # We need to specify -static-libgcc or we need to 1644 # add the path to the sparv9 libgcc. 1645 # JH: static-libgcc is necessary for core Tcl, but may 1646 # not be necessary for extensions. 1647 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc" 1648 # for finding sparcv9 libgcc, get the regular libgcc 1649 # path, remove so name and append 'sparcv9' 1650 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..." 1651 #LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS},-R,$v9gcclibdir" 1652 fi 1653 else 1654 SHLIB_LD="/usr/ccs/bin/ld -G -z text" 1655 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' 1656 fi 1657 ;; 1658 ULTRIX-4.*) 1659 SHLIB_CFLAGS="-G 0" 1660 SHLIB_SUFFIX=".a" 1661 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" 1662 SHLIB_LD_LIBS='${LIBS}' 1663 DL_OBJS="tclLoadAout.o" 1664 DL_LIBS="" 1665 LDFLAGS="$LDFLAGS -Wl,-D,08000000" 1666 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 1667 if test "$GCC" != "yes" ; then 1668 CFLAGS="$CFLAGS -DHAVE_TZSET -std1" 1669 fi 1670 ;; 1671 UNIX_SV* | UnixWare-5*) 1672 SHLIB_CFLAGS="-KPIC" 1673 SHLIB_LD="cc -G" 1674 SHLIB_LD_LIBS="" 1675 SHLIB_SUFFIX=".so" 1676 DL_OBJS="tclLoadDl.o" 1677 DL_LIBS="-ldl" 1678 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers 1679 # that don't grok the -Bexport option. Test that it does. 1680 hold_ldflags=$LDFLAGS 1681 AC_MSG_CHECKING(for ld accepts -Bexport flag) 1682 LDFLAGS="$LDFLAGS -Wl,-Bexport" 1683 AC_TRY_LINK(, [int i;], [found=yes], 1684 [LDFLAGS=$hold_ldflags found=no]) 1685 AC_MSG_RESULT([$found]) 1686 LD_SEARCH_FLAGS="" 1687 ;; 1688 esac 1689 1690 if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then 1691 AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform") 1692 fi 1693 1694 # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic 1695 # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, 1696 # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need 1697 # to determine which of several header files defines the a.out file 1698 # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we 1699 # support only a file format that is more or less version-7-compatible. 1700 # In particular, 1701 # - a.out files must begin with `struct exec'. 1702 # - the N_TXTOFF on the `struct exec' must compute the seek address 1703 # of the text segment 1704 # - The `struct exec' must contain a_magic, a_text, a_data, a_bss 1705 # and a_entry fields. 1706 # The following compilation should succeed if and only if either sys/exec.h 1707 # or a.out.h is usable for the purpose. 1708 # 1709 # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the 1710 # `struct exec' includes a second header that contains information that 1711 # duplicates the v7 fields that are needed. 1712 1713 if test "x$DL_OBJS" = "xtclLoadAout.o" ; then 1714 AC_MSG_CHECKING([sys/exec.h]) 1715 AC_TRY_COMPILE([#include <sys/exec.h>],[ 1716 struct exec foo; 1717 unsigned long seek; 1718 int flag; 1719#if defined(__mips) || defined(mips) 1720 seek = N_TXTOFF (foo.ex_f, foo.ex_o); 1721#else 1722 seek = N_TXTOFF (foo); 1723#endif 1724 flag = (foo.a_magic == OMAGIC); 1725 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; 1726 ], tcl_ok=usable, tcl_ok=unusable) 1727 AC_MSG_RESULT([$tcl_ok]) 1728 if test $tcl_ok = usable; then 1729 AC_DEFINE(USE_SYS_EXEC_H) 1730 else 1731 AC_MSG_CHECKING([a.out.h]) 1732 AC_TRY_COMPILE([#include <a.out.h>],[ 1733 struct exec foo; 1734 unsigned long seek; 1735 int flag; 1736#if defined(__mips) || defined(mips) 1737 seek = N_TXTOFF (foo.ex_f, foo.ex_o); 1738#else 1739 seek = N_TXTOFF (foo); 1740#endif 1741 flag = (foo.a_magic == OMAGIC); 1742 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; 1743 ], tcl_ok=usable, tcl_ok=unusable) 1744 AC_MSG_RESULT([$tcl_ok]) 1745 if test $tcl_ok = usable; then 1746 AC_DEFINE(USE_A_OUT_H) 1747 else 1748 AC_MSG_CHECKING([sys/exec_aout.h]) 1749 AC_TRY_COMPILE([#include <sys/exec_aout.h>],[ 1750 struct exec foo; 1751 unsigned long seek; 1752 int flag; 1753#if defined(__mips) || defined(mips) 1754 seek = N_TXTOFF (foo.ex_f, foo.ex_o); 1755#else 1756 seek = N_TXTOFF (foo); 1757#endif 1758 flag = (foo.a_midmag == OMAGIC); 1759 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; 1760 ], tcl_ok=usable, tcl_ok=unusable) 1761 AC_MSG_RESULT([$tcl_ok]) 1762 if test $tcl_ok = usable; then 1763 AC_DEFINE(USE_SYS_EXEC_AOUT_H) 1764 else 1765 DL_OBJS="" 1766 fi 1767 fi 1768 fi 1769 fi 1770 1771 # Step 5: disable dynamic loading if requested via a command-line switch. 1772 1773 AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command], 1774 [tcl_ok=$enableval], [tcl_ok=yes]) 1775 if test "$tcl_ok" = "no"; then 1776 DL_OBJS="" 1777 fi 1778 1779 if test "x$DL_OBJS" != "x" ; then 1780 BUILD_DLTEST="\$(DLTEST_TARGETS)" 1781 else 1782 echo "Can't figure out how to do dynamic loading or shared libraries" 1783 echo "on this system." 1784 SHLIB_CFLAGS="" 1785 SHLIB_LD="" 1786 SHLIB_SUFFIX="" 1787 DL_OBJS="tclLoadNone.o" 1788 DL_LIBS="" 1789 LDFLAGS="$LDFLAGS_ORIG" 1790 LD_SEARCH_FLAGS="" 1791 BUILD_DLTEST="" 1792 fi 1793 1794 # If we're running gcc, then change the C flags for compiling shared 1795 # libraries to the right flags for gcc, instead of those for the 1796 # standard manufacturer compiler. 1797 1798 if test "$DL_OBJS" != "tclLoadNone.o" ; then 1799 if test "$GCC" = "yes" ; then 1800 case $system in 1801 AIX-*) 1802 ;; 1803 BSD/OS*) 1804 ;; 1805 IRIX*) 1806 ;; 1807 NetBSD-*|FreeBSD-*) 1808 ;; 1809 Darwin-*) 1810 ;; 1811 RISCos-*) 1812 ;; 1813 SCO_SV-3.2*) 1814 ;; 1815 ULTRIX-4.*) 1816 ;; 1817 windows) 1818 ;; 1819 *) 1820 SHLIB_CFLAGS="-fPIC" 1821 ;; 1822 esac 1823 fi 1824 fi 1825 1826 if test "$SHARED_LIB_SUFFIX" = "" ; then 1827 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}' 1828 fi 1829 if test "$UNSHARED_LIB_SUFFIX" = "" ; then 1830 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' 1831 fi 1832 1833 AC_SUBST(DL_LIBS) 1834 AC_SUBST(CFLAGS_DEBUG) 1835 AC_SUBST(CFLAGS_OPTIMIZE) 1836 AC_SUBST(CFLAGS_WARNING) 1837 1838 AC_SUBST(STLIB_LD) 1839 AC_SUBST(SHLIB_LD) 1840 AC_SUBST(SHLIB_CFLAGS) 1841 AC_SUBST(SHLIB_LD_LIBS) 1842 AC_SUBST(LDFLAGS_DEBUG) 1843 AC_SUBST(LDFLAGS_OPTIMIZE) 1844 AC_SUBST(LD_LIBRARY_PATH_VAR) 1845 1846 # These must be called after we do the basic CFLAGS checks and 1847 # verify any possible 64-bit or similar switches are necessary 1848 TEA_TCL_EARLY_FLAGS 1849 TEA_TCL_64BIT_FLAGS 1850]) 1851 1852#-------------------------------------------------------------------- 1853# TEA_SERIAL_PORT 1854# 1855# Determine which interface to use to talk to the serial port. 1856# Note that #include lines must begin in leftmost column for 1857# some compilers to recognize them as preprocessor directives, 1858# and some build environments have stdin not pointing at a 1859# pseudo-terminal (usually /dev/null instead.) 1860# 1861# Arguments: 1862# none 1863# 1864# Results: 1865# 1866# Defines only one of the following vars: 1867# HAVE_SYS_MODEM_H 1868# USE_TERMIOS 1869# USE_TERMIO 1870# USE_SGTTY 1871# 1872#-------------------------------------------------------------------- 1873 1874AC_DEFUN(TEA_SERIAL_PORT, [ 1875 AC_CHECK_HEADERS(sys/modem.h) 1876 AC_MSG_CHECKING([termios vs. termio vs. sgtty]) 1877 AC_CACHE_VAL(tcl_cv_api_serial, [ 1878 AC_TRY_RUN([ 1879#include <termios.h> 1880 1881int main() { 1882 struct termios t; 1883 if (tcgetattr(0, &t) == 0) { 1884 cfsetospeed(&t, 0); 1885 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; 1886 return 0; 1887 } 1888 return 1; 1889}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) 1890 if test $tcl_cv_api_serial = no ; then 1891 AC_TRY_RUN([ 1892#include <termio.h> 1893 1894int main() { 1895 struct termio t; 1896 if (ioctl(0, TCGETA, &t) == 0) { 1897 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; 1898 return 0; 1899 } 1900 return 1; 1901}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) 1902 fi 1903 if test $tcl_cv_api_serial = no ; then 1904 AC_TRY_RUN([ 1905#include <sgtty.h> 1906 1907int main() { 1908 struct sgttyb t; 1909 if (ioctl(0, TIOCGETP, &t) == 0) { 1910 t.sg_ospeed = 0; 1911 t.sg_flags |= ODDP | EVENP | RAW; 1912 return 0; 1913 } 1914 return 1; 1915}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) 1916 fi 1917 if test $tcl_cv_api_serial = no ; then 1918 AC_TRY_RUN([ 1919#include <termios.h> 1920#include <errno.h> 1921 1922int main() { 1923 struct termios t; 1924 if (tcgetattr(0, &t) == 0 1925 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { 1926 cfsetospeed(&t, 0); 1927 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; 1928 return 0; 1929 } 1930 return 1; 1931}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) 1932 fi 1933 if test $tcl_cv_api_serial = no; then 1934 AC_TRY_RUN([ 1935#include <termio.h> 1936#include <errno.h> 1937 1938int main() { 1939 struct termio t; 1940 if (ioctl(0, TCGETA, &t) == 0 1941 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { 1942 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; 1943 return 0; 1944 } 1945 return 1; 1946 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) 1947 fi 1948 if test $tcl_cv_api_serial = no; then 1949 AC_TRY_RUN([ 1950#include <sgtty.h> 1951#include <errno.h> 1952 1953int main() { 1954 struct sgttyb t; 1955 if (ioctl(0, TIOCGETP, &t) == 0 1956 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { 1957 t.sg_ospeed = 0; 1958 t.sg_flags |= ODDP | EVENP | RAW; 1959 return 0; 1960 } 1961 return 1; 1962}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) 1963 fi]) 1964 case $tcl_cv_api_serial in 1965 termios) AC_DEFINE(USE_TERMIOS);; 1966 termio) AC_DEFINE(USE_TERMIO);; 1967 sgtty) AC_DEFINE(USE_SGTTY);; 1968 esac 1969 AC_MSG_RESULT([$tcl_cv_api_serial]) 1970]) 1971 1972#-------------------------------------------------------------------- 1973# TEA_MISSING_POSIX_HEADERS 1974# 1975# Supply substitutes for missing POSIX header files. Special 1976# notes: 1977# - stdlib.h doesn't define strtol, strtoul, or 1978# strtod insome versions of SunOS 1979# - some versions of string.h don't declare procedures such 1980# as strstr 1981# 1982# Arguments: 1983# none 1984# 1985# Results: 1986# 1987# Defines some of the following vars: 1988# NO_DIRENT_H 1989# NO_ERRNO_H 1990# NO_VALUES_H 1991# HAVE_LIMITS_H or NO_LIMITS_H 1992# NO_STDLIB_H 1993# NO_STRING_H 1994# NO_SYS_WAIT_H 1995# NO_DLFCN_H 1996# HAVE_SYS_PARAM_H 1997# 1998# HAVE_STRING_H ? 1999# 2000# tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and 2001# CHECK on limits.h 2002#-------------------------------------------------------------------- 2003 2004AC_DEFUN(TEA_MISSING_POSIX_HEADERS, [ 2005 AC_MSG_CHECKING([dirent.h]) 2006 AC_TRY_LINK([#include <sys/types.h> 2007#include <dirent.h>], [ 2008#ifndef _POSIX_SOURCE 2009# ifdef __Lynx__ 2010 /* 2011 * Generate compilation error to make the test fail: Lynx headers 2012 * are only valid if really in the POSIX environment. 2013 */ 2014 2015 missing_procedure(); 2016# endif 2017#endif 2018DIR *d; 2019struct dirent *entryPtr; 2020char *p; 2021d = opendir("foobar"); 2022entryPtr = readdir(d); 2023p = entryPtr->d_name; 2024closedir(d); 2025], tcl_ok=yes, tcl_ok=no) 2026 2027 if test $tcl_ok = no; then 2028 AC_DEFINE(NO_DIRENT_H) 2029 fi 2030 2031 AC_MSG_RESULT([$tcl_ok]) 2032 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)]) 2033 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)]) 2034 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)]) 2035 AC_CHECK_HEADER(limits.h, 2036 [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)]) 2037 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) 2038 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) 2039 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) 2040 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0) 2041 if test $tcl_ok = 0; then 2042 AC_DEFINE(NO_STDLIB_H) 2043 fi 2044 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) 2045 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) 2046 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) 2047 2048 # See also memmove check below for a place where NO_STRING_H can be 2049 # set and why. 2050 2051 if test $tcl_ok = 0; then 2052 AC_DEFINE(NO_STRING_H) 2053 fi 2054 2055 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)]) 2056 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)]) 2057 2058 # OS/390 lacks sys/param.h (and doesn't need it, by chance). 2059 AC_HAVE_HEADERS(sys/param.h) 2060 2061]) 2062 2063#-------------------------------------------------------------------- 2064# TEA_PATH_X 2065# 2066# Locate the X11 header files and the X11 library archive. Try 2067# the ac_path_x macro first, but if it doesn't find the X stuff 2068# (e.g. because there's no xmkmf program) then check through 2069# a list of possible directories. Under some conditions the 2070# autoconf macro will return an include directory that contains 2071# no include files, so double-check its result just to be safe. 2072# 2073# This should be called after TEA_CONFIG_CFLAGS as setting the 2074# LIBS line can confuse some configure macro magic. 2075# 2076# Arguments: 2077# none 2078# 2079# Results: 2080# 2081# Sets the following vars: 2082# XINCLUDES 2083# XLIBSW 2084# LIBS (appends to) 2085# TEA_WINDOWINGSYSTEM 2086# 2087#-------------------------------------------------------------------- 2088 2089AC_DEFUN(TEA_PATH_X, [ 2090 if test "${TEA_PLATFORM}" = "unix" ; then 2091 case ${TK_DEFS} in 2092 *MAC_OSX_TK*) 2093 AC_DEFINE(MAC_OSX_TK) 2094 TEA_WINDOWINGSYSTEM="aqua" 2095 ;; 2096 *) 2097 TEA_PATH_UNIX_X 2098 TEA_WINDOWINGSYSTEM="x11" 2099 ;; 2100 esac 2101 elif test "${TEA_PLATFORM}" = "windows" ; then 2102 TEA_WINDOWINGSYSTEM="windows" 2103 fi 2104]) 2105 2106AC_DEFUN(TEA_PATH_UNIX_X, [ 2107 AC_PATH_X 2108 not_really_there="" 2109 if test "$no_x" = ""; then 2110 if test "$x_includes" = ""; then 2111 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes") 2112 else 2113 if test ! -r $x_includes/X11/Intrinsic.h; then 2114 not_really_there="yes" 2115 fi 2116 fi 2117 fi 2118 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then 2119 AC_MSG_CHECKING([for X11 header files]) 2120 XINCLUDES="# no special path needed" 2121 AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope") 2122 if test "$XINCLUDES" = nope; then 2123 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" 2124 for i in $dirs ; do 2125 if test -r $i/X11/Intrinsic.h; then 2126 AC_MSG_RESULT([$i]) 2127 XINCLUDES=" -I$i" 2128 break 2129 fi 2130 done 2131 fi 2132 else 2133 if test "$x_includes" != ""; then 2134 XINCLUDES=-I$x_includes 2135 else 2136 XINCLUDES="# no special path needed" 2137 fi 2138 fi 2139 if test "$XINCLUDES" = nope; then 2140 AC_MSG_RESULT([could not find any!]) 2141 XINCLUDES="# no include files found" 2142 fi 2143 2144 if test "$no_x" = yes; then 2145 AC_MSG_CHECKING([for X11 libraries]) 2146 XLIBSW=nope 2147 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" 2148 for i in $dirs ; do 2149 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then 2150 AC_MSG_RESULT([$i]) 2151 XLIBSW="-L$i -lX11" 2152 x_libraries="$i" 2153 break 2154 fi 2155 done 2156 else 2157 if test "$x_libraries" = ""; then 2158 XLIBSW=-lX11 2159 else 2160 XLIBSW="-L$x_libraries -lX11" 2161 fi 2162 fi 2163 if test "$XLIBSW" = nope ; then 2164 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow) 2165 fi 2166 if test "$XLIBSW" = nope ; then 2167 AC_MSG_RESULT([could not find any! Using -lX11.]) 2168 XLIBSW=-lX11 2169 fi 2170 if test x"${XLIBSW}" != x ; then 2171 PKG_LIBS="${PKG_LIBS} ${XLIBSW}" 2172 fi 2173]) 2174 2175#-------------------------------------------------------------------- 2176# TEA_BLOCKING_STYLE 2177# 2178# The statements below check for systems where POSIX-style 2179# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. 2180# On these systems (mostly older ones), use the old BSD-style 2181# FIONBIO approach instead. 2182# 2183# Arguments: 2184# none 2185# 2186# Results: 2187# 2188# Defines some of the following vars: 2189# HAVE_SYS_IOCTL_H 2190# HAVE_SYS_FILIO_H 2191# USE_FIONBIO 2192# O_NONBLOCK 2193# 2194#-------------------------------------------------------------------- 2195 2196AC_DEFUN(TEA_BLOCKING_STYLE, [ 2197 AC_CHECK_HEADERS(sys/ioctl.h) 2198 AC_CHECK_HEADERS(sys/filio.h) 2199 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) 2200 if test -f /usr/lib/NextStep/software_version; then 2201 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` 2202 else 2203 system=`uname -s`-`uname -r` 2204 if test "$?" -ne 0 ; then 2205 system=unknown 2206 else 2207 # Special check for weird MP-RAS system (uname returns weird 2208 # results, and the version is kept in special file). 2209 2210 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then 2211 system=MP-RAS-`awk '{print $3}' /etc/.relid'` 2212 fi 2213 if test "`uname -s`" = "AIX" ; then 2214 system=AIX-`uname -v`.`uname -r` 2215 fi 2216 fi 2217 fi 2218 case $system in 2219 # There used to be code here to use FIONBIO under AIX. However, it 2220 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since 2221 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO 2222 # code (JO, 5/31/97). 2223 2224 OSF*) 2225 AC_DEFINE(USE_FIONBIO) 2226 AC_MSG_RESULT([FIONBIO]) 2227 ;; 2228 SunOS-4*) 2229 AC_DEFINE(USE_FIONBIO) 2230 AC_MSG_RESULT([FIONBIO]) 2231 ;; 2232 ULTRIX-4.*) 2233 AC_DEFINE(USE_FIONBIO) 2234 AC_MSG_RESULT([FIONBIO]) 2235 ;; 2236 *) 2237 AC_MSG_RESULT([O_NONBLOCK]) 2238 ;; 2239 esac 2240]) 2241 2242#-------------------------------------------------------------------- 2243# TEA_TIME_HANLDER 2244# 2245# Checks how the system deals with time.h, what time structures 2246# are used on the system, and what fields the structures have. 2247# 2248# Arguments: 2249# none 2250# 2251# Results: 2252# 2253# Defines some of the following vars: 2254# USE_DELTA_FOR_TZ 2255# HAVE_TM_GMTOFF 2256# HAVE_TM_TZADJ 2257# HAVE_TIMEZONE_VAR 2258# 2259#-------------------------------------------------------------------- 2260 2261AC_DEFUN(TEA_TIME_HANDLER, [ 2262 AC_CHECK_HEADERS(sys/time.h) 2263 AC_HEADER_TIME 2264 AC_STRUCT_TIMEZONE 2265 2266 AC_CHECK_FUNCS(gmtime_r localtime_r) 2267 2268 AC_MSG_CHECKING([tm_tzadj in struct tm]) 2269 AC_CACHE_VAL(tcl_cv_member_tm_tzadj, 2270 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;], 2271 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)) 2272 AC_MSG_RESULT([$tcl_cv_member_tm_tzadj]) 2273 if test $tcl_cv_member_tm_tzadj = yes ; then 2274 AC_DEFINE(HAVE_TM_TZADJ) 2275 fi 2276 2277 AC_MSG_CHECKING([tm_gmtoff in struct tm]) 2278 AC_CACHE_VAL(tcl_cv_member_tm_gmtoff, 2279 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;], 2280 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)) 2281 AC_MSG_RESULT([$tcl_cv_member_tm_gmtoff]) 2282 if test $tcl_cv_member_tm_gmtoff = yes ; then 2283 AC_DEFINE(HAVE_TM_GMTOFF) 2284 fi 2285 2286 # 2287 # Its important to include time.h in this check, as some systems 2288 # (like convex) have timezone functions, etc. 2289 # 2290 AC_MSG_CHECKING([long timezone variable]) 2291 AC_CACHE_VAL(tcl_cv_var_timezone, 2292 AC_TRY_COMPILE([#include <time.h>], 2293 [extern long timezone; 2294 timezone += 1; 2295 exit (0);], 2296 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)) 2297 AC_MSG_RESULT([$tcl_cv_timezone_long]) 2298 if test $tcl_cv_timezone_long = yes ; then 2299 AC_DEFINE(HAVE_TIMEZONE_VAR) 2300 else 2301 # 2302 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. 2303 # 2304 AC_MSG_CHECKING([time_t timezone variable]) 2305 AC_CACHE_VAL(tcl_cv_timezone_time, 2306 AC_TRY_COMPILE([#include <time.h>], 2307 [extern time_t timezone; 2308 timezone += 1; 2309 exit (0);], 2310 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)) 2311 AC_MSG_RESULT([$tcl_cv_timezone_time]) 2312 if test $tcl_cv_timezone_time = yes ; then 2313 AC_DEFINE(HAVE_TIMEZONE_VAR) 2314 fi 2315 fi 2316]) 2317 2318#-------------------------------------------------------------------- 2319# TEA_BUGGY_STRTOD 2320# 2321# Under Solaris 2.4, strtod returns the wrong value for the 2322# terminating character under some conditions. Check for this 2323# and if the problem exists use a substitute procedure 2324# "fixstrtod" (provided by Tcl) that corrects the error. 2325# Also, on Compaq's Tru64 Unix 5.0, 2326# strtod(" ") returns 0.0 instead of a failure to convert. 2327# 2328# Arguments: 2329# none 2330# 2331# Results: 2332# 2333# Might defines some of the following vars: 2334# strtod (=fixstrtod) 2335# 2336#-------------------------------------------------------------------- 2337 2338AC_DEFUN(TEA_BUGGY_STRTOD, [ 2339 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) 2340 if test "$tcl_strtod" = 1; then 2341 AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs]) 2342 AC_TRY_RUN([ 2343 extern double strtod(); 2344 int main() 2345 { 2346 char *string = "NaN", *spaceString = " "; 2347 char *term; 2348 double value; 2349 value = strtod(string, &term); 2350 if ((term != string) && (term[-1] == 0)) { 2351 exit(1); 2352 } 2353 value = strtod(spaceString, &term); 2354 if (term == (spaceString+1)) { 2355 exit(1); 2356 } 2357 exit(0); 2358 }], tcl_ok=1, tcl_ok=0, tcl_ok=0) 2359 if test "$tcl_ok" = 1; then 2360 AC_MSG_RESULT([ok]) 2361 else 2362 AC_MSG_RESULT([buggy]) 2363 #LIBOBJS="$LIBOBJS fixstrtod.o" 2364 AC_LIBOBJ([fixstrtod]) 2365 USE_COMPAT=1 2366 AC_DEFINE(strtod, fixstrtod) 2367 fi 2368 fi 2369]) 2370 2371#-------------------------------------------------------------------- 2372# TEA_TCL_LINK_LIBS 2373# 2374# Search for the libraries needed to link the Tcl shell. 2375# Things like the math library (-lm) and socket stuff (-lsocket vs. 2376# -lnsl) are dealt with here. 2377# 2378# Arguments: 2379# Requires the following vars to be set in the Makefile: 2380# DL_LIBS 2381# LIBS 2382# MATH_LIBS 2383# 2384# Results: 2385# 2386# Subst's the following var: 2387# TCL_LIBS 2388# MATH_LIBS 2389# 2390# Might append to the following vars: 2391# LIBS 2392# 2393# Might define the following vars: 2394# HAVE_NET_ERRNO_H 2395# 2396#-------------------------------------------------------------------- 2397 2398AC_DEFUN(TEA_TCL_LINK_LIBS, [ 2399 #-------------------------------------------------------------------- 2400 # On a few very rare systems, all of the libm.a stuff is 2401 # already in libc.a. Set compiler flags accordingly. 2402 # Also, Linux requires the "ieee" library for math to work 2403 # right (and it must appear before "-lm"). 2404 #-------------------------------------------------------------------- 2405 2406 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm") 2407 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) 2408 2409 #-------------------------------------------------------------------- 2410 # Interactive UNIX requires -linet instead of -lsocket, plus it 2411 # needs net/errno.h to define the socket-related error codes. 2412 #-------------------------------------------------------------------- 2413 2414 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) 2415 AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H)) 2416 2417 #-------------------------------------------------------------------- 2418 # Check for the existence of the -lsocket and -lnsl libraries. 2419 # The order here is important, so that they end up in the right 2420 # order in the command line generated by make. Here are some 2421 # special considerations: 2422 # 1. Use "connect" and "accept" to check for -lsocket, and 2423 # "gethostbyname" to check for -lnsl. 2424 # 2. Use each function name only once: can't redo a check because 2425 # autoconf caches the results of the last check and won't redo it. 2426 # 3. Use -lnsl and -lsocket only if they supply procedures that 2427 # aren't already present in the normal libraries. This is because 2428 # IRIX 5.2 has libraries, but they aren't needed and they're 2429 # bogus: they goof up name resolution if used. 2430 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. 2431 # To get around this problem, check for both libraries together 2432 # if -lsocket doesn't work by itself. 2433 #-------------------------------------------------------------------- 2434 2435 tcl_checkBoth=0 2436 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) 2437 if test "$tcl_checkSocket" = 1; then 2438 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt, 2439 LIBS="$LIBS -lsocket", tcl_checkBoth=1)]) 2440 fi 2441 if test "$tcl_checkBoth" = 1; then 2442 tk_oldLibs=$LIBS 2443 LIBS="$LIBS -lsocket -lnsl" 2444 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) 2445 fi 2446 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, 2447 [LIBS="$LIBS -lnsl"])]) 2448 2449 # Don't perform the eval of the libraries here because DL_LIBS 2450 # won't be set until we call TEA_CONFIG_CFLAGS 2451 2452 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' 2453 AC_SUBST(TCL_LIBS) 2454 AC_SUBST(MATH_LIBS) 2455]) 2456 2457#-------------------------------------------------------------------- 2458# TEA_TCL_EARLY_FLAGS 2459# 2460# Check for what flags are needed to be passed so the correct OS 2461# features are available. 2462# 2463# Arguments: 2464# None 2465# 2466# Results: 2467# 2468# Might define the following vars: 2469# _ISOC99_SOURCE 2470# _LARGEFILE64_SOURCE 2471# 2472#-------------------------------------------------------------------- 2473 2474AC_DEFUN(TEA_TCL_EARLY_FLAG,[ 2475 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), 2476 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no, 2477 AC_TRY_COMPILE([[#define ]$1[ 1 2478]$2], $3, 2479 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes, 2480 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no))) 2481 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then 2482 AC_DEFINE($1) 2483 tcl_flags="$tcl_flags $1" 2484 fi 2485]) 2486 2487AC_DEFUN(TEA_TCL_EARLY_FLAGS,[ 2488 AC_MSG_CHECKING([for required early compiler flags]) 2489 tcl_flags="" 2490 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>], 2491 [char *p = (char *)strtoll; char *q = (char *)strtoull;]) 2492 TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>], 2493 [struct stat64 buf; int i = stat64("/", &buf);]) 2494 if test "x${tcl_flags}" = "x" ; then 2495 AC_MSG_RESULT([none]) 2496 else 2497 AC_MSG_RESULT([${tcl_flags}]) 2498 fi 2499]) 2500 2501#-------------------------------------------------------------------- 2502# TEA_TCL_64BIT_FLAGS 2503# 2504# Check for what is defined in the way of 64-bit features. 2505# 2506# Arguments: 2507# None 2508# 2509# Results: 2510# 2511# Might define the following vars: 2512# TCL_WIDE_INT_IS_LONG 2513# TCL_WIDE_INT_TYPE 2514# HAVE_STRUCT_DIRENT64 2515# HAVE_STRUCT_STAT64 2516# HAVE_TYPE_OFF64_T 2517# 2518#-------------------------------------------------------------------- 2519 2520AC_DEFUN(TEA_TCL_64BIT_FLAGS, [ 2521 AC_MSG_CHECKING([for 64-bit integer type]) 2522 AC_CACHE_VAL(tcl_cv_type_64bit,[ 2523 tcl_cv_type_64bit=none 2524 # See if the compiler knows natively about __int64 2525 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], 2526 tcl_type_64bit=__int64, tcl_type_64bit="long long") 2527 # See if we should use long anyway Note that we substitute in the 2528 # type that is our current guess for a 64-bit type inside this check 2529 # program, so it should be modified only carefully... 2530 AC_TRY_COMPILE(,[switch (0) { 2531 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; 2532 }],tcl_cv_type_64bit=${tcl_type_64bit})]) 2533 if test "${tcl_cv_type_64bit}" = none ; then 2534 AC_DEFINE(TCL_WIDE_INT_IS_LONG) 2535 AC_MSG_RESULT([using long]) 2536 elif test "${tcl_cv_type_64bit}" = "__int64" \ 2537 -a "${TEA_PLATFORM}" = "windows" ; then 2538 # We actually want to use the default tcl.h checks in this 2539 # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* 2540 AC_MSG_RESULT([using Tcl header defaults]) 2541 else 2542 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}) 2543 AC_MSG_RESULT([${tcl_cv_type_64bit}]) 2544 2545 # Now check for auxiliary declarations 2546 AC_MSG_CHECKING([for struct dirent64]) 2547 AC_CACHE_VAL(tcl_cv_struct_dirent64,[ 2548 AC_TRY_COMPILE([#include <sys/types.h> 2549#include <sys/dirent.h>],[struct dirent64 p;], 2550 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) 2551 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then 2552 AC_DEFINE(HAVE_STRUCT_DIRENT64) 2553 fi 2554 AC_MSG_RESULT([${tcl_cv_struct_dirent64}]) 2555 2556 AC_MSG_CHECKING([for struct stat64]) 2557 AC_CACHE_VAL(tcl_cv_struct_stat64,[ 2558 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p; 2559], 2560 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)]) 2561 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then 2562 AC_DEFINE(HAVE_STRUCT_STAT64) 2563 fi 2564 AC_MSG_RESULT([${tcl_cv_struct_stat64}]) 2565 2566 AC_MSG_CHECKING([for off64_t]) 2567 AC_CACHE_VAL(tcl_cv_type_off64_t,[ 2568 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset; 2569], 2570 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)]) 2571 if test "x${tcl_cv_type_off64_t}" = "xyes" ; then 2572 AC_DEFINE(HAVE_TYPE_OFF64_T) 2573 fi 2574 AC_MSG_RESULT([${tcl_cv_type_off64_t}]) 2575 fi 2576]) 2577 2578## 2579## Here ends the standard Tcl configuration bits and starts the 2580## TEA specific functions 2581## 2582 2583#------------------------------------------------------------------------ 2584# TEA_INIT -- 2585# 2586# Init various Tcl Extension Architecture (TEA) variables. 2587# This should be the first called TEA_* macro. 2588# 2589# Arguments: 2590# none 2591# 2592# Results: 2593# 2594# Defines and substs the following vars: 2595# CYGPATH 2596# EXEEXT 2597# Defines only: 2598# TEA_INITED 2599# TEA_PLATFORM (windows or unix) 2600# 2601# "cygpath" is used on windows to generate native path names for include 2602# files. These variables should only be used with the compiler and linker 2603# since they generate native path names. 2604# 2605# EXEEXT 2606# Select the executable extension based on the host type. This 2607# is a lightweight replacement for AC_EXEEXT that doesn't require 2608# a compiler. 2609#------------------------------------------------------------------------ 2610 2611AC_DEFUN(TEA_INIT, [ 2612 # TEA extensions pass this us the version of TEA they think they 2613 # are compatible with. 2614 TEA_VERSION="3.2" 2615 2616 AC_MSG_CHECKING([for correct TEA configuration]) 2617 if test x"${PACKAGE_NAME}" = x ; then 2618 AC_MSG_ERROR([ 2619The PACKAGE_NAME variable must be defined by your TEA configure.in]) 2620 fi 2621 if test x"$1" = x ; then 2622 AC_MSG_ERROR([ 2623TEA version not specified.]) 2624 elif test "$1" != "${TEA_VERSION}" ; then 2625 AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"]) 2626 else 2627 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})]) 2628 fi 2629 case "`uname -s`" in 2630 *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) 2631 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo) 2632 EXEEXT=".exe" 2633 TEA_PLATFORM="windows" 2634 ;; 2635 *) 2636 CYGPATH=echo 2637 EXEEXT="" 2638 TEA_PLATFORM="unix" 2639 ;; 2640 esac 2641 2642 # Check if exec_prefix is set. If not use fall back to prefix. 2643 # Note when adjusted, so that TEA_PREFIX can correct for this. 2644 # This is needed for recursive configures, since autoconf propagates 2645 # $prefix, but not $exec_prefix (doh!). 2646 if test x$exec_prefix = xNONE ; then 2647 exec_prefix_default=yes 2648 exec_prefix=$prefix 2649 fi 2650 2651 AC_SUBST(EXEEXT) 2652 AC_SUBST(CYGPATH) 2653 2654 # This package name must be replaced statically for AC_SUBST to work 2655 AC_SUBST(PKG_LIB_FILE) 2656 # Substitute STUB_LIB_FILE in case package creates a stub library too. 2657 AC_SUBST(PKG_STUB_LIB_FILE) 2658 2659 # We AC_SUBST these here to ensure they are subst'ed, 2660 # in case the user doesn't call TEA_ADD_... 2661 AC_SUBST(PKG_STUB_SOURCES) 2662 AC_SUBST(PKG_STUB_OBJECTS) 2663 AC_SUBST(PKG_TCL_SOURCES) 2664 AC_SUBST(PKG_HEADERS) 2665 AC_SUBST(PKG_INCLUDES) 2666 AC_SUBST(PKG_LIBS) 2667 AC_SUBST(PKG_CFLAGS) 2668]) 2669 2670#------------------------------------------------------------------------ 2671# TEA_ADD_SOURCES -- 2672# 2673# Specify one or more source files. Users should check for 2674# the right platform before adding to their list. 2675# It is not important to specify the directory, as long as it is 2676# in the generic, win or unix subdirectory of $(srcdir). 2677# 2678# Arguments: 2679# one or more file names 2680# 2681# Results: 2682# 2683# Defines and substs the following vars: 2684# PKG_SOURCES 2685# PKG_OBJECTS 2686#------------------------------------------------------------------------ 2687AC_DEFUN(TEA_ADD_SOURCES, [ 2688 vars="$@" 2689 for i in $vars; do 2690 case $i in 2691 [\$]*) 2692 # allow $-var names 2693 PKG_SOURCES="$PKG_SOURCES $i" 2694 PKG_OBJECTS="$PKG_OBJECTS $i" 2695 ;; 2696 *) 2697 # check for existence - allows for generic/win/unix VPATH 2698 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ 2699 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ 2700 ; then 2701 AC_MSG_ERROR([could not find source file '$i']) 2702 fi 2703 PKG_SOURCES="$PKG_SOURCES $i" 2704 # this assumes it is in a VPATH dir 2705 i=`basename $i` 2706 # handle user calling this before or after TEA_SETUP_COMPILER 2707 if test x"${OBJEXT}" != x ; then 2708 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}" 2709 else 2710 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}" 2711 fi 2712 PKG_OBJECTS="$PKG_OBJECTS $j" 2713 ;; 2714 esac 2715 done 2716 AC_SUBST(PKG_SOURCES) 2717 AC_SUBST(PKG_OBJECTS) 2718]) 2719 2720#------------------------------------------------------------------------ 2721# TEA_ADD_STUB_SOURCES -- 2722# 2723# Specify one or more source files. Users should check for 2724# the right platform before adding to their list. 2725# It is not important to specify the directory, as long as it is 2726# in the generic, win or unix subdirectory of $(srcdir). 2727# 2728# Arguments: 2729# one or more file names 2730# 2731# Results: 2732# 2733# Defines and substs the following vars: 2734# PKG_STUB_SOURCES 2735# PKG_STUB_OBJECTS 2736#------------------------------------------------------------------------ 2737AC_DEFUN(TEA_ADD_STUB_SOURCES, [ 2738 vars="$@" 2739 for i in $vars; do 2740 # check for existence - allows for generic/win/unix VPATH 2741 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ 2742 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ 2743 ; then 2744 AC_MSG_ERROR([could not find stub source file '$i']) 2745 fi 2746 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i" 2747 # this assumes it is in a VPATH dir 2748 i=`basename $i` 2749 # handle user calling this before or after TEA_SETUP_COMPILER 2750 if test x"${OBJEXT}" != x ; then 2751 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}" 2752 else 2753 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}" 2754 fi 2755 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j" 2756 done 2757 AC_SUBST(PKG_STUB_SOURCES) 2758 AC_SUBST(PKG_STUB_OBJECTS) 2759]) 2760 2761#------------------------------------------------------------------------ 2762# TEA_ADD_TCL_SOURCES -- 2763# 2764# Specify one or more Tcl source files. These should be platform 2765# independent runtime files. 2766# 2767# Arguments: 2768# one or more file names 2769# 2770# Results: 2771# 2772# Defines and substs the following vars: 2773# PKG_TCL_SOURCES 2774#------------------------------------------------------------------------ 2775AC_DEFUN(TEA_ADD_TCL_SOURCES, [ 2776 vars="$@" 2777 for i in $vars; do 2778 # check for existence, be strict because it is installed 2779 if test ! -f "${srcdir}/$i" ; then 2780 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i']) 2781 fi 2782 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i" 2783 done 2784 AC_SUBST(PKG_TCL_SOURCES) 2785]) 2786 2787#------------------------------------------------------------------------ 2788# TEA_ADD_HEADERS -- 2789# 2790# Specify one or more source headers. Users should check for 2791# the right platform before adding to their list. 2792# 2793# Arguments: 2794# one or more file names 2795# 2796# Results: 2797# 2798# Defines and substs the following vars: 2799# PKG_HEADERS 2800#------------------------------------------------------------------------ 2801AC_DEFUN(TEA_ADD_HEADERS, [ 2802 vars="$@" 2803 for i in $vars; do 2804 # check for existence, be strict because it is installed 2805 if test ! -f "${srcdir}/$i" ; then 2806 AC_MSG_ERROR([could not find header file '${srcdir}/$i']) 2807 fi 2808 PKG_HEADERS="$PKG_HEADERS $i" 2809 done 2810 AC_SUBST(PKG_HEADERS) 2811]) 2812 2813#------------------------------------------------------------------------ 2814# TEA_ADD_INCLUDES -- 2815# 2816# Specify one or more include dirs. Users should check for 2817# the right platform before adding to their list. 2818# 2819# Arguments: 2820# one or more file names 2821# 2822# Results: 2823# 2824# Defines and substs the following vars: 2825# PKG_INCLUDES 2826#------------------------------------------------------------------------ 2827AC_DEFUN(TEA_ADD_INCLUDES, [ 2828 vars="$@" 2829 for i in $vars; do 2830 PKG_INCLUDES="$PKG_INCLUDES $i" 2831 done 2832 AC_SUBST(PKG_INCLUDES) 2833]) 2834 2835#------------------------------------------------------------------------ 2836# TEA_ADD_LIBS -- 2837# 2838# Specify one or more libraries. Users should check for 2839# the right platform before adding to their list. For Windows, 2840# libraries provided in "foo.lib" format will be converted to 2841# "-lfoo" when using GCC (mingw). 2842# 2843# Arguments: 2844# one or more file names 2845# 2846# Results: 2847# 2848# Defines and substs the following vars: 2849# PKG_LIBS 2850#------------------------------------------------------------------------ 2851AC_DEFUN(TEA_ADD_LIBS, [ 2852 vars="$@" 2853 for i in $vars; do 2854 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then 2855 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib 2856 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'` 2857 fi 2858 PKG_LIBS="$PKG_LIBS $i" 2859 done 2860 AC_SUBST(PKG_LIBS) 2861]) 2862 2863#------------------------------------------------------------------------ 2864# TEA_ADD_CFLAGS -- 2865# 2866# Specify one or more CFLAGS. Users should check for 2867# the right platform before adding to their list. 2868# 2869# Arguments: 2870# one or more file names 2871# 2872# Results: 2873# 2874# Defines and substs the following vars: 2875# PKG_CFLAGS 2876#------------------------------------------------------------------------ 2877AC_DEFUN(TEA_ADD_CFLAGS, [ 2878 PKG_CFLAGS="$PKG_CFLAGS $@" 2879 AC_SUBST(PKG_CFLAGS) 2880]) 2881 2882#------------------------------------------------------------------------ 2883# TEA_PREFIX -- 2884# 2885# Handle the --prefix=... option by defaulting to what Tcl gave 2886# 2887# Arguments: 2888# none 2889# 2890# Results: 2891# 2892# If --prefix or --exec-prefix was not specified, $prefix and 2893# $exec_prefix will be set to the values given to Tcl when it was 2894# configured. 2895#------------------------------------------------------------------------ 2896AC_DEFUN(TEA_PREFIX, [ 2897 if test "${prefix}" = "NONE"; then 2898 prefix_default=yes 2899 if test x"${TCL_PREFIX}" != x; then 2900 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}]) 2901 prefix=${TCL_PREFIX} 2902 else 2903 AC_MSG_NOTICE([--prefix defaulting to /usr/local]) 2904 prefix=/usr/local 2905 fi 2906 fi 2907 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \ 2908 -o x"${exec_prefix_default}" = x"yes" ; then 2909 if test x"${TCL_EXEC_PREFIX}" != x; then 2910 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}]) 2911 exec_prefix=${TCL_EXEC_PREFIX} 2912 else 2913 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}]) 2914 exec_prefix=$prefix 2915 fi 2916 fi 2917]) 2918 2919#------------------------------------------------------------------------ 2920# TEA_SETUP_COMPILER_CC -- 2921# 2922# Do compiler checks the way we want. This is just a replacement 2923# for AC_PROG_CC in TEA configure.in files to make them cleaner. 2924# 2925# Arguments: 2926# none 2927# 2928# Results: 2929# 2930# Sets up CC var and other standard bits we need to make executables. 2931#------------------------------------------------------------------------ 2932AC_DEFUN(TEA_SETUP_COMPILER_CC, [ 2933 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) 2934 # in this macro, they need to go into TEA_SETUP_COMPILER instead. 2935 2936 # If the user did not set CFLAGS, set it now to keep 2937 # the AC_PROG_CC macro from adding "-g -O2". 2938 if test "${CFLAGS+set}" != "set" ; then 2939 CFLAGS="" 2940 fi 2941 2942 AC_PROG_CC 2943 AC_PROG_CPP 2944 2945 AC_PROG_INSTALL 2946 2947 #-------------------------------------------------------------------- 2948 # Checks to see if the make program sets the $MAKE variable. 2949 #-------------------------------------------------------------------- 2950 2951 AC_PROG_MAKE_SET 2952 2953 #-------------------------------------------------------------------- 2954 # Find ranlib 2955 #-------------------------------------------------------------------- 2956 2957 AC_PROG_RANLIB 2958 2959 #-------------------------------------------------------------------- 2960 # Determines the correct binary file extension (.o, .obj, .exe etc.) 2961 #-------------------------------------------------------------------- 2962 2963 AC_OBJEXT 2964 AC_EXEEXT 2965]) 2966 2967#------------------------------------------------------------------------ 2968# TEA_SETUP_COMPILER -- 2969# 2970# Do compiler checks that use the compiler. This must go after 2971# TEA_SETUP_COMPILER_CC, which does the actual compiler check. 2972# 2973# Arguments: 2974# none 2975# 2976# Results: 2977# 2978# Sets up CC var and other standard bits we need to make executables. 2979#------------------------------------------------------------------------ 2980AC_DEFUN(TEA_SETUP_COMPILER, [ 2981 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. 2982 AC_REQUIRE([TEA_SETUP_COMPILER_CC]) 2983 2984 #------------------------------------------------------------------------ 2985 # If we're using GCC, see if the compiler understands -pipe. If so, use it. 2986 # It makes compiling go faster. (This is only a performance feature.) 2987 #------------------------------------------------------------------------ 2988 2989 if test -z "$no_pipe" -a -n "$GCC"; then 2990 AC_MSG_CHECKING([if the compiler understands -pipe]) 2991 OLDCC="$CC" 2992 CC="$CC -pipe" 2993 AC_TRY_COMPILE(,, AC_MSG_RESULT([yes]), CC="$OLDCC" 2994 AC_MSG_RESULT([no])) 2995 fi 2996 2997 #-------------------------------------------------------------------- 2998 # Common compiler flag setup 2999 #-------------------------------------------------------------------- 3000 3001 AC_C_BIGENDIAN 3002 if test "${TEA_PLATFORM}" = "unix" ; then 3003 TEA_TCL_LINK_LIBS 3004 TEA_MISSING_POSIX_HEADERS 3005 # Let the user call this, because if it triggers, they will 3006 # need a compat/strtod.c that is correct. Users can also 3007 # use Tcl_GetDouble(FromObj) instead. 3008 #TEA_BUGGY_STRTOD 3009 fi 3010]) 3011 3012#------------------------------------------------------------------------ 3013# TEA_MAKE_LIB -- 3014# 3015# Generate a line that can be used to build a shared/unshared library 3016# in a platform independent manner. 3017# 3018# Arguments: 3019# none 3020# 3021# Requires: 3022# 3023# Results: 3024# 3025# Defines the following vars: 3026# CFLAGS - Done late here to note disturb other AC macros 3027# MAKE_LIB - Command to execute to build the Tcl library; 3028# differs depending on whether or not Tcl is being 3029# compiled as a shared library. 3030# MAKE_SHARED_LIB Makefile rule for building a shared library 3031# MAKE_STATIC_LIB Makefile rule for building a static library 3032# MAKE_STUB_LIB Makefile rule for building a stub library 3033#------------------------------------------------------------------------ 3034 3035AC_DEFUN(TEA_MAKE_LIB, [ 3036 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then 3037 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)" 3038 MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)" 3039 MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)" 3040 else 3041 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)" 3042 MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}" 3043 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)" 3044 fi 3045 3046 if test "${SHARED_BUILD}" = "1" ; then 3047 MAKE_LIB="${MAKE_SHARED_LIB} " 3048 else 3049 MAKE_LIB="${MAKE_STATIC_LIB} " 3050 fi 3051 3052 #-------------------------------------------------------------------- 3053 # Shared libraries and static libraries have different names. 3054 # Use the double eval to make sure any variables in the suffix is 3055 # substituted. (@@@ Might not be necessary anymore) 3056 #-------------------------------------------------------------------- 3057 3058 if test "${TEA_PLATFORM}" = "windows" ; then 3059 if test "${SHARED_BUILD}" = "1" ; then 3060 # We force the unresolved linking of symbols that are really in 3061 # the private libraries of Tcl and Tk. 3062 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" 3063 if test x"${TK_BIN_DIR}" != x ; then 3064 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" 3065 fi 3066 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 3067 else 3068 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 3069 fi 3070 # Some packages build there own stubs libraries 3071 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 3072 # These aren't needed on Windows (either MSVC or gcc) 3073 RANLIB=: 3074 RANLIB_STUB=: 3075 else 3076 RANLIB_STUB="${RANLIB}" 3077 if test "${SHARED_BUILD}" = "1" ; then 3078 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" 3079 if test x"${TK_BIN_DIR}" != x ; then 3080 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" 3081 fi 3082 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" 3083 RANLIB=: 3084 else 3085 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" 3086 fi 3087 # Some packages build there own stubs libraries 3088 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" 3089 fi 3090 3091 # These are escaped so that only CFLAGS is picked up at configure time. 3092 # The other values will be substituted at make time. 3093 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" 3094 if test "${SHARED_BUILD}" = "1" ; then 3095 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" 3096 fi 3097 3098 AC_SUBST(MAKE_LIB) 3099 AC_SUBST(MAKE_SHARED_LIB) 3100 AC_SUBST(MAKE_STATIC_LIB) 3101 AC_SUBST(MAKE_STUB_LIB) 3102 AC_SUBST(RANLIB_STUB) 3103]) 3104 3105#------------------------------------------------------------------------ 3106# TEA_LIB_SPEC -- 3107# 3108# Compute the name of an existing object library located in libdir 3109# from the given base name and produce the appropriate linker flags. 3110# 3111# Arguments: 3112# basename The base name of the library without version 3113# numbers, extensions, or "lib" prefixes. 3114# extra_dir Extra directory in which to search for the 3115# library. This location is used first, then 3116# $prefix/$exec-prefix, then some defaults. 3117# 3118# Requires: 3119# TEA_INIT and TEA_PREFIX must be called first. 3120# 3121# Results: 3122# 3123# Defines the following vars: 3124# ${basename}_LIB_NAME The computed library name. 3125# ${basename}_LIB_SPEC The computed linker flags. 3126#------------------------------------------------------------------------ 3127 3128AC_DEFUN(TEA_LIB_SPEC, [ 3129 AC_MSG_CHECKING([for $1 library]) 3130 3131 # Look in exec-prefix for the library (defined by TEA_PREFIX). 3132 3133 tea_lib_name_dir="${exec_prefix}/lib" 3134 3135 # Or in a user-specified location. 3136 3137 if test x"$2" != x ; then 3138 tea_extra_lib_dir=$2 3139 else 3140 tea_extra_lib_dir=NONE 3141 fi 3142 3143 for i in \ 3144 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \ 3145 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \ 3146 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \ 3147 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \ 3148 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \ 3149 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \ 3150 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \ 3151 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do 3152 if test -f "$i" ; then 3153 tea_lib_name_dir=`dirname $i` 3154 $1_LIB_NAME=`basename $i` 3155 $1_LIB_PATH_NAME=$i 3156 break 3157 fi 3158 done 3159 3160 if test "${TEA_PLATFORM}" = "windows"; then 3161 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\" 3162 else 3163 # Strip off the leading "lib" and trailing ".a" or ".so" 3164 3165 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'` 3166 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}" 3167 fi 3168 3169 if test "x${$1_LIB_NAME}" = x ; then 3170 AC_MSG_ERROR([not found]) 3171 else 3172 AC_MSG_RESULT([${$1_LIB_SPEC}]) 3173 fi 3174]) 3175 3176#------------------------------------------------------------------------ 3177# TEA_PRIVATE_TCL_HEADERS -- 3178# 3179# Locate the private Tcl include files 3180# 3181# Arguments: 3182# 3183# Requires: 3184# TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has 3185# already been called. 3186# 3187# Results: 3188# 3189# Substs the following vars: 3190# TCL_TOP_DIR_NATIVE 3191# TCL_GENERIC_DIR_NATIVE 3192# TCL_UNIX_DIR_NATIVE 3193# TCL_WIN_DIR_NATIVE 3194# TCL_BMAP_DIR_NATIVE 3195# TCL_TOOL_DIR_NATIVE 3196# TCL_PLATFORM_DIR_NATIVE 3197# TCL_BIN_DIR_NATIVE 3198# TCL_INCLUDES 3199#------------------------------------------------------------------------ 3200 3201AC_DEFUN(TEA_PRIVATE_TCL_HEADERS, [ 3202 AC_MSG_CHECKING([for Tcl private include files]) 3203 3204 if test "${TEA_PLATFORM}" = "windows"; then 3205 TCL_TOP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}`\" 3206 TCL_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/generic`\" 3207 TCL_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/unix`\" 3208 TCL_WIN_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/win`\" 3209 TCL_BMAP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/bitmaps`\" 3210 TCL_TOOL_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/tools`\" 3211 TCL_COMPAT_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/compat`\" 3212 TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE} 3213 3214 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}" 3215 else 3216 TCL_TOP_DIR_NATIVE='$(TCL_SRC_DIR)' 3217 TCL_GENERIC_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/generic' 3218 TCL_UNIX_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/unix' 3219 TCL_WIN_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/win' 3220 TCL_BMAP_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/bitmaps' 3221 TCL_TOOL_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/tools' 3222 TCL_COMPAT_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/compat' 3223 TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE} 3224 3225 # substitute these in "relaxed" so that TCL_INCLUDES still works 3226 # without requiring the other vars to be defined in the Makefile 3227 eval "TCL_INCLUDES=\"-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}\"" 3228 fi 3229 3230 AC_SUBST(TCL_TOP_DIR_NATIVE) 3231 AC_SUBST(TCL_GENERIC_DIR_NATIVE) 3232 AC_SUBST(TCL_UNIX_DIR_NATIVE) 3233 AC_SUBST(TCL_WIN_DIR_NATIVE) 3234 AC_SUBST(TCL_BMAP_DIR_NATIVE) 3235 AC_SUBST(TCL_TOOL_DIR_NATIVE) 3236 AC_SUBST(TCL_PLATFORM_DIR_NATIVE) 3237 3238 AC_SUBST(TCL_INCLUDES) 3239 AC_MSG_RESULT([Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}]) 3240]) 3241 3242#------------------------------------------------------------------------ 3243# TEA_PUBLIC_TCL_HEADERS -- 3244# 3245# Locate the installed public Tcl header files 3246# 3247# Arguments: 3248# None. 3249# 3250# Requires: 3251# CYGPATH must be set 3252# 3253# Results: 3254# 3255# Adds a --with-tclinclude switch to configure. 3256# Result is cached. 3257# 3258# Substs the following vars: 3259# TCL_INCLUDES 3260#------------------------------------------------------------------------ 3261 3262AC_DEFUN(TEA_PUBLIC_TCL_HEADERS, [ 3263 AC_MSG_CHECKING([for Tcl public headers]) 3264 3265 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval}) 3266 3267 AC_CACHE_VAL(ac_cv_c_tclh, [ 3268 # Use the value from --with-tclinclude, if it was given 3269 3270 if test x"${with_tclinclude}" != x ; then 3271 if test -f "${with_tclinclude}/tcl.h" ; then 3272 ac_cv_c_tclh=${with_tclinclude} 3273 else 3274 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h]) 3275 fi 3276 else 3277 # Check order: pkg --prefix location, Tcl's --prefix location, 3278 # directory of tclConfig.sh, and Tcl source directory. 3279 # Looking in the source dir is not ideal, but OK. 3280 3281 eval "temp_includedir=${includedir}" 3282 list="`ls -d ${temp_includedir} 2>/dev/null` \ 3283 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ 3284 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \ 3285 `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`" 3286 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then 3287 list="$list /usr/local/include /usr/include" 3288 fi 3289 for i in $list ; do 3290 if test -f "$i/tcl.h" ; then 3291 ac_cv_c_tclh=$i 3292 break 3293 fi 3294 done 3295 fi 3296 ]) 3297 3298 # Print a message based on how we determined the include path 3299 3300 if test x"${ac_cv_c_tclh}" = x ; then 3301 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude]) 3302 else 3303 AC_MSG_RESULT([${ac_cv_c_tclh}]) 3304 fi 3305 3306 # Convert to a native path and substitute into the output files. 3307 3308 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}` 3309 3310 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" 3311 3312 AC_SUBST(TCL_INCLUDES) 3313]) 3314 3315#------------------------------------------------------------------------ 3316# TEA_PRIVATE_TK_HEADERS -- 3317# 3318# Locate the private Tk include files 3319# 3320# Arguments: 3321# 3322# Requires: 3323# TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has 3324# already been called. 3325# 3326# Results: 3327# 3328# Substs the following vars: 3329# TK_INCLUDES 3330#------------------------------------------------------------------------ 3331 3332AC_DEFUN(TEA_PRIVATE_TK_HEADERS, [ 3333 AC_MSG_CHECKING([for Tk private include files]) 3334 3335 if test "${TEA_PLATFORM}" = "windows"; then 3336 TK_TOP_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}`\" 3337 TK_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/unix`\" 3338 TK_WIN_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/win`\" 3339 TK_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/generic`\" 3340 TK_XLIB_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/xlib`\" 3341 TK_PLATFORM_DIR_NATIVE=${TK_WIN_DIR_NATIVE} 3342 3343 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE} -I${TK_XLIB_DIR_NATIVE}" 3344 else 3345 TK_TOP_DIR_NATIVE='${TK_SRC_DIR}' 3346 TK_GENERIC_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/generic' 3347 TK_UNIX_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/unix' 3348 TK_WIN_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/win' 3349 TK_PLATFORM_DIR_NATIVE=${TK_UNIX_DIR_NATIVE} 3350 3351 # substitute these in "relaxed" so that TK_INCLUDES still works 3352 # without requiring the other vars to be defined in the Makefile 3353 eval "TK_INCLUDES=\"-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}\"" 3354 fi 3355 3356 AC_SUBST(TK_TOP_DIR_NATIVE) 3357 AC_SUBST(TK_UNIX_DIR_NATIVE) 3358 AC_SUBST(TK_WIN_DIR_NATIVE) 3359 AC_SUBST(TK_GENERIC_DIR_NATIVE) 3360 AC_SUBST(TK_XLIB_DIR_NATIVE) 3361 AC_SUBST(TK_PLATFORM_DIR_NATIVE) 3362 3363 AC_SUBST(TK_INCLUDES) 3364 AC_MSG_RESULT([Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}]) 3365]) 3366 3367#------------------------------------------------------------------------ 3368# TEA_PUBLIC_TK_HEADERS -- 3369# 3370# Locate the installed public Tk header files 3371# 3372# Arguments: 3373# None. 3374# 3375# Requires: 3376# CYGPATH must be set 3377# 3378# Results: 3379# 3380# Adds a --with-tkinclude switch to configure. 3381# Result is cached. 3382# 3383# Substs the following vars: 3384# TK_INCLUDES 3385#------------------------------------------------------------------------ 3386 3387AC_DEFUN(TEA_PUBLIC_TK_HEADERS, [ 3388 AC_MSG_CHECKING([for Tk public headers]) 3389 3390 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files.], with_tkinclude=${withval}) 3391 3392 AC_CACHE_VAL(ac_cv_c_tkh, [ 3393 # Use the value from --with-tkinclude, if it was given 3394 3395 if test x"${with_tkinclude}" != x ; then 3396 if test -f "${with_tkinclude}/tk.h" ; then 3397 ac_cv_c_tkh=${with_tkinclude} 3398 else 3399 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h]) 3400 fi 3401 else 3402 # Check order: pkg --prefix location, Tcl's --prefix location, 3403 # directory of tclConfig.sh, and Tcl source directory. 3404 # Looking in the source dir is not ideal, but OK. 3405 3406 eval "temp_includedir=${includedir}" 3407 list="`ls -d ${temp_includedir} 2>/dev/null` \ 3408 `ls -d ${TK_PREFIX}/include 2>/dev/null` \ 3409 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ 3410 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \ 3411 `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`" 3412 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then 3413 list="$list /usr/local/include /usr/include" 3414 fi 3415 for i in $list ; do 3416 if test -f "$i/tk.h" ; then 3417 ac_cv_c_tkh=$i 3418 break 3419 fi 3420 done 3421 fi 3422 ]) 3423 3424 # Print a message based on how we determined the include path 3425 3426 if test x"${ac_cv_c_tkh}" = x ; then 3427 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude]) 3428 else 3429 AC_MSG_RESULT([${ac_cv_c_tkh}]) 3430 fi 3431 3432 # Convert to a native path and substitute into the output files. 3433 3434 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}` 3435 3436 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" 3437 3438 AC_SUBST(TK_INCLUDES) 3439 3440 if test "${TEA_PLATFORM}" = "windows" ; then 3441 # On Windows, we need the X compat headers 3442 AC_MSG_CHECKING([for X11 header files]) 3443 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then 3444 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`" 3445 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" 3446 AC_SUBST(TK_XINCLUDES) 3447 fi 3448 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}]) 3449 fi 3450]) 3451 3452#------------------------------------------------------------------------ 3453# TEA_PROG_TCLSH 3454# Locate a tclsh shell in the following directories: 3455# ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin 3456# ${exec_prefix}/bin ${prefix}/bin 3457# ${PATH} 3458# 3459# Arguments 3460# none 3461# 3462# Results 3463# Subst's the following values: 3464# TCLSH_PROG 3465#------------------------------------------------------------------------ 3466 3467AC_DEFUN(TEA_PROG_TCLSH, [ 3468 # Allow the user to provide this setting in the env 3469 if test "x${TCLSH_PROG}" = "x" ; then 3470 AC_MSG_CHECKING([for tclsh]) 3471 3472 AC_CACHE_VAL(ac_cv_path_tclsh, [ 3473 search_path=`echo ${PATH} | sed -e 's/:/ /g'` 3474 if test "${TEA_PLATFORM}" != "windows" -o \ 3475 \( "$do64bit_ok" = "no" -a "$doWince" = "no" \) ; then 3476 # Do not allow target tclsh in known cross-compile builds, 3477 # as we need one we can run on this system 3478 search_path="${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin ${exec_prefix}/bin ${prefix}/bin ${search_path}" 3479 fi 3480 for dir in $search_path ; do 3481 for j in `ls -r $dir/tclsh[[8-9]]*${EXEEXT} 2> /dev/null` \ 3482 `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do 3483 if test x"$ac_cv_path_tclsh" = x ; then 3484 if test -f "$j" ; then 3485 ac_cv_path_tclsh=$j 3486 break 3487 fi 3488 fi 3489 done 3490 done 3491 ]) 3492 3493 if test -f "$ac_cv_path_tclsh" ; then 3494 TCLSH_PROG=$ac_cv_path_tclsh 3495 AC_MSG_RESULT([$TCLSH_PROG]) 3496 else 3497 AC_MSG_ERROR([No tclsh found in PATH: $search_path]) 3498 fi 3499 fi 3500 AC_SUBST(TCLSH_PROG) 3501]) 3502 3503#------------------------------------------------------------------------ 3504# TEA_PROG_WISH 3505# Locate a wish shell in the following directories: 3506# ${TK_BIN_DIR} ${TK_BIN_DIR}/../bin 3507# ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin 3508# ${exec_prefix}/bin ${prefix}/bin 3509# ${PATH} 3510# 3511# Arguments 3512# none 3513# 3514# Results 3515# Subst's the following values: 3516# WISH_PROG 3517#------------------------------------------------------------------------ 3518 3519AC_DEFUN(TEA_PROG_WISH, [ 3520 # Allow the user to provide this setting in the env 3521 if test "x${WISH_PROG}" = "x" ; then 3522 AC_MSG_CHECKING([for wish]) 3523 3524 AC_CACHE_VAL(ac_cv_path_wish, [ 3525 search_path=`echo ${PATH} | sed -e 's/:/ /g'` 3526 if test "${TEA_PLATFORM}" != "windows" -o \ 3527 \( "$do64bit_ok" = "no" -a "$doWince" = "no" \) ; then 3528 # Do not allow target wish in known cross-compile builds, 3529 # as we need one we can run on this system 3530 search_path="${TK_BIN_DIR} ${TK_BIN_DIR}/../bin ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin ${exec_prefix}/bin ${prefix}/bin ${search_path}" 3531 fi 3532 for dir in $search_path ; do 3533 for j in `ls -r $dir/wish[[8-9]]*${EXEEXT} 2> /dev/null` \ 3534 `ls -r $dir/wish*${EXEEXT} 2> /dev/null` ; do 3535 if test x"$ac_cv_path_wish" = x ; then 3536 if test -f "$j" ; then 3537 ac_cv_path_wish=$j 3538 break 3539 fi 3540 fi 3541 done 3542 done 3543 ]) 3544 3545 if test -f "$ac_cv_path_wish" ; then 3546 WISH_PROG=$ac_cv_path_wish 3547 AC_MSG_RESULT([$WISH_PROG]) 3548 else 3549 AC_MSG_ERROR([No wish found in PATH: $search_path]) 3550 fi 3551 fi 3552 AC_SUBST(WISH_PROG) 3553]) 3554 3555#------------------------------------------------------------------------ 3556# TEA_PATH_CONFIG -- 3557# 3558# Locate the ${1}Config.sh file and perform a sanity check on 3559# the ${1} compile flags. These are used by packages like 3560# [incr Tk] that load *Config.sh files from more than Tcl and Tk. 3561# 3562# Arguments: 3563# none 3564# 3565# Results: 3566# 3567# Adds the following arguments to configure: 3568# --with-$1=... 3569# 3570# Defines the following vars: 3571# $1_BIN_DIR Full path to the directory containing 3572# the $1Config.sh file 3573#------------------------------------------------------------------------ 3574 3575AC_DEFUN(TEA_PATH_CONFIG, [ 3576 # 3577 # Ok, lets find the $1 configuration 3578 # First, look for one uninstalled. 3579 # the alternative search directory is invoked by --with-$1 3580 # 3581 3582 if test x"${no_$1}" = x ; then 3583 # we reset no_$1 in case something fails here 3584 no_$1=true 3585 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval}) 3586 AC_MSG_CHECKING([for $1 configuration]) 3587 AC_CACHE_VAL(ac_cv_c_$1config,[ 3588 3589 # First check to see if --with-$1 was specified. 3590 if test x"${with_$1config}" != x ; then 3591 case ${with_$1config} in 3592 */$1Config.sh ) 3593 if test -f ${with_$1config}; then 3594 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself]) 3595 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'` 3596 fi;; 3597 esac 3598 if test -f "${with_$1config}/$1Config.sh" ; then 3599 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)` 3600 else 3601 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh]) 3602 fi 3603 fi 3604 3605 # then check for a private $1 installation 3606 if test x"${ac_cv_c_$1config}" = x ; then 3607 for i in \ 3608 ../$1 \ 3609 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ 3610 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ 3611 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \ 3612 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ 3613 ../../$1 \ 3614 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ 3615 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ 3616 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \ 3617 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ 3618 ../../../$1 \ 3619 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ 3620 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ 3621 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \ 3622 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ 3623 ${srcdir}/../$1 \ 3624 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ 3625 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ 3626 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \ 3627 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ 3628 ; do 3629 if test -f "$i/$1Config.sh" ; then 3630 ac_cv_c_$1config=`(cd $i; pwd)` 3631 break 3632 fi 3633 if test -f "$i/unix/$1Config.sh" ; then 3634 ac_cv_c_$1config=`(cd $i/unix; pwd)` 3635 break 3636 fi 3637 done 3638 fi 3639 3640 # check in a few common install locations 3641 if test x"${ac_cv_c_$1config}" = x ; then 3642 for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \ 3643 `ls -d ${prefix}/lib 2>/dev/null` \ 3644 `ls -d /usr/local/lib 2>/dev/null` \ 3645 `ls -d /usr/contrib/lib 2>/dev/null` \ 3646 `ls -d /usr/lib 2>/dev/null` \ 3647 ; do 3648 if test -f "$i/$1Config.sh" ; then 3649 ac_cv_c_$1config=`(cd $i; pwd)` 3650 break 3651 fi 3652 done 3653 fi 3654 ]) 3655 3656 if test x"${ac_cv_c_$1config}" = x ; then 3657 $1_BIN_DIR="# no $1 configs found" 3658 AC_MSG_WARN("Cannot find $1 configuration definitions") 3659 exit 0 3660 else 3661 no_$1= 3662 $1_BIN_DIR=${ac_cv_c_$1config} 3663 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh]) 3664 fi 3665 fi 3666]) 3667 3668#------------------------------------------------------------------------ 3669# TEA_LOAD_CONFIG -- 3670# 3671# Load the $1Config.sh file 3672# 3673# Arguments: 3674# 3675# Requires the following vars to be set: 3676# $1_BIN_DIR 3677# 3678# Results: 3679# 3680# Subst the following vars: 3681# $1_SRC_DIR 3682# $1_LIB_FILE 3683# $1_LIB_SPEC 3684# 3685#------------------------------------------------------------------------ 3686 3687AC_DEFUN(TEA_LOAD_CONFIG, [ 3688 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh]) 3689 3690 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then 3691 AC_MSG_RESULT([loading]) 3692 . ${$1_BIN_DIR}/$1Config.sh 3693 else 3694 AC_MSG_RESULT([file not found]) 3695 fi 3696 3697 # 3698 # If the $1_BIN_DIR is the build directory (not the install directory), 3699 # then set the common variable name to the value of the build variables. 3700 # For example, the variable $1_LIB_SPEC will be set to the value 3701 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC 3702 # instead of $1_BUILD_LIB_SPEC since it will work with both an 3703 # installed and uninstalled version of Tcl. 3704 # 3705 3706 if test -f ${$1_BIN_DIR}/Makefile ; then 3707 AC_MSG_WARN([Found Makefile - using build library specs for $1]) 3708 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC} 3709 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC} 3710 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH} 3711 fi 3712 3713 AC_SUBST($1_VERSION) 3714 AC_SUBST($1_BIN_DIR) 3715 AC_SUBST($1_SRC_DIR) 3716 3717 AC_SUBST($1_LIB_FILE) 3718 AC_SUBST($1_LIB_SPEC) 3719 3720 AC_SUBST($1_STUB_LIB_FILE) 3721 AC_SUBST($1_STUB_LIB_SPEC) 3722 AC_SUBST($1_STUB_LIB_PATH) 3723]) 3724 3725#------------------------------------------------------------------------ 3726# TEA_PATH_CELIB -- 3727# 3728# Locate Keuchel's celib emulation layer for targeting Win/CE 3729# 3730# Arguments: 3731# none 3732# 3733# Results: 3734# 3735# Adds the following arguments to configure: 3736# --with-celib=... 3737# 3738# Defines the following vars: 3739# CELIB_DIR Full path to the directory containing 3740# the include and platform lib files 3741#------------------------------------------------------------------------ 3742 3743AC_DEFUN(TEA_PATH_CELIB, [ 3744 # First, look for one uninstalled. 3745 # the alternative search directory is invoked by --with-celib 3746 3747 if test x"${no_celib}" = x ; then 3748 # we reset no_celib in case something fails here 3749 no_celib=true 3750 AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval}) 3751 AC_MSG_CHECKING([for Windows/CE celib directory]) 3752 AC_CACHE_VAL(ac_cv_c_celibconfig,[ 3753 # First check to see if --with-celibconfig was specified. 3754 if test x"${with_celibconfig}" != x ; then 3755 if test -d "${with_celibconfig}/inc" ; then 3756 ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` 3757 else 3758 AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory]) 3759 fi 3760 fi 3761 3762 # then check for a celib library 3763 if test x"${ac_cv_c_celibconfig}" = x ; then 3764 for i in \ 3765 ../celib-palm-3.0 \ 3766 ../celib \ 3767 ../../celib-palm-3.0 \ 3768 ../../celib \ 3769 `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \ 3770 ${srcdir}/../celib-palm-3.0 \ 3771 ${srcdir}/../celib \ 3772 `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \ 3773 ; do 3774 if test -d "$i/inc" ; then 3775 ac_cv_c_celibconfig=`(cd $i; pwd)` 3776 break 3777 fi 3778 done 3779 fi 3780 ]) 3781 if test x"${ac_cv_c_celibconfig}" = x ; then 3782 AC_MSG_ERROR([Cannot find celib support library directory]) 3783 else 3784 no_celib= 3785 CELIB_DIR=${ac_cv_c_celibconfig} 3786 AC_MSG_RESULT([found $CELIB_DIR]) 3787 TEA_PATH_NOSPACE(CELIB_DIR, ${ac_cv_c_celibconfig}) 3788 fi 3789 fi 3790]) 3791 3792#------------------------------------------------------------------------ 3793# TEA_PATH_NOSPACE 3794# Ensure that the given path has no spaces. This is necessary for 3795# CC (and consitutuent vars that build it up) to work in the 3796# tortured autoconf environment. Currently only for Windows use. 3797# 3798# Arguments 3799# VAR - name of the variable to set 3800# PATH - path to ensure no spaces in 3801# 3802# Results 3803# Sets $VAR to short path of $PATH if it can be found. 3804#------------------------------------------------------------------------ 3805 3806AC_DEFUN([TEA_PATH_NOSPACE], [ 3807 if test "${TEA_PLATFORM}" = "windows" ; then 3808 # we need TCLSH_PROG defined to get Windows short pathnames 3809 AC_REQUIRE([TEA_PROG_TCLSH]) 3810 3811 AC_MSG_CHECKING([short pathname for $1 ($2)]) 3812 3813 shortpath= 3814 case "$2" in 3815 *\ *) 3816 # Only do this if we need to. 3817 shortpath=`echo "puts [[file attributes {$2} -shortname]] ; exit" | ${TCLSH_PROG} 2>/dev/null` 3818 ;; 3819 esac 3820 if test "x${shortpath}" = "x" ; then 3821 AC_MSG_RESULT([not changed]) 3822 else 3823 $1=$shortpath 3824 AC_MSG_RESULT([${$1}]) 3825 fi 3826 fi 3827]) 3828