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