1#------------------------------------------------------------------------ 2# SC_PATH_TCLCONFIG -- 3# 4# Locate the tclConfig.sh file and perform a sanity check on 5# the Tcl compile flags 6# Currently a no-op for Windows 7# 8# Arguments: 9# PATCH_LEVEL The patch level for Tcl if any. 10# 11# Results: 12# 13# Adds the following arguments to configure: 14# --with-tcl=... 15# 16# Sets the following vars: 17# TCL_BIN_DIR Full path to the tclConfig.sh file 18#------------------------------------------------------------------------ 19 20AC_DEFUN([SC_PATH_TCLCONFIG], [ 21 AC_MSG_CHECKING([the location of tclConfig.sh]) 22 23 if test -d ../../tcl8.4$1/win; then 24 TCL_BIN_DIR_DEFAULT=../../tcl8.4$1/win 25 elif test -d ../../tcl8.4/win; then 26 TCL_BIN_DIR_DEFAULT=../../tcl8.4/win 27 else 28 TCL_BIN_DIR_DEFAULT=../../tcl/win 29 fi 30 31 AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.4 binaries from DIR], 32 TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`) 33 if test ! -d $TCL_BIN_DIR; then 34 AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist) 35 fi 36 if test ! -f $TCL_BIN_DIR/tclConfig.sh; then 37 AC_MSG_ERROR(There is no tclConfig.sh in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) 38 fi 39 AC_MSG_RESULT($TCL_BIN_DIR/tclConfig.sh) 40]) 41 42#------------------------------------------------------------------------ 43# SC_PATH_TKCONFIG -- 44# 45# Locate the tkConfig.sh file 46# Currently a no-op for Windows 47# 48# Arguments: 49# none 50# 51# Results: 52# 53# Adds the following arguments to configure: 54# --with-tk=... 55# 56# Sets the following vars: 57# TK_BIN_DIR Full path to the tkConfig.sh file 58#------------------------------------------------------------------------ 59 60AC_DEFUN([SC_PATH_TKCONFIG], [ 61 AC_MSG_CHECKING([the location of tkConfig.sh]) 62 63 if test -d ../../tk8.4$1/win; then 64 TK_BIN_DIR_DEFAULT=../../tk8.4$1/win 65 elif test -d ../../tk8.4/win; then 66 TK_BIN_DIR_DEFAULT=../../tk8.4/win 67 else 68 TK_BIN_DIR_DEFAULT=../../tk/win 69 fi 70 71 AC_ARG_WITH(tk, [ --with-tk=DIR use Tk 8.4 binaries from DIR], 72 TK_BIN_DIR=$withval, TK_BIN_DIR=`cd $TK_BIN_DIR_DEFAULT; pwd`) 73 if test ! -d $TK_BIN_DIR; then 74 AC_MSG_ERROR(Tk directory $TK_BIN_DIR does not exist) 75 fi 76 if test ! -f $TK_BIN_DIR/tkConfig.sh; then 77 AC_MSG_ERROR(There is no tkConfig.sh in $TK_BIN_DIR: perhaps you did not specify the Tk *build* directory (not the toplevel Tk directory) or you forgot to configure Tk?) 78 fi 79 80 AC_MSG_RESULT([$TK_BIN_DIR/tkConfig.sh]) 81]) 82 83#------------------------------------------------------------------------ 84# SC_LOAD_TCLCONFIG -- 85# 86# Load the tclConfig.sh file. 87# 88# Arguments: 89# 90# Requires the following vars to be set: 91# TCL_BIN_DIR 92# 93# Results: 94# 95# Subst the following vars: 96# TCL_BIN_DIR 97# TCL_SRC_DIR 98# TCL_LIB_FILE 99# 100#------------------------------------------------------------------------ 101 102AC_DEFUN([SC_LOAD_TCLCONFIG], [ 103 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) 104 105 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then 106 AC_MSG_RESULT([loading]) 107 . $TCL_BIN_DIR/tclConfig.sh 108 else 109 AC_MSG_RESULT([file not found]) 110 fi 111 112 # 113 # If the TCL_BIN_DIR is the build directory (not the install directory), 114 # then set the common variable name to the value of the build variables. 115 # For example, the variable TCL_LIB_SPEC will be set to the value 116 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC 117 # instead of TCL_BUILD_LIB_SPEC since it will work with both an 118 # installed and uninstalled version of Tcl. 119 # 120 121 if test -f $TCL_BIN_DIR/Makefile ; then 122 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} 123 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} 124 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} 125 fi 126 127 # 128 # eval is required to do the TCL_DBGX substitution 129 # 130 131 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" 132 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" 133 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" 134 135 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" 136 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" 137 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" 138 139 AC_SUBST(TCL_VERSION) 140 AC_SUBST(TCL_PATCH_LEVEL) 141 AC_SUBST(TCL_BIN_DIR) 142 AC_SUBST(TCL_SRC_DIR) 143 144 AC_SUBST(TCL_LIB_FILE) 145 AC_SUBST(TCL_LIB_FLAG) 146 AC_SUBST(TCL_LIB_SPEC) 147 148 AC_SUBST(TCL_STUB_LIB_FILE) 149 AC_SUBST(TCL_STUB_LIB_FLAG) 150 AC_SUBST(TCL_STUB_LIB_SPEC) 151 152 AC_SUBST(TCL_DEFS) 153]) 154 155#------------------------------------------------------------------------ 156# SC_LOAD_TKCONFIG -- 157# 158# Load the tkConfig.sh file 159# Currently a no-op for Windows 160# 161# Arguments: 162# 163# Requires the following vars to be set: 164# TK_BIN_DIR 165# 166# Results: 167# 168# Sets the following vars that should be in tkConfig.sh: 169# TK_BIN_DIR 170#------------------------------------------------------------------------ 171 172AC_DEFUN([SC_LOAD_TKCONFIG], [ 173 AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh]) 174 175 if test -f "$TK_BIN_DIR/tkConfig.sh" ; then 176 AC_MSG_RESULT([loading]) 177 . $TK_BIN_DIR/tkConfig.sh 178 else 179 AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh]) 180 fi 181 182 183 AC_SUBST(TK_BIN_DIR) 184 AC_SUBST(TK_SRC_DIR) 185 AC_SUBST(TK_LIB_FILE) 186]) 187 188#------------------------------------------------------------------------ 189# SC_ENABLE_SHARED -- 190# 191# Allows the building of shared libraries 192# 193# Arguments: 194# none 195# 196# Results: 197# 198# Adds the following arguments to configure: 199# --enable-shared=yes|no 200# 201# Defines the following vars: 202# STATIC_BUILD Used for building import/export libraries 203# on Windows. 204# 205# Sets the following vars: 206# SHARED_BUILD Value of 1 or 0 207#------------------------------------------------------------------------ 208 209AC_DEFUN([SC_ENABLE_SHARED], [ 210 AC_MSG_CHECKING([how to build libraries]) 211 AC_ARG_ENABLE(shared, 212 [ --enable-shared build and link with shared libraries [--enable-shared]], 213 [tcl_ok=$enableval], [tcl_ok=yes]) 214 215 if test "${enable_shared+set}" = set; then 216 enableval="$enable_shared" 217 tcl_ok=$enableval 218 else 219 tcl_ok=yes 220 fi 221 222 if test "$tcl_ok" = "yes" ; then 223 AC_MSG_RESULT([shared]) 224 SHARED_BUILD=1 225 else 226 AC_MSG_RESULT([static]) 227 SHARED_BUILD=0 228 AC_DEFINE(STATIC_BUILD) 229 fi 230]) 231 232#------------------------------------------------------------------------ 233# SC_ENABLE_THREADS -- 234# 235# Specify if thread support should be enabled 236# 237# Arguments: 238# none 239# 240# Results: 241# 242# Adds the following arguments to configure: 243# --enable-threads=yes|no 244# 245# Defines the following vars: 246# TCL_THREADS 247#------------------------------------------------------------------------ 248 249AC_DEFUN([SC_ENABLE_THREADS], [ 250 AC_MSG_CHECKING(for building with threads) 251 AC_ARG_ENABLE(threads, [ --enable-threads build with threads], 252 [tcl_ok=$enableval], [tcl_ok=no]) 253 254 if test "$tcl_ok" = "yes"; then 255 AC_MSG_RESULT(yes) 256 TCL_THREADS=1 257 AC_DEFINE(TCL_THREADS) 258 # USE_THREAD_ALLOC tells us to try the special thread-based 259 # allocator that significantly reduces lock contention 260 AC_DEFINE(USE_THREAD_ALLOC) 261 else 262 TCL_THREADS=0 263 AC_MSG_RESULT([no (default)]) 264 fi 265 AC_SUBST(TCL_THREADS) 266]) 267 268#------------------------------------------------------------------------ 269# SC_ENABLE_SYMBOLS -- 270# 271# Specify if debugging symbols should be used 272# Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging 273# can also be enabled. 274# 275# Arguments: 276# none 277# 278# Requires the following vars to be set in the Makefile: 279# CFLAGS_DEBUG 280# CFLAGS_OPTIMIZE 281# 282# Results: 283# 284# Adds the following arguments to configure: 285# --enable-symbols 286# 287# Defines the following vars: 288# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true 289# Sets to $(CFLAGS_OPTIMIZE) if false 290# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true 291# Sets to $(LDFLAGS_OPTIMIZE) if false 292# DBGX Debug library extension 293# 294#------------------------------------------------------------------------ 295 296AC_DEFUN([SC_ENABLE_SYMBOLS], [ 297 AC_MSG_CHECKING([for build with symbols]) 298 AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no]) 299# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. 300 if test "$tcl_ok" = "no"; then 301 CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' 302 LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' 303 DBGX="" 304 AC_MSG_RESULT([no]) 305 else 306 CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' 307 LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' 308 DBGX=g 309 if test "$tcl_ok" = "yes"; then 310 AC_MSG_RESULT([yes (standard debugging)]) 311 fi 312 fi 313 AC_SUBST(CFLAGS_DEFAULT) 314 AC_SUBST(LDFLAGS_DEFAULT) 315 316 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then 317 AC_DEFINE(TCL_MEM_DEBUG) 318 fi 319 320 if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then 321 AC_DEFINE(TCL_COMPILE_DEBUG) 322 AC_DEFINE(TCL_COMPILE_STATS) 323 fi 324 325 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then 326 if test "$tcl_ok" = "all"; then 327 AC_MSG_RESULT([enabled symbols mem compile debugging]) 328 else 329 AC_MSG_RESULT([enabled $tcl_ok debugging]) 330 fi 331 fi 332]) 333 334#-------------------------------------------------------------------- 335# SC_CONFIG_CFLAGS 336# 337# Try to determine the proper flags to pass to the compiler 338# for building shared libraries and other such nonsense. 339# 340# NOTE: The backslashes in quotes below are substituted twice 341# due to the fact that they are in a macro and then inlined 342# in the final configure script. 343# 344# Arguments: 345# none 346# 347# Results: 348# 349# Can the following vars: 350# EXTRA_CFLAGS 351# CFLAGS_DEBUG 352# CFLAGS_OPTIMIZE 353# CFLAGS_WARNING 354# LDFLAGS_DEBUG 355# LDFLAGS_OPTIMIZE 356# LDFLAGS_CONSOLE 357# LDFLAGS_WINDOW 358# CC_OBJNAME 359# CC_EXENAME 360# CYGPATH 361# STLIB_LD 362# SHLIB_LD 363# SHLIB_LD_LIBS 364# LIBS 365# AR 366# RC 367# RES 368# 369# MAKE_LIB 370# MAKE_EXE 371# MAKE_DLL 372# 373# LIBSUFFIX 374# LIBPREFIX 375# LIBRARIES 376# EXESUFFIX 377# DLLSUFFIX 378# 379#-------------------------------------------------------------------- 380 381AC_DEFUN([SC_CONFIG_CFLAGS], [ 382 383 # Step 0: Enable 64 bit support? 384 385 AC_MSG_CHECKING([if 64bit support is requested]) 386 AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable = amd64|ia64)], [do64bit=$enableval], [do64bit=no]) 387 AC_MSG_RESULT($do64bit) 388 389 # Set some defaults (may get changed below) 390 EXTRA_CFLAGS="" 391 392 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo) 393 394 SHLIB_SUFFIX=".dll" 395 396 # MACHINE is IX86 for LINK, but this is used by the manifest, 397 # which requires x86|amd64|ia64. 398 MACHINE="X86" 399 400 # Check for a bug in gcc's windres that causes the 401 # compile to fail when a Windows native path is 402 # passed into windres. The mingw toolchain requires 403 # Windows native paths while Cygwin should work 404 # with both. Avoid the bug by passing a POSIX 405 # path when using the Cygwin toolchain. 406 407 if test "$GCC" = "yes" && test "$CYGPATH" != "echo" ; then 408 conftest=/tmp/conftest.rc 409 echo "STRINGTABLE BEGIN" > $conftest 410 echo "101 \"name\"" >> $conftest 411 echo "END" >> $conftest 412 413 AC_MSG_CHECKING([for Windows native path bug in windres]) 414 cyg_conftest=`$CYGPATH $conftest` 415 if AC_TRY_COMMAND($RC -o conftest.res.o $cyg_conftest) ; then 416 AC_MSG_RESULT([no]) 417 else 418 AC_MSG_RESULT([yes]) 419 CYGPATH=echo 420 fi 421 conftest= 422 cyg_conftest= 423 fi 424 425 if test "$CYGPATH" = "echo" || test "$ac_cv_cygwin" = "yes"; then 426 DEPARG='"$<"' 427 else 428 DEPARG='"$(shell $(CYGPATH) $<)"' 429 fi 430 431 # set various compiler flags depending on whether we are using gcc or cl 432 433 AC_MSG_CHECKING([compiler flags]) 434 if test "${GCC}" = "yes" ; then 435 if test "$do64bit" != "no" ; then 436 AC_MSG_WARN("64bit mode not supported with GCC on Windows") 437 fi 438 SHLIB_LD="" 439 SHLIB_LD_LIBS="" 440 LIBS="" 441 LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32" 442 STLIB_LD='${AR} cr' 443 RC_OUT=-o 444 RC_TYPE= 445 RC_INCLUDE=--include 446 RC_DEFINE=--define 447 RES=res.o 448 MAKE_LIB="\${STLIB_LD} \[$]@" 449 POST_MAKE_LIB="\${RANLIB} \[$]@" 450 MAKE_EXE="\${CC} -o \[$]@" 451 LIBPREFIX="lib" 452 453 #if test "$ac_cv_cygwin" = "yes"; then 454 # extra_cflags="-mno-cygwin" 455 # extra_ldflags="-mno-cygwin" 456 #else 457 # extra_cflags="" 458 # extra_ldflags="" 459 #fi 460 461 if test "$ac_cv_cygwin" = "yes"; then 462 touch ac$$.c 463 if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then 464 case "$extra_cflags" in 465 *-mwin32*) ;; 466 *) extra_cflags="-mwin32 $extra_cflags" ;; 467 esac 468 case "$extra_ldflags" in 469 *-mwin32*) ;; 470 *) extra_ldflags="-mwin32 $extra_ldflags" ;; 471 esac 472 fi 473 rm -f ac$$.o ac$$.c 474 else 475 extra_cflags='' 476 extra_ldflags='' 477 fi 478 479 if test "${SHARED_BUILD}" = "0" ; then 480 # static 481 AC_MSG_RESULT([using static flags]) 482 runtime= 483 MAKE_DLL="echo " 484 LIBSUFFIX="s\${DBGX}.a" 485 LIBFLAGSUFFIX="s\${DBGX}" 486 LIBRARIES="\${STATIC_LIBRARIES}" 487 EXESUFFIX="s\${DBGX}.exe" 488 else 489 # dynamic 490 AC_MSG_RESULT([using shared flags]) 491 492 # ad-hoc check to see if CC supports -shared. 493 if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then 494 AC_MSG_ERROR([${CC} does not support the -shared option. 495 You will need to upgrade to a newer version of the toolchain.]) 496 fi 497 498 runtime= 499 # Link with gcc since ld does not link to default libs like 500 # -luser32 and -lmsvcrt by default. Make sure CFLAGS is 501 # included so -mno-cygwin passed the correct libs to the linker. 502 SHLIB_LD='${CC} -shared ${CFLAGS}' 503 SHLIB_LD_LIBS='${LIBS}' 504 # Add SHLIB_LD_LIBS to the Make rule, not here. 505 MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \ 506 -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\[$]@)" 507 508 LIBSUFFIX="\${DBGX}.a" 509 LIBFLAGSUFFIX="\${DBGX}" 510 EXESUFFIX="\${DBGX}.exe" 511 LIBRARIES="\${SHARED_LIBRARIES}" 512 fi 513 # DLLSUFFIX is separate because it is the building block for 514 # users of tclConfig.sh that may build shared or static. 515 DLLSUFFIX="\${DBGX}.dll" 516 SHLIB_SUFFIX=.dll 517 518 EXTRA_CFLAGS="${extra_cflags}" 519 520 CFLAGS_DEBUG=-g 521 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" 522 CFLAGS_WARNING="-Wall -Wconversion" 523 LDFLAGS_DEBUG= 524 LDFLAGS_OPTIMIZE= 525 526 # Specify the CC output file names based on the target name 527 CC_OBJNAME="-o \[$]@" 528 CC_EXENAME="-o \[$]@" 529 530 # Specify linker flags depending on the type of app being 531 # built -- Console vs. Window. 532 # 533 # ORIGINAL COMMENT: 534 # We need to pass -e _WinMain@16 so that ld will use 535 # WinMain() instead of main() as the entry point. We can't 536 # use autoconf to check for this case since it would need 537 # to run an executable and that does not work when 538 # cross compiling. Remove this -e workaround once we 539 # require a gcc that does not have this bug. 540 # 541 # MK NOTE: Tk should use a different mechanism. This causes 542 # interesting problems, such as wish dying at startup. 543 #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}" 544 LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" 545 LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" 546 else 547 if test "${SHARED_BUILD}" = "0" ; then 548 # static 549 AC_MSG_RESULT([using static flags]) 550 runtime=-MT 551 MAKE_DLL="echo " 552 LIBSUFFIX="s\${DBGX}.lib" 553 LIBFLAGSUFFIX="s\${DBGX}" 554 LIBRARIES="\${STATIC_LIBRARIES}" 555 EXESUFFIX="s\${DBGX}.exe" 556 SHLIB_LD_LIBS="" 557 else 558 # dynamic 559 AC_MSG_RESULT([using shared flags]) 560 runtime=-MD 561 # Add SHLIB_LD_LIBS to the Make rule, not here. 562 MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\[$]@" 563 LIBSUFFIX="\${DBGX}.lib" 564 LIBFLAGSUFFIX="\${DBGX}" 565 EXESUFFIX="\${DBGX}.exe" 566 LIBRARIES="\${SHARED_LIBRARIES}" 567 SHLIB_LD_LIBS='${LIBS}' 568 fi 569 # DLLSUFFIX is separate because it is the building block for 570 # users of tclConfig.sh that may build shared or static. 571 DLLSUFFIX="\${DBGX}.dll" 572 573 # This is a 2-stage check to make sure we have the 64-bit SDK 574 # We have to know where the SDK is installed. 575 # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs 576 if test "$do64bit" != "no" ; then 577 if test "x${MSSDK}x" = "xx" ; then 578 MSSDK="C:/Progra~1/Microsoft Platform SDK" 579 fi 580 MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` 581 PATH64="" 582 case "$do64bit" in 583 amd64|x64|yes) 584 MACHINE="AMD64" ; # default to AMD64 64-bit build 585 PATH64="${MSSDK}/Bin/Win64/x86/AMD64" 586 ;; 587 ia64) 588 MACHINE="IA64" 589 PATH64="${MSSDK}/Bin/Win64" 590 ;; 591 esac 592 if test ! -d "${PATH64}" ; then 593 AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode]) 594 AC_MSG_WARN([Ensure latest Platform SDK is installed]) 595 do64bit="no" 596 else 597 AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) 598 fi 599 fi 600 601 if test "$do64bit" != "no" ; then 602 # The space-based-path will work for the Makefile, but will 603 # not work if AC_TRY_COMPILE is called. 604 CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \ 605 -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\"" 606 RC="\"${MSSDK}/bin/rc.exe\"" 607 CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" 608 # Do not use -O2 for Win64 - this has proved buggy in code gen. 609 CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}" 610 lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" 611 LINKBIN="\"${PATH64}/link.exe\"" 612 # Avoid 'unresolved external symbol __security_cookie' errors. 613 # c.f. http://support.microsoft.com/?id=894573 614 LIBS="user32.lib advapi32.lib bufferoverflowU.lib" 615 else 616 RC="rc" 617 # -Od - no optimization 618 # -WX - warnings as errors 619 CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d" 620 # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) 621 CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" 622 lflags="-nologo" 623 LINKBIN="link" 624 LIBS="user32.lib advapi32.lib" 625 fi 626 627 LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib" 628 SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" 629 # link -lib only works when -lib is the first arg 630 STLIB_LD="${LINKBIN} -lib ${lflags}" 631 RC_OUT=-fo 632 RC_TYPE=-r 633 RC_INCLUDE=-i 634 RC_DEFINE=-d 635 RES=res 636 MAKE_LIB="\${STLIB_LD} -out:\[$]@" 637 POST_MAKE_LIB= 638 MAKE_EXE="\${CC} -Fe\[$]@" 639 LIBPREFIX="" 640 641 EXTRA_CFLAGS="" 642 CFLAGS_WARNING="-W3" 643 LDFLAGS_DEBUG="-debug:full" 644 LDFLAGS_OPTIMIZE="-release" 645 646 # Specify the CC output file names based on the target name 647 CC_OBJNAME="-Fo\[$]@" 648 CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\[$]@')\"" 649 650 # Specify linker flags depending on the type of app being 651 # built -- Console vs. Window. 652 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" 653 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" 654 fi 655 656 # DL_LIBS is empty, but then we match the Unix version 657 AC_SUBST(DL_LIBS) 658 AC_SUBST(CFLAGS_DEBUG) 659 AC_SUBST(CFLAGS_OPTIMIZE) 660 AC_SUBST(CFLAGS_WARNING) 661]) 662 663#------------------------------------------------------------------------ 664# SC_WITH_TCL -- 665# 666# Location of the Tcl build directory. 667# 668# Arguments: 669# none 670# 671# Results: 672# 673# Adds the following arguments to configure: 674# --with-tcl=... 675# 676# Defines the following vars: 677# TCL_BIN_DIR Full path to the tcl build dir. 678#------------------------------------------------------------------------ 679 680AC_DEFUN([SC_WITH_TCL], [ 681 if test -d ../../tcl8.4$1/win; then 682 TCL_BIN_DEFAULT=../../tcl8.4$1/win 683 else 684 TCL_BIN_DEFAULT=../../tcl8.4/win 685 fi 686 687 AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.4 binaries from DIR], 688 TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`) 689 if test ! -d $TCL_BIN_DIR; then 690 AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist) 691 fi 692 if test ! -f $TCL_BIN_DIR/Makefile; then 693 AC_MSG_ERROR(There is no Makefile in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) 694 else 695 echo "building against Tcl binaries in: $TCL_BIN_DIR" 696 fi 697 AC_SUBST(TCL_BIN_DIR) 698]) 699 700#------------------------------------------------------------------------ 701# SC_PROG_TCLSH 702# Locate a tclsh shell installed on the system path. This macro 703# will only find a Tcl shell that already exists on the system. 704# It will not find a Tcl shell in the Tcl build directory or 705# a Tcl shell that has been installed from the Tcl build directory. 706# If a Tcl shell can't be located on the PATH, then TCLSH_PROG will 707# be set to "". Extensions should take care not to create Makefile 708# rules that are run by default and depend on TCLSH_PROG. An 709# extension can't assume that an executable Tcl shell exists at 710# build time. 711# 712# Arguments 713# none 714# 715# Results 716# Subst's the following values: 717# TCLSH_PROG 718#------------------------------------------------------------------------ 719 720AC_DEFUN([SC_PROG_TCLSH], [ 721 AC_MSG_CHECKING([for tclsh]) 722 723 AC_CACHE_VAL(ac_cv_path_tclsh, [ 724 search_path=`echo ${PATH} | sed -e 's/:/ /g'` 725 for dir in $search_path ; do 726 for j in `ls -r $dir/tclsh[[8-9]]*.exe 2> /dev/null` \ 727 `ls -r $dir/tclsh* 2> /dev/null` ; do 728 if test x"$ac_cv_path_tclsh" = x ; then 729 if test -f "$j" ; then 730 ac_cv_path_tclsh=$j 731 break 732 fi 733 fi 734 done 735 done 736 ]) 737 738 if test -f "$ac_cv_path_tclsh" ; then 739 TCLSH_PROG="$ac_cv_path_tclsh" 740 AC_MSG_RESULT($TCLSH_PROG) 741 else 742 # It is not an error if an installed version of Tcl can't be located. 743 TCLSH_PROG="" 744 AC_MSG_RESULT([No tclsh found on PATH]) 745 fi 746 AC_SUBST(TCLSH_PROG) 747]) 748 749#------------------------------------------------------------------------ 750# SC_BUILD_TCLSH 751# Determine the fully qualified path name of the tclsh executable 752# in the Tcl build directory. This macro will correctly determine 753# the name of the tclsh executable even if tclsh has not yet 754# been built in the build directory. The build tclsh must be used 755# when running tests from an extension build directory. It is not 756# correct to use the TCLSH_PROG in cases like this. 757# 758# Arguments 759# none 760# 761# Results 762# Subst's the following values: 763# BUILD_TCLSH 764#------------------------------------------------------------------------ 765 766AC_DEFUN([SC_BUILD_TCLSH], [ 767 AC_MSG_CHECKING([for tclsh in Tcl build directory]) 768 BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT} 769 AC_MSG_RESULT($BUILD_TCLSH) 770 AC_SUBST(BUILD_TCLSH) 771]) 772 773