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