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