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