1#------------------------------------------------------------------------ 2# SC_PATH_TCLCONFIG -- 3# 4# Locate the tclConfig.sh file and perform a sanity check on 5# the Tcl compile flags 6# 7# Arguments: 8# none 9# 10# Results: 11# 12# Adds the following arguments to configure: 13# --with-tcl=... 14# 15# Defines the following vars: 16# TCL_BIN_DIR Full path to the directory containing 17# the tclConfig.sh file 18#------------------------------------------------------------------------ 19 20AC_DEFUN([SC_PATH_TCLCONFIG], [ 21 # 22 # Ok, lets find the tcl configuration 23 # First, look for one uninstalled. 24 # the alternative search directory is invoked by --with-tcl 25 # 26 27 if test x"${no_tcl}" = x ; then 28 # we reset no_tcl in case something fails here 29 no_tcl=true 30 AC_ARG_WITH(tcl, 31 AC_HELP_STRING([--with-tcl], 32 [directory containing tcl configuration (tclConfig.sh)]), 33 with_tclconfig="${withval}") 34 AC_MSG_CHECKING([for Tcl configuration]) 35 AC_CACHE_VAL(ac_cv_c_tclconfig,[ 36 37 # First check to see if --with-tcl was specified. 38 if test x"${with_tclconfig}" != x ; then 39 case "${with_tclconfig}" in 40 */tclConfig.sh ) 41 if test -f "${with_tclconfig}"; then 42 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself]) 43 with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`" 44 fi ;; 45 esac 46 if test -f "${with_tclconfig}/tclConfig.sh" ; then 47 ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`" 48 else 49 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) 50 fi 51 fi 52 53 # then check for a private Tcl installation 54 if test x"${ac_cv_c_tclconfig}" = x ; then 55 for i in \ 56 ../tcl \ 57 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 58 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ 59 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ 60 ../../tcl \ 61 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 62 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ 63 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ 64 ../../../tcl \ 65 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 66 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ 67 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do 68 if test -f "$i/win/tclConfig.sh" ; then 69 ac_cv_c_tclconfig="`(cd $i/win; pwd)`" 70 break 71 fi 72 done 73 fi 74 75 # check in a few common install locations 76 if test x"${ac_cv_c_tclconfig}" = x ; then 77 for i in `ls -d ${libdir} 2>/dev/null` \ 78 `ls -d ${exec_prefix}/lib 2>/dev/null` \ 79 `ls -d ${prefix}/lib 2>/dev/null` \ 80 `ls -d /cygdrive/c/Tcl/lib 2>/dev/null` \ 81 `ls -d /cygdrive/c/Progra~1/Tcl/lib 2>/dev/null` \ 82 `ls -d /c/Tcl/lib 2>/dev/null` \ 83 `ls -d /c/Progra~1/Tcl/lib 2>/dev/null` \ 84 `ls -d C:/Tcl/lib 2>/dev/null` \ 85 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ 86 ; do 87 if test -f "$i/tclConfig.sh" ; then 88 ac_cv_c_tclconfig="`(cd $i; pwd)`" 89 break 90 fi 91 done 92 fi 93 94 # check in a few other private locations 95 if test x"${ac_cv_c_tclconfig}" = x ; then 96 for i in \ 97 ${srcdir}/../tcl \ 98 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 99 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ 100 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do 101 if test -f "$i/win/tclConfig.sh" ; then 102 ac_cv_c_tclconfig="`(cd $i/win; pwd)`" 103 break 104 fi 105 done 106 fi 107 ]) 108 109 if test x"${ac_cv_c_tclconfig}" = x ; then 110 TCL_BIN_DIR="# no Tcl configs found" 111 AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh]) 112 else 113 no_tcl= 114 TCL_BIN_DIR="${ac_cv_c_tclconfig}" 115 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh]) 116 fi 117 fi 118]) 119 120#------------------------------------------------------------------------ 121# SC_PATH_TKCONFIG -- 122# 123# Locate the tkConfig.sh file 124# 125# Arguments: 126# none 127# 128# Results: 129# 130# Adds the following arguments to configure: 131# --with-tk=... 132# 133# Defines the following vars: 134# TK_BIN_DIR Full path to the directory containing 135# the tkConfig.sh file 136#------------------------------------------------------------------------ 137 138AC_DEFUN([SC_PATH_TKCONFIG], [ 139 # 140 # Ok, lets find the tk configuration 141 # First, look for one uninstalled. 142 # the alternative search directory is invoked by --with-tk 143 # 144 145 if test x"${no_tk}" = x ; then 146 # we reset no_tk in case something fails here 147 no_tk=true 148 AC_ARG_WITH(tk, 149 AC_HELP_STRING([--with-tk], 150 [directory containing tk configuration (tkConfig.sh)]), 151 with_tkconfig="${withval}") 152 AC_MSG_CHECKING([for Tk configuration]) 153 AC_CACHE_VAL(ac_cv_c_tkconfig,[ 154 155 # First check to see if --with-tkconfig was specified. 156 if test x"${with_tkconfig}" != x ; then 157 case "${with_tkconfig}" in 158 */tkConfig.sh ) 159 if test -f "${with_tkconfig}"; then 160 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself]) 161 with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`" 162 fi ;; 163 esac 164 if test -f "${with_tkconfig}/tkConfig.sh" ; then 165 ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`" 166 else 167 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh]) 168 fi 169 fi 170 171 # then check for a private Tk library 172 if test x"${ac_cv_c_tkconfig}" = x ; then 173 for i in \ 174 ../tk \ 175 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 176 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \ 177 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \ 178 ../../tk \ 179 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 180 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \ 181 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ 182 ../../../tk \ 183 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 184 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \ 185 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do 186 if test -f "$i/win/tkConfig.sh" ; then 187 ac_cv_c_tkconfig="`(cd $i/win; pwd)`" 188 break 189 fi 190 done 191 fi 192 193 # check in a few common install locations 194 if test x"${ac_cv_c_tkconfig}" = x ; then 195 for i in `ls -d ${libdir} 2>/dev/null` \ 196 `ls -d ${exec_prefix}/lib 2>/dev/null` \ 197 `ls -d ${prefix}/lib 2>/dev/null` \ 198 `ls -d /cygdrive/c/Tcl/lib 2>/dev/null` \ 199 `ls -d /cygdrive/c/Progra~1/Tcl/lib 2>/dev/null` \ 200 `ls -d /c/Tcl/lib 2>/dev/null` \ 201 `ls -d /c/Progra~1/Tcl/lib 2>/dev/null` \ 202 `ls -d C:/Tcl/lib 2>/dev/null` \ 203 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ 204 ; do 205 if test -f "$i/tkConfig.sh" ; then 206 ac_cv_c_tkconfig="`(cd $i; pwd)`" 207 break 208 fi 209 done 210 fi 211 212 # check in a few other private locations 213 if test x"${ac_cv_c_tkconfig}" = x ; then 214 for i in \ 215 ${srcdir}/../tk \ 216 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ 217 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \ 218 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do 219 if test -f "$i/win/tkConfig.sh" ; then 220 ac_cv_c_tkconfig="`(cd $i/win; pwd)`" 221 break 222 fi 223 done 224 fi 225 ]) 226 227 if test x"${ac_cv_c_tkconfig}" = x ; then 228 TK_BIN_DIR="# no Tk configs found" 229 AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh]) 230 else 231 no_tk= 232 TK_BIN_DIR="${ac_cv_c_tkconfig}" 233 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh]) 234 fi 235 fi 236]) 237 238#------------------------------------------------------------------------ 239# SC_LOAD_TCLCONFIG -- 240# 241# Load the tclConfig.sh file. 242# 243# Arguments: 244# 245# Requires the following vars to be set: 246# TCL_BIN_DIR 247# 248# Results: 249# 250# Subst the following vars: 251# TCL_BIN_DIR 252# TCL_SRC_DIR 253# TCL_LIB_FILE 254# 255#------------------------------------------------------------------------ 256 257AC_DEFUN([SC_LOAD_TCLCONFIG], [ 258 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) 259 260 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then 261 AC_MSG_RESULT([loading]) 262 . "${TCL_BIN_DIR}/tclConfig.sh" 263 else 264 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh]) 265 fi 266 267 # 268 # If the TCL_BIN_DIR is the build directory (not the install directory), 269 # then set the common variable name to the value of the build variables. 270 # For example, the variable TCL_LIB_SPEC will be set to the value 271 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC 272 # instead of TCL_BUILD_LIB_SPEC since it will work with both an 273 # installed and uninstalled version of Tcl. 274 # 275 276 if test -f $TCL_BIN_DIR/Makefile ; then 277 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} 278 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} 279 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} 280 fi 281 282 # 283 # eval is required to do the TCL_DBGX substitution 284 # 285 286 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" 287 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" 288 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" 289 290 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" 291 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" 292 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" 293 294 AC_SUBST(TCL_VERSION) 295 AC_SUBST(TCL_BIN_DIR) 296 AC_SUBST(TCL_SRC_DIR) 297 298 AC_SUBST(TCL_LIB_FILE) 299 AC_SUBST(TCL_LIB_FLAG) 300 AC_SUBST(TCL_LIB_SPEC) 301 302 AC_SUBST(TCL_STUB_LIB_FILE) 303 AC_SUBST(TCL_STUB_LIB_FLAG) 304 AC_SUBST(TCL_STUB_LIB_SPEC) 305 306 AC_SUBST(TCL_DEFS) 307]) 308 309#------------------------------------------------------------------------ 310# SC_LOAD_TKCONFIG -- 311# 312# Load the tkConfig.sh file 313# 314# Arguments: 315# 316# Requires the following vars to be set: 317# TK_BIN_DIR 318# 319# Results: 320# 321# Sets the following vars that should be in tkConfig.sh: 322# TK_BIN_DIR 323#------------------------------------------------------------------------ 324 325AC_DEFUN([SC_LOAD_TKCONFIG], [ 326 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh]) 327 328 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then 329 AC_MSG_RESULT([loading]) 330 . "${TK_BIN_DIR}/tkConfig.sh" 331 else 332 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh]) 333 fi 334 335 336 AC_SUBST(TK_BIN_DIR) 337 AC_SUBST(TK_SRC_DIR) 338 AC_SUBST(TK_LIB_FILE) 339]) 340 341#------------------------------------------------------------------------ 342# SC_ENABLE_SHARED -- 343# 344# Allows the building of shared libraries 345# 346# Arguments: 347# none 348# 349# Results: 350# 351# Adds the following arguments to configure: 352# --enable-shared=yes|no 353# 354# Defines the following vars: 355# STATIC_BUILD Used for building import/export libraries 356# on Windows. 357# 358# Sets the following vars: 359# SHARED_BUILD Value of 1 or 0 360#------------------------------------------------------------------------ 361 362AC_DEFUN([SC_ENABLE_SHARED], [ 363 AC_MSG_CHECKING([how to build libraries]) 364 AC_ARG_ENABLE(shared, 365 [ --enable-shared build and link with shared libraries (default: on)], 366 [tcl_ok=$enableval], [tcl_ok=yes]) 367 368 if test "${enable_shared+set}" = set; then 369 enableval="$enable_shared" 370 tcl_ok=$enableval 371 else 372 tcl_ok=yes 373 fi 374 375 if test "$tcl_ok" = "yes" ; then 376 AC_MSG_RESULT([shared]) 377 SHARED_BUILD=1 378 else 379 AC_MSG_RESULT([static]) 380 SHARED_BUILD=0 381 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) 382 fi 383]) 384 385#------------------------------------------------------------------------ 386# SC_ENABLE_THREADS -- 387# 388# Specify if thread support should be enabled 389# 390# Arguments: 391# none 392# 393# Results: 394# 395# Adds the following arguments to configure: 396# --enable-threads=yes|no 397# 398# Defines the following vars: 399# TCL_THREADS 400#------------------------------------------------------------------------ 401 402AC_DEFUN([SC_ENABLE_THREADS], [ 403 AC_MSG_CHECKING(for building with threads) 404 AC_ARG_ENABLE(threads, [ --enable-threads build with threads (default: off)], 405 [tcl_ok=$enableval], [tcl_ok=no]) 406 407 if test "$tcl_ok" = "yes"; then 408 AC_MSG_RESULT(yes) 409 TCL_THREADS=1 410 AC_DEFINE(TCL_THREADS) 411 # USE_THREAD_ALLOC tells us to try the special thread-based 412 # allocator that significantly reduces lock contention 413 AC_DEFINE(USE_THREAD_ALLOC) 414 else 415 TCL_THREADS=0 416 AC_MSG_RESULT([no (default)]) 417 fi 418 AC_SUBST(TCL_THREADS) 419]) 420 421#------------------------------------------------------------------------ 422# SC_ENABLE_SYMBOLS -- 423# 424# Specify if debugging symbols should be used. 425# Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging 426# can also be enabled. 427# 428# Arguments: 429# none 430# 431# Requires the following vars to be set in the Makefile: 432# CFLAGS_DEBUG 433# CFLAGS_OPTIMIZE 434# 435# Results: 436# 437# Adds the following arguments to configure: 438# --enable-symbols 439# 440# Defines the following vars: 441# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true 442# Sets to $(CFLAGS_OPTIMIZE) if false 443# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true 444# Sets to $(LDFLAGS_OPTIMIZE) if false 445# DBGX Debug library extension 446# 447#------------------------------------------------------------------------ 448 449AC_DEFUN([SC_ENABLE_SYMBOLS], [ 450 AC_MSG_CHECKING([for build with symbols]) 451 AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols (default: off)], [tcl_ok=$enableval], [tcl_ok=no]) 452# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. 453 if test "$tcl_ok" = "no"; then 454 CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' 455 LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' 456 DBGX="" 457 AC_DEFINE(NDEBUG, 1, [Is no debugging enabled?]) 458 AC_MSG_RESULT([no]) 459 460 AC_DEFINE(TCL_CFG_OPTIMIZED) 461 else 462 CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' 463 LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' 464 DBGX=g 465 if test "$tcl_ok" = "yes"; then 466 AC_MSG_RESULT([yes (standard debugging)]) 467 fi 468 fi 469 AC_SUBST(CFLAGS_DEFAULT) 470 AC_SUBST(LDFLAGS_DEFAULT) 471 472 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then 473 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?]) 474 fi 475 476 if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then 477 AC_DEFINE(TCL_COMPILE_DEBUG, 1, [Is bytecode debugging enabled?]) 478 AC_DEFINE(TCL_COMPILE_STATS, 1, [Are bytecode statistics enabled?]) 479 fi 480 481 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then 482 if test "$tcl_ok" = "all"; then 483 AC_MSG_RESULT([enabled symbols mem compile debugging]) 484 else 485 AC_MSG_RESULT([enabled $tcl_ok debugging]) 486 fi 487 fi 488]) 489 490#-------------------------------------------------------------------- 491# SC_CONFIG_CFLAGS 492# 493# Try to determine the proper flags to pass to the compiler 494# for building shared libraries and other such nonsense. 495# 496# NOTE: The backslashes in quotes below are substituted twice 497# due to the fact that they are in a macro and then inlined 498# in the final configure script. 499# 500# Arguments: 501# none 502# 503# Results: 504# 505# Can the following vars: 506# EXTRA_CFLAGS 507# CFLAGS_DEBUG 508# CFLAGS_OPTIMIZE 509# CFLAGS_WARNING 510# LDFLAGS_DEBUG 511# LDFLAGS_OPTIMIZE 512# LDFLAGS_CONSOLE 513# LDFLAGS_WINDOW 514# CC_OBJNAME 515# CC_EXENAME 516# CYGPATH 517# STLIB_LD 518# SHLIB_LD 519# SHLIB_LD_LIBS 520# LIBS 521# AR 522# RC 523# RES 524# 525# MAKE_LIB 526# MAKE_STUB_LIB 527# MAKE_EXE 528# MAKE_DLL 529# 530# LIBSUFFIX 531# LIBFLAGSUFFIX 532# LIBPREFIX 533# LIBRARIES 534# EXESUFFIX 535# DLLSUFFIX 536# 537#-------------------------------------------------------------------- 538 539AC_DEFUN([SC_CONFIG_CFLAGS], [ 540 541 # Step 0: Enable 64 bit support? 542 543 AC_MSG_CHECKING([if 64bit support is requested]) 544 AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no]) 545 AC_MSG_RESULT($do64bit) 546 547 # Cross-compiling options for Windows/CE builds 548 549 AC_MSG_CHECKING([if Windows/CE build is requested]) 550 AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no]) 551 AC_MSG_RESULT($doWince) 552 553 AC_MSG_CHECKING([for Windows/CE celib directory]) 554 AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], 555 CELIB_DIR=$withval, CELIB_DIR=NO_CELIB) 556 AC_MSG_RESULT([$CELIB_DIR]) 557 558 # Set some defaults (may get changed below) 559 EXTRA_CFLAGS="" 560 561 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo) 562 563 SHLIB_SUFFIX=".dll" 564 565 # MACHINE is IX86 for LINK, but this is used by the manifest, 566 # which requires x86|amd64|ia64. 567 MACHINE="X86" 568 569 if test "$GCC" = "yes"; then 570 571 AC_CACHE_CHECK(for cross-compile version of gcc, 572 ac_cv_cross, 573 AC_TRY_COMPILE([ 574 #ifndef __WIN32__ 575 #error cross-compiler 576 #endif 577 ], [], 578 ac_cv_cross=no, 579 ac_cv_cross=yes) 580 ) 581 582 if test "$ac_cv_cross" = "yes"; then 583 case "$do64bit" in 584 amd64|x64|yes) 585 CC="x86_64-w64-mingw32-gcc" 586 LD="x86_64-w64-mingw32-ld" 587 AR="x86_64-w64-mingw32-ar" 588 RANLIB="x86_64-w64-mingw32-ranlib" 589 RC="x86_64-w64-mingw32-windres" 590 ;; 591 *) 592 CC="i686-w64-mingw32-gcc" 593 LD="i686-w64-mingw32-ld" 594 AR="i686-w64-mingw32-ar" 595 RANLIB="i686-w64-mingw32-ranlib" 596 RC="i686-w64-mingw32-windres" 597 ;; 598 esac 599 fi 600 fi 601 602 # Check for a bug in gcc's windres that causes the 603 # compile to fail when a Windows native path is 604 # passed into windres. The mingw toolchain requires 605 # Windows native paths while Cygwin should work 606 # with both. Avoid the bug by passing a POSIX 607 # path when using the Cygwin toolchain. 608 609 if test "$GCC" = "yes" && test "$CYGPATH" != "echo" ; then 610 conftest=/tmp/conftest.rc 611 echo "STRINGTABLE BEGIN" > $conftest 612 echo "101 \"name\"" >> $conftest 613 echo "END" >> $conftest 614 615 AC_MSG_CHECKING([for Windows native path bug in windres]) 616 cyg_conftest=`$CYGPATH $conftest` 617 if AC_TRY_COMMAND($RC -o conftest.res.o $cyg_conftest) ; then 618 AC_MSG_RESULT([no]) 619 else 620 AC_MSG_RESULT([yes]) 621 CYGPATH=echo 622 fi 623 conftest= 624 cyg_conftest= 625 fi 626 627 if test "$CYGPATH" = "echo"; then 628 DEPARG='"$<"' 629 else 630 DEPARG='"$(shell $(CYGPATH) $<)"' 631 fi 632 633 # set various compiler flags depending on whether we are using gcc or cl 634 635 if test "${GCC}" = "yes" ; then 636 extra_cflags="-pipe" 637 extra_ldflags="-pipe -static-libgcc" 638 AC_CACHE_CHECK(for mingw32 version of gcc, 639 ac_cv_win32, 640 AC_TRY_COMPILE([ 641 #ifdef __WIN32__ 642 #error win32 643 #endif 644 ], [], 645 ac_cv_win32=no, 646 ac_cv_win32=yes) 647 ) 648 if test "$ac_cv_win32" != "yes"; then 649 AC_MSG_ERROR([${CC} cannot produce win32 executables.]) 650 fi 651 fi 652 653 AC_MSG_CHECKING([compiler flags]) 654 if test "${GCC}" = "yes" ; then 655 SHLIB_LD="" 656 SHLIB_LD_LIBS="" 657 LIBS="-lws2_32" 658 # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't 659 LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" 660 STLIB_LD='${AR} cr' 661 RC_OUT=-o 662 RC_TYPE= 663 RC_INCLUDE=--include 664 RC_DEFINE=--define 665 RES=res.o 666 MAKE_LIB="\${STLIB_LD} \[$]@" 667 MAKE_STUB_LIB="\${STLIB_LD} \[$]@" 668 POST_MAKE_LIB="\${RANLIB} \[$]@" 669 MAKE_EXE="\${CC} -o \[$]@" 670 LIBPREFIX="lib" 671 672 if test "${SHARED_BUILD}" = "0" ; then 673 # static 674 AC_MSG_RESULT([using static flags]) 675 runtime= 676 MAKE_DLL="echo " 677 LIBSUFFIX="s\${DBGX}.a" 678 LIBFLAGSUFFIX="s\${DBGX}" 679 LIBRARIES="\${STATIC_LIBRARIES}" 680 EXESUFFIX="s\${DBGX}.exe" 681 else 682 # dynamic 683 AC_MSG_RESULT([using shared flags]) 684 685 # ad-hoc check to see if CC supports -shared. 686 if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then 687 AC_MSG_ERROR([${CC} does not support the -shared option. 688 You will need to upgrade to a newer version of the toolchain.]) 689 fi 690 691 runtime= 692 # Link with gcc since ld does not link to default libs like 693 # -luser32 and -lmsvcrt by default. 694 SHLIB_LD='${CC} -shared' 695 SHLIB_LD_LIBS='${LIBS}' 696 # Add SHLIB_LD_LIBS to the Make rule, not here. 697 MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \ 698 -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\[$]@)" 699 700 LIBSUFFIX="\${DBGX}.a" 701 LIBFLAGSUFFIX="\${DBGX}" 702 EXESUFFIX="\${DBGX}.exe" 703 LIBRARIES="\${SHARED_LIBRARIES}" 704 fi 705 # DLLSUFFIX is separate because it is the building block for 706 # users of tclConfig.sh that may build shared or static. 707 DLLSUFFIX="\${DBGX}.dll" 708 SHLIB_SUFFIX=.dll 709 710 EXTRA_CFLAGS="${extra_cflags}" 711 712 CFLAGS_DEBUG=-g 713 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" 714 CFLAGS_WARNING="-Wall" 715 LDFLAGS_DEBUG= 716 LDFLAGS_OPTIMIZE= 717 718 # Specify the CC output file names based on the target name 719 CC_OBJNAME="-o \[$]@" 720 CC_EXENAME="-o \[$]@" 721 722 # Specify linker flags depending on the type of app being 723 # built -- Console vs. Window. 724 # 725 # ORIGINAL COMMENT: 726 # We need to pass -e _WinMain@16 so that ld will use 727 # WinMain() instead of main() as the entry point. We can't 728 # use autoconf to check for this case since it would need 729 # to run an executable and that does not work when 730 # cross compiling. Remove this -e workaround once we 731 # require a gcc that does not have this bug. 732 # 733 # MK NOTE: Tk should use a different mechanism. This causes 734 # interesting problems, such as wish dying at startup. 735 #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}" 736 LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" 737 LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" 738 739 case "$do64bit" in 740 amd64|x64|yes) 741 MACHINE="AMD64" ; # assume AMD64 as default 64-bit build 742 AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) 743 ;; 744 ia64) 745 MACHINE="IA64" 746 AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) 747 ;; 748 *) 749 AC_TRY_COMPILE([ 750 #ifndef _WIN64 751 #error 32-bit 752 #endif 753 ], [], 754 tcl_win_64bit=yes, 755 tcl_win_64bit=no 756 ) 757 if test "$tcl_win_64bit" = "yes" ; then 758 do64bit=amd64 759 MACHINE="AMD64" 760 AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) 761 fi 762 ;; 763 esac 764 else 765 if test "${SHARED_BUILD}" = "0" ; then 766 # static 767 AC_MSG_RESULT([using static flags]) 768 runtime=-MT 769 MAKE_DLL="echo " 770 LIBSUFFIX="s\${DBGX}.lib" 771 LIBFLAGSUFFIX="s\${DBGX}" 772 LIBRARIES="\${STATIC_LIBRARIES}" 773 EXESUFFIX="s\${DBGX}.exe" 774 SHLIB_LD_LIBS="" 775 else 776 # dynamic 777 AC_MSG_RESULT([using shared flags]) 778 runtime=-MD 779 # Add SHLIB_LD_LIBS to the Make rule, not here. 780 MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\[$]@" 781 LIBSUFFIX="\${DBGX}.lib" 782 LIBFLAGSUFFIX="\${DBGX}" 783 EXESUFFIX="\${DBGX}.exe" 784 LIBRARIES="\${SHARED_LIBRARIES}" 785 SHLIB_LD_LIBS='${LIBS}' 786 case "x`echo \${VisualStudioVersion}`" in 787 x1[[4-9]]*) 788 lflags="${lflags} -nodefaultlib:libucrt.lib" 789 ;; 790 *) 791 ;; 792 esac 793 fi 794 # DLLSUFFIX is separate because it is the building block for 795 # users of tclConfig.sh that may build shared or static. 796 DLLSUFFIX="\${DBGX}.dll" 797 798 # This is a 2-stage check to make sure we have the 64-bit SDK 799 # We have to know where the SDK is installed. 800 # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs 801 if test "$do64bit" != "no" ; then 802 if test "x${MSSDK}x" = "xx" ; then 803 MSSDK="C:/Progra~1/Microsoft Platform SDK" 804 fi 805 MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` 806 PATH64="" 807 case "$do64bit" in 808 amd64|x64|yes) 809 MACHINE="AMD64" ; # assume AMD64 as default 64-bit build 810 PATH64="${MSSDK}/Bin/Win64/x86/AMD64" 811 ;; 812 ia64) 813 MACHINE="IA64" 814 PATH64="${MSSDK}/Bin/Win64" 815 ;; 816 esac 817 if test ! -d "${PATH64}" ; then 818 AC_MSG_WARN([Could not find 64-bit $MACHINE SDK]) 819 fi 820 AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) 821 fi 822 823 LIBS="user32.lib advapi32.lib ws2_32.lib" 824 825 case "x`echo \${VisualStudioVersion}`" in 826 x1[[4-9]]*) 827 LIBS="$LIBS ucrt.lib" 828 ;; 829 *) 830 ;; 831 esac 832 833 if test "$do64bit" != "no" ; then 834 # The space-based-path will work for the Makefile, but will 835 # not work if AC_TRY_COMPILE is called. TEA has the 836 # TEA_PATH_NOSPACE to avoid this issue. 837 # Check if _WIN64 is already recognized, and if so we don't 838 # need to modify CC. 839 AC_CHECK_DECL([_WIN64], [], 840 [CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \ 841 -I\"${MSSDK}/Include/crt\" \ 842 -I\"${MSSDK}/Include/crt/sys\""]) 843 RC="\"${MSSDK}/bin/rc.exe\"" 844 CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" 845 # Do not use -O2 for Win64 - this has proved buggy in code gen. 846 CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}" 847 lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" 848 LINKBIN="\"${PATH64}/link.exe\"" 849 # Avoid 'unresolved external symbol __security_cookie' errors. 850 # c.f. http://support.microsoft.com/?id=894573 851 LIBS="$LIBS bufferoverflowU.lib" 852 else 853 RC="rc" 854 # -Od - no optimization 855 # -WX - warnings as errors 856 CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d" 857 # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) 858 CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" 859 lflags="${lflags} -nologo" 860 LINKBIN="link" 861 fi 862 863 if test "$doWince" != "no" ; then 864 # Set defaults for common evc4/PPC2003 setup 865 # Currently Tcl requires 300+, possibly 420+ for sockets 866 CEVERSION=420; # could be 211 300 301 400 420 ... 867 TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... 868 ARCH=ARM; # could be ARM MIPS X86EM ... 869 PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" 870 if test "$doWince" != "yes"; then 871 # If !yes then the user specified something 872 # Reset ARCH to allow user to skip specifying it 873 ARCH= 874 eval `echo $doWince | awk -F "," '{ \ 875 if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \ 876 if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ 877 if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \ 878 if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \ 879 if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \ 880 }'` 881 if test "x${ARCH}" = "x" ; then 882 ARCH=$TARGETCPU; 883 fi 884 fi 885 OSVERSION=WCE$CEVERSION; 886 if test "x${WCEROOT}" = "x" ; then 887 WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" 888 if test ! -d "${WCEROOT}" ; then 889 WCEROOT="C:/Program Files/Microsoft eMbedded Tools" 890 fi 891 fi 892 if test "x${SDKROOT}" = "x" ; then 893 SDKROOT="C:/Program Files/Windows CE Tools" 894 if test ! -d "${SDKROOT}" ; then 895 SDKROOT="C:/Windows CE Tools" 896 fi 897 fi 898 # The space-based-path will work for the Makefile, but will 899 # not work if AC_TRY_COMPILE is called. 900 WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'` 901 SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'` 902 CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'` 903 if test ! -d "${CELIB_DIR}/inc"; then 904 AC_MSG_ERROR([Invalid celib directory "${CELIB_DIR}"]) 905 fi 906 if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\ 907 -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then 908 AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]]) 909 else 910 CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" 911 if test -d "${CEINCLUDE}/${TARGETCPU}" ; then 912 CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" 913 fi 914 CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" 915 fi 916 fi 917 918 if test "$doWince" != "no" ; then 919 CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" 920 if test "${TARGETCPU}" = "X86"; then 921 CC="${CEBINROOT}/cl.exe" 922 else 923 CC="${CEBINROOT}/cl${ARCH}.exe" 924 fi 925 CC="\"${CC}\" -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" 926 RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\"" 927 arch=`echo ${ARCH} | awk '{print tolower([$]0)}'` 928 defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS" 929 for i in $defs ; do 930 AC_DEFINE_UNQUOTED($i) 931 done 932# if test "${ARCH}" = "X86EM"; then 933# AC_DEFINE_UNQUOTED(_WIN32_WCE_EMULATION) 934# fi 935 AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION) 936 AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION) 937 CFLAGS_DEBUG="-nologo -Zi -Od" 938 CFLAGS_OPTIMIZE="-nologo -O2" 939 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` 940 lflags="-nodefaultlib -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" 941 LINKBIN="\"${CEBINROOT}/link.exe\"" 942 AC_SUBST(CELIB_DIR) 943 if test "${CEVERSION}" -lt 400 ; then 944 LIBS="coredll.lib corelibc.lib winsock.lib" 945 else 946 LIBS="coredll.lib corelibc.lib ws2.lib" 947 fi 948 # celib currently stuck at wce300 status 949 #LIBS="$LIBS \${CELIB_DIR}/wince-${ARCH}-pocket-${OSVERSION}-release/celib.lib" 950 LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\"" 951 LIBS_GUI="commctrl.lib commdlg.lib" 952 else 953 LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib" 954 fi 955 956 SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" 957 # link -lib only works when -lib is the first arg 958 STLIB_LD="${LINKBIN} -lib ${lflags}" 959 RC_OUT=-fo 960 RC_TYPE=-r 961 RC_INCLUDE=-i 962 RC_DEFINE=-d 963 RES=res 964 MAKE_LIB="\${STLIB_LD} -out:\[$]@" 965 MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[$]@" 966 POST_MAKE_LIB= 967 MAKE_EXE="\${CC} -Fe\[$]@" 968 LIBPREFIX="" 969 970 CFLAGS_DEBUG="${CFLAGS_DEBUG} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE" 971 CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE" 972 973 EXTRA_CFLAGS="" 974 CFLAGS_WARNING="-W3" 975 LDFLAGS_DEBUG="-debug" 976 LDFLAGS_OPTIMIZE="-release" 977 978 # Specify the CC output file names based on the target name 979 CC_OBJNAME="-Fo\[$]@" 980 CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\[$]@')\"" 981 982 # Specify linker flags depending on the type of app being 983 # built -- Console vs. Window. 984 if test "$doWince" != "no" -a "${TARGETCPU}" != "X86"; then 985 LDFLAGS_CONSOLE="-link ${lflags}" 986 LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} 987 else 988 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" 989 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" 990 fi 991 fi 992 993 if test "$do64bit" != "no" ; then 994 AC_DEFINE(TCL_CFG_DO64BIT) 995 fi 996 997 if test "${GCC}" = "yes" ; then 998 AC_CACHE_CHECK(for SEH support in compiler, 999 tcl_cv_seh, 1000 AC_TRY_RUN([ 1001 #define WIN32_LEAN_AND_MEAN 1002 #include <windows.h> 1003 #undef WIN32_LEAN_AND_MEAN 1004 1005 int main(int argc, char** argv) { 1006 int a, b = 0; 1007 __try { 1008 a = 666 / b; 1009 } 1010 __except (EXCEPTION_EXECUTE_HANDLER) { 1011 return 0; 1012 } 1013 return 1; 1014 } 1015 ], 1016 tcl_cv_seh=yes, 1017 tcl_cv_seh=no, 1018 tcl_cv_seh=no) 1019 ) 1020 if test "$tcl_cv_seh" = "no" ; then 1021 AC_DEFINE(HAVE_NO_SEH, 1, 1022 [Defined when mingw does not support SEH]) 1023 fi 1024 1025 # 1026 # Check to see if the excpt.h include file provided contains the 1027 # definition for EXCEPTION_DISPOSITION; if not, which is the case 1028 # with Cygwin's version as of 2002-04-10, define it to be int, 1029 # sufficient for getting the current code to work. 1030 # 1031 AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files, 1032 tcl_cv_eh_disposition, 1033 AC_TRY_COMPILE([ 1034# define WIN32_LEAN_AND_MEAN 1035# include <windows.h> 1036# undef WIN32_LEAN_AND_MEAN 1037 ],[ 1038 EXCEPTION_DISPOSITION x; 1039 ], 1040 tcl_cv_eh_disposition=yes, 1041 tcl_cv_eh_disposition=no) 1042 ) 1043 if test "$tcl_cv_eh_disposition" = "no" ; then 1044 AC_DEFINE(EXCEPTION_DISPOSITION, int, 1045 [Defined when cygwin/mingw does not support EXCEPTION DISPOSITION]) 1046 fi 1047 1048 # Check to see if winnt.h defines CHAR, SHORT, and LONG 1049 # even if VOID has already been #defined. The win32api 1050 # used by mingw and cygwin is known to do this. 1051 1052 AC_CACHE_CHECK(for winnt.h that ignores VOID define, 1053 tcl_cv_winnt_ignore_void, 1054 AC_TRY_COMPILE([ 1055 #define VOID void 1056 #define WIN32_LEAN_AND_MEAN 1057 #include <windows.h> 1058 #undef WIN32_LEAN_AND_MEAN 1059 ], [ 1060 CHAR c; 1061 SHORT s; 1062 LONG l; 1063 ], 1064 tcl_cv_winnt_ignore_void=yes, 1065 tcl_cv_winnt_ignore_void=no) 1066 ) 1067 if test "$tcl_cv_winnt_ignore_void" = "yes" ; then 1068 AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1, 1069 [Defined when cygwin/mingw ignores VOID define in winnt.h]) 1070 fi 1071 1072 # See if the compiler supports casting to a union type. 1073 # This is used to stop gcc from printing a compiler 1074 # warning when initializing a union member. 1075 1076 AC_CACHE_CHECK(for cast to union support, 1077 tcl_cv_cast_to_union, 1078 AC_TRY_COMPILE([], 1079 [ 1080 union foo { int i; double d; }; 1081 union foo f = (union foo) (int) 0; 1082 ], 1083 tcl_cv_cast_to_union=yes, 1084 tcl_cv_cast_to_union=no) 1085 ) 1086 if test "$tcl_cv_cast_to_union" = "yes"; then 1087 AC_DEFINE(HAVE_CAST_TO_UNION, 1, 1088 [Defined when compiler supports casting to union type.]) 1089 fi 1090 fi 1091 1092 # DL_LIBS is empty, but then we match the Unix version 1093 AC_SUBST(DL_LIBS) 1094 AC_SUBST(CFLAGS_DEBUG) 1095 AC_SUBST(CFLAGS_OPTIMIZE) 1096 AC_SUBST(CFLAGS_WARNING) 1097]) 1098 1099#------------------------------------------------------------------------ 1100# SC_WITH_TCL -- 1101# 1102# Location of the Tcl build directory. 1103# 1104# Arguments: 1105# none 1106# 1107# Results: 1108# 1109# Adds the following arguments to configure: 1110# --with-tcl=... 1111# 1112# Defines the following vars: 1113# TCL_BIN_DIR Full path to the tcl build dir. 1114#------------------------------------------------------------------------ 1115 1116AC_DEFUN([SC_WITH_TCL], [ 1117 if test -d ../../tcl8.5$1/win; then 1118 TCL_BIN_DEFAULT=../../tcl8.5$1/win 1119 else 1120 TCL_BIN_DEFAULT=../../tcl8.5/win 1121 fi 1122 1123 AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.5 binaries from DIR], 1124 TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`) 1125 if test ! -d $TCL_BIN_DIR; then 1126 AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist) 1127 fi 1128 if test ! -f $TCL_BIN_DIR/Makefile; then 1129 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?) 1130 else 1131 echo "building against Tcl binaries in: $TCL_BIN_DIR" 1132 fi 1133 AC_SUBST(TCL_BIN_DIR) 1134]) 1135 1136#------------------------------------------------------------------------ 1137# SC_PROG_TCLSH 1138# Locate a tclsh shell installed on the system path. This macro 1139# will only find a Tcl shell that already exists on the system. 1140# It will not find a Tcl shell in the Tcl build directory or 1141# a Tcl shell that has been installed from the Tcl build directory. 1142# If a Tcl shell can't be located on the PATH, then TCLSH_PROG will 1143# be set to "". Extensions should take care not to create Makefile 1144# rules that are run by default and depend on TCLSH_PROG. An 1145# extension can't assume that an executable Tcl shell exists at 1146# build time. 1147# 1148# Arguments 1149# none 1150# 1151# Results 1152# Subst's the following values: 1153# TCLSH_PROG 1154#------------------------------------------------------------------------ 1155 1156AC_DEFUN([SC_PROG_TCLSH], [ 1157 AC_MSG_CHECKING([for tclsh]) 1158 1159 AC_CACHE_VAL(ac_cv_path_tclsh, [ 1160 search_path=`echo ${PATH} | sed -e 's/:/ /g'` 1161 for dir in $search_path ; do 1162 for j in `ls -r $dir/tclsh[[8-9]]*.exe 2> /dev/null` \ 1163 `ls -r $dir/tclsh* 2> /dev/null` ; do 1164 if test x"$ac_cv_path_tclsh" = x ; then 1165 if test -f "$j" ; then 1166 ac_cv_path_tclsh=$j 1167 break 1168 fi 1169 fi 1170 done 1171 done 1172 ]) 1173 1174 if test -f "$ac_cv_path_tclsh" ; then 1175 TCLSH_PROG="$ac_cv_path_tclsh" 1176 AC_MSG_RESULT($TCLSH_PROG) 1177 else 1178 # It is not an error if an installed version of Tcl can't be located. 1179 TCLSH_PROG="" 1180 AC_MSG_RESULT([No tclsh found on PATH]) 1181 fi 1182 AC_SUBST(TCLSH_PROG) 1183]) 1184 1185#------------------------------------------------------------------------ 1186# SC_BUILD_TCLSH 1187# Determine the fully qualified path name of the tclsh executable 1188# in the Tcl build directory. This macro will correctly determine 1189# the name of the tclsh executable even if tclsh has not yet 1190# been built in the build directory. The build tclsh must be used 1191# when running tests from an extension build directory. It is not 1192# correct to use the TCLSH_PROG in cases like this. 1193# 1194# Arguments 1195# none 1196# 1197# Results 1198# Subst's the following values: 1199# BUILD_TCLSH 1200#------------------------------------------------------------------------ 1201 1202AC_DEFUN([SC_BUILD_TCLSH], [ 1203 AC_MSG_CHECKING([for tclsh in Tcl build directory]) 1204 BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT} 1205 AC_MSG_RESULT($BUILD_TCLSH) 1206 AC_SUBST(BUILD_TCLSH) 1207]) 1208 1209#-------------------------------------------------------------------- 1210# SC_TCL_CFG_ENCODING TIP #59 1211# 1212# Declare the encoding to use for embedded configuration information. 1213# 1214# Arguments: 1215# None. 1216# 1217# Results: 1218# Might append to the following vars: 1219# DEFS (implicit) 1220# 1221# Will define the following vars: 1222# TCL_CFGVAL_ENCODING 1223# 1224#-------------------------------------------------------------------- 1225 1226AC_DEFUN([SC_TCL_CFG_ENCODING], [ 1227 AC_ARG_WITH(encoding, [ --with-encoding encoding for configuration values], with_tcencoding=${withval}) 1228 1229 if test x"${with_tcencoding}" != x ; then 1230 AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}") 1231 else 1232 # Default encoding on windows is not "iso8859-1" 1233 AC_DEFINE(TCL_CFGVAL_ENCODING,"cp1252") 1234 fi 1235]) 1236 1237#-------------------------------------------------------------------- 1238# SC_EMBED_MANIFEST 1239# 1240# Figure out if we can embed the manifest where necessary 1241# 1242# Arguments: 1243# An optional manifest to merge into DLL/EXE. 1244# 1245# Results: 1246# Will define the following vars: 1247# VC_MANIFEST_EMBED_DLL 1248# VC_MANIFEST_EMBED_EXE 1249# 1250#-------------------------------------------------------------------- 1251 1252AC_DEFUN([SC_EMBED_MANIFEST], [ 1253 AC_MSG_CHECKING(whether to embed manifest) 1254 AC_ARG_ENABLE(embedded-manifest, 1255 AC_HELP_STRING([--enable-embedded-manifest], 1256 [embed manifest if possible (default: yes)]), 1257 [embed_ok=$enableval], [embed_ok=yes]) 1258 1259 VC_MANIFEST_EMBED_DLL= 1260 VC_MANIFEST_EMBED_EXE= 1261 result=no 1262 if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \ 1263 -a "$GCC" != "yes" ; then 1264 # Add the magic to embed the manifest into the dll/exe 1265 AC_EGREP_CPP([manifest needed], [ 1266#if defined(_MSC_VER) && _MSC_VER >= 1400 1267print("manifest needed") 1268#endif 1269 ], [ 1270 # Could do a CHECK_PROG for mt, but should always be with MSVC8+ 1271 # Could add 'if test -f' check, but manifest should be created 1272 # in this compiler case 1273 # Add in a manifest argument that may be specified 1274 # XXX Needs improvement so that the test for existence accounts 1275 # XXX for a provided (known) manifest 1276 VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;2 ; fi" 1277 VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;1 ; fi" 1278 result=yes 1279 if test "x$1" != x ; then 1280 result="yes ($1)" 1281 fi 1282 ]) 1283 fi 1284 AC_MSG_RESULT([$result]) 1285 AC_SUBST(VC_MANIFEST_EMBED_DLL) 1286 AC_SUBST(VC_MANIFEST_EMBED_EXE) 1287]) 1288