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