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