os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/win/tcl.m4
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/win/tcl.m4	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,771 @@
     1.4 +#------------------------------------------------------------------------
     1.5 +# SC_PATH_TCLCONFIG --
     1.6 +#
     1.7 +#	Locate the tclConfig.sh file and perform a sanity check on
     1.8 +#	the Tcl compile flags
     1.9 +#	Currently a no-op for Windows
    1.10 +#
    1.11 +# Arguments:
    1.12 +#	PATCH_LEVEL	The patch level for Tcl if any.
    1.13 +#
    1.14 +# Results:
    1.15 +#
    1.16 +#	Adds the following arguments to configure:
    1.17 +#		--with-tcl=...
    1.18 +#
    1.19 +#	Sets the following vars:
    1.20 +#		TCL_BIN_DIR	Full path to the tclConfig.sh file
    1.21 +#------------------------------------------------------------------------
    1.22 +
    1.23 +AC_DEFUN([SC_PATH_TCLCONFIG], [
    1.24 +    AC_MSG_CHECKING([the location of tclConfig.sh])
    1.25 +
    1.26 +    if test -d ../../tcl8.4$1/win;  then
    1.27 +	TCL_BIN_DIR_DEFAULT=../../tcl8.4$1/win
    1.28 +    elif test -d ../../tcl8.4/win;  then
    1.29 +	TCL_BIN_DIR_DEFAULT=../../tcl8.4/win
    1.30 +    else
    1.31 +	TCL_BIN_DIR_DEFAULT=../../tcl/win
    1.32 +    fi
    1.33 +    
    1.34 +    AC_ARG_WITH(tcl, [  --with-tcl=DIR          use Tcl 8.4 binaries from DIR],
    1.35 +	    TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`)
    1.36 +    if test ! -d $TCL_BIN_DIR; then
    1.37 +	AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist)
    1.38 +    fi
    1.39 +    if test ! -f $TCL_BIN_DIR/tclConfig.sh; then
    1.40 +	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?)
    1.41 +    fi
    1.42 +    AC_MSG_RESULT($TCL_BIN_DIR/tclConfig.sh)
    1.43 +])
    1.44 +
    1.45 +#------------------------------------------------------------------------
    1.46 +# SC_PATH_TKCONFIG --
    1.47 +#
    1.48 +#	Locate the tkConfig.sh file
    1.49 +#	Currently a no-op for Windows
    1.50 +#
    1.51 +# Arguments:
    1.52 +#	none
    1.53 +#
    1.54 +# Results:
    1.55 +#
    1.56 +#	Adds the following arguments to configure:
    1.57 +#		--with-tk=...
    1.58 +#
    1.59 +#	Sets the following vars:
    1.60 +#		TK_BIN_DIR	Full path to the tkConfig.sh file
    1.61 +#------------------------------------------------------------------------
    1.62 +
    1.63 +AC_DEFUN([SC_PATH_TKCONFIG], [
    1.64 +    AC_MSG_CHECKING([the location of tkConfig.sh])
    1.65 +
    1.66 +    if test -d ../../tk8.4$1/win;  then
    1.67 +	TK_BIN_DIR_DEFAULT=../../tk8.4$1/win
    1.68 +    elif test -d ../../tk8.4/win;  then
    1.69 +	TK_BIN_DIR_DEFAULT=../../tk8.4/win
    1.70 +    else
    1.71 +	TK_BIN_DIR_DEFAULT=../../tk/win
    1.72 +    fi
    1.73 +    
    1.74 +    AC_ARG_WITH(tk, [  --with-tk=DIR          use Tk 8.4 binaries from DIR],
    1.75 +	    TK_BIN_DIR=$withval, TK_BIN_DIR=`cd $TK_BIN_DIR_DEFAULT; pwd`)
    1.76 +    if test ! -d $TK_BIN_DIR; then
    1.77 +	AC_MSG_ERROR(Tk directory $TK_BIN_DIR does not exist)
    1.78 +    fi
    1.79 +    if test ! -f $TK_BIN_DIR/tkConfig.sh; then
    1.80 +	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?)
    1.81 +    fi
    1.82 +
    1.83 +    AC_MSG_RESULT([$TK_BIN_DIR/tkConfig.sh])
    1.84 +])
    1.85 +
    1.86 +#------------------------------------------------------------------------
    1.87 +# SC_LOAD_TCLCONFIG --
    1.88 +#
    1.89 +#	Load the tclConfig.sh file.
    1.90 +#
    1.91 +# Arguments:
    1.92 +#	
    1.93 +#	Requires the following vars to be set:
    1.94 +#		TCL_BIN_DIR
    1.95 +#
    1.96 +# Results:
    1.97 +#
    1.98 +#	Subst the following vars:
    1.99 +#		TCL_BIN_DIR
   1.100 +#		TCL_SRC_DIR
   1.101 +#		TCL_LIB_FILE
   1.102 +#
   1.103 +#------------------------------------------------------------------------
   1.104 +
   1.105 +AC_DEFUN([SC_LOAD_TCLCONFIG], [
   1.106 +    AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
   1.107 +
   1.108 +    if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
   1.109 +        AC_MSG_RESULT([loading])
   1.110 +	. $TCL_BIN_DIR/tclConfig.sh
   1.111 +    else
   1.112 +        AC_MSG_RESULT([file not found])
   1.113 +    fi
   1.114 +
   1.115 +    #
   1.116 +    # If the TCL_BIN_DIR is the build directory (not the install directory),
   1.117 +    # then set the common variable name to the value of the build variables.
   1.118 +    # For example, the variable TCL_LIB_SPEC will be set to the value
   1.119 +    # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
   1.120 +    # instead of TCL_BUILD_LIB_SPEC since it will work with both an
   1.121 +    # installed and uninstalled version of Tcl.
   1.122 +    #
   1.123 +
   1.124 +    if test -f $TCL_BIN_DIR/Makefile ; then
   1.125 +        TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
   1.126 +        TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
   1.127 +        TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
   1.128 +    fi
   1.129 +
   1.130 +    #
   1.131 +    # eval is required to do the TCL_DBGX substitution
   1.132 +    #
   1.133 +
   1.134 +    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
   1.135 +    eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
   1.136 +    eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
   1.137 +
   1.138 +    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
   1.139 +    eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
   1.140 +    eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
   1.141 +
   1.142 +    AC_SUBST(TCL_VERSION)
   1.143 +    AC_SUBST(TCL_BIN_DIR)
   1.144 +    AC_SUBST(TCL_SRC_DIR)
   1.145 +
   1.146 +    AC_SUBST(TCL_LIB_FILE)
   1.147 +    AC_SUBST(TCL_LIB_FLAG)
   1.148 +    AC_SUBST(TCL_LIB_SPEC)
   1.149 +
   1.150 +    AC_SUBST(TCL_STUB_LIB_FILE)
   1.151 +    AC_SUBST(TCL_STUB_LIB_FLAG)
   1.152 +    AC_SUBST(TCL_STUB_LIB_SPEC)
   1.153 +
   1.154 +    AC_SUBST(TCL_DEFS)
   1.155 +])
   1.156 +
   1.157 +#------------------------------------------------------------------------
   1.158 +# SC_LOAD_TKCONFIG --
   1.159 +#
   1.160 +#	Load the tkConfig.sh file
   1.161 +#	Currently a no-op for Windows
   1.162 +#
   1.163 +# Arguments:
   1.164 +#	
   1.165 +#	Requires the following vars to be set:
   1.166 +#		TK_BIN_DIR
   1.167 +#
   1.168 +# Results:
   1.169 +#
   1.170 +#	Sets the following vars that should be in tkConfig.sh:
   1.171 +#		TK_BIN_DIR
   1.172 +#------------------------------------------------------------------------
   1.173 +
   1.174 +AC_DEFUN([SC_LOAD_TKCONFIG], [
   1.175 +    AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh])
   1.176 +
   1.177 +    if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
   1.178 +        AC_MSG_RESULT([loading])
   1.179 +	. $TK_BIN_DIR/tkConfig.sh
   1.180 +    else
   1.181 +        AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
   1.182 +    fi
   1.183 +
   1.184 +
   1.185 +    AC_SUBST(TK_BIN_DIR)
   1.186 +    AC_SUBST(TK_SRC_DIR)
   1.187 +    AC_SUBST(TK_LIB_FILE)
   1.188 +])
   1.189 +
   1.190 +#------------------------------------------------------------------------
   1.191 +# SC_ENABLE_SHARED --
   1.192 +#
   1.193 +#	Allows the building of shared libraries
   1.194 +#
   1.195 +# Arguments:
   1.196 +#	none
   1.197 +#	
   1.198 +# Results:
   1.199 +#
   1.200 +#	Adds the following arguments to configure:
   1.201 +#		--enable-shared=yes|no
   1.202 +#
   1.203 +#	Defines the following vars:
   1.204 +#		STATIC_BUILD	Used for building import/export libraries
   1.205 +#				on Windows.
   1.206 +#
   1.207 +#	Sets the following vars:
   1.208 +#		SHARED_BUILD	Value of 1 or 0
   1.209 +#------------------------------------------------------------------------
   1.210 +
   1.211 +AC_DEFUN([SC_ENABLE_SHARED], [
   1.212 +    AC_MSG_CHECKING([how to build libraries])
   1.213 +    AC_ARG_ENABLE(shared,
   1.214 +	[  --enable-shared         build and link with shared libraries [--enable-shared]],
   1.215 +    [tcl_ok=$enableval], [tcl_ok=yes])
   1.216 +
   1.217 +    if test "${enable_shared+set}" = set; then
   1.218 +	enableval="$enable_shared"
   1.219 +	tcl_ok=$enableval
   1.220 +    else
   1.221 +	tcl_ok=yes
   1.222 +    fi
   1.223 +
   1.224 +    if test "$tcl_ok" = "yes" ; then
   1.225 +	AC_MSG_RESULT([shared])
   1.226 +	SHARED_BUILD=1
   1.227 +    else
   1.228 +	AC_MSG_RESULT([static])
   1.229 +	SHARED_BUILD=0
   1.230 +	AC_DEFINE(STATIC_BUILD)
   1.231 +    fi
   1.232 +])
   1.233 +
   1.234 +#------------------------------------------------------------------------
   1.235 +# SC_ENABLE_THREADS --
   1.236 +#
   1.237 +#	Specify if thread support should be enabled
   1.238 +#
   1.239 +# Arguments:
   1.240 +#	none
   1.241 +#	
   1.242 +# Results:
   1.243 +#
   1.244 +#	Adds the following arguments to configure:
   1.245 +#		--enable-threads=yes|no
   1.246 +#
   1.247 +#	Defines the following vars:
   1.248 +#		TCL_THREADS
   1.249 +#------------------------------------------------------------------------
   1.250 +
   1.251 +AC_DEFUN([SC_ENABLE_THREADS], [
   1.252 +    AC_MSG_CHECKING(for building with threads)
   1.253 +    AC_ARG_ENABLE(threads, [  --enable-threads        build with threads],
   1.254 +	[tcl_ok=$enableval], [tcl_ok=no])
   1.255 +
   1.256 +    if test "$tcl_ok" = "yes"; then
   1.257 +	AC_MSG_RESULT(yes)
   1.258 +	TCL_THREADS=1
   1.259 +	AC_DEFINE(TCL_THREADS)
   1.260 +	# USE_THREAD_ALLOC tells us to try the special thread-based
   1.261 +	# allocator that significantly reduces lock contention
   1.262 +	AC_DEFINE(USE_THREAD_ALLOC)
   1.263 +    else
   1.264 +	TCL_THREADS=0
   1.265 +	AC_MSG_RESULT([no (default)])
   1.266 +    fi
   1.267 +    AC_SUBST(TCL_THREADS)
   1.268 +])
   1.269 +
   1.270 +#------------------------------------------------------------------------
   1.271 +# SC_ENABLE_SYMBOLS --
   1.272 +#
   1.273 +#	Specify if debugging symbols should be used
   1.274 +#	Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
   1.275 +#	can also be enabled.
   1.276 +#
   1.277 +# Arguments:
   1.278 +#	none
   1.279 +#	
   1.280 +#	Requires the following vars to be set in the Makefile:
   1.281 +#		CFLAGS_DEBUG
   1.282 +#		CFLAGS_OPTIMIZE
   1.283 +#	
   1.284 +# Results:
   1.285 +#
   1.286 +#	Adds the following arguments to configure:
   1.287 +#		--enable-symbols
   1.288 +#
   1.289 +#	Defines the following vars:
   1.290 +#		CFLAGS_DEFAULT	Sets to $(CFLAGS_DEBUG) if true
   1.291 +#				Sets to $(CFLAGS_OPTIMIZE) if false
   1.292 +#		LDFLAGS_DEFAULT	Sets to $(LDFLAGS_DEBUG) if true
   1.293 +#				Sets to $(LDFLAGS_OPTIMIZE) if false
   1.294 +#		DBGX		Debug library extension
   1.295 +#
   1.296 +#------------------------------------------------------------------------
   1.297 +
   1.298 +AC_DEFUN([SC_ENABLE_SYMBOLS], [
   1.299 +    AC_MSG_CHECKING([for build with symbols])
   1.300 +    AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols [--disable-symbols]],    [tcl_ok=$enableval], [tcl_ok=no])
   1.301 +# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
   1.302 +    if test "$tcl_ok" = "no"; then
   1.303 +	CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
   1.304 +	LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
   1.305 +	DBGX=""
   1.306 +	AC_MSG_RESULT([no])
   1.307 +    else
   1.308 +	CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
   1.309 +	LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
   1.310 +	DBGX=g
   1.311 +	if test "$tcl_ok" = "yes"; then
   1.312 +	    AC_MSG_RESULT([yes (standard debugging)])
   1.313 +	fi
   1.314 +    fi
   1.315 +    AC_SUBST(CFLAGS_DEFAULT)
   1.316 +    AC_SUBST(LDFLAGS_DEFAULT)
   1.317 +
   1.318 +    if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
   1.319 +	AC_DEFINE(TCL_MEM_DEBUG)
   1.320 +    fi
   1.321 +
   1.322 +    if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
   1.323 +	AC_DEFINE(TCL_COMPILE_DEBUG)
   1.324 +	AC_DEFINE(TCL_COMPILE_STATS)
   1.325 +    fi
   1.326 +
   1.327 +    if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
   1.328 +	if test "$tcl_ok" = "all"; then
   1.329 +	    AC_MSG_RESULT([enabled symbols mem compile debugging])
   1.330 +	else
   1.331 +	    AC_MSG_RESULT([enabled $tcl_ok debugging])
   1.332 +	fi
   1.333 +    fi
   1.334 +])
   1.335 +
   1.336 +#--------------------------------------------------------------------
   1.337 +# SC_CONFIG_CFLAGS
   1.338 +#
   1.339 +#	Try to determine the proper flags to pass to the compiler
   1.340 +#	for building shared libraries and other such nonsense.
   1.341 +#
   1.342 +#	NOTE: The backslashes in quotes below are substituted twice
   1.343 +#	due to the fact that they are in a macro and then inlined
   1.344 +#	in the final configure script.
   1.345 +#
   1.346 +# Arguments:
   1.347 +#	none
   1.348 +#
   1.349 +# Results:
   1.350 +#
   1.351 +#	Can the following vars:
   1.352 +#		EXTRA_CFLAGS
   1.353 +#		CFLAGS_DEBUG
   1.354 +#		CFLAGS_OPTIMIZE
   1.355 +#		CFLAGS_WARNING
   1.356 +#		LDFLAGS_DEBUG
   1.357 +#		LDFLAGS_OPTIMIZE
   1.358 +#		LDFLAGS_CONSOLE
   1.359 +#		LDFLAGS_WINDOW
   1.360 +#		CC_OBJNAME
   1.361 +#		CC_EXENAME
   1.362 +#		CYGPATH
   1.363 +#		STLIB_LD
   1.364 +#		SHLIB_LD
   1.365 +#		SHLIB_LD_LIBS
   1.366 +#		LIBS
   1.367 +#		AR
   1.368 +#		RC
   1.369 +#		RES
   1.370 +#
   1.371 +#		MAKE_LIB
   1.372 +#		MAKE_EXE
   1.373 +#		MAKE_DLL
   1.374 +#
   1.375 +#		LIBSUFFIX
   1.376 +#		LIBPREFIX
   1.377 +#		LIBRARIES
   1.378 +#		EXESUFFIX
   1.379 +#		DLLSUFFIX
   1.380 +#
   1.381 +#--------------------------------------------------------------------
   1.382 +
   1.383 +AC_DEFUN([SC_CONFIG_CFLAGS], [
   1.384 +
   1.385 +    # Step 0: Enable 64 bit support?
   1.386 +
   1.387 +    AC_MSG_CHECKING([if 64bit support is requested])
   1.388 +    AC_ARG_ENABLE(64bit,[  --enable-64bit          enable 64bit support (where applicable = amd64|ia64)], [do64bit=$enableval], [do64bit=no])
   1.389 +    AC_MSG_RESULT($do64bit)
   1.390 +
   1.391 +    # Set some defaults (may get changed below)
   1.392 +    EXTRA_CFLAGS=""
   1.393 +
   1.394 +    AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
   1.395 +
   1.396 +    SHLIB_SUFFIX=".dll"
   1.397 +
   1.398 +    # MACHINE is IX86 for LINK, but this is used by the manifest,
   1.399 +    # which requires x86|amd64|ia64.
   1.400 +    MACHINE="X86"
   1.401 +
   1.402 +    # Check for a bug in gcc's windres that causes the
   1.403 +    # compile to fail when a Windows native path is
   1.404 +    # passed into windres. The mingw toolchain requires
   1.405 +    # Windows native paths while Cygwin should work
   1.406 +    # with both. Avoid the bug by passing a POSIX
   1.407 +    # path when using the Cygwin toolchain.
   1.408 +
   1.409 +    if test "$GCC" = "yes" && test "$CYGPATH" != "echo" ; then
   1.410 +	conftest=/tmp/conftest.rc
   1.411 +	echo "STRINGTABLE BEGIN" > $conftest
   1.412 +	echo "101 \"name\"" >> $conftest
   1.413 +	echo "END" >> $conftest
   1.414 +
   1.415 +	AC_MSG_CHECKING([for Windows native path bug in windres])
   1.416 +	cyg_conftest=`$CYGPATH $conftest`
   1.417 +	if AC_TRY_COMMAND($RC -o conftest.res.o $cyg_conftest) ; then
   1.418 +	    AC_MSG_RESULT([no])
   1.419 +	else
   1.420 +	    AC_MSG_RESULT([yes])
   1.421 +	    CYGPATH=echo
   1.422 +	fi
   1.423 +	conftest=
   1.424 +	cyg_conftest=
   1.425 +    fi
   1.426 +
   1.427 +    if test "$CYGPATH" = "echo" || test "$ac_cv_cygwin" = "yes"; then
   1.428 +        DEPARG='"$<"'
   1.429 +    else
   1.430 +        DEPARG='"$(shell $(CYGPATH) $<)"'
   1.431 +    fi
   1.432 +
   1.433 +    # set various compiler flags depending on whether we are using gcc or cl
   1.434 +
   1.435 +    AC_MSG_CHECKING([compiler flags])
   1.436 +    if test "${GCC}" = "yes" ; then
   1.437 +	if test "$do64bit" != "no" ; then
   1.438 +	    AC_MSG_WARN("64bit mode not supported with GCC on Windows")
   1.439 +	fi
   1.440 +	SHLIB_LD=""
   1.441 +	SHLIB_LD_LIBS=""
   1.442 +	LIBS=""
   1.443 +	LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32"
   1.444 +	STLIB_LD='${AR} cr'
   1.445 +	RC_OUT=-o
   1.446 +	RC_TYPE=
   1.447 +	RC_INCLUDE=--include
   1.448 +	RC_DEFINE=--define
   1.449 +	RES=res.o
   1.450 +	MAKE_LIB="\${STLIB_LD} \[$]@"
   1.451 +	POST_MAKE_LIB="\${RANLIB} \[$]@"
   1.452 +	MAKE_EXE="\${CC} -o \[$]@"
   1.453 +	LIBPREFIX="lib"
   1.454 +
   1.455 +	#if test "$ac_cv_cygwin" = "yes"; then
   1.456 +	#    extra_cflags="-mno-cygwin"
   1.457 +	#    extra_ldflags="-mno-cygwin"
   1.458 +	#else
   1.459 +	#    extra_cflags=""
   1.460 +	#    extra_ldflags=""
   1.461 +	#fi
   1.462 +
   1.463 +	if test "$ac_cv_cygwin" = "yes"; then
   1.464 +	  touch ac$$.c
   1.465 +	  if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then
   1.466 +	    case "$extra_cflags" in
   1.467 +	      *-mwin32*) ;;
   1.468 +	      *) extra_cflags="-mwin32 $extra_cflags" ;;
   1.469 +	    esac
   1.470 +	    case "$extra_ldflags" in
   1.471 +	      *-mwin32*) ;;
   1.472 +	      *) extra_ldflags="-mwin32 $extra_ldflags" ;;
   1.473 +	    esac
   1.474 +	  fi
   1.475 +	  rm -f ac$$.o ac$$.c
   1.476 +	else
   1.477 +	  extra_cflags=''
   1.478 +	  extra_ldflags=''
   1.479 +	fi
   1.480 +
   1.481 +	if test "${SHARED_BUILD}" = "0" ; then
   1.482 +	    # static
   1.483 +            AC_MSG_RESULT([using static flags])
   1.484 +	    runtime=
   1.485 +	    MAKE_DLL="echo "
   1.486 +	    LIBSUFFIX="s\${DBGX}.a"
   1.487 +	    LIBFLAGSUFFIX="s\${DBGX}"
   1.488 +	    LIBRARIES="\${STATIC_LIBRARIES}"
   1.489 +	    EXESUFFIX="s\${DBGX}.exe"
   1.490 +	else
   1.491 +	    # dynamic
   1.492 +            AC_MSG_RESULT([using shared flags])
   1.493 +
   1.494 +	    # ad-hoc check to see if CC supports -shared.
   1.495 +	    if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then
   1.496 +		AC_MSG_ERROR([${CC} does not support the -shared option.
   1.497 +                You will need to upgrade to a newer version of the toolchain.])
   1.498 +	    fi
   1.499 +
   1.500 +	    runtime=
   1.501 +	    # Link with gcc since ld does not link to default libs like
   1.502 +	    # -luser32 and -lmsvcrt by default. Make sure CFLAGS is
   1.503 +	    # included so -mno-cygwin passed the correct libs to the linker.
   1.504 +	    SHLIB_LD='${CC} -shared ${CFLAGS}'
   1.505 +	    SHLIB_LD_LIBS='${LIBS}'
   1.506 +	    # Add SHLIB_LD_LIBS to the Make rule, not here.
   1.507 +	    MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \
   1.508 +	        -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\[$]@)"
   1.509 +
   1.510 +	    LIBSUFFIX="\${DBGX}.a"
   1.511 +	    LIBFLAGSUFFIX="\${DBGX}"
   1.512 +	    EXESUFFIX="\${DBGX}.exe"
   1.513 +	    LIBRARIES="\${SHARED_LIBRARIES}"
   1.514 +	fi
   1.515 +	# DLLSUFFIX is separate because it is the building block for
   1.516 +	# users of tclConfig.sh that may build shared or static.
   1.517 +	DLLSUFFIX="\${DBGX}.dll"
   1.518 +	SHLIB_SUFFIX=.dll
   1.519 +
   1.520 +	EXTRA_CFLAGS="${extra_cflags}"
   1.521 +
   1.522 +	CFLAGS_DEBUG=-g
   1.523 +	CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
   1.524 +	CFLAGS_WARNING="-Wall -Wconversion"
   1.525 +	LDFLAGS_DEBUG=
   1.526 +	LDFLAGS_OPTIMIZE=
   1.527 +
   1.528 +	# Specify the CC output file names based on the target name
   1.529 +	CC_OBJNAME="-o \[$]@"
   1.530 +	CC_EXENAME="-o \[$]@"
   1.531 +
   1.532 +	# Specify linker flags depending on the type of app being 
   1.533 +	# built -- Console vs. Window.
   1.534 +	#
   1.535 +	# ORIGINAL COMMENT:
   1.536 +	# We need to pass -e _WinMain@16 so that ld will use
   1.537 +	# WinMain() instead of main() as the entry point. We can't
   1.538 +	# use autoconf to check for this case since it would need
   1.539 +	# to run an executable and that does not work when
   1.540 +	# cross compiling. Remove this -e workaround once we
   1.541 +	# require a gcc that does not have this bug.
   1.542 +	#
   1.543 +	# MK NOTE: Tk should use a different mechanism. This causes 
   1.544 +	# interesting problems, such as wish dying at startup.
   1.545 +	#LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}"
   1.546 +	LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}"
   1.547 +	LDFLAGS_WINDOW="-mwindows ${extra_ldflags}"
   1.548 +    else
   1.549 +	if test "${SHARED_BUILD}" = "0" ; then
   1.550 +	    # static
   1.551 +            AC_MSG_RESULT([using static flags])
   1.552 +	    runtime=-MT
   1.553 +	    MAKE_DLL="echo "
   1.554 +	    LIBSUFFIX="s\${DBGX}.lib"
   1.555 +	    LIBFLAGSUFFIX="s\${DBGX}"
   1.556 +	    LIBRARIES="\${STATIC_LIBRARIES}"
   1.557 +	    EXESUFFIX="s\${DBGX}.exe"
   1.558 +	    SHLIB_LD_LIBS=""
   1.559 +	else
   1.560 +	    # dynamic
   1.561 +            AC_MSG_RESULT([using shared flags])
   1.562 +	    runtime=-MD
   1.563 +	    # Add SHLIB_LD_LIBS to the Make rule, not here.
   1.564 +	    MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\[$]@"
   1.565 +	    LIBSUFFIX="\${DBGX}.lib"
   1.566 +	    LIBFLAGSUFFIX="\${DBGX}"
   1.567 +	    EXESUFFIX="\${DBGX}.exe"
   1.568 +	    LIBRARIES="\${SHARED_LIBRARIES}"
   1.569 +	    SHLIB_LD_LIBS='${LIBS}'
   1.570 +	fi
   1.571 +	# DLLSUFFIX is separate because it is the building block for
   1.572 +	# users of tclConfig.sh that may build shared or static.
   1.573 +	DLLSUFFIX="\${DBGX}.dll"
   1.574 +
   1.575 +	# This is a 2-stage check to make sure we have the 64-bit SDK
   1.576 +	# We have to know where the SDK is installed.
   1.577 +	# This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
   1.578 +	if test "$do64bit" != "no" ; then
   1.579 +	    if test "x${MSSDK}x" = "xx" ; then
   1.580 +		MSSDK="C:/Progra~1/Microsoft Platform SDK"
   1.581 +	    fi
   1.582 +	    MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
   1.583 +	    PATH64=""
   1.584 +	    case "$do64bit" in
   1.585 +		amd64|x64|yes)
   1.586 +		    MACHINE="AMD64" ; # default to AMD64 64-bit build
   1.587 +		    PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
   1.588 +		    ;;
   1.589 +		ia64)
   1.590 +		    MACHINE="IA64"
   1.591 +		    PATH64="${MSSDK}/Bin/Win64"
   1.592 +		    ;;
   1.593 +	    esac
   1.594 +	    if test ! -d "${PATH64}" ; then
   1.595 +		AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode])
   1.596 +		AC_MSG_WARN([Ensure latest Platform SDK is installed])
   1.597 +		do64bit="no"
   1.598 +	    else
   1.599 +		AC_MSG_RESULT([   Using 64-bit $MACHINE mode])
   1.600 +	    fi
   1.601 +	fi
   1.602 +
   1.603 +	if test "$do64bit" != "no" ; then
   1.604 +	    # The space-based-path will work for the Makefile, but will
   1.605 +	    # not work if AC_TRY_COMPILE is called.
   1.606 +	    CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
   1.607 +		-I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
   1.608 +	    RC="\"${MSSDK}/bin/rc.exe\""
   1.609 +	    CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
   1.610 +	    # Do not use -O2 for Win64 - this has proved buggy in code gen.
   1.611 +	    CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
   1.612 +	    lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
   1.613 +	    LINKBIN="\"${PATH64}/link.exe\""
   1.614 +	    # Avoid 'unresolved external symbol __security_cookie' errors.
   1.615 +	    # c.f. http://support.microsoft.com/?id=894573
   1.616 +	    LIBS="user32.lib advapi32.lib bufferoverflowU.lib"
   1.617 +	else
   1.618 +	    RC="rc"
   1.619 +	    # -Od - no optimization
   1.620 +	    # -WX - warnings as errors
   1.621 +	    CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
   1.622 +	    # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy)
   1.623 +	    CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}"
   1.624 +	    lflags="-nologo"
   1.625 +	    LINKBIN="link"
   1.626 +	    LIBS="user32.lib advapi32.lib"
   1.627 +	fi
   1.628 +
   1.629 +	LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib"
   1.630 +	SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
   1.631 +	# link -lib only works when -lib is the first arg
   1.632 +	STLIB_LD="${LINKBIN} -lib ${lflags}"
   1.633 +	RC_OUT=-fo
   1.634 +	RC_TYPE=-r
   1.635 +	RC_INCLUDE=-i
   1.636 +	RC_DEFINE=-d
   1.637 +	RES=res
   1.638 +	MAKE_LIB="\${STLIB_LD} -out:\[$]@"
   1.639 +	POST_MAKE_LIB=
   1.640 +	MAKE_EXE="\${CC} -Fe\[$]@"
   1.641 +	LIBPREFIX=""
   1.642 +
   1.643 +	EXTRA_CFLAGS=""
   1.644 +	CFLAGS_WARNING="-W3"
   1.645 +	LDFLAGS_DEBUG="-debug:full"
   1.646 +	LDFLAGS_OPTIMIZE="-release"
   1.647 +	
   1.648 +	# Specify the CC output file names based on the target name
   1.649 +	CC_OBJNAME="-Fo\[$]@"
   1.650 +	CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\[$]@')\""
   1.651 +
   1.652 +	# Specify linker flags depending on the type of app being 
   1.653 +	# built -- Console vs. Window.
   1.654 +	LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
   1.655 +	LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
   1.656 +    fi
   1.657 +
   1.658 +    # DL_LIBS is empty, but then we match the Unix version
   1.659 +    AC_SUBST(DL_LIBS)
   1.660 +    AC_SUBST(CFLAGS_DEBUG)
   1.661 +    AC_SUBST(CFLAGS_OPTIMIZE)
   1.662 +    AC_SUBST(CFLAGS_WARNING)
   1.663 +])
   1.664 +
   1.665 +#------------------------------------------------------------------------
   1.666 +# SC_WITH_TCL --
   1.667 +#
   1.668 +#	Location of the Tcl build directory.
   1.669 +#
   1.670 +# Arguments:
   1.671 +#	none
   1.672 +#
   1.673 +# Results:
   1.674 +#
   1.675 +#	Adds the following arguments to configure:
   1.676 +#		--with-tcl=...
   1.677 +#
   1.678 +#	Defines the following vars:
   1.679 +#		TCL_BIN_DIR	Full path to the tcl build dir.
   1.680 +#------------------------------------------------------------------------
   1.681 +
   1.682 +AC_DEFUN([SC_WITH_TCL], [
   1.683 +    if test -d ../../tcl8.4$1/win;  then
   1.684 +	TCL_BIN_DEFAULT=../../tcl8.4$1/win
   1.685 +    else
   1.686 +	TCL_BIN_DEFAULT=../../tcl8.4/win
   1.687 +    fi
   1.688 +    
   1.689 +    AC_ARG_WITH(tcl, [  --with-tcl=DIR          use Tcl 8.4 binaries from DIR],
   1.690 +	    TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`)
   1.691 +    if test ! -d $TCL_BIN_DIR; then
   1.692 +	AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist)
   1.693 +    fi
   1.694 +    if test ! -f $TCL_BIN_DIR/Makefile; then
   1.695 +	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?)
   1.696 +    else
   1.697 +	echo "building against Tcl binaries in: $TCL_BIN_DIR"
   1.698 +    fi
   1.699 +    AC_SUBST(TCL_BIN_DIR)
   1.700 +])
   1.701 +
   1.702 +#------------------------------------------------------------------------
   1.703 +# SC_PROG_TCLSH
   1.704 +#	Locate a tclsh shell installed on the system path. This macro
   1.705 +#	will only find a Tcl shell that already exists on the system.
   1.706 +#	It will not find a Tcl shell in the Tcl build directory or
   1.707 +#	a Tcl shell that has been installed from the Tcl build directory.
   1.708 +#	If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
   1.709 +#	be set to "". Extensions should take care not to create Makefile
   1.710 +#	rules that are run by default and depend on TCLSH_PROG. An
   1.711 +#	extension can't assume that an executable Tcl shell exists at
   1.712 +#	build time.
   1.713 +#
   1.714 +# Arguments
   1.715 +#	none
   1.716 +#
   1.717 +# Results
   1.718 +#	Subst's the following values:
   1.719 +#		TCLSH_PROG
   1.720 +#------------------------------------------------------------------------
   1.721 +
   1.722 +AC_DEFUN([SC_PROG_TCLSH], [
   1.723 +    AC_MSG_CHECKING([for tclsh])
   1.724 +
   1.725 +    AC_CACHE_VAL(ac_cv_path_tclsh, [
   1.726 +	search_path=`echo ${PATH} | sed -e 's/:/ /g'`
   1.727 +	for dir in $search_path ; do
   1.728 +	    for j in `ls -r $dir/tclsh[[8-9]]*.exe 2> /dev/null` \
   1.729 +		    `ls -r $dir/tclsh* 2> /dev/null` ; do
   1.730 +		if test x"$ac_cv_path_tclsh" = x ; then
   1.731 +		    if test -f "$j" ; then
   1.732 +			ac_cv_path_tclsh=$j
   1.733 +			break
   1.734 +		    fi
   1.735 +		fi
   1.736 +	    done
   1.737 +	done
   1.738 +    ])
   1.739 +
   1.740 +    if test -f "$ac_cv_path_tclsh" ; then
   1.741 +	TCLSH_PROG="$ac_cv_path_tclsh"
   1.742 +	AC_MSG_RESULT($TCLSH_PROG)
   1.743 +    else
   1.744 +	# It is not an error if an installed version of Tcl can't be located.
   1.745 +	TCLSH_PROG=""
   1.746 +	AC_MSG_RESULT([No tclsh found on PATH])
   1.747 +    fi
   1.748 +    AC_SUBST(TCLSH_PROG)
   1.749 +])
   1.750 +
   1.751 +#------------------------------------------------------------------------
   1.752 +# SC_BUILD_TCLSH
   1.753 +#	Determine the fully qualified path name of the tclsh executable
   1.754 +#	in the Tcl build directory. This macro will correctly determine
   1.755 +#	the name of the tclsh executable even if tclsh has not yet
   1.756 +#	been built in the build directory. The build tclsh must be used
   1.757 +#	when running tests from an extension build directory. It is not
   1.758 +#	correct to use the TCLSH_PROG in cases like this.
   1.759 +#
   1.760 +# Arguments
   1.761 +#	none
   1.762 +#
   1.763 +# Results
   1.764 +#	Subst's the following values:
   1.765 +#		BUILD_TCLSH
   1.766 +#------------------------------------------------------------------------
   1.767 +
   1.768 +AC_DEFUN([SC_BUILD_TCLSH], [
   1.769 +    AC_MSG_CHECKING([for tclsh in Tcl build directory])
   1.770 +    BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}
   1.771 +    AC_MSG_RESULT($BUILD_TCLSH)
   1.772 +    AC_SUBST(BUILD_TCLSH)
   1.773 +])
   1.774 +