ADDED .fossil-settings/binary-glob Index: .fossil-settings/binary-glob ================================================================== --- /dev/null +++ .fossil-settings/binary-glob @@ -0,0 +1,12 @@ +*.a +*.bmp +*.dll +*.exe +*.gif +*.gz +*.jpg +*.lib +*.pdf +*.png +*.xlsx +*.zip ADDED .fossil-settings/crlf-glob Index: .fossil-settings/crlf-glob ================================================================== --- /dev/null +++ .fossil-settings/crlf-glob @@ -0,0 +1,18 @@ +compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +compat/zlib/contrib/vstudio/readme.txt +compat/zlib/contrib/vstudio/*/zlib.rc +compat/zlib/contrib/vstudio/*/*.sln +compat/zlib/win32/*.txt +compat/zlib/win64/*.txt +libtommath/*.dsp +libtommath/*.sln +libtommath/*.vcproj +tools/tcl.wse.in +win/buildall.vc.bat +win/coffbase.txt +win/makefile.vc +win/rules.vc +win/rules-ext.vc +win/targets.vc +win/tcl.dsp +win/tcl.dsw ADDED .fossil-settings/encoding-glob Index: .fossil-settings/encoding-glob ================================================================== --- /dev/null +++ .fossil-settings/encoding-glob @@ -0,0 +1,7 @@ +tools/tcl.wse.in +win/buildall.vc.bat +win/coffbase.txt +win/makefile.vc +win/rules.vc +win/tcl.dsp +win/tcl.dsw ADDED .fossil-settings/ignore-glob Index: .fossil-settings/ignore-glob ================================================================== --- /dev/null +++ .fossil-settings/ignore-glob @@ -0,0 +1,29 @@ +*.a +*.dll +*.dylib +*.dylib.E +*.exe +*.exp +*.la +*.lib +*.lo +*.o +*.obj +*.pdb +*.res +*.sl +*.so +Makefile +autom4te.cache +config.cache +config.log +config.status +itkConfig.sh +pkgIndex.tcl +versions.vc +version.vc +libitk.vfs +libitk_*.zip +html +win/nmakehlp.out +win/nmhlp-out.txt ADDED .gitattributes Index: .gitattributes ================================================================== --- /dev/null +++ .gitattributes @@ -0,0 +1,40 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* eol=lf +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.3 text +*.c text +*.css text +*.enc text +*.h text +*.htm text +*.html text +*.java text +*.js text +*.json text +*.n text +*.svg text +*.ts text +*.tcl text +*.test text + +# Declare files that will always have CRLF line endings on checkout. +*.bat eol=crlf +*.sln eol=crlf +*.vc eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.a binary +*.bmp binary +*.dll binary +*.exe binary +*.gif binary +*.gz binary +*.jpg binary +*.lib binary +*.pdf binary +*.png binary +*.xlsx binary +*.zip binary ADDED .gitignore Index: .gitignore ================================================================== --- /dev/null +++ .gitignore @@ -0,0 +1,33 @@ +*.a +*.bundle +*.dll +*.dylib +*.dylib.E +*.exe +*.exp +*.lib +*.o +*.obj +*.pdb +*.res +*.sl +*.so +.fslckout +Makefile +autom4te.cache +config.cache +config.log +config.status +config.status.lineno +html +manifest.uuid +_FOSSIL_ +itkConfig.sh +pkgIndex.tcl +versions.vc +version.vc +libitk.vfs +libitk_*.zip +html +win/nmakehlp.out +win/nmhlp-out.txt Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -62,11 +62,11 @@ PKG_LIB_FILE = @PKG_LIB_FILE@ PKG_LIB_FILE8 = @PKG_LIB_FILE8@ PKG_LIB_FILE9 = @PKG_LIB_FILE9@ PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ -lib_BINARIES = $(PKG_LIB_FILE) +lib_BINARIES = $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE) BINARIES = $(lib_BINARIES) SHELL = @SHELL@ srcdir = @srcdir@ @@ -169,11 +169,11 @@ CLEANFILES = @CLEANFILES@ CPPFLAGS = @CPPFLAGS@ LIBS = @PKG_LIBS@ @LIBS@ AR = @AR@ -CFLAGS = @CFLAGS@ -DTCL_NO_DEPRECATED +CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) GDB = gdb VALGRIND = valgrind VALGRINDARGS = --tool=memcheck --num-callers=8 --leak-resolution=high \ @@ -218,10 +218,11 @@ install-binaries: binaries install-lib-binaries install-bin-binaries #======================================================================== # This rule installs platform-independent files, such as header files. +# The list=...; for p in $$list handles the empty list case x-platform. #======================================================================== install-libraries: libraries @$(INSTALL_DATA_DIR) "$(DESTDIR)$(includedir)" @echo "Installing header files in $(DESTDIR)$(includedir)" @@ -308,11 +309,11 @@ # Setting the VPATH variable to a list of paths will cause the makefile # to look into these paths when resolving .c to .obj dependencies. # As necessary, add $(srcdir):$(srcdir)/compat:.... #======================================================================== -VPATH = $(srcdir)/unix:$(srcdir)/generic:$(srcdir)/win +VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/macosx .c.@OBJEXT@: $(COMPILE) -c `@CYGPATH@ $<` -I. -o $@ itkBase.@OBJEXT@: itkUuid.h Index: configure ================================================================== --- configure +++ configure @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for itk 4.2.3. +# Generated by GNU Autoconf 2.71 for itk 4.2.4. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # @@ -606,12 +606,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='itk' PACKAGE_TARNAME='itk' -PACKAGE_VERSION='4.2.3' -PACKAGE_STRING='itk 4.2.3' +PACKAGE_VERSION='4.2.4' +PACKAGE_STRING='itk 4.2.4' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ @@ -662,10 +662,11 @@ WISH_PROG TCLSH_PROG VC_MANIFEST_EMBED_EXE VC_MANIFEST_EMBED_DLL RANLIB_STUB +PKG_STUB_LIB_FILE MAKE_STUB_LIB MAKE_STATIC_LIB MAKE_SHARED_LIB MAKE_LIB EGREP @@ -750,11 +751,10 @@ PKG_INCLUDES PKG_HEADERS PKG_TCL_SOURCES PKG_STUB_OBJECTS PKG_STUB_SOURCES -PKG_STUB_LIB_FILE PKG_LIB_FILE9 PKG_LIB_FILE8 PKG_LIB_FILE EXEEXT CYGPATH @@ -799,10 +799,11 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_tcl +with_tcl8 with_tk with_itcl with_tclinclude with_tkinclude with_x @@ -1369,11 +1370,11 @@ # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures itk 4.2.3 to adapt to many kinds of systems. +\`configure' configures itk 4.2.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. @@ -1435,11 +1436,11 @@ _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of itk 4.2.3:";; + short | recursive ) echo "Configuration of itk 4.2.4:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options @@ -1456,10 +1457,11 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) + --with-tcl8 Compile for Tcl8 in Tcl9 environment --with-tk directory containing tk configuration (tkConfig.sh) --with-itcl directory containing itcl configuration (itclConfig.sh) --with-tclinclude directory containing the public Tcl header files --with-tkinclude directory containing the public Tk header files --with-x use the X Window System @@ -1540,11 +1542,11 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -itk configure 4.2.3 +itk configure 4.2.4 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. @@ -1839,11 +1841,11 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by itk $as_me 4.2.3, which was +It was created by itk $as_me 4.2.4, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _ACEOF @@ -2608,12 +2610,10 @@ # This package name must be replaced statically for AC_SUBST to work - # Substitute STUB_LIB_FILE in case package creates a stub library too. - # We AC_SUBST these here to ensure they are subst'ed, # in case the user doesn't call TEA_ADD_... @@ -2730,10 +2730,17 @@ if test ${with_tcl+y} then : withval=$with_tcl; with_tclconfig="${withval}" fi + +# Check whether --with-tcl8 was given. +if test ${with_tcl8+y} +then : + withval=$with_tcl8; with_tcl8="${withval}" +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5 printf %s "checking for Tcl configuration... " >&6; } if test ${ac_cv_c_tclconfig+y} then : printf %s "(cached) " >&6 @@ -5647,10 +5654,16 @@ printf "%s\n" "$tcl_cv_cc_pipe" >&6; } if test $tcl_cv_cc_pipe = yes; then CFLAGS="$CFLAGS -pipe" fi fi + + if test "${TCL_MAJOR_VERSION}" -lt 9 -a "${TCL_MINOR_VERSION}" -lt 7; then + +printf "%s\n" "#define Tcl_Size int" >>confdefs.h + + fi #-------------------------------------------------------------------- # Common compiler flag setup #-------------------------------------------------------------------- @@ -5876,13 +5889,11 @@ printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) - -printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - + # ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -5974,11 +5985,34 @@ PKG_CFLAGS="$PKG_CFLAGS " -#TEA_ADD_STUB_SOURCES([itkStubLib.c]) + + vars="itkStubLib.c" + for i in $vars; do + # check for existence - allows for generic/win/unix VPATH + if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ + -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ + -a ! -f "${srcdir}/macosx/$i" \ + ; then + as_fn_error $? "could not find stub source file '$i'" "$LINENO" 5 + fi + PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i" + # this assumes it is in a VPATH dir + i=`basename $i` + # handle user calling this before or after TEA_SETUP_COMPILER + if test x"${OBJEXT}" != x ; then + j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" + else + j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" + fi + PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j" + done + + + vars="library/Archetype.itk library/Toplevel.itk library/Widget.itk library/itk.tcl @@ -7167,10 +7201,13 @@ if test "$do64bit" != "no" ; then case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # default to AMD64 64-bit build ;; + arm64|aarch64) + MACHINE="ARM64" + ;; ia64) MACHINE="IA64" ;; esac fi @@ -7379,10 +7416,17 @@ LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; + arm64|aarch64) + CC="aarch64-w64-mingw32-clang" + LD="aarch64-w64-mingw32-ld" + AR="aarch64-w64-mingw32-ar" + RANLIB="aarch64-w64-mingw32-ranlib" + RC="aarch64-w64-mingw32-windres" + ;; *) CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -8964,110 +9008,62 @@ printf "%s\n" "#define _ISOC99_SOURCE 1" >>confdefs.h tcl_flags="$tcl_flags _ISOC99_SOURCE" fi - - if test ${tcl_cv_flag__largefile64_source+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -struct stat64 buf; int i = stat64("/", &buf); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - tcl_cv_flag__largefile64_source=no -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _LARGEFILE64_SOURCE 1 -#include -int -main (void) -{ -struct stat64 buf; int i = stat64("/", &buf); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - tcl_cv_flag__largefile64_source=yes -else $as_nop - tcl_cv_flag__largefile64_source=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then - -printf "%s\n" "#define _LARGEFILE64_SOURCE 1" >>confdefs.h - - tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" - fi - - - if test ${tcl_cv_flag__largefile_source64+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -char *p = (char *)open64; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - tcl_cv_flag__largefile_source64=no -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _LARGEFILE_SOURCE64 1 -#include -int -main (void) -{ -char *p = (char *)open64; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - tcl_cv_flag__largefile_source64=yes -else $as_nop - tcl_cv_flag__largefile_source64=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then - -printf "%s\n" "#define _LARGEFILE_SOURCE64 1" >>confdefs.h - - tcl_flags="$tcl_flags _LARGEFILE_SOURCE64" - fi - + if test "${TCL_MAJOR_VERSION}" -ne 8 ; then + + if test ${tcl_cv_flag__file_offset_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +switch (0) { case 0: case (sizeof(off_t)==sizeof(long long)): ; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + tcl_cv_flag__file_offset_bits=no +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include +int +main (void) +{ +switch (0) { case 0: case (sizeof(off_t)==sizeof(long long)): ; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + tcl_cv_flag__file_offset_bits=yes +else $as_nop + tcl_cv_flag__file_offset_bits=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + if test "x${tcl_cv_flag__file_offset_bits}" = "xyes" ; then + +printf "%s\n" "#define _FILE_OFFSET_BITS 64" >>confdefs.h + + tcl_flags="$tcl_flags _FILE_OFFSET_BITS" + fi + + fi if test "x${tcl_flags}" = "x" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 printf "%s\n" "none" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${tcl_flags}" >&5 @@ -9143,10 +9139,79 @@ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${tcl_cv_type_64bit}" >&5 printf "%s\n" "${tcl_cv_type_64bit}" >&6; } # Now check for auxiliary declarations + if test "${TCL_MAJOR_VERSION}" -ne 8 ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit time_t" >&5 +printf %s "checking for 64-bit time_t... " >&6; } +if test ${tcl_cv_time_t_64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;} + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + tcl_cv_time_t_64=yes +else $as_nop + tcl_cv_time_t_64=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_time_t_64" >&5 +printf "%s\n" "$tcl_cv_time_t_64" >&6; } + if test "x${tcl_cv_time_t_64}" = "xno" ; then + # Note that _TIME_BITS=64 requires _FILE_OFFSET_BITS=64 + # which SC_TCL_EARLY_FLAGS has defined if necessary. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if _TIME_BITS=64 enables 64-bit time_t" >&5 +printf %s "checking if _TIME_BITS=64 enables 64-bit time_t... " >&6; } +if test ${tcl_cv__time_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _TIME_BITS 64 +#include +int +main (void) +{ +switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;} + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + tcl_cv__time_bits=yes +else $as_nop + tcl_cv__time_bits=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv__time_bits" >&5 +printf "%s\n" "$tcl_cv__time_bits" >&6; } + if test "x${tcl_cv__time_bits}" = "xyes" ; then + +printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h + + fi + fi + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent64" >&5 printf %s "checking for struct dirent64... " >&6; } if test ${tcl_cv_struct_dirent64+y} then : printf %s "(cached) " >&6 @@ -9563,14 +9628,17 @@ # substituted. (@@@ Might not be necessary anymore) #-------------------------------------------------------------------- PACKAGE_LIB_PREFIX8="${PACKAGE_LIB_PREFIX}" PACKAGE_LIB_PREFIX9="${PACKAGE_LIB_PREFIX}tcl9" - if test "${TCL_MAJOR_VERSION}" -gt 8 ; then + if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" == x; then PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX9}" else PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX8}" + +printf "%s\n" "#define TCL_MAJOR_VERSION 8" >>confdefs.h + fi if test "${TEA_PLATFORM}" = "windows" ; then if test "${SHARED_BUILD}" = "1" ; then # We force the unresolved linking of symbols that are really in # the private libraries of Tcl and Tk. @@ -9591,11 +9659,15 @@ eval eval "PKG_LIB_FILE8=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" eval eval "PKG_LIB_FILE9=${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" fi # Some packages build their own stubs libraries - eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" == x; then + eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub.a" + else + eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + fi if test "$GCC" = "yes"; then PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE} fi # These aren't needed on Windows (either MSVC or gcc) RANLIB=: @@ -9610,16 +9682,20 @@ eval eval "PKG_LIB_FILE8=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" eval eval "PKG_LIB_FILE9=lib${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" RANLIB=: else - eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" - eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + eval eval "PKG_LIB_FILE8=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" + eval eval "PKG_LIB_FILE9=lib${PACKAGE_LIB_PREFIX9}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" fi # Some packages build their own stubs libraries - eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" == x; then + eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub.a" + else + eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX8}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + fi fi # These are escaped so that only CFLAGS is picked up at configure time. # The other values will be substituted at make time. CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" @@ -9628,10 +9704,12 @@ fi + + # Substitute STUB_LIB_FILE in case package creates a stub library too. @@ -9748,10 +9826,14 @@ eval itk_STUB_LIB_FLAG="-litkstub${PACKAGE_VERSION}" else eval itk_LIB_FLAG="-litk`echo ${PACKAGE_VERSION} | tr -d .`" eval itk_STUB_LIB_FLAG="-litkstub`echo ${PACKAGE_VERSION} | tr -d .`" fi + if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tcl8}" == x; then + eval itk_STUB_LIB_FLAG="-litkstub" + fi + itk_BUILD_LIB_SPEC="-L`$CYGPATH $(pwd)` ${itk_LIB_FLAG}" itk_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` ${itk_LIB_FLAG}" itk_BUILD_STUB_LIB_SPEC="-L`$CYGPATH $(pwd)` ${itk_STUB_LIB_FLAG}" itk_STUB_LIB_SPEC="-L`$CYGPATH ${pkglibdir}` ${itk_STUB_LIB_FLAG}" itk_BUILD_STUB_LIB_PATH="`$CYGPATH $(pwd)`/${PKG_STUB_LIB_FILE}" @@ -9930,11 +10012,10 @@ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs - CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS="" : "${CONFIG_STATUS=./config.status}" @@ -10324,11 +10405,11 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by itk $as_me 4.2.3, which was +This file was extended by itk $as_me 4.2.4, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS @@ -10379,11 +10460,11 @@ ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -itk config.status 4.2.3 +itk config.status 4.2.4 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -17,11 +17,11 @@ # so you can encode the package version directly into the source files. # This will also define a special symbol for Windows (BUILD_ # so that we create the export library with the dll. #----------------------------------------------------------------------- -AC_INIT([itk], [4.2.3]) +AC_INIT([itk],[4.2.4]) #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. @@ -113,11 +113,11 @@ ]) TEA_ADD_HEADERS([generic/itk.h generic/itkInt.h]) TEA_ADD_INCLUDES([${ITCL_INCLUDES} -I\"`${CYGPATH} ${srcdir}/generic`\"]) TEA_ADD_LIBS([]) TEA_ADD_CFLAGS([]) -#TEA_ADD_STUB_SOURCES([itkStubLib.c]) +TEA_ADD_STUB_SOURCES([itkStubLib.c]) TEA_ADD_TCL_SOURCES([library/Archetype.itk library/Toplevel.itk library/Widget.itk library/itk.tcl library/tclIndex]) @@ -257,6 +257,6 @@ #-------------------------------------------------------------------- # Finally, substitute all of the various values into the files # specified with AC_CONFIG_FILES. #-------------------------------------------------------------------- -AC_OUTPUT() +AC_OUTPUT Index: doc/Archetype.n ================================================================== --- doc/Archetype.n +++ doc/Archetype.n @@ -46,11 +46,11 @@ the "hull" for the mega-widget. The \fBToplevel\fR base class inherits from \fBArchetype\fR, but adds a Tk toplevel which acts as the "hull". .PP \fIEach derived class must invoke the \fBitk_initialize\fP method -within its constructor\fR, so that all options are properly +within its constructor, so that all options are properly integrated and initialized in the composite list. .SH "PUBLIC METHODS" .PP Index: doc/itkvars.n ================================================================== --- doc/itkvars.n +++ doc/itkvars.n @@ -26,13 +26,13 @@ is set from the ITK_LIBRARY environment variable if it exists, or from a compiled-in value otherwise. .sp When \fB[incr\ Tk]\fR is added to an interpreter, it executes the script "\fCinit.itk\fR" in this directory. This script, -in turn, looks for other script files with the name "\fCinit.\fIxxx\fR". +in turn, looks for other script files with the name "\fCinit.\fR\fIxxx\fR". Mega-widget libraries will be automatically initialized if they -install a script named "\fCinit.\fIxxx\fR" in this directory, +install a script named "\fCinit.\fR\fIxxx\fR" in this directory, where "\fIxxx\fR" is the name of the mega-widget library. For example, the \fB[incr\ Widgets]\fR library installs the script "\fCinit.iwidgets\fR" in this directory. This script establishes the "iwidgets" namespace, and sets up autoloading for all \fB[incr\ Widgets]\fR commands. Index: generic/itk.decls ================================================================== --- generic/itk.decls +++ generic/itk.decls @@ -53,33 +53,33 @@ # # Functions used internally by this package: # declare 2 { - int Itk_ConfigBodyCmd (ClientData cdata, Tcl_Interp *interp, \ + int Itk_ConfigBodyCmd (void *cdata, Tcl_Interp *interp, \ int objc, Tcl_Obj *const objv[]) } declare 3 { - int Itk_UsualCmd (ClientData cdata, Tcl_Interp *interp, int objc, \ + int Itk_UsualCmd (void *cdata, Tcl_Interp *interp, int objc, \ Tcl_Obj *const objv[]) } # # Functions for managing options included in class definitions: # declare 4 { - int Itk_ClassOptionDefineCmd (ClientData cdata, Tcl_Interp *interp, \ + int Itk_ClassOptionDefineCmd (void *cdata, Tcl_Interp *interp, \ int objc, Tcl_Obj *const objv[]) } declare 5 { - int Itk_ClassOptionIllegalCmd (ClientData cdata, Tcl_Interp *interp, \ + int Itk_ClassOptionIllegalCmd (void *cdata, Tcl_Interp *interp, \ int objc, Tcl_Obj *const objv[]) } declare 6 { int Itk_ConfigClassOption (Tcl_Interp *interp, ItclObject *contextObj, \ - ClientData cdata, const char* newVal) + void *cdata, const char* newVal) } declare 7 { ItkClassOptTable* Itk_CreateClassOptTable( Tcl_Interp *interp, \ ItclClass *cdefn) } Index: generic/itk.h ================================================================== --- generic/itk.h +++ generic/itk.h @@ -69,11 +69,11 @@ #define ITK_MINOR_VERSION 2 #define ITK_RELEASE_LEVEL TCL_FINAL_RELEASE #define ITK_RELEASE_SERIAL 3 #define ITK_VERSION "4.2" -#define ITK_PATCH_LEVEL "4.2.3" +#define ITK_PATCH_LEVEL "4.2.4" /* * A special definition used to allow this header file to be included * in resource files so that they can get obtain version information from Index: generic/itkArchBase.c ================================================================== --- generic/itkArchBase.c +++ generic/itkArchBase.c @@ -27,11 +27,11 @@ /* * FORWARD DECLARATIONS */ static int Itk_PropagateOption (Tcl_Interp *interp, - ItclObject *contextObj, ClientData cdata, const char *newval); + ItclObject *contextObj, void *cdata, const char *newval); static int Itk_ArchSetOption (Tcl_Interp *interp, ArchInfo *info, const char *name, const char *value); static ArchComponent* Itk_CreateArchComponent ( @@ -46,17 +46,17 @@ ArchInfo *info, ArchOption *archOpt, const char *defVal, char *currVal); static void Itk_DelArchOption (ArchOption *archOpt); static int Itk_RemoveArchOptionPart (ArchInfo *info, - char *switchName, ClientData from); + char *switchName, void *from); static int Itk_IgnoreArchOptionPart (ArchInfo *info, GenericConfigOpt *opt); static ConfigCmdline* Itk_CreateConfigCmdline ( Tcl_Interp *interp, Tcl_Command accessCmd, char *switchName); -static void Itk_DeleteConfigCmdline (ClientData cdata); +static void Itk_DeleteConfigCmdline (void *cdata); static Tcl_HashTable* Itk_CreateGenericOptTable (Tcl_Interp *interp, const char *options); static void Itk_DelGenericOptTable (Tcl_HashTable *tPtr); @@ -110,11 +110,11 @@ * from the global list of Archetype objects. * ------------------------------------------------------------------------ */ void Itk_DelArchInfo( - ClientData cdata) /* client data for Archetype objects */ + void *cdata) /* client data for Archetype objects */ { ArchInfo *info = (ArchInfo*)cdata; Tcl_HashEntry *entry; Tcl_HashSearch place; @@ -163,11 +163,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchCompAddCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_HashEntry *entry = NULL; @@ -309,11 +309,11 @@ * Take the result from the widget creation commands as the * path name for the new component. Make a local copy of * this, since the interpreter will get used in the mean time. */ resultStr = Tcl_GetStringResult(interp); - path = (char*)ckalloc((unsigned)(strlen(resultStr)+1)); + path = (char*)ckalloc((strlen(resultStr)+1)); strcpy(path, resultStr); /* * Look for the access command token in the context of the * calling namespace. By-pass any protection at this point. @@ -346,11 +346,11 @@ if (!archComp) { goto compFail; } - Tcl_SetHashValue(entry, (ClientData)archComp); + Tcl_SetHashValue(entry, (void *)archComp); archComp->protection = pLevel; /* * If this component is the "hull" for the mega-widget, then * move the hull widget access command to a different name, @@ -406,11 +406,11 @@ Tcl_DStringAppend(&buffer, "::bind itk-destroy-", -1); Tcl_DStringAppend(&buffer, path, -1); Tcl_DStringAppend(&buffer, " [::itcl::code ", -1); Tcl_DStringAppend(&buffer, - Tcl_GetStringFromObj(objNamePtr,(int*)NULL), -1); + Tcl_GetString(objNamePtr), -1); Tcl_DStringAppend(&buffer, " itk_component delete ", -1); Tcl_DStringAppend(&buffer, name, -1); Tcl_DStringAppend(&buffer, "]\n", -1); Tcl_DStringAppend(&buffer, "::bindtags ", -1); @@ -432,11 +432,11 @@ * table to represent these, so they can be found quickly * by the option parsing commands in "itk::option-parser". */ Tcl_DStringSetLength(&buffer, 0); Tcl_DStringAppendElement(&buffer, - Tcl_GetStringFromObj(winNamePtr, (int*)NULL)); + Tcl_GetString(winNamePtr)); Tcl_DStringAppendElement(&buffer, "configure"); result = Tcl_Eval(interp, Tcl_DStringValue(&buffer)); if (result != TCL_OK) { @@ -563,11 +563,11 @@ Tcl_GetCommandFullName(contextObj->iclsPtr->interp, contextObj->accessCmd, objPtr); Tcl_AppendToObj(objPtr, "\")", -1); Tcl_IncrRefCount(objPtr); - Tcl_AddErrorInfo(interp, Tcl_GetStringFromObj(objPtr, (int*)NULL)); + Tcl_AppendObjToErrorInfo(interp, objPtr); Tcl_DecrRefCount(objPtr); return TCL_ERROR; } @@ -587,11 +587,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchCompDeleteCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int i; @@ -672,12 +672,12 @@ while (entry) { archOpt = (ArchOption*)Tcl_GetHashValue(entry); elem = Itcl_FirstListElem(&archOpt->parts); while (elem) { optPart = (ArchOptionPart*)Itcl_GetListValue(elem); - if (optPart->from == (ClientData)archComp) { - Itcl_AppendList(&delOptList, (ClientData)entry); + if (optPart->from == (void *)archComp) { + Itcl_AppendList(&delOptList, (void *)entry); } elem = Itcl_NextListElem(elem); } entry = Tcl_NextHashEntry(&place); } @@ -689,11 +689,11 @@ elem = Itcl_FirstListElem(&delOptList); while (elem) { entry = (Tcl_HashEntry*)Itcl_GetListValue(elem); token = (char *)Tcl_GetHashKey(&info->options, entry); - Itk_RemoveArchOptionPart(info, token, (ClientData)archComp); + Itk_RemoveArchOptionPart(info, token, (void *)archComp); elem = Itcl_NextListElem(elem); } Itcl_DeleteList(&delOptList); @@ -720,11 +720,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchOptKeepCmd( - ClientData clientData, /* option merging info record */ + void *clientData, /* option merging info record */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ArchMergeInfo *mergeInfo = (ArchMergeInfo*)clientData; @@ -748,11 +748,11 @@ * Make sure that this command is being accessed in the * proper context. The merge info record should be set up * properly. */ if (!mergeInfo->archInfo || !mergeInfo->optionTable) { - token = Tcl_GetStringFromObj(objv[0], (int*)NULL); + token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: \"", token, "\" should only be accessed via itk_component", (char*)NULL); return TCL_ERROR; @@ -762,11 +762,11 @@ * Scan through all of the options on the list, and make * sure that they are valid options for this component. * Integrate them into the option info for the mega-widget. */ for (i=1; i < objc; i++) { - token = Tcl_GetStringFromObj(objv[i], (int*)NULL); + token = Tcl_GetString(objv[i]); entry = Tcl_FindHashEntry(mergeInfo->optionTable, token); if (!entry) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "option not recognized: ", token, (char*)NULL); @@ -786,13 +786,13 @@ * to this option for this component. */ cmdlinePtr = Itk_CreateConfigCmdline(interp, mergeInfo->archComp->accessCmd, token); - optPart = Itk_CreateOptionPart(interp, (ClientData)cmdlinePtr, + optPart = Itk_CreateOptionPart(interp, (void *)cmdlinePtr, Itk_PropagateOption, Itk_DeleteConfigCmdline, - (ClientData)mergeInfo->archComp); + (void *)mergeInfo->archComp); result = Itk_AddOptionPart(interp, mergeInfo->archInfo, opt->switchName, opt->resName, opt->resClass, opt->init, opt->value, optPart, &archOpt); @@ -826,11 +826,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchOptIgnoreCmd( - ClientData clientData, /* option merging info record */ + void *clientData, /* option merging info record */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ArchMergeInfo *mergeInfo = (ArchMergeInfo*)clientData; @@ -850,11 +850,11 @@ * Make sure that this command is being accessed in the * proper context. The merge info record should be set up * properly. */ if (!mergeInfo->archInfo || !mergeInfo->optionTable) { - token = Tcl_GetStringFromObj(objv[0], (int*)NULL); + token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: \"", token, "\" should only be accessed via itk_component", (char*)NULL); return TCL_ERROR; @@ -864,11 +864,11 @@ * Scan through all of the options on the list, and make * sure that they are valid options for this component. * Remove them from the mega-widget. */ for (i=1; i < objc; i++) { - token = Tcl_GetStringFromObj(objv[i], (int*)NULL); + token = Tcl_GetString(objv[i]); entry = Tcl_FindHashEntry(mergeInfo->optionTable, token); if (!entry) { Tcl_AppendResult(interp, "option not recognized: ", token, (char*)NULL); return TCL_ERROR; @@ -901,11 +901,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchOptRenameCmd( - ClientData clientData, /* option merging info record */ + void *clientData, /* option merging info record */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ArchMergeInfo *mergeInfo = (ArchMergeInfo*)clientData; @@ -929,22 +929,22 @@ * Make sure that this command is being accessed in the * proper context. The merge info record should be set up * properly. */ if (!mergeInfo->archInfo || !mergeInfo->optionTable) { - char *token = Tcl_GetStringFromObj(objv[0], (int*)NULL); + char *token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: \"", token, "\" should only be accessed via itk_component", (char*)NULL); return TCL_ERROR; } - oldSwitch = Tcl_GetStringFromObj(objv[1], (int*)NULL); - newSwitch = Tcl_GetStringFromObj(objv[2], (int*)NULL); - resName = Tcl_GetStringFromObj(objv[3], (int*)NULL); - resClass = Tcl_GetStringFromObj(objv[4], (int*)NULL); + oldSwitch = Tcl_GetString(objv[1]); + newSwitch = Tcl_GetString(objv[2]); + resName = Tcl_GetString(objv[3]); + resClass = Tcl_GetString(objv[4]); /* * Make sure that the resource name and resource class look good. */ if (!islower((int)*resName)) { @@ -985,13 +985,13 @@ * to this option for this component. */ cmdlinePtr = Itk_CreateConfigCmdline(interp, mergeInfo->archComp->accessCmd, oldSwitch); - optPart = Itk_CreateOptionPart(interp, (ClientData)cmdlinePtr, + optPart = Itk_CreateOptionPart(interp, (void *)cmdlinePtr, Itk_PropagateOption, Itk_DeleteConfigCmdline, - (ClientData)mergeInfo->archComp); + (void *)mergeInfo->archComp); /* * Merge this option into the mega-widget with a new name. */ result = Itk_AddOptionPart(interp, mergeInfo->archInfo, newSwitch, @@ -1031,11 +1031,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchOptUsualCmd( - ClientData clientData, /* option merging info record */ + void *clientData, /* option merging info record */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ArchMergeInfo *mergeInfo = (ArchMergeInfo*)clientData; @@ -1054,11 +1054,11 @@ * Make sure that this command is being accessed in the * proper context. The merge info record should be set up * properly. */ if (!mergeInfo->archInfo || !mergeInfo->optionTable) { - char *token = Tcl_GetStringFromObj(objv[0], (int*)NULL); + char *token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: \"", token, "\" should only be accessed via itk_component", (char*)NULL); return TCL_ERROR; @@ -1068,11 +1068,11 @@ * If a tag name was specified, then use this to look up * the "usual" code. Otherwise, use the class name for * the component widget. */ if (objc == 2) { - tag = Tcl_GetStringFromObj(objv[1], (int*)NULL); + tag = Tcl_GetString(objv[1]); } else { tag = Tk_Class(mergeInfo->archComp->tkwin); } /* @@ -1115,11 +1115,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_UsualCmd( - ClientData clientData, /* option merging info record */ + void *clientData, /* option merging info record */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ArchMergeInfo *mergeInfo = (ArchMergeInfo*)clientData; @@ -1153,30 +1153,30 @@ /* * If a code fragment was specified, then save it in the * hash table for "usual" code. */ if (objc == 3) { - token = Tcl_GetStringFromObj(objv[1], (int*)NULL); + token = Tcl_GetString(objv[1]); entry = Tcl_CreateHashEntry(&mergeInfo->usualCode, token, &newEntry); if (!newEntry) { codePtr = (Tcl_Obj*)Tcl_GetHashValue(entry); Tcl_DecrRefCount(codePtr); } codePtr = objv[2]; Tcl_IncrRefCount(codePtr); - Tcl_SetHashValue(entry, (ClientData)codePtr); + Tcl_SetHashValue(entry, (void *)codePtr); return TCL_OK; } } /* * Otherwise, look for a code fragment with the specified tag. */ - token = Tcl_GetStringFromObj(objv[1], (int*)NULL); + token = Tcl_GetString(objv[1]); entry = Tcl_FindHashEntry(&mergeInfo->usualCode, token); if (entry) { codePtr = (Tcl_Obj*)Tcl_GetHashValue(entry); Tcl_SetObjResult(interp, codePtr); } @@ -1204,11 +1204,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchOptionAddCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclClass *contextClass; @@ -1278,16 +1278,16 @@ Tcl_DStringFree(&buffer); return TCL_ERROR; } optPart = Itk_FindArchOptionPart(info, Tcl_GetString(opt->namePtr), - (ClientData)iclsPtr); + (void *)iclsPtr); if (!optPart) { - optPart = Itk_CreateOptionPart(interp, (ClientData)opt, + optPart = Itk_CreateOptionPart(interp, (void *)opt, Itk_ConfigClassOption, (Tcl_CmdDeleteProc*)NULL, - (ClientData)iclsPtr); + (void *)iclsPtr); result = Itk_AddOptionPart(interp, info, Tcl_GetString(opt->namePtr), opt->resName, opt->resClass, opt->init, (char*)NULL, optPart, &archOpt); @@ -1332,19 +1332,19 @@ Tcl_AddErrorInfo(interp, msg); return TCL_ERROR; } optPart = Itk_FindArchOptionPart(info, generic->switchName, - (ClientData)archComp); + (void *)archComp); if (!optPart) { cmdlinePtr = Itk_CreateConfigCmdline(interp, archComp->accessCmd, generic->switchName); - optPart = Itk_CreateOptionPart(interp, (ClientData)cmdlinePtr, + optPart = Itk_CreateOptionPart(interp, (void *)cmdlinePtr, Itk_PropagateOption, Itk_DeleteConfigCmdline, - (ClientData)archComp); + (void *)archComp); result = Itk_AddOptionPart(interp, info, generic->switchName, generic->resName, generic->resClass, generic->init, generic->value, optPart, &archOpt); @@ -1393,11 +1393,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchOptionRemoveCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclClass *contextClass; @@ -1463,11 +1463,11 @@ Tcl_DStringFree(&buffer); return TCL_ERROR; } Itk_RemoveArchOptionPart(info, Tcl_GetString(opt->namePtr), - (ClientData)iclsPtr); + (void *)iclsPtr); Tcl_DStringFree(&buffer); continue; } Tcl_DStringFree(&buffer); @@ -1501,11 +1501,11 @@ Tcl_AddErrorInfo(interp, msg); return TCL_ERROR; } Itk_RemoveArchOptionPart(info, generic->switchName, - (ClientData)archComp); + (void *)archComp); Itk_DelGenericOpt(generic); continue; } @@ -1540,11 +1540,11 @@ /* ARGSUSED */ static int Itk_PropagateOption( Tcl_Interp *interp, /* interpreter managing the class */ ItclObject *contextObj, /* itcl object being configured */ - ClientData cdata, /* command prefix to use for configuration */ + void *cdata, /* command prefix to use for configuration */ const char *newval) /* new value for this option */ { ConfigCmdline *cmdlinePtr = (ConfigCmdline*)cdata; int result; Tcl_Obj *objPtr; @@ -1576,11 +1576,11 @@ /* ARGSUSED */ int Itk_PropagatePublicVar( Tcl_Interp *interp, /* interpreter managing the class */ ItclObject *contextObj, /* itcl object being configured */ - ClientData cdata, /* command prefix to use for configuration */ + void *cdata, /* command prefix to use for configuration */ const char *newval) /* new value for this option */ { ItclVariable *ivPtr = (ItclVariable*)cdata; int result = TCL_OK; @@ -1765,11 +1765,11 @@ v = ItclGetInstanceVar(interp, "itk_option", archOpt->switchName, ioPtr, iclsPtr); #endif if (v) { - lastval = (char*)ckalloc((unsigned)(strlen(v)+1)); + lastval = (char*)ckalloc((strlen(v)+1)); strcpy(lastval, v); } else { lastval = NULL; } @@ -1910,11 +1910,11 @@ if (init && (!archOpt->init || (strcmp(init, archOpt->init) != 0))) { if (!archOpt->init) { ckfree(archOpt->init); } - archOpt->init = (char*)ckalloc((unsigned)(strlen(init)+1)); + archOpt->init = (char*)ckalloc((strlen(init)+1)); strcpy(archOpt->init, init); if (Itk_ArchSetOption(interp, info, archOpt->switchName, init) != TCL_OK) { return NULL; @@ -1934,11 +1934,11 @@ Tcl_IncrRefCount(archComp->namePtr); archComp->iclsPtr = iclsPtr; archComp->protection = ITCL_PUBLIC; archComp->accessCmd = accessCmd; archComp->tkwin = tkwin; - archComp->pathName = (char *) ckalloc((unsigned)(strlen(wname)+1)); + archComp->pathName = (char *) ckalloc((strlen(wname)+1)); strcpy(archComp->pathName, wname); return archComp; } @@ -2003,11 +2003,11 @@ /* * If the switch does not have a leading "-", add it on. */ if (*switchName != '-') { - name = (char *)ckalloc((unsigned)(strlen(switchName)+2)); + name = (char *)ckalloc((strlen(switchName)+2)); *name = '-'; strcpy(name+1, switchName); } else { name = switchName; } @@ -2020,11 +2020,11 @@ entry = Tcl_CreateHashEntry(&info->options, name, &newEntry); if (!newEntry) { archOpt = (ArchOption*)Tcl_GetHashValue(entry); if (resName && !archOpt->resName) { - archOpt->resName = (char*)ckalloc((unsigned)(strlen(resName)+1)); + archOpt->resName = (char*)ckalloc((strlen(resName)+1)); strcpy(archOpt->resName, resName); } else if (resName && strcmp(archOpt->resName, resName) != 0) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad resource name \"", resName, "\" for option \"", @@ -2033,11 +2033,11 @@ result = TCL_ERROR; goto getArchOptionDone; } if (resClass && !archOpt->resClass) { - archOpt->resClass = (char*)ckalloc((unsigned)(strlen(resClass)+1)); + archOpt->resClass = (char*)ckalloc((strlen(resClass)+1)); strcpy(archOpt->resClass, resClass); } else { if (resClass && strcmp(archOpt->resClass, resClass) != 0) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad resource class \"", resClass, "\" for option \"", @@ -2061,22 +2061,22 @@ * Create the record to represent this option, and save it * in the option table. */ archOpt = (ArchOption*)ckalloc(sizeof(ArchOption)); - archOpt->switchName = (char*)ckalloc((unsigned)(strlen(name)+1)); + archOpt->switchName = (char*)ckalloc((strlen(name)+1)); strcpy(archOpt->switchName, name); if (resName) { - archOpt->resName = (char*)ckalloc((unsigned)(strlen(resName)+1)); + archOpt->resName = (char*)ckalloc((strlen(resName)+1)); strcpy(archOpt->resName, resName); } else { archOpt->resName = NULL; } if (resClass) { - archOpt->resClass = (char*)ckalloc((unsigned)(strlen(resClass)+1)); + archOpt->resClass = (char*)ckalloc((strlen(resClass)+1)); strcpy(archOpt->resClass, resClass); } else { archOpt->resClass = NULL; } @@ -2084,11 +2084,11 @@ Itcl_InitList(&archOpt->parts); archOpt->init = NULL; Itk_InitArchOption(interp,info,archOpt,defVal,currVal); - Tcl_SetHashValue(entry, (ClientData)archOpt); + Tcl_SetHashValue(entry, (void *)archOpt); Itk_OptListAdd(&info->order, entry); *aoPtr = archOpt; getArchOptionDone: @@ -2166,11 +2166,11 @@ Tcl_SetVar2(interp, "itk_option", archOpt->switchName, (char *)((ival) ? ival : ""), 0); if (ival) { - archOpt->init = (char*)ckalloc((unsigned)(strlen(ival)+1)); + archOpt->init = (char*)ckalloc((strlen(ival)+1)); strcpy(archOpt->init, ival); } } /* @@ -2235,14 +2235,14 @@ * ------------------------------------------------------------------------ */ ArchOptionPart* Itk_CreateOptionPart( Tcl_Interp *interp, /* interpreter handling this request */ - ClientData cdata, /* data representing this part */ + void *cdata, /* data representing this part */ Itk_ConfigOptionPartProc *cproc, /* proc used to apply config changes */ Tcl_CmdDeleteProc *dproc, /* proc used to clean up ClientData */ - ClientData from) /* who contributed this option */ + void *from) /* who contributed this option */ { ArchOptionPart *optPart; /* * Create the record to represent this part of the option. @@ -2306,11 +2306,11 @@ * Add the option part to the composite option. If the * composite option has already been configured, then * simply update this part to the current value. Otherwise, * leave the configuration to Itk_ArchInitCmd(). */ - elemPtr = Itcl_AppendList(&archOpt->parts, (ClientData)optPart); + elemPtr = Itcl_AppendList(&archOpt->parts, (void *)optPart); if ((archOpt->flags & ITK_ARCHOPT_INIT) != 0) { if (result == TCL_OK) { init = Tcl_GetVar2(interp, "itk_option", archOpt->switchName, 0); @@ -2354,11 +2354,11 @@ */ ArchOptionPart* Itk_FindArchOptionPart( ArchInfo *info, /* info for Archetype mega-widget */ char *switchName, /* name of command-line switch */ - ClientData from) /* who contributed this option */ + void *from) /* who contributed this option */ { ArchOptionPart *optPart = NULL; char *name; Tcl_HashEntry *entry; @@ -2368,11 +2368,11 @@ /* * If the switch does not have a leading "-", add it on. */ if (*switchName != '-') { - name = (char *)ckalloc((unsigned)(strlen(switchName)+2)); + name = (char *)ckalloc((strlen(switchName)+2)); *name = '-'; strcpy(name+1, switchName); } else { name = switchName; } @@ -2425,11 +2425,11 @@ */ static int Itk_RemoveArchOptionPart( ArchInfo *info, /* info for Archetype mega-widget */ char *switchName, /* name of command-line switch */ - ClientData from) /* who contributed this option */ + void *from) /* who contributed this option */ { int result = 0; char *name; Tcl_HashEntry *entry; @@ -2642,11 +2642,11 @@ * with the configure command. * ------------------------------------------------------------------------ */ static void Itk_DeleteConfigCmdline( - ClientData cdata) /* command to be freed */ + void *cdata) /* command to be freed */ { ConfigCmdline *cmdlinePtr = (ConfigCmdline*)cdata; int i; /* @@ -2683,16 +2683,17 @@ static Tcl_HashTable* Itk_CreateGenericOptTable( Tcl_Interp *interp, /* interpreter handling this request */ const char *options) /* string description of config options */ { - int confc; + Tcl_Size confc; const char **confv = NULL; - int optc; + Tcl_Size optc; const char **optv = NULL; - int i, newEntry; + Tcl_Size i; + int newEntry; Tcl_HashTable *tPtr; Tcl_HashEntry *entry; GenericConfigOpt *info; tPtr = (Tcl_HashTable*)ckalloc(sizeof(Tcl_HashTable)); @@ -2720,11 +2721,11 @@ info->init = (char *)optv[3]; info->value = (char *)optv[4]; info->storage = (char **)optv; info->integrated = NULL; info->optPart = NULL; - Tcl_SetHashValue(entry, (ClientData)info); + Tcl_SetHashValue(entry, (void *)info); } } else { ckfree((char*)optv); } @@ -2800,11 +2801,12 @@ Tcl_Command accessCmd) /* access command for component */ { GenericConfigOpt *genericOpt = NULL; Tcl_Obj *codePtr = NULL; - int optc, result; + Tcl_Size optc; + int result; const char **optv; char *name; const char *my_name; char *info; Tcl_Obj *resultPtr; @@ -2811,11 +2813,11 @@ /* * If the switch does not have a leading "-", add it on. */ if (*switchName != '-') { - name = (char *)ckalloc((unsigned)(strlen(switchName)+2)); + name = (char *)ckalloc((strlen(switchName)+2)); *name = '-'; strcpy(name+1, switchName); my_name = name; } else { my_name = switchName; @@ -2840,11 +2842,11 @@ * Only consider options with all 5 required components. Avoid * aliases like "-bg". */ resultPtr = Tcl_GetObjResult(interp); Tcl_IncrRefCount(resultPtr); - info = Tcl_GetStringFromObj(resultPtr, (int*)NULL); + info = Tcl_GetString(resultPtr); result = Tcl_SplitList(interp, info, &optc, &optv); Tcl_DecrRefCount(resultPtr); Index: generic/itkArchetype.c ================================================================== --- generic/itkArchetype.c +++ generic/itkArchetype.c @@ -93,39 +93,39 @@ * Declare all of the C routines that are integrated into * the Archetype base class. */ if (Itcl_RegisterObjC(interp, "Archetype-init", Itk_ArchInitOptsCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || Itcl_RegisterObjC(interp, "Archetype-delete", Itk_ArchDeleteOptsCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || Itcl_RegisterObjC(interp, "Archetype-itk_component", Itk_ArchComponentCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || Itcl_RegisterObjC(interp, "Archetype-itk_option", Itk_ArchOptionCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || Itcl_RegisterObjC(interp, "Archetype-itk_initialize", Itk_ArchInitCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || Itcl_RegisterObjC(interp, "Archetype-component", Itk_ArchCompAccessCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || Itcl_RegisterObjC(interp, "Archetype-configure",Itk_ArchConfigureCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || Itcl_RegisterObjC(interp, "Archetype-cget",Itk_ArchCgetCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK) { + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK) { return TCL_ERROR; } /* @@ -155,42 +155,42 @@ mergeInfo->archInfo = NULL; mergeInfo->archComp = NULL; mergeInfo->optionTable = NULL; parserNs = Tcl_CreateNamespace(interp, "::itk::option-parser", - (ClientData)mergeInfo, Itcl_ReleaseData); + (void *)mergeInfo, Itcl_ReleaseData); if (!parserNs) { Itk_DelMergeInfo(mergeInfo); Tcl_AddErrorInfo(interp, "\n (while initializing itk)"); return TCL_ERROR; } - Itcl_PreserveData((ClientData)mergeInfo); - Itcl_EventuallyFree((ClientData)mergeInfo, (Tcl_FreeProc *)Itk_DelMergeInfo); + Itcl_PreserveData((void *)mergeInfo); + Itcl_EventuallyFree((void *)mergeInfo, (Tcl_FreeProc *)Itk_DelMergeInfo); Tcl_CreateObjCommand(interp, "::itk::option-parser::keep", Itk_ArchOptKeepCmd, - (ClientData)mergeInfo, (Tcl_CmdDeleteProc*)NULL); + (void *)mergeInfo, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand(interp, "::itk::option-parser::ignore", Itk_ArchOptIgnoreCmd, - (ClientData)mergeInfo, (Tcl_CmdDeleteProc*)NULL); + (void *)mergeInfo, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand(interp, "::itk::option-parser::rename", Itk_ArchOptRenameCmd, - (ClientData)mergeInfo, (Tcl_CmdDeleteProc*)NULL); + (void *)mergeInfo, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand(interp, "::itk::option-parser::usual", Itk_ArchOptUsualCmd, - (ClientData)mergeInfo, (Tcl_CmdDeleteProc*)NULL); + (void *)mergeInfo, (Tcl_CmdDeleteProc*)NULL); /* * Add the "itk::usual" command to register option handling code. */ Tcl_CreateObjCommand(interp, "::itk::usual", Itk_UsualCmd, - (ClientData)mergeInfo, Itcl_ReleaseData); - Itcl_PreserveData((ClientData)mergeInfo); + (void *)mergeInfo, Itcl_ReleaseData); + Itcl_PreserveData((void *)mergeInfo); return TCL_OK; } /* @@ -212,11 +212,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchetypeCmd( - ClientData clientData, /* class definition */ + void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclShowArgs(2, "Itk_ArchetypeCmd", objc, objv); @@ -246,11 +246,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchInitOptsCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int newEntry; @@ -295,11 +295,11 @@ entry = Tcl_CreateHashEntry(objsWithArchInfo, (char*)contextObj, &newEntry); if (!newEntry) { Itk_DelArchInfo( Tcl_GetHashValue(entry) ); } - Tcl_SetHashValue(entry, (ClientData)info); + Tcl_SetHashValue(entry, (void *)info); /* * Make sure that the access command for this object * resides in the global namespace. If need be, move * the command. @@ -341,11 +341,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchDeleteOptsCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclClass *contextClass; @@ -359,11 +359,11 @@ } contextClass = NULL; if (Itcl_GetContext(interp, &contextClass, &contextObj) != TCL_OK || !contextObj) { - char *token = Tcl_GetStringFromObj(objv[0], (int*)NULL); + char *token = Tcl_GetString(objv[0]); Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot use \"", token, "\" without an object context", (char*)NULL); return TCL_ERROR; @@ -399,11 +399,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchComponentCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { char *cmd; @@ -472,11 +472,11 @@ Tcl_DStringFree(&buffer); /* * Flag any errors. */ - cmd = Tcl_GetStringFromObj(objv[0], (int*)NULL); + cmd = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option \"", token, "\": should be one of...\n", " ", cmd, " add name createCmds ?optionCmds?\n", " ", cmd, " delete name ?name name...?", @@ -503,11 +503,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchInitCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclClass *contextClass; @@ -575,16 +575,16 @@ if (varPtr && TclIsVarArray(varPtr)) { continue; } optPart = Itk_FindArchOptionPart(info, - Tcl_GetString(ivPtr->namePtr), (ClientData)ivPtr); + Tcl_GetString(ivPtr->namePtr), (void *)ivPtr); if (!optPart) { - optPart = Itk_CreateOptionPart(interp, (ClientData)ivPtr, + optPart = Itk_CreateOptionPart(interp, (void *)ivPtr, Itk_PropagatePublicVar, (Tcl_CmdDeleteProc*)NULL, - (ClientData)ivPtr); + (void *)ivPtr); val = Itcl_GetInstanceVar(interp, Tcl_GetString(ivPtr->namePtr), contextObj, iclsPtr); @@ -610,16 +610,16 @@ if (optTable) { for (i=0; i < optTable->order.len; i++) { opt = (ItkClassOption*)Tcl_GetHashValue(optTable->order.list[i]); optPart = Itk_FindArchOptionPart(info, Tcl_GetString(opt->namePtr), - (ClientData)contextClass); + (void *)contextClass); if (!optPart) { - optPart = Itk_CreateOptionPart(interp, (ClientData)opt, + optPart = Itk_CreateOptionPart(interp, (void *)opt, Itk_ConfigClassOption, (Tcl_CmdDeleteProc*)NULL, - (ClientData)contextClass); + (void *)contextClass); result = Itk_AddOptionPart(interp, info, Tcl_GetString(opt->namePtr), opt->resName, opt->resClass, opt->init, (char*)NULL, optPart, &archOpt); @@ -719,11 +719,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchOptionCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { char *cmd; @@ -828,11 +828,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchCompAccessCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int i; @@ -845,11 +845,11 @@ ItclObject *contextObj; Tcl_HashEntry *entry; Tcl_HashSearch place; ArchInfo *info; ArchComponent *archComp; - int cmdlinec; + Tcl_Size cmdlinec; Tcl_Obj *objPtr; Tcl_Obj *cmdlinePtr; Tcl_Obj **cmdlinev; ItclShowArgs(2, "Itk_ArchCompAccessCmd", objc, objv); @@ -1015,11 +1015,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchConfigureCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int i; @@ -1171,11 +1171,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ArchCgetCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { const char *token; Index: generic/itkBase.c ================================================================== --- generic/itkBase.c +++ generic/itkBase.c @@ -118,17 +118,17 @@ static int Initialize( Tcl_Interp *interp) /* interpreter to be updated */ { Tcl_Namespace *itkNs, *parserNs; - ClientData parserInfo; + void *parserInfo; Tcl_CmdInfo info; - if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { + if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { return TCL_ERROR; } - if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) { + if (Tk_InitStubs(interp, "8.6-", 0) == NULL) { return TCL_ERROR; }; if (Itcl_InitStubs(interp, "4.1", 0) == NULL) { return TCL_ERROR; } @@ -161,16 +161,16 @@ Itcl_PreserveData(parserInfo); if (Itcl_AddEnsemblePart(interp, "::itcl::parser::itk_option", "add", "name ?name name...?", Itk_ClassOptionIllegalCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK || Itcl_AddEnsemblePart(interp, "::itcl::parser::itk_option", "remove", "name ?name name...?", Itk_ClassOptionIllegalCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK) { + (void *)NULL, (Tcl_CmdDeleteProc*)NULL) != TCL_OK) { return TCL_ERROR; } /* @@ -184,11 +184,11 @@ * Create the "itk" namespace. Export all the commands in * the namespace so that they can be imported by a command * such as "namespace import itk::*" */ itkNs = Tcl_CreateNamespace(interp, "::itk", - (ClientData)NULL, (Tcl_NamespaceDeleteProc*)NULL); + (void *)NULL, (Tcl_NamespaceDeleteProc*)NULL); } if (!itkNs || Tcl_Export(interp, itkNs, "*", /* resetListFirst */ 1) != TCL_OK) { return TCL_ERROR; @@ -204,11 +204,11 @@ /* * Fix the "itcl::configbody" command to recognize mega-widget * options. */ Tcl_CreateObjCommand(interp, "::itcl::configbody", Itk_ConfigBodyCmd, - (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + (void *)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_SetVar(interp, "::itk::version", ITK_VERSION, TCL_NAMESPACE_ONLY); Tcl_SetVar(interp, "::itk::patchLevel", ITK_PATCH_LEVEL, TCL_NAMESPACE_ONLY); @@ -272,13 +272,13 @@ #ifdef STATIC_BUILD ".static" #endif ), NULL); } - Tcl_PkgProvideEx(interp, "Itk", ITK_PATCH_LEVEL, (ClientData) &itkStubs); + Tcl_PkgProvideEx(interp, "Itk", ITK_PATCH_LEVEL, (void *) &itkStubs); return Tcl_PkgProvideEx(interp, "itk", ITK_PATCH_LEVEL, - (ClientData) &itkStubs); + (void *) &itkStubs); } /* * ------------------------------------------------------------------------ * Itk_Init() Index: generic/itkCmd.c ================================================================== --- generic/itkCmd.c +++ generic/itkCmd.c @@ -46,11 +46,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ConfigBodyCmd( - ClientData dummy, /* unused */ + void *dummy, /* unused */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int result = TCL_OK; @@ -131,19 +131,19 @@ result = TCL_ERROR; goto configBodyCmdDone; } - Itcl_PreserveData((ClientData)mcode); + Itcl_PreserveData((void *)mcode); #ifdef NOTDEF - Itcl_EventuallyFree((ClientData)mcode, (Tcl_FreeProc *)Itcl_DeleteMemberCode); + Itcl_EventuallyFree((void *)mcode, (Tcl_FreeProc *)Itcl_DeleteMemberCode); #endif if (opt->codePtr) { - Itcl_ReleaseData((ClientData)opt->codePtr); + Itcl_ReleaseData((void *)opt->codePtr); } opt->codePtr = mcode; configBodyCmdDone: Tcl_DStringFree(&buffer); return result; } Index: generic/itkHelpers.c ================================================================== --- generic/itkHelpers.c +++ generic/itkHelpers.c @@ -52,11 +52,11 @@ if (info->itclObj && info->itclObj->accessCmd) { Tcl_AppendToObj(objPtr, " for widget \"", -1); Tcl_GetCommandFullName(interp, info->itclObj->accessCmd, objPtr); Tcl_AppendToObj(objPtr, "\")", -1); } - Tcl_AddErrorInfo(interp, Tcl_GetStringFromObj(objPtr, (int*)NULL)); + Tcl_AddErrorInfo(interp, Tcl_GetString(objPtr)); Tcl_DecrRefCount(objPtr); } /* @@ -159,11 +159,11 @@ if (!objTable) { objTable = (Tcl_HashTable*)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(objTable, TCL_ONE_WORD_KEYS); Tcl_SetAssocData(interp, "itk_objsWithArchInfo", - ItkFreeObjsWithArchInfo, (ClientData)objTable); + ItkFreeObjsWithArchInfo, (void *)objTable); } return objTable; } /* @@ -174,11 +174,11 @@ * free up the associated data created by ItkGetObjsWithArchInfo. * ------------------------------------------------------------------------ */ void ItkFreeObjsWithArchInfo( - ClientData clientData, /* associated data */ + void *clientData, /* associated data */ Tcl_Interp *interp) /* interpreter being freed */ { Tcl_HashTable *tablePtr = (Tcl_HashTable*)clientData; Tcl_HashSearch place; Tcl_HashEntry *entry; Index: generic/itkInt.h ================================================================== --- generic/itkInt.h +++ generic/itkInt.h @@ -106,18 +106,18 @@ /* * Various parts of a composite option in an Archetype mega-widget: */ typedef int (Itk_ConfigOptionPartProc) (Tcl_Interp *interp, - ItclObject *contextObj, ClientData cdata, const char* newVal); + ItclObject *contextObj, void *cdata, const char* newVal); typedef struct ArchOptionPart { - ClientData clientData; /* data associated with this part */ + void *clientData; /* data associated with this part */ Itk_ConfigOptionPartProc *configProc; /* update when new vals arrive */ Tcl_CmdDeleteProc *deleteProc; /* clean up after clientData */ - ClientData from; /* token that indicates who + void *from; /* token that indicates who * contributed this option part */ } ArchOptionPart; /* @@ -155,67 +155,67 @@ */ typedef struct ConfigCmdline { Tcl_Obj *objv[4]; /* objects representing "configure" command */ } ConfigCmdline; -MODULE_SCOPE int Itk_ArchInitOptsCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchDeleteOptsCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchComponentCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchInitCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchOptionCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchCompAccessCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchConfigureCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchCgetCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); - -MODULE_SCOPE int Itk_ArchCompAddCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchCompDeleteCmd (ClientData cdata, +MODULE_SCOPE int Itk_ArchInitOptsCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Itk_ArchDeleteOptsCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Itk_ArchComponentCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Itk_ArchInitCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Itk_ArchOptionCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Itk_ArchCompAccessCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Itk_ArchConfigureCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Itk_ArchCgetCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); + +MODULE_SCOPE int Itk_ArchCompAddCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Itk_ArchCompDeleteCmd (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int Itk_ArchConfigOption (Tcl_Interp *interp, ArchInfo *info, char *name, char *value); -MODULE_SCOPE int Itk_ArchOptionAddCmd (ClientData cdata, +MODULE_SCOPE int Itk_ArchOptionAddCmd (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchOptionRemoveCmd (ClientData cdata, +MODULE_SCOPE int Itk_ArchOptionRemoveCmd (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int Itk_PropagatePublicVar (Tcl_Interp *interp, - ItclObject *contextObj, ClientData cdata, const char *newval); + ItclObject *contextObj, void *cdata, const char *newval); MODULE_SCOPE int Itk_GetArchInfo (Tcl_Interp *interp, ItclObject* contextObj, ArchInfo **infoPtr); MODULE_SCOPE void Itk_ArchOptConfigError (Tcl_Interp *interp, ArchInfo *info, ArchOption *archOpt); MODULE_SCOPE void Itk_ArchOptAccessError (Tcl_Interp *interp, ArchInfo *info, ArchOption *archOpt); MODULE_SCOPE ArchOptionPart* Itk_CreateOptionPart ( - Tcl_Interp *interp, ClientData cdata, Itk_ConfigOptionPartProc* cproc, - Tcl_CmdDeleteProc *dproc, ClientData from); + Tcl_Interp *interp, void *cdata, Itk_ConfigOptionPartProc* cproc, + Tcl_CmdDeleteProc *dproc, void *from); MODULE_SCOPE int Itk_AddOptionPart (Tcl_Interp *interp, ArchInfo *info, char *switchName, char *resName, char *resClass, const char *defVal, char *currVal, ArchOptionPart *optPart, ArchOption **raOpt); MODULE_SCOPE ArchOptionPart* Itk_FindArchOptionPart ( - ArchInfo *info, char *switchName, ClientData from); + ArchInfo *info, char *switchName, void *from); MODULE_SCOPE void Itk_DelOptionPart (ArchOptionPart *optPart); -MODULE_SCOPE void Itk_DelArchInfo (ClientData cdata); +MODULE_SCOPE void Itk_DelArchInfo (void *cdata); MODULE_SCOPE Tcl_HashTable* ItkGetObjsWithArchInfo (Tcl_Interp *interp); -MODULE_SCOPE void ItkFreeObjsWithArchInfo (ClientData cdata, +MODULE_SCOPE void ItkFreeObjsWithArchInfo (void *cdata, Tcl_Interp *interp); MODULE_SCOPE void Itk_DelMergeInfo (void* cdata); -MODULE_SCOPE int Itk_ArchOptKeepCmd (ClientData cdata, +MODULE_SCOPE int Itk_ArchOptKeepCmd (void *cdata, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Itk_ArchOptIgnoreCmd (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchOptIgnoreCmd (ClientData cdata, +MODULE_SCOPE int Itk_ArchOptRenameCmd (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchOptRenameCmd (ClientData cdata, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Itk_ArchOptUsualCmd (ClientData cdata, +MODULE_SCOPE int Itk_ArchOptUsualCmd (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #include "itkIntDecls.h" Index: generic/itkIntDecls.h ================================================================== --- generic/itkIntDecls.h +++ generic/itkIntDecls.h @@ -13,27 +13,26 @@ */ /* Slot 0 is reserved */ /* Slot 1 is reserved */ /* 2 */ -ITKAPI int Itk_ConfigBodyCmd(ClientData cdata, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +ITKAPI int Itk_ConfigBodyCmd(void *cdata, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); /* 3 */ -ITKAPI int Itk_UsualCmd(ClientData cdata, Tcl_Interp *interp, +ITKAPI int Itk_UsualCmd(void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 4 */ -ITKAPI int Itk_ClassOptionDefineCmd(ClientData cdata, +ITKAPI int Itk_ClassOptionDefineCmd(void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 5 */ -ITKAPI int Itk_ClassOptionIllegalCmd(ClientData cdata, +ITKAPI int Itk_ClassOptionIllegalCmd(void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 6 */ ITKAPI int Itk_ConfigClassOption(Tcl_Interp *interp, - ItclObject *contextObj, ClientData cdata, + ItclObject *contextObj, void *cdata, const char*newVal); /* 7 */ ITKAPI ItkClassOptTable* Itk_CreateClassOptTable(Tcl_Interp *interp, ItclClass *cdefn); /* 8 */ @@ -68,15 +67,15 @@ int revision; void *hooks; void (*reserved0)(void); void (*reserved1)(void); - int (*itk_ConfigBodyCmd) (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 2 */ - int (*itk_UsualCmd) (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 3 */ - int (*itk_ClassOptionDefineCmd) (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 4 */ - int (*itk_ClassOptionIllegalCmd) (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 5 */ - int (*itk_ConfigClassOption) (Tcl_Interp *interp, ItclObject *contextObj, ClientData cdata, const char*newVal); /* 6 */ + int (*itk_ConfigBodyCmd) (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 2 */ + int (*itk_UsualCmd) (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 3 */ + int (*itk_ClassOptionDefineCmd) (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 4 */ + int (*itk_ClassOptionIllegalCmd) (void *cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 5 */ + int (*itk_ConfigClassOption) (Tcl_Interp *interp, ItclObject *contextObj, void *cdata, const char*newVal); /* 6 */ ItkClassOptTable* (*itk_CreateClassOptTable) (Tcl_Interp *interp, ItclClass *cdefn); /* 7 */ ItkClassOptTable* (*itk_FindClassOptTable) (ItclClass *cdefn); /* 8 */ void (*reserved9)(void); int (*itk_CreateClassOption) (Tcl_Interp *interp, ItclClass *cdefn, char *switchName, char *resName, char *resClass, char *defVal, char *config, ItkClassOption **optPtr); /* 10 */ ItkClassOption* (*itk_FindClassOption) (ItclClass *cdefn, const char *switchName); /* 11 */ Index: generic/itkOption.c ================================================================== --- generic/itkOption.c +++ generic/itkOption.c @@ -24,15 +24,15 @@ #include "itkInt.h" /* * FORWARD DECLARATIONS */ -static char* ItkTraceClassDestroy (ClientData cdata, +static char* ItkTraceClassDestroy (void *cdata, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static Tcl_HashTable* ItkGetClassesWithOptInfo ( Tcl_Interp *interp); -static void ItkFreeClassesWithOptInfo (ClientData cdata, +static void ItkFreeClassesWithOptInfo (void *cdata, Tcl_Interp *interp); /* * ------------------------------------------------------------------------ @@ -54,11 +54,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ClassOptionDefineCmd( - ClientData clientData, /* class parser info */ + void *clientData, /* class parser info */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclObjectInfo *info = (ItclObjectInfo*)clientData; @@ -156,11 +156,11 @@ if (Itk_CreateClassOption(interp, iclsPtr, switchName, resName, resClass, init, config, &opt) != TCL_OK) { return TCL_ERROR; } - Tcl_SetHashValue(entry, (ClientData)opt); + Tcl_SetHashValue(entry, (void *)opt); Itk_OptListAdd(&optTable->order, entry); return TCL_OK; } @@ -175,11 +175,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itk_ClassOptionIllegalCmd( - ClientData clientData, /* class parser info */ + void *clientData, /* class parser info */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { char *op = Tcl_GetString(objv[0]); @@ -209,11 +209,11 @@ /* ARGSUSED */ int Itk_ConfigClassOption( Tcl_Interp *interp, /* interpreter managing the class */ ItclObject *contextObj, /* object being configured */ - ClientData cdata, /* class option */ + void *cdata, /* class option */ const char *newval) /* new value for this option */ { ItkClassOption *opt = (ItkClassOption*)cdata; int result = TCL_OK; ItclMemberCode *mcode; @@ -331,19 +331,19 @@ if (newEntry) { optTable = (ItkClassOptTable*)ckalloc(sizeof(ItkClassOptTable)); Tcl_InitHashTable(&optTable->options, TCL_STRING_KEYS); Itk_OptListInit(&optTable->order, &optTable->options); - Tcl_SetHashValue(entry, (ClientData)optTable); + Tcl_SetHashValue(entry, (void *)optTable); result = Itcl_PushCallFrame(interp, &frame, iclsPtr->nsPtr, /* isProcCallFrame */ 0); if (result == TCL_OK) { Tcl_TraceVar(interp, "_itk_option_data", (TCL_TRACE_UNSETS | TCL_NAMESPACE_ONLY), - ItkTraceClassDestroy, (ClientData)iclsPtr); + ItkTraceClassDestroy, (void *)iclsPtr); Itcl_PopCallFrame(interp); } } else { optTable = (ItkClassOptTable*)Tcl_GetHashValue(entry); } @@ -399,11 +399,11 @@ * ------------------------------------------------------------------------ */ /* ARGSUSED */ static char* ItkTraceClassDestroy( - ClientData cdata, /* class definition data */ + void *cdata, /* class definition data */ Tcl_Interp *interp, /* interpreter managing the class */ const char *name1, /* name of variable involved in trace */ const char *name2, /* name of array element within variable */ int flags) /* flags describing trace */ { @@ -476,13 +476,13 @@ if (Itcl_CreateMemberCode(interp, iclsPtr, (char*)NULL, config, &mcode) != TCL_OK) { return TCL_ERROR; } - Itcl_PreserveData((ClientData)mcode); + Itcl_PreserveData((void *)mcode); #ifdef NOTDEF - Itcl_EventuallyFree((ClientData)mcode, (Tcl_FreeProc *)Itcl_DeleteMemberCode); + Itcl_EventuallyFree((void *)mcode, (Tcl_FreeProc *)Itcl_DeleteMemberCode); #endif } else { mcode = NULL; } @@ -500,17 +500,17 @@ Tcl_AppendToObj(opt->fullNamePtr, "::", 2); Tcl_AppendToObj(opt->fullNamePtr, switchName, -1); Tcl_IncrRefCount(opt->fullNamePtr); opt->codePtr = mcode; - opt->resName = (char*)ckalloc((unsigned)(strlen(resName)+1)); + opt->resName = (char*)ckalloc((strlen(resName)+1)); strcpy(opt->resName, resName); - opt->resClass = (char*)ckalloc((unsigned)(strlen(resClass)+1)); + opt->resClass = (char*)ckalloc((strlen(resClass)+1)); strcpy(opt->resClass, resClass); - opt->init = (char*)ckalloc((unsigned)(strlen(defVal)+1)); + opt->init = (char*)ckalloc((strlen(defVal)+1)); strcpy(opt->init, defVal); *optPtr = opt; return TCL_OK; } @@ -611,11 +611,11 @@ if (!classesTable) { classesTable = (Tcl_HashTable*)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(classesTable, TCL_ONE_WORD_KEYS); Tcl_SetAssocData(interp, "itk_classesWithOptInfo", - ItkFreeClassesWithOptInfo, (ClientData)classesTable); + ItkFreeClassesWithOptInfo, (void *)classesTable); } return classesTable; } /* @@ -626,11 +626,11 @@ * free up the associated data created by ItkGetClassesWithOptInfo. * ------------------------------------------------------------------------ */ static void ItkFreeClassesWithOptInfo( - ClientData clientData, /* associated data */ + void *clientData, /* associated data */ Tcl_Interp *interp) /* interpreter being freed */ { Tcl_HashTable *tablePtr = (Tcl_HashTable*)clientData; Tcl_HashSearch place; Tcl_HashSearch place2; Index: generic/itkStubLib.c ================================================================== --- generic/itkStubLib.c +++ generic/itkStubLib.c @@ -57,11 +57,11 @@ int exact) { const char *actualVersion; actualVersion = Tcl_PkgRequireEx(interp, "itk", (const char *)version, - exact, (ClientData *) &itkStubsPtr); + exact, &itkStubsPtr); if (actualVersion == NULL) { itkStubsPtr = NULL; return NULL; } Index: generic/itkUtil.c ================================================================== --- generic/itkUtil.c +++ generic/itkUtil.c @@ -39,11 +39,11 @@ { olist->options = options; olist->len = 0; olist->max = 10; olist->list = (Tcl_HashEntry**)ckalloc( - (unsigned)(olist->max*sizeof(Tcl_HashEntry*)) + (olist->max*sizeof(Tcl_HashEntry*)) ); } /* @@ -92,11 +92,11 @@ * Make sure that the option list is big enough. Resize * if needed. */ if (olist->len >= olist->max) { size = olist->max*sizeof(Tcl_HashEntry*); - newOrder = (Tcl_HashEntry**)ckalloc((unsigned)2*size); + newOrder = (Tcl_HashEntry**)ckalloc(2*size); memcpy((void*)newOrder, (void*)olist->list, (size_t)size); ckfree((char*)olist->list); olist->list = newOrder; olist->max *= 2; Index: library/itk.tcl ================================================================== --- library/itk.tcl +++ library/itk.tcl @@ -12,11 +12,11 @@ # Copyright (c) 1993-1998 Lucent Technologies, Inc. # ====================================================================== # See the file "license.terms" for information on usage and # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. -package require -exact Itk 4.2.3 +package require -exact Itk 4.2.4 # # Provide transparent access to all [incr Tk] commands # lappend auto_path ${itk::library} Index: pkgIndex.tcl.in ================================================================== --- pkgIndex.tcl.in +++ pkgIndex.tcl.in @@ -10,6 +10,7 @@ } else { package ifneeded itk @PACKAGE_VERSION@ \ [list load [file join $dir @PKG_LIB_FILE8@] Itk] } -package ifneeded Itk @PACKAGE_VERSION@ [list package require -exact itk @PACKAGE_VERSION@] +package ifneeded Itk @PACKAGE_VERSION@ \ + [list package require -exact itk @PACKAGE_VERSION@] Index: win/makefile.vc ================================================================== --- win/makefile.vc +++ win/makefile.vc @@ -1,452 +1,163 @@ -#------------------------------------------------------------------------------ -# Visual C++ 6.0+ makefile for [Incr Tk] -# -# See the file "license.terms" for information on usage and redistribution -# of this file, and for a DISCLAIMER OF ALL WARRANTIES. -# -# Copyright (c) 1993-1998 Lucent Technologies, Inc. -#------------------------------------------------------------------------------ -# To build (after setting up Visual C++ command line environment), -# nmake -f makefile.vc TCLDIR=path_to_tcl_sources TKDIR=path_to_tk_sources -# To install -# nmake -f makefile.vc TCLDIR=path_to_tcl_sources TKDIR=path_to_tk_sources INSTALLDIR=path_to_install_dir install - -!if !exist("makefile.vc") -MSG = ^ -You must run this makefile only from the directory it is in.^ -Please `cd` to its location first. -!error $(MSG) -!endif - -PROJECT = itk -PROJECT_REQUIRES_TK = 1 -ITCLDIR = ..\..\itcl -!include "$(ITCLDIR)\win\rules.vc" - -!if $(TCLINSTALL) -!message *** Warning: [Incr Tk] requires the source distribution of Tcl to build from, -!message *** at this time, sorry. Please set the TCLDIR and TKDIR macros to point -!message *** to the sources. -!endif - -!if [echo REM = This file is generated from makefile.vc > versions.vc] -!endif -!if [echo ITCL_MAJOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V $(ITCLDIR)\generic\itcl.h ITCL_MAJOR_VERSION >> versions.vc] -!endif -!if [echo ITCL_MINOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V $(ITCLDIR)\generic\itcl.h ITCL_MINOR_VERSION >> versions.vc] -!endif -!if [echo ITCL_PATCH_LEVEL = \>> versions.vc] \ - && [nmakehlp -V $(ITCLDIR)\generic\itcl.h ITCL_PATCH_LEVEL >> versions.vc] -!endif -!if [echo ITK_MAJOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V ..\generic\itk.h ITK_MAJOR_VERSION >> versions.vc] -!endif -!if [echo ITK_MINOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V ..\generic\itk.h ITK_MINOR_VERSION >> versions.vc] -!endif -!if [echo ITK_PATCH_LEVEL = \>> versions.vc] \ - && [nmakehlp -V ..\generic\itk.h ITK_PATCH_LEVEL >> versions.vc] -!endif -!include "versions.vc" -ITCL_VERSION = $(ITCL_MAJOR_VERSION)$(ITCL_MINOR_VERSION) -ITK_VERSION = $(ITK_MAJOR_VERSION)$(ITK_MINOR_VERSION) -DOTVERSION = $(ITK_PATCH_LEVEL) - -BINROOT = . -ROOT = .. -STUBPREFIX = $(PROJECT)stub - -PKGINDEX = "$(TMP_DIR)\pkgIndex.tcl" - -ITCLLIBNAME = itcl$(ITCL_VERSION)$(SUFX).$(EXT) -ITCLLIB = "$(ITCLDIR)\win\$(OUT_DIR)\$(ITCLLIBNAME)" -ITKIMPLIB = "$(OUT_DIR)\$(PROJECT)$(ITK_VERSION)$(SUFX).lib" -ITKSTUBLIBNAME = $(STUBPREFIX)$(ITK_VERSION).lib -ITKSTUBLIB = "$(OUT_DIR)\$(ITKSTUBLIBNAME)" - -ITKLIBNAME = $(PROJECT)$(ITK_VERSION)$(SUFX).$(EXT) -ITCLIMPLIBNAME = itcl$(ITCL_VERSION)$(SUFX).$(EXT) -ITKLIB = "$(OUT_DIR)\$(ITKLIBNAME)" -ITCLIMPLIB = "$(ITCLDIR)\win\$(BUILDDIRTOP)\$(ITCLIMPLIBNAME)" - - -TKSTUBLIB = $(TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib -TKIMPLIB = $(TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(DBGX).lib -WISH = $(TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(DBGX).exe -TCL_LIBRARY = $(TCLDIR)\library -TK_LIBRARY = $(TKDIR)\library -ITCL_LIBRARY = $(ITCLDIR:\=/)/library -ITK_LIBRARY = $(ROOT)/library - -ITCLSTUBLIBNAME = itclstub$(ITCL_VERSION).lib -ITCLSTUBLIB = $(ITCLDIR)\win\$(BUILDDIRTOP)\$(ITCLSTUBLIBNAME) - -BIN_INSTALL_DIR = $(_INSTALLDIR)\..\bin -DOC_INSTALL_DIR = $(_INSTALLDIR)\..\doc -LIB_INSTALL_DIR = $(_INSTALLDIR) -SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) -INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include - -ITKOBJS = \ - $(TMP_DIR)\itkArchBase.obj \ - $(TMP_DIR)\itkArchetype.obj \ - $(TMP_DIR)\itkBase.obj \ - $(TMP_DIR)\itkCmd.obj \ - $(TMP_DIR)\itkHelpers.obj \ - $(TMP_DIR)\itkOption.obj \ - $(TMP_DIR)\itkUtil.obj \ -!if !$(STATIC_BUILD) - $(TMP_DIR)\dllEntryPoint.obj \ - $(TMP_DIR)\itk.res \ -!endif - $(TMP_DIR)\itkStubInit.obj - -ITKSTUBOBJS = \ - $(TMP_DIR)\itkStubLib.obj - -GENERICDIR = $(ROOT)\generic -DOCDIR = $(ROOT)\doc -WINDIR = $(ROOT)\win -RCDIR = $(ROOT)\win\rc -TOOLSDIR = ..\..\tools - -#--------------------------------------------------------------------- -# Link flags -#--------------------------------------------------------------------- - -!if $(DEBUG) -ldebug = -debug:full -debugtype:cv -!else -ldebug = -release -opt:ref -opt:icf,3 -!endif - -# declarations common to all linker options -lflags = -nologo -machine:$(MACHINE) $(ldebug) - -!if $(PROFILE) -lflags = $(lflags) -profile -!endif - -!if $(ALIGN98_HACK) && !$(STATIC_BUILD) -# align sections for PE size savings. -lflags = $(lflags) -opt:nowin98 -!else if !$(ALIGN98_HACK) && $(STATIC_BUILD) -# align sections for speed in loading by choosing the virtual page size. -lflags = $(lflags) -align:4096 -!endif - -!if $(LOIMPACT) -lflags = $(lflags) -ws:aggressive -!endif - -ITK_LFLAGS = $(lflags) -subsystem:windows -dll -ITK_LLIBS = $(TCLSTUBLIB) $(TKSTUBLIB) $(ITCLSTUBLIB) - -!if exist("$(TCLDIR)\win\coffbase.txt") -ITK_DLLBASE = -base:@$(TCLDIR)\win\coffbase.txt,itk -!else -ITK_DLLBASE = -!endif - -baselibs = -# Avoid 'unresolved external symbol __security_cookie' errors. -# c.f. http://support.microsoft.com/?id=894573 -!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" -!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500 -baselibs = $(baselibs) bufferoverflowU.lib -!endif -!endif - -#--------------------------------------------------------------------- -# Compile flags -#--------------------------------------------------------------------- - -!if !$(DEBUG) -!if $(OPTIMIZING) -### This cranks the optimization level to maximize speed -cdebug = -O2 $(OPTIMIZATIONS) -!else -cdebug = -!endif -!if $(SYMBOLS) -cdebug = $(cdebug) -Zi -!endif -!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" -### Warnings are too many, can't support warnings into errors. -cdebug = -Zi -Od $(DEBUGFLAGS) -!else -cdebug = -Zi -WX $(DEBUGFLAGS) -!endif - -### Declarations common to all compiler options -cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ - -!if $(MSVCRT) -!if $(DEBUG) && !$(UNCHECKED) -crt = -MDd -!else -crt = -MD -!endif -!else -!if $(DEBUG) && !$(UNCHECKED) -crt = -MTd -!else -crt = -MT -!endif -!endif - -!if $(TCLINSTALL) -TCL_INCLUDES = -I"$(TCLDIR)\include" -TK_INCLUDES = -!else -TCL_INCLUDES = -I"$(TCLDIR)\generic" -I"$(TCLDIR)\win" -TK_INCLUDES = -I"$(TKDIR)\generic" -I"$(TKDIR)\xlib" -!endif - -ITK_INCLUDES = -I$(WINDIR) -I$(GENERICDIR) -ITCL_INCLUDES = -I"$(ITCLDIR)\generic" -ITK_DEFINES = -DBUILD_itk -DTCL_THREADS=1 -ITK_EXE_CFLAGS = $(cdebug) $(cflags) $(crt) $(ITCL_INCLUDES) $(ITK_INCLUDES) \ - $(TCL_INCLUDES) $(TK_INCLUDES) $(ITK_DEFINES) - -### By convention, static builds do not use Stubs. This is just a practice, -### not a technical limitation. -!if $(STATIC_BUILD) -ITK_CFLAGS = $(ITK_EXE_CFLAGS) -DSTATIC_BUILD $(OPTDEFINES) -!else -ITK_CFLAGS = $(ITK_EXE_CFLAGS) -DUSE_TCL_STUBS -DUSE_TK_STUBS -DUSE_ITCL_STUBS $(OPTDEFINES) -!endif - -#--------------------------------------------------------------------- -# Project specific targets -#--------------------------------------------------------------------- - -all : setup $(ITKLIB) $(ITKSTUBLIB) -release : setup $(ITKLIB) $(ITKSTUBLIB) -install : install-binaries install-docs - -(ROOT)\manifest.uuid: - copy $(WIN_DIR)\gitmanifest.in $(ROOT)\manifest.uuid - git rev-parse HEAD >>$(ROOT)\manifest.uuid - -$(TMP_DIR)\itkUuid.h: $(ROOT)\manifest.uuid - copy $(WIN_DIR)\itclUuid.h.in+$(ROOT)\manifest.uuid $(TMP_DIR)\itkUuid.h - -(TMP_DIR)\itkBase.obj: $(TMP_DIR)\itkUuid.h - -pkgindex: $(OUT_DIR)\pkgIndex.tcl -$(OUT_DIR)\pkgIndex.tcl: - @$(COPY) << "$(OUT_DIR)\pkgIndex.tcl" -# -*- tcl -*- -# Tcl package index file, version 1.1 -# - -if {![package vsatisfies [package provide Tcl] 8.6-]} {return} - -if {[package vsatisfies [package provide Tcl] 9.0-]} { - package ifneeded itk $(DOTVERSION) \ - [list load [file join $$dir tcl9itk$(VERSION).dll] Itk] -} else { - package ifneeded itcl $(DOTVERSION) \ - [list load [file join $$dir itk$(VERSION).dll] Itk] -} -package ifneeded Itk $(DOTVERSION) [list package require -exact itk $(DOTVERSION)] -<< - - -!if $(STATIC_BUILD) -test : - @echo test target not supported for a static library. -!else -test : setup $(ITKLIB) $(ITKSTUBLIB) - set TCL_LIBRARY=$(TCL_LIBRARY) - set TK_LIBRARY=$(TK_LIBRARY) - set ITCL_LIBRARY=$(ITCL_LIBRARY) - set ITK_LIBRARY=$(ITK_LIBRARY) - $(TCLSH) ..\tests\all.tcl $(TESTFLAGS) -loadfile << - load [file normalize $(ITCLLIB:\=/)] Itcl - load [file normalize $(ITKLIB:\=/)] Itk -<< -!endif - -setup : - @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) - @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) - -$(ITKLIB): $(ITKOBJS) -!if $(STATIC_BUILD) - $(lib32) -nologo -machine:$(MACHINE) -out:$@ @<< -!else - $(link32) $(ITK_LFLAGS) $(ITK_DLLBASE) -out:$@ $(ITK_LLIBS) $(baselibs) @<< -!endif - $(ITKOBJS) -<< - - -$(ITKSTUBLIB) : $(ITKSTUBOBJS) - $(lib32) -nologo -out:$@ $(ITKSTUBOBJS) - -install-binaries: - if not exist "$(_INSTALLDIR)" mkdir "$(_INSTALLDIR)" - if not exist "$(BIN_INSTALL_DIR)" mkdir "$(BIN_INSTALL_DIR)" - if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" - if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" - if not exist "$(INCLUDE_INSTALL_DIR)" mkdir "$(INCLUDE_INSTALL_DIR)" - copy $(ITKLIB) "$(SCRIPT_INSTALL_DIR)" -!if $(ITKSTUBLIB) != "" - copy $(ITKSTUBLIB) "$(LIB_INSTALL_DIR)" -!endif - copy $(ROOT)\generic\itk.h "$(INCLUDE_INSTALL_DIR)" - copy $(ROOT)\generic\itkDecls.h "$(INCLUDE_INSTALL_DIR)" - copy $(ROOT)\library\*.* "$(SCRIPT_INSTALL_DIR)" - - -#--------------------------------------------------------------------- -# Regenerate the stubs files. -#--------------------------------------------------------------------- - -!if !$(TCLINSTALL) -# Only from the sources of Tcl does genStubs.tcl exist. -genstubs: - $(TCLSH) $(TOOLSDIR)\genStubs.tcl $(GENERICDIR) \ - $(GENERICDIR)\itk.decls -!else -genstubs: - @echo ERROR: Can't rebuild stubs tables without the Tcl source distribution -!endif - -#--------------------------------------------------------------------- -# Special case object file targets -#--------------------------------------------------------------------- - -# The following object is part of the stub library and should not -# be built as DLL objects but none of the symbols should be exported - -$(TMP_DIR)\itkStubLib.obj : $(GENERICDIR)\itkStubLib.c - $(cc32) -DSTATIC_BUILD $(ITK_EXE_CFLAGS) -Zl -Fo$@ $? - -#--------------------------------------------------------------------- -# Inference rules. -#--------------------------------------------------------------------- - -{$(WINDIR)}.c{$(TMP_DIR)}.obj :: - $(cc32) $(ITK_CFLAGS) -Fo$(TMP_DIR)\ @<< -$< -<< - -{$(GENERICDIR)}.c{$(TMP_DIR)}.obj :: - $(cc32) $(ITK_CFLAGS) -Fo$(TMP_DIR)\ @<< -$< -<< - -{$(RCDIR)}.rc{$(TMP_DIR)}.res : - $(rc32) -fo $@ -DDEBUG=$(DEBUG) $(ITK_INCLUDES) $(TCL_INCLUDES) $(ITCL_INCLUDES) $(ITK_DEFINES) $< - -#--------------------------------------------------------------------- -# Generate the windows help files. -#--------------------------------------------------------------------- - -HLPBASE = $(PROJECT)$(ITK_VERSION) -HELPFILE = $(OUT_DIR)\$(HLPBASE).hlp -HELPCNT = $(OUT_DIR)\$(HLPBASE).cnt -DOCTMP_DIR = $(OUT_DIR)\$(PROJECT)_docs -HELPRTF = $(DOCTMP_DIR)\$(PROJECT).rtf -MAN2HELP = $(DOCTMP_DIR)\man2help.tcl -MAN2HELP2 = $(DOCTMP_DIR)\man2help2.tcl -INDEX = $(DOCTMP_DIR)\index.tcl -BMP = $(DOCTMP_DIR)\toaster.bmp -BMP_NOPATH = toaster.bmp -MAN2TCL = $(DOCTMP_DIR)\man2tcl.exe - -winhelp: docsetup $(HELPFILE) - -docsetup: - @if not exist $(DOCTMP_DIR)\nul mkdir $(DOCTMP_DIR) - -$(MAN2HELP) $(MAN2HELP2) $(INDEX): $(TCLTOOLSDIR)\$$(@F) - copy $(TCLTOOLSDIR)\$(@F) $(@D) - -$(BMP): - copy $(WINDIR)\$(@F) $(@D) - -$(HELPFILE): $(HELPRTF) $(BMP) - cd $(DOCTMP_DIR) - start /wait hcrtf.exe -x <<$(PROJECT).hpj -[OPTIONS] -COMPRESS=12 Hall Zeck -LCID=0x409 0x0 0x0 ; English (United States) -TITLE=[Incr Tk] Reference Manual -BMROOT=. -CNT=$(@B).cnt -HLP=$(@B).hlp - -[FILES] -$(PROJECT).rtf - -[WINDOWS] -main="[Incr Tk] Reference Manual",,27648,(r15263976),(r65280) - -[CONFIG] -BrowseButtons() -CreateButton(1, "Web", ExecFile("http://www.tcl.tk")) -CreateButton(2, "SF", ExecFile("http://sf.net/projects/incrtcl")) -CreateButton(3, "Wiki", ExecFile("http://wiki.tcl.tk")) -CreateButton(4, "FAQ", ExecFile("http://www.purl.org/NET/Tcl-FAQ/")) -<< - cd $(MAKEDIR) - copy "$(DOCTMP_DIR)\$(@B).hlp" "$(OUT_DIR)" - copy "$(DOCTMP_DIR)\$(@B).cnt" "$(OUT_DIR)" - -$(MAN2TCL): $(TCLTOOLSDIR)\$$(@B).c - $(cc32) -nologo -G4 -ML -O2 -Fo$(@D)\ $(TCLTOOLSDIR)\$(@B).c $(baselibs) -link -out:$@ - -$(HELPRTF): $(MAN2TCL) $(MAN2HELP) $(MAN2HELP2) $(INDEX) - $(TCLSH) $(MAN2HELP) -bitmap $(BMP_NOPATH) $(PROJECT) $(ITK_VERSION) $(DOCDIR:\=/) - -install-docs: -!if exist($(HELPFILE)) - @xcopy /i /y "$(HELPFILE)" "$(DOC_INSTALL_DIR)\" - @xcopy /i /y "$(HELPCNT)" "$(DOC_INSTALL_DIR)\" - $(TCLSH) << -puts "Installing $(PROJECT)'s helpfile contents into Tcl's ..." -set f [open {$(DOC_INSTALL_DIR:\=/)/tcl$(TCL_VERSION).cnt} r] -while {![eof $$f]} { - if {[regexp {:Include $(PROJECT)([0-9]{2}).cnt} [gets $$f] dummy ver]} { - if {$$ver == $(ITK_VERSION)} { - puts "Already installed." - exit - } else { - # do something here logical to remove (or replace) it. - puts "$$ver != $(ITK_VERSION), unfinished code path, die, die!" - exit 1 - } - } -} -close $$f -set f [open {$(DOC_INSTALL_DIR:\=/)/tcl$(TCL_VERSION).cnt} a] -puts $$f {:Include $(HLPBASE).cnt} -close $$f -<< - start /wait winhlp32 -g $(DOC_INSTALL_DIR)\tcl$(TCL_VERSION).hlp -!endif - -#--------------------------------------------------------------------- -# Clean up -#--------------------------------------------------------------------- - -tidy : - -del $(TMP_DIR)\*.pch - -del $(TMP_DIR)\*.obj - -del $(TMP_DIR)\*.res - -clean : tidy - -del $(OUT_DIR)\*.exp - -del $(OUT_DIR)\*.lib - -del $(OUT_DIR)\*.dll - -hose : clean - -rmdir $(OUT_DIR) - -rmdir $(TMP_DIR) +#------------------------------------------------------------- -*- makefile -*- +# +# Makefile for [Incr Tk] interface +# +# Basic build, test and install +# nmake /f makefile.vc INSTALLDIR=c:\path\to\installdir +# nmake /f makefile.vc INSTALLDIR=c:\path\to\installdir test +# nmake /f makefile.vc INSTALLDIR=c:\path\to\installdir install +# +# For other build options (debug, static etc.), +# See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for +# detailed documentation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +#------------------------------------------------------------------------------ + +PROJECT = itk +# Tcl 8.6 etc. compile with /DUNICODE. ITK pre-nmake reform compiled +# without -DUNICODE. Keep that behaviour for now. +USE_WIDECHAR_API = 0 +NEED_TK = 1 + +PRJ_DEFINES = $(PRJ_DEFINES) -Dinline=__inline +PRJ_DEFINES = $(PRJ_DEFINES) +PRJ_DEFINES = $(PRJ_DEFINES) -I$(TMP_DIR) + +!include "rules-ext.vc" + +# nmakehelp -V will search the file for tag, skips until a +# number and returns all character until a character not in [0-9.ab] +# is read. +!if [echo REM = This file is generated from Makefile.vc > versions.vc] +!endif +!if [echo TCL_VERSION_REQ = \>> versions.vc] \ + && [nmakehlp -V ..\configure.ac TCL_VERSION_REQ >> versions.vc] +!endif +!include "versions.vc" + +PRJ_OBJS = \ + $(TMP_DIR)\itkArchBase.obj \ + $(TMP_DIR)\itkArchetype.obj \ + $(TMP_DIR)\itkBase.obj \ + $(TMP_DIR)\itkCmd.obj \ + $(TMP_DIR)\itkHelpers.obj \ + $(TMP_DIR)\itkOption.obj \ + $(TMP_DIR)\itkUtil.obj \ + $(TMP_DIR)\itkStubInit.obj + + +# Uncomment the following line if you want to build and install stubs +PRJ_STUBOBJS = $(TMP_DIR)\itkStubLib.obj + +PRJ_HEADERS = \ + $(GENERICDIR)\itkInt.h \ + $(GENERICDIR)\itk.h + +# Locate ITCL headers and libraries. +# In principle, we don't need the ITCL source directory, and an installed +# ITCL should suffice. But that needs additional machinery not implemented +# yet. +!if [echo ITCL_DIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\itcl.h >> nmakehlp.out] +!error Could not locate ITCL source directory. +!endif +# Locate TK headers and libraries. +# In principle, we don't need the TK source directory, and an installed +# TK should suffice. But that needs additional machinery not implemented +# yet. +!if [echo TK_DIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tk.h >> nmakehlp.out] +!error Could not locate TK source directory. +!endif +!include nmakehlp.out + +# Get the ITCL version from its configure.ac +!if [echo ITCL_DOTVERSION = \> versions.vc] \ + && [nmakehlp -V "$(ITCL_DIR)\configure.ac" itcl >> versions.vc] +!error Could not retrieve ITCL version. +!endif +# Get the TK version from its configure.ac +!if [echo TK_DOTVERSION = \> versions.vc] \ + && [nmakehlp -V "$(TK_DIR)\configure.ac" tk >> versions.vc] +!error Could not retrieve TK version. +!endif +!include versions.vc + +ITCL_VERSION = $(ITCL_DOTVERSION:.=) +ITCL_GENERIC_DIR = $(ITCL_DIR)\generic +!if $(TCL_MAJOR_VERSION) == 8 || "$(TCL_BUILD_FOR)" == "8" +ITCLSTUBLIBNAME = itclstub$(ITCL_VERSION).lib +ITCL_LIB_FILE = itcl$(ITCL_VERSION).dll +!else +ITCLSTUBLIBNAME = itclstub.lib +ITCL_LIB_FILE = tcl9itcl$(ITCL_VERSION).dll +!endif +ITCLSTUBLIB = $(ITCL_DIR)\win\$(BUILDDIRTOP)\$(ITCLSTUBLIBNAME) +ITCL_BIN_DIR = $(ITCL_DIR)/win/$(BUILDDIRTOP) + +TK_VERSION = $(TK_DOTVERSION:.=) +TK_GENERIC_DIR = $(TK_DIR)\generic +TK_XLIB_DIR = $(TK_DIR)\xlib +!if $(TCL_MAJOR_VERSION) == 8 || "$(TCL_BUILD_FOR)" == "8" +TKSTUBLIBNAME = tkstub$(TK_VERSION).lib +!else +TKSTUBLIBNAME = tkstub.lib +!endif +TKSTUBLIB = $(TK_DIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME) +TK_BIN_DIR = $(TK_DIR)/win/$(BUILDDIRTOP) + +PRJ_INCLUDES = -I"$(ITCL_GENERIC_DIR)" -I"$(TK_GENERIC_DIR)" -I"$(TK_XLIB_DIR)" + +!if !$(STATIC_BUILD) +PRJ_LIBS = $(ITCLSTUBLIB) $(TKSTUBLIB) +!endif + +# Disable standard test target because we have a custom one +DISABLE_TARGET_test = 1 +!include "$(_RULESDIR)\targets.vc" + +# Additional default actions for install +install: default-install-docs-n + +# The TIP 477 generation of pkgIndex.tcl from pkgIndex.tcl.in does not include +# all replacements below so define our own target. +pkgindex: $(OUT_DIR)\pkgIndex.tcl +$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in + @nmakehlp -s << $** > $@ +@PACKAGE_NAME@ $(PROJECT) +@PACKAGE_VERSION@ $(DOTVERSION) +@TCL_VERSION_REQ@ $(TCL_VERSION_REQ) +@PKG_LIB_FILE@ $(PRJLIBNAME) +@PKG_LIB_FILE8@ $(PRJLIBNAME8) +@PKG_LIB_FILE9@ $(PRJLIBNAME9) +<< + +$(ROOT)\manifest.uuid: + copy $(WIN_DIR)\gitmanifest.in $(ROOT)\manifest.uuid + git rev-parse HEAD >>$(ROOT)\manifest.uuid + +$(TMP_DIR)\itkUuid.h: $(ROOT)\manifest.uuid + copy $(WIN_DIR)\itkUuid.h.in+$(ROOT)\manifest.uuid $(TMP_DIR)\itkUuid.h + +test: setup $(PROJECT) + @echo testing itk + @set ITK_LIBRARY=$(LIBDIR:\=/) + @$(CPY) $(LIBDIR)\*.tcl $(OUT_DIR) +!if $(TKINSTALL) + @set PATH=$(_TKDIR)\bin;$(PATH) + $(DEBUGGER) $(WISH) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) +!else + @set PATH=$(_TKDIR)\win\$(BUILDDIRTOP);$(PATH) + $(DEBUGGER) $(WISH) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) \ + -load "package ifneeded itk $(DOTVERSION) \ + {source {$(LIBDIR:\=/)/itk.tcl};load {$(PRJLIB:\=/)} [string totitle $(PROJECT)]};\ + package ifneeded itcl $(ITCL_DOTVERSION) \ + {source {$(ITCL_BIN_DIR:\=/)/itcl.tcl};load {$(ITCL_BIN_DIR:\=/)/$(ITCL_LIB_FILE)} Itcl}" +!endif + + +# Explicit dependency rules +$(GENERICDIR)\itkBase.c : $(TMP_DIR)\itkUuid.h ADDED win/rules-ext.vc Index: win/rules-ext.vc ================================================================== --- /dev/null +++ win/rules-ext.vc @@ -0,0 +1,123 @@ +# This file should only be included in makefiles for Tcl extensions, +# NOT in the makefile for Tcl itself. + +!ifndef _RULES_EXT_VC + +# We need to run from the directory the parent makefile is located in. +# nmake does not tell us what makefile was used to invoke it so parent +# makefile has to set the MAKEFILEVC macro or we just make a guess and +# warn if we think that is not the case. +!if "$(MAKEFILEVC)" == "" + +!if exist("$(PROJECT).vc") +MAKEFILEVC = $(PROJECT).vc +!elseif exist("makefile.vc") +MAKEFILEVC = makefile.vc +!endif +!endif # "$(MAKEFILEVC)" == "" + +!if !exist("$(MAKEFILEVC)") +MSG = ^ +You must run nmake from the directory containing the project makefile.^ +If you are doing that and getting this message, set the MAKEFILEVC^ +macro to the name of the project makefile. +!message WARNING: $(MSG) +!endif + +!if "$(PROJECT)" == "tcl" +!error The rules-ext.vc file is not intended for Tcl itself. +!endif + +# We extract version numbers using the nmakehlp program. For now use +# the local copy of nmakehlp. Once we locate Tcl, we will use that +# one if it is newer. +!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)" +!if [$(CC) -nologo -DNDEBUG "nmakehlp.c" -link -subsystem:console > nul] +!endif +!else +!if [copy x86_64-w64-mingw32-nmakehlp.exe nmakehlp.exe >NUL] +!endif +!endif + +# First locate the Tcl directory that we are working with. +!if "$(TCLDIR)" != "" + +_RULESDIR = $(TCLDIR:/=\) + +!else + +# If an installation path is specified, that is also the Tcl directory. +# Also Tk never builds against an installed Tcl, it needs Tcl sources +!if defined(INSTALLDIR) && "$(PROJECT)" != "tk" +_RULESDIR=$(INSTALLDIR:/=\) +!else +# Locate Tcl sources +!if [echo _RULESDIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tcl.h >> nmakehlp.out] +_RULESDIR = ..\..\tcl +!else +!include nmakehlp.out +!endif + +!endif # defined(INSTALLDIR).... + +!endif # ifndef TCLDIR + +# Now look for the targets.vc file under the Tcl root. Note we check this +# file and not rules.vc because the latter also exists on older systems. +!if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl +_RULESDIR = $(_RULESDIR)\lib\nmake +!elseif exist("$(_RULESDIR)\win\targets.vc") # Building against Tcl sources +_RULESDIR = $(_RULESDIR)\win +!else +# If we have not located Tcl's targets file, most likely we are compiling +# against an older version of Tcl and so must use our own support files. +_RULESDIR = . +!endif + +!if "$(_RULESDIR)" != "." +# Potentially using Tcl's support files. If this extension has its own +# nmake support files, need to compare the versions and pick newer. + +!if exist("rules.vc") # The extension has its own copy + +!if [echo TCL_RULES_MAJOR = \> versions.vc] \ + && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc] +!endif +!if [echo TCL_RULES_MINOR = \>> versions.vc] \ + && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc] +!endif + +!if [echo OUR_RULES_MAJOR = \>> versions.vc] \ + && [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc] +!endif +!if [echo OUR_RULES_MINOR = \>> versions.vc] \ + && [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc] +!endif +!include versions.vc +# We have a newer version of the support files, use them +!if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR)) +_RULESDIR = . +!endif + +!endif # if exist("rules.vc") + +!endif # if $(_RULESDIR) != "." + +# Let rules.vc know what copy of nmakehlp.c to use. +NMAKEHLPC = $(_RULESDIR)\nmakehlp.c + +# Get rid of our internal defines before calling rules.vc +!undef TCL_RULES_MAJOR +!undef TCL_RULES_MINOR +!undef OUR_RULES_MAJOR +!undef OUR_RULES_MINOR + +!if exist("$(_RULESDIR)\rules.vc") +!message *** Using $(_RULESDIR)\rules.vc +!include "$(_RULESDIR)\rules.vc" +!else +!error *** Could not locate rules.vc in $(_RULESDIR) +!endif + +!endif # _RULES_EXT_VC ADDED win/rules.vc Index: win/rules.vc ================================================================== --- /dev/null +++ win/rules.vc @@ -0,0 +1,1914 @@ +#------------------------------------------------------------- -*- makefile -*- +# rules.vc -- +# +# Part of the nmake based build system for Tcl and its extensions. +# This file does all the hard work in terms of parsing build options, +# compiler switches, defining common targets and macros. The Tcl makefile +# directly includes this. Extensions include it via "rules-ext.vc". +# +# See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for +# detailed documentation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# Copyright (c) 2001-2003 David Gravereaux. +# Copyright (c) 2003-2008 Patrick Thoyts +# Copyright (c) 2017 Ashok P. Nadkarni +#------------------------------------------------------------------------------ + +!ifndef _RULES_VC +_RULES_VC = 1 + +# The following macros define the version of the rules.vc nmake build system +# For modifications that are not backward-compatible, you *must* change +# the major version. +RULES_VERSION_MAJOR = 1 +RULES_VERSION_MINOR = 11 + +# The PROJECT macro must be defined by parent makefile. +!if "$(PROJECT)" == "" +!error *** Error: Macro PROJECT not defined! Please define it before including rules.vc +!endif + +!if "$(PRJ_PACKAGE_TCLNAME)" == "" +PRJ_PACKAGE_TCLNAME = $(PROJECT) +!endif + +# Also special case Tcl and Tk to save some typing later +DOING_TCL = 0 +DOING_TK = 0 +!if "$(PROJECT)" == "tcl" +DOING_TCL = 1 +!elseif "$(PROJECT)" == "tk" +DOING_TK = 1 +!endif + +!ifndef NEED_TK +# Backwards compatibility +!ifdef PROJECT_REQUIRES_TK +NEED_TK = $(PROJECT_REQUIRES_TK) +!else +NEED_TK = 0 +!endif +!endif + +!ifndef NEED_TCL_SOURCE +NEED_TCL_SOURCE = 0 +!endif + +!ifdef NEED_TK_SOURCE +!if $(NEED_TK_SOURCE) +NEED_TK = 1 +!endif +!else +NEED_TK_SOURCE = 0 +!endif + +################################################################ +# Nmake is a pretty weak environment in syntax and capabilities +# so this file is necessarily verbose. It's broken down into +# the following parts. +# +# 0. Sanity check that compiler environment is set up and initialize +# any built-in settings from the parent makefile +# 1. First define the external tools used for compiling, copying etc. +# as this is independent of everything else. +# 2. Figure out our build structure in terms of the directory, whether +# we are building Tcl or an extension, etc. +# 3. Determine the compiler and linker versions +# 4. Build the nmakehlp helper application +# 5. Determine the supported compiler options and features +# 6. Parse the OPTS macro value for user-specified build configuration +# 7. Parse the STATS macro value for statistics instrumentation +# 8. Parse the CHECKS macro for additional compilation checks +# 9. Extract Tcl, and possibly Tk, version numbers from the headers +# 10. Based on this selected configuration, construct the output +# directory and file paths +# 11. Construct the paths where the package is to be installed +# 12. Set up the actual options passed to compiler and linker based +# on the information gathered above. +# 13. Define some standard build targets and implicit rules. These may +# be optionally disabled by the parent makefile. +# 14. (For extensions only.) Compare the configuration of the target +# Tcl and the extensions and warn against discrepancies. +# +# One final note about the macro names used. They are as they are +# for historical reasons. We would like legacy extensions to +# continue to work with this make include file so be wary of +# changing them for consistency or clarity. + +# 0. Sanity check compiler environment + +# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or +# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir) + +!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR) +MSG = ^ +Visual C++ compiler environment not initialized. +!error $(MSG) +!endif + +# We need to run from the directory the parent makefile is located in. +# nmake does not tell us what makefile was used to invoke it so parent +# makefile has to set the MAKEFILEVC macro or we just make a guess and +# warn if we think that is not the case. +!if "$(MAKEFILEVC)" == "" + +!if exist("$(PROJECT).vc") +MAKEFILEVC = $(PROJECT).vc +!elseif exist("makefile.vc") +MAKEFILEVC = makefile.vc +!endif +!endif # "$(MAKEFILEVC)" == "" + +!if !exist("$(MAKEFILEVC)") +MSG = ^ +You must run nmake from the directory containing the project makefile.^ +If you are doing that and getting this message, set the MAKEFILEVC^ +macro to the name of the project makefile. +!message WARNING: $(MSG) +!endif + + +################################################################ +# 1. Define external programs being used + +#---------------------------------------------------------- +# Set the proper copy method to avoid overwrite questions +# to the user when copying files and selecting the right +# "delete all" method. +#---------------------------------------------------------- + +RMDIR = rmdir /S /Q +CPY = xcopy /i /y >NUL +CPYDIR = xcopy /e /i /y >NUL +COPY = copy /y >NUL +MKDIR = mkdir + +###################################################################### +# 2. Figure out our build environment in terms of what we're building. +# +# (a) Tcl itself +# (b) Tk +# (c) a Tcl extension using libraries/includes from an *installed* Tcl +# (d) a Tcl extension using libraries/includes from Tcl source directory +# +# This last is needed because some extensions still need +# some Tcl interfaces that are not publicly exposed. +# +# The fragment will set the following macros: +# ROOT - root of this module sources +# COMPATDIR - source directory that holds compatibility sources +# DOCDIR - source directory containing documentation files +# GENERICDIR - platform-independent source directory +# WIN_DIR - Windows-specific source directory +# TESTDIR - directory containing test files +# TOOLSDIR - directory containing build tools +# _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set +# when building Tcl itself. +# _INSTALLDIR - native form of the installation path. For Tcl +# this will be the root of the Tcl installation. For extensions +# this will be the lib directory under the root. +# TCLINSTALL - set to 1 if _TCLDIR refers to +# headers and libraries from an installed Tcl, and 0 if built against +# Tcl sources. Not set when building Tcl itself. Yes, not very well +# named. +# _TCL_H - native path to the tcl.h file +# +# If Tk is involved, also sets the following +# _TKDIR - native form Tk installation OR Tk source. Not set if building +# Tk itself. +# TKINSTALL - set 1 if _TKDIR refers to installed Tk and 0 if Tk sources +# _TK_H - native path to the tk.h file + +# Root directory for sources and assumed subdirectories +ROOT = $(MAKEDIR)\.. +# The following paths CANNOT have spaces in them as they appear on the +# left side of implicit rules. +!ifndef COMPATDIR +COMPATDIR = $(ROOT)\compat +!endif +!ifndef DOCDIR +DOCDIR = $(ROOT)\doc +!endif +!ifndef GENERICDIR +GENERICDIR = $(ROOT)\generic +!endif +!ifndef TOOLSDIR +TOOLSDIR = $(ROOT)\tools +!endif +!ifndef TESTDIR +TESTDIR = $(ROOT)\tests +!endif +!ifndef LIBDIR +!if exist("$(ROOT)\library") +LIBDIR = $(ROOT)\library +!else +LIBDIR = $(ROOT)\lib +!endif +!endif +!ifndef DEMODIR +!if exist("$(LIBDIR)\demos") +DEMODIR = $(LIBDIR)\demos +!else +DEMODIR = $(ROOT)\demos +!endif +!endif # ifndef DEMODIR +# Do NOT use WINDIR because it is Windows internal environment +# variable to point to c:\windows! +WIN_DIR = $(ROOT)\win + +!ifndef RCDIR +!if exist("$(WIN_DIR)\rc") +RCDIR = $(WIN_DIR)\rc +!else +RCDIR = $(WIN_DIR) +!endif +!endif +RCDIR = $(RCDIR:/=\) + +# The target directory where the built packages and binaries will be installed. +# INSTALLDIR is the (optional) path specified by the user. +# _INSTALLDIR is INSTALLDIR using the backslash separator syntax +!ifdef INSTALLDIR +### Fix the path separators. +_INSTALLDIR = $(INSTALLDIR:/=\) +!else +### Assume the normal default. +_INSTALLDIR = $(HOMEDRIVE)\Tcl +!endif + +!if $(DOING_TCL) + +# BEGIN Case 2(a) - Building Tcl itself + +# Only need to define _TCL_H +_TCL_H = ..\generic\tcl.h + +# END Case 2(a) - Building Tcl itself + +!elseif $(DOING_TK) + +# BEGIN Case 2(b) - Building Tk + +TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl +!if "$(TCLDIR)" == "" +!if [echo TCLDIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tcl.h >> nmakehlp.out] +!error *** Could not locate Tcl source directory. +!endif +!include nmakehlp.out +!endif # TCLDIR == "" + +_TCLDIR = $(TCLDIR:/=\) +_TCL_H = $(_TCLDIR)\generic\tcl.h +!if !exist("$(_TCL_H)") +!error Could not locate tcl.h. Please set the TCLDIR macro to point to the Tcl *source* directory. +!endif + +_TK_H = ..\generic\tk.h + +# END Case 2(b) - Building Tk + +!else + +# BEGIN Case 2(c) or (d) - Building an extension other than Tk + +# If command line has specified Tcl location through TCLDIR, use it +# else default to the INSTALLDIR setting +!if "$(TCLDIR)" != "" + +_TCLDIR = $(TCLDIR:/=\) +!if exist("$(_TCLDIR)\include\tcl.h") # Case 2(c) with TCLDIR defined +TCLINSTALL = 1 +_TCL_H = $(_TCLDIR)\include\tcl.h +!elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(d) with TCLDIR defined +TCLINSTALL = 0 +_TCL_H = $(_TCLDIR)\generic\tcl.h +!endif + +!else # # Case 2(c) for extensions with TCLDIR undefined + +# Need to locate Tcl depending on whether it needs Tcl source or not. +# If we don't, check the INSTALLDIR for an installed Tcl first + +!if exist("$(_INSTALLDIR)\include\tcl.h") && !$(NEED_TCL_SOURCE) + +TCLINSTALL = 1 +TCLDIR = $(_INSTALLDIR)\.. +# NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions +# later so the \.. accounts for the /lib +_TCLDIR = $(_INSTALLDIR)\.. +_TCL_H = $(_TCLDIR)\include\tcl.h + +!else # exist(...) && !$(NEED_TCL_SOURCE) + +!if [echo _TCLDIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tcl.h >> nmakehlp.out] +!error *** Could not locate Tcl source directory. +!endif +!include nmakehlp.out +TCLINSTALL = 0 +TCLDIR = $(_TCLDIR) +_TCL_H = $(_TCLDIR)\generic\tcl.h + +!endif # exist(...) && !$(NEED_TCL_SOURCE) + +!endif # TCLDIR + +!ifndef _TCL_H +MSG =^ +Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h. +!error $(MSG) +!endif + +# Now do the same to locate Tk headers and libs if project requires Tk +!if $(NEED_TK) + +!if "$(TKDIR)" != "" + +_TKDIR = $(TKDIR:/=\) +!if exist("$(_TKDIR)\include\tk.h") +TKINSTALL = 1 +_TK_H = $(_TKDIR)\include\tk.h +!elseif exist("$(_TKDIR)\generic\tk.h") +TKINSTALL = 0 +_TK_H = $(_TKDIR)\generic\tk.h +!endif + +!else # TKDIR not defined + +# Need to locate Tcl depending on whether it needs Tcl source or not. +# If we don't, check the INSTALLDIR for an installed Tcl first + +!if exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE) + +TKINSTALL = 1 +# NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions +# later so the \.. accounts for the /lib +_TKDIR = $(_INSTALLDIR)\.. +_TK_H = $(_TKDIR)\include\tk.h +TKDIR = $(_TKDIR) + +!else # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE) + +!if [echo _TKDIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tk.h >> nmakehlp.out] +!error *** Could not locate Tk source directory. +!endif +!include nmakehlp.out +TKINSTALL = 0 +TKDIR = $(_TKDIR) +_TK_H = $(_TKDIR)\generic\tk.h + +!endif # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE) + +!endif # TKDIR + +!ifndef _TK_H +MSG =^ +Failed to find tk.h. The TKDIR macro is set incorrectly or is not set and default path does not contain tk.h. +!error $(MSG) +!endif + +!endif # NEED_TK + +!if $(NEED_TCL_SOURCE) && $(TCLINSTALL) +MSG = ^ +*** Warning: This extension requires the source distribution of Tcl.^ +*** Please set the TCLDIR macro to point to the Tcl sources. +!error $(MSG) +!endif + +!if $(NEED_TK_SOURCE) +!if $(TKINSTALL) +MSG = ^ +*** Warning: This extension requires the source distribution of Tk.^ +*** Please set the TKDIR macro to point to the Tk sources. +!error $(MSG) +!endif +!endif + + +# If INSTALLDIR set to Tcl installation root dir then reset to the +# lib dir for installing extensions +!if exist("$(_INSTALLDIR)\include\tcl.h") +_INSTALLDIR=$(_INSTALLDIR)\lib +!endif + +# END Case 2(c) or (d) - Building an extension +!endif # if $(DOING_TCL) + +################################################################ +# 3. Determine compiler version and architecture +# In this section, we figure out the compiler version and the +# architecture for which we are building. This sets the +# following macros: +# VCVERSION - the internal compiler version as 1200, 1400, 1910 etc. +# This is also printed by the compiler in dotted form 19.10 etc. +# VCVER - the "marketing version", for example Visual C++ 6 for internal +# compiler version 1200. This is kept only for legacy reasons as it +# does not make sense for recent Microsoft compilers. Only used for +# output directory names. +# ARCH - set to IX86, ARM64 or AMD64 depending on 32- or 64-bit target +# NATIVE_ARCH - set to IX86, ARM64 or AMD64 for the host machine +# MACHINE - same as $(ARCH) - legacy +# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed + +cc32 = $(CC) # built-in default. +link32 = link +lib32 = lib +rc32 = $(RC) # built-in default. + +#---------------------------------------------------------------- +# Figure out the compiler architecture and version by writing +# the C macros to a file, preprocessing them with the C +# preprocessor and reading back the created file + +_HASH=^# +_VC_MANIFEST_EMBED_EXE= +_VC_MANIFEST_EMBED_DLL= +VCVER=0 +!if ![echo VCVERSION=_MSC_VER > vercl.x] \ + && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \ + && ![echo ARCH=IX86 >> vercl.x] \ + && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \ + && ![echo ARCH=AMD64 >> vercl.x] \ + && ![echo $(_HASH)elif defined(_M_ARM64) >> vercl.x] \ + && ![echo ARCH=ARM64 >> vercl.x] \ + && ![echo $(_HASH)endif >> vercl.x] \ + && ![$(cc32) -nologo -TC -P vercl.x 2>NUL] +!include vercl.i +!if $(VCVERSION) < 1900 +!if ![echo VCVER= ^\> vercl.vc] \ + && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc] +!include vercl.vc +!endif +!else +# The simple calculation above does not apply to new Visual Studio releases +# Keep the compiler version in its native form. +VCVER = $(VCVERSION) +!endif +!endif + +!if ![del 2>NUL /q/f vercl.x vercl.i vercl.vc] +!endif + +#---------------------------------------------------------------- +# The MACHINE macro is used by legacy makefiles so set it as well +!ifdef MACHINE +!if "$(MACHINE)" == "x86" +!undef MACHINE +MACHINE = IX86 +!elseif "$(MACHINE)" == "arm64" +!undef MACHINE +MACHINE = ARM64 +!elseif "$(MACHINE)" == "x64" +!undef MACHINE +MACHINE = AMD64 +!endif +!if "$(MACHINE)" != "$(ARCH)" +!error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH). +!endif +!else +MACHINE=$(ARCH) +!endif + +#--------------------------------------------------------------- +# The PLATFORM_IDENTIFY macro matches the values returned by +# the Tcl platform::identify command +!if "$(MACHINE)" == "AMD64" +PLATFORM_IDENTIFY = win32-x86_64 +!elseif "$(MACHINE)" == "ARM64" +PLATFORM_IDENTIFY = win32-arm +!else +PLATFORM_IDENTIFY = win32-ix86 +!endif + +# The MULTIPLATFORM macro controls whether binary extensions are installed +# in platform-specific directories. Intended to be set/used by extensions. +!ifndef MULTIPLATFORM_INSTALL +MULTIPLATFORM_INSTALL = 0 +!endif + +#------------------------------------------------------------ +# Figure out the *host* architecture by reading the registry + +!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] +NATIVE_ARCH=IX86 +!elseif ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i ARM | findstr /i 64-bit] +NATIVE_ARCH=ARM64 +!else +NATIVE_ARCH=AMD64 +!endif + +# Since MSVC8 we must deal with manifest resources. +!if $(VCVERSION) >= 1400 +_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 +_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 +!endif + +################################################################ +# 4. Build the nmakehlp program +# This is a helper app we need to overcome nmake's limiting +# environment. We will call out to it to get various bits of +# information about supported compiler options etc. +# +# Tcl itself will always use the nmakehlp.c program which is +# in its own source. It will be kept updated there. +# +# Extensions built against an installed Tcl will use the installed +# copy of Tcl's nmakehlp.c if there is one and their own version +# otherwise. In the latter case, they would also be using their own +# rules.vc. Note that older versions of Tcl do not install nmakehlp.c +# or rules.vc. +# +# Extensions built against Tcl sources will use the one from the Tcl source. +# +# When building an extension using a sufficiently new version of Tcl, +# rules-ext.vc will define NMAKEHLPC appropriately to point to the +# copy of nmakehlp.c to be used. + +!ifndef NMAKEHLPC +# Default to the one in the current directory (the extension's own nmakehlp.c) +NMAKEHLPC = nmakehlp.c + +!if !$(DOING_TCL) +!if $(TCLINSTALL) +!if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c") +NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c +!endif +!else # !$(TCLINSTALL) +!if exist("$(_TCLDIR)\win\nmakehlp.c") +NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c +!endif +!endif # $(TCLINSTALL) +!endif # !$(DOING_TCL) + +!endif # NMAKEHLPC + +# We always build nmakehlp even if it exists since we do not know +# what source it was built from. +!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)" +!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul] +!endif +!else +!if [copy $(NMAKEHLPC:nmakehlp.c=x86_64-w64-mingw32-nmakehlp.exe) nmakehlp.exe >NUL] +!endif +!endif + +################################################################ +# 5. Test for compiler features +# Visual C++ compiler options have changed over the years. Check +# which options are supported by the compiler in use. +# +# The following macros are set: +# OPTIMIZATIONS - the compiler flags to be used for optimized builds +# DEBUGFLAGS - the compiler flags to be used for debug builds +# LINKERFLAGS - Flags passed to the linker +# +# Note that these are the compiler settings *available*, not those +# that will be *used*. The latter depends on the OPTS macro settings +# which we have not yet parsed. +# +# Also note that some of the flags in OPTIMIZATIONS are not really +# related to optimization. They are placed there only for legacy reasons +# as some extensions expect them to be included in that macro. + +# -Op improves float consistency. Note only needed for older compilers +# Newer compilers do not need or support this option. +!if [nmakehlp -c -Op] +FPOPTS = -Op +!endif + +# Strict floating point semantics - present in newer compilers in lieu of -Op +!if [nmakehlp -c -fp:strict] +FPOPTS = $(FPOPTS) -fp:strict +!endif + +!if "$(MACHINE)" == "IX86" +### test for pentium errata +!if [nmakehlp -c -QI0f] +!message *** Compiler has 'Pentium 0x0f fix' +FPOPTS = $(FPOPTS) -QI0f +!else +!message *** Compiler does not have 'Pentium 0x0f fix' +!endif +!endif + +### test for optimizations +# /O2 optimization includes /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy as per +# documentation. Note we do NOT want /Gs as that inserts a _chkstk +# stack probe at *every* function entry, not just those with more than +# a page of stack allocation resulting in a performance hit. However, +# /O2 documentation is misleading as its stack probes are simply the +# default page size locals allocation probes and not what is implied +# by an explicit /Gs option. + +OPTIMIZATIONS = $(FPOPTS) + +!if [nmakehlp -c -O2] +OPTIMIZING = 1 +OPTIMIZATIONS = $(OPTIMIZATIONS) -O2 +!else +# Legacy, really. All modern compilers support this +!message *** Compiler does not have 'Optimizations' +OPTIMIZING = 0 +!endif + +# Checks for buffer overflows in local arrays +!if [nmakehlp -c -GS] +OPTIMIZATIONS = $(OPTIMIZATIONS) -GS +!endif + +# Link time optimization. Note that this option (potentially) makes +# generated libraries only usable by the specific VC++ version that +# created it. Requires /LTCG linker option +!if [nmakehlp -c -GL] +OPTIMIZATIONS = $(OPTIMIZATIONS) -GL +CC_GL_OPT_ENABLED = 1 +!else +# In newer compilers -GL and -YX are incompatible. +!if [nmakehlp -c -YX] +OPTIMIZATIONS = $(OPTIMIZATIONS) -YX +!endif +!endif # [nmakehlp -c -GL] + +DEBUGFLAGS = $(FPOPTS) + +# Run time error checks. Not available or valid in a release, non-debug build +# RTC is for modern compilers, -GZ is legacy +!if [nmakehlp -c -RTC1] +DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 +!elseif [nmakehlp -c -GZ] +DEBUGFLAGS = $(DEBUGFLAGS) -GZ +!endif + +#---------------------------------------------------------------- +# Linker flags + +# LINKER_TESTFLAGS are for internal use when we call nmakehlp to test +# if the linker supports a specific option. Without these flags link will +# return "LNK1561: entry point must be defined" error compiling from VS-IDE: +# They are not passed through to the actual application / extension +# link rules. +!ifndef LINKER_TESTFLAGS +LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmakehlp.out +!endif + +LINKERFLAGS = + +# If compiler has enabled link time optimization, linker must too with -ltcg +!ifdef CC_GL_OPT_ENABLED +!if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)] +LINKERFLAGS = $(LINKERFLAGS) -ltcg +!endif +!endif + + +################################################################ +# 6. Extract various version numbers from headers +# For Tcl and Tk, version numbers are extracted from tcl.h and tk.h +# respectively. For extensions, versions are extracted from the +# configure.in or configure.ac from the TEA configuration if it +# exists, and unset otherwise. +# Sets the following macros: +# TCL_MAJOR_VERSION +# TCL_MINOR_VERSION +# TCL_RELEASE_SERIAL +# TCL_PATCH_LEVEL +# TCL_PATCH_LETTER +# TCL_VERSION +# TK_MAJOR_VERSION +# TK_MINOR_VERSION +# TK_RELEASE_SERIAL +# TK_PATCH_LEVEL +# TK_PATCH_LETTER +# TK_VERSION +# DOTVERSION - set as (for example) 2.5 +# VERSION - set as (for example 25) +#-------------------------------------------------------------- + +!if [echo REM = This file is generated from rules.vc > versions.vc] +!endif +!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" "define TCL_MAJOR_VERSION" >> versions.vc] +!endif +!if [echo TCL_MINOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc] +!endif +!if [echo TCL_RELEASE_SERIAL = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_RELEASE_SERIAL >> versions.vc] +!endif +!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] +!endif + +!if defined(_TK_H) +!if [echo TK_MAJOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V $(_TK_H) "define TK_MAJOR_VERSION" >> versions.vc] +!endif +!if [echo TK_MINOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc] +!endif +!if [echo TK_RELEASE_SERIAL = \>> versions.vc] \ + && [nmakehlp -V "$(_TK_H)" TK_RELEASE_SERIAL >> versions.vc] +!endif +!if [echo TK_PATCH_LEVEL = \>> versions.vc] \ + && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc] +!endif +!endif # _TK_H + +!include versions.vc + +TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) +TCL_DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) +!if [nmakehlp -f $(TCL_PATCH_LEVEL) "a"] +TCL_PATCH_LETTER = a +!elseif [nmakehlp -f $(TCL_PATCH_LEVEL) "b"] +TCL_PATCH_LETTER = b +!else +TCL_PATCH_LETTER = . +!endif + +!if defined(_TK_H) + +TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) +TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) +!if [nmakehlp -f $(TK_PATCH_LEVEL) "a"] +TK_PATCH_LETTER = a +!elseif [nmakehlp -f $(TK_PATCH_LEVEL) "b"] +TK_PATCH_LETTER = b +!else +TK_PATCH_LETTER = . +!endif + +!endif + +# Set DOTVERSION and VERSION +!if $(DOING_TCL) + +DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) +VERSION = $(TCL_VERSION) + +!elseif $(DOING_TK) + +DOTVERSION = $(TK_DOTVERSION) +VERSION = $(TK_VERSION) + +!else # Doing a non-Tk extension + +# If parent makefile has not defined DOTVERSION, try to get it from TEA +# first from a configure.in file, and then from configure.ac +!ifndef DOTVERSION +!if [echo DOTVERSION = \> versions.vc] \ + || [nmakehlp -V $(ROOT)\configure.in ^[$(PROJECT)^] >> versions.vc] +!if [echo DOTVERSION = \> versions.vc] \ + || [nmakehlp -V $(ROOT)\configure.ac ^[$(PROJECT)^] >> versions.vc] +!error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc. +!endif +!endif +!include versions.vc +!endif # DOTVERSION +VERSION = $(DOTVERSION:.=) + +!endif # $(DOING_TCL) ... etc. + +# Windows RC files have 3 version components. Ensure this irrespective +# of how many components the package has specified. Basically, ensure +# minimum 4 components by appending 4 0's and then pick out the first 4. +# Also take care of the fact that DOTVERSION may have "a" or "b" instead +# of "." separating the version components. +DOTSEPARATED=$(DOTVERSION:a=.) +DOTSEPARATED=$(DOTSEPARATED:b=.) +!if [echo RCCOMMAVERSION = \> versions.vc] \ + || [for /f "tokens=1,2,3,4,5* delims=." %a in ("$(DOTSEPARATED).0.0.0.0") do echo %a,%b,%c,%d >> versions.vc] +!error *** Could not generate RCCOMMAVERSION *** +!endif +!include versions.vc + +######################################################################## +# 7. Parse the OPTS macro to work out the requested build configuration. +# Based on this, we will construct the actual switches to be passed to the +# compiler and linker using the macros defined in the previous section. +# The following macros are defined by this section based on OPTS +# STATIC_BUILD - 0 -> Tcl is to be built as a shared library +# 1 -> build as a static library and shell +# TCL_THREADS - legacy but always 1 on Windows since winsock requires it. +# DEBUG - 1 -> debug build, 0 -> release builds +# SYMBOLS - 1 -> generate PDB's, 0 -> no PDB's +# PROFILE - 1 -> generate profiling info, 0 -> no profiling +# PGO - 1 -> profile based optimization, 0 -> no +# MSVCRT - 1 -> link to dynamic C runtime even when building static Tcl build +# 0 -> link to static C runtime for static Tcl build. +# Does not impact shared Tcl builds (STATIC_BUILD == 0) +# Default: 1 for Tcl 8.7 and up, 0 otherwise. +# TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions +# in the Tcl and Wish shell. 0 -> keep them as shared libraries. Does +# not impact shared Tcl builds. Implied by STATIC_BUILD since Tcl 8.7. +# USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation. +# 0 -> Use the non-thread allocator. +# UNCHECKED - 1 -> when doing a debug build with symbols, use the release +# C runtime, 0 -> use the debug C runtime. +# USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking +# CONFIG_CHECK - 1 -> check current build configuration against Tcl +# configuration (ignored for Tcl itself) +# _USE_64BIT_TIME_T - forces a build using 64-bit time_t for 32-bit build +# (CRT library should support this, not needed for Tcl 9.x) +# Further, LINKERFLAGS are modified based on above. + +# Default values for all the above +STATIC_BUILD = 0 +TCL_THREADS = 1 +DEBUG = 0 +SYMBOLS = 0 +PROFILE = 0 +PGO = 0 +MSVCRT = 1 +TCL_USE_STATIC_PACKAGES = 0 +USE_THREAD_ALLOC = 1 +UNCHECKED = 0 +CONFIG_CHECK = 1 +!if $(DOING_TCL) +USE_STUBS = 0 +!else +USE_STUBS = 1 +!endif + +# If OPTS is not empty AND does not contain "none" which turns off all OPTS +# set the above macros based on OPTS content +!if "$(OPTS)" != "" && ![nmakehlp -f "$(OPTS)" "none"] + +# OPTS are specified, parse them + +!if [nmakehlp -f $(OPTS) "static"] +!message *** Doing static +STATIC_BUILD = 1 +!endif + +!if [nmakehlp -f $(OPTS) "nostubs"] +!message *** Not using stubs +USE_STUBS = 0 +!endif + +!if [nmakehlp -f $(OPTS) "nomsvcrt"] +!message *** Doing nomsvcrt +MSVCRT = 0 +!else +!if [nmakehlp -f $(OPTS) "msvcrt"] +!message *** Doing msvcrt +!else +!if $(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) < 7 && $(STATIC_BUILD) +MSVCRT = 0 +!endif +!endif +!endif # [nmakehlp -f $(OPTS) "nomsvcrt"] + +!if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD) +!message *** Doing staticpkg +TCL_USE_STATIC_PACKAGES = 1 +!endif + +!if [nmakehlp -f $(OPTS) "nothreads"] +!message *** Compile explicitly for non-threaded tcl +TCL_THREADS = 0 +USE_THREAD_ALLOC= 0 +!endif + +!if [nmakehlp -f $(OPTS) "tcl8"] +!message *** Build for Tcl8 +TCL_BUILD_FOR = 8 +!endif + +!if $(TCL_MAJOR_VERSION) == 8 +!if [nmakehlp -f $(OPTS) "time64bit"] +!message *** Force 64-bit time_t +_USE_64BIT_TIME_T = 1 +!endif +!endif + +# Yes, it's weird that the "symbols" option controls DEBUG and +# the "pdbs" option controls SYMBOLS. That's historical. +!if [nmakehlp -f $(OPTS) "symbols"] +!message *** Doing symbols +DEBUG = 1 +!else +DEBUG = 0 +!endif + +!if [nmakehlp -f $(OPTS) "pdbs"] +!message *** Doing pdbs +SYMBOLS = 1 +!else +SYMBOLS = 0 +!endif + +!if [nmakehlp -f $(OPTS) "profile"] +!message *** Doing profile +PROFILE = 1 +!else +PROFILE = 0 +!endif + +!if [nmakehlp -f $(OPTS) "pgi"] +!message *** Doing profile guided optimization instrumentation +PGO = 1 +!elseif [nmakehlp -f $(OPTS) "pgo"] +!message *** Doing profile guided optimization +PGO = 2 +!else +PGO = 0 +!endif + +!if [nmakehlp -f $(OPTS) "loimpact"] +!message *** Warning: ignoring option "loimpact" - deprecated on modern Windows. +!endif + +# TBD - should get rid of this option +!if [nmakehlp -f $(OPTS) "thrdalloc"] +!message *** Doing thrdalloc +USE_THREAD_ALLOC = 1 +!endif + +!if [nmakehlp -f $(OPTS) "tclalloc"] +USE_THREAD_ALLOC = 0 +!endif + +!if [nmakehlp -f $(OPTS) "unchecked"] +!message *** Doing unchecked +UNCHECKED = 1 +!else +UNCHECKED = 0 +!endif + +!if [nmakehlp -f $(OPTS) "noconfigcheck"] +CONFIG_CHECK = 1 +!else +CONFIG_CHECK = 0 +!endif + +!endif # "$(OPTS)" != "" && ... parsing of OPTS + +# Set linker flags based on above + +!if $(PGO) > 1 +!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)] +LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize +!else +MSG=^ +This compiler does not support profile guided optimization. +!error $(MSG) +!endif +!elseif $(PGO) > 0 +!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)] +LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument +!else +MSG=^ +This compiler does not support profile guided optimization. +!error $(MSG) +!endif +!endif + +################################################################ +# 8. Parse the STATS macro to configure code instrumentation +# The following macros are set by this section: +# TCL_MEM_DEBUG - 1 -> enables memory allocation instrumentation +# 0 -> disables +# TCL_COMPILE_DEBUG - 1 -> enables byte compiler logging +# 0 -> disables + +# Default both are off +TCL_MEM_DEBUG = 0 +TCL_COMPILE_DEBUG = 0 + +!if "$(STATS)" != "" && ![nmakehlp -f "$(STATS)" "none"] + +!if [nmakehlp -f $(STATS) "memdbg"] +!message *** Doing memdbg +TCL_MEM_DEBUG = 1 +!else +TCL_MEM_DEBUG = 0 +!endif + +!if [nmakehlp -f $(STATS) "compdbg"] +!message *** Doing compdbg +TCL_COMPILE_DEBUG = 1 +!else +TCL_COMPILE_DEBUG = 0 +!endif + +!endif + +#################################################################### +# 9. Parse the CHECKS macro to configure additional compiler checks +# The following macros are set by this section: +# WARNINGS - compiler switches that control the warnings level +# TCL_NO_DEPRECATED - 1 -> disable support for deprecated functions +# 0 -> enable deprecated functions + +# Defaults - Permit deprecated functions and warning level 3 +TCL_NO_DEPRECATED = 0 +WARNINGS = -W3 + +!if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"] + +!if [nmakehlp -f $(CHECKS) "nodep"] +!message *** Doing nodep check +TCL_NO_DEPRECATED = 1 +!endif + +!if [nmakehlp -f $(CHECKS) "fullwarn"] +!message *** Doing full warnings check +WARNINGS = -W4 +!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)] +LINKERFLAGS = $(LINKERFLAGS) -warn:3 +!endif +!endif + +!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64] +!message *** Doing 64bit portability warnings +WARNINGS = $(WARNINGS) -Wp64 +!endif + +!endif + + +################################################################ +# 10. Construct output directory and file paths +# Figure-out how to name our intermediate and output directories. +# In order to avoid inadvertent mixing of object files built using +# different compilers, build configurations etc., +# +# Naming convention (suffixes): +# t = full thread support. (Not used for Tcl >= 8.7) +# s = static library (as opposed to an import library) +# g = linked to the debug enabled C run-time. +# x = special static build when it links to the dynamic C run-time. +# +# The following macros are set in this section: +# SUFX - the suffix to use for binaries based on above naming convention +# BUILDDIRTOP - the toplevel default output directory +# is of the form {Release,Debug}[_AMD64][_COMPILERVERSION] +# TMP_DIR - directory where object files are created +# OUT_DIR - directory where output executables are created +# Both TMP_DIR and OUT_DIR are defaulted only if not defined by the +# parent makefile (or command line). The default values are +# based on BUILDDIRTOP. +# STUBPREFIX - name of the stubs library for this project +# PRJIMPLIB - output path of the generated project import library +# PRJLIBNAME - name of generated project library +# PRJLIB - output path of generated project library +# PRJSTUBLIBNAME - name of the generated project stubs library +# PRJSTUBLIB - output path of the generated project stubs library +# RESFILE - output resource file (only if not static build) + +SUFX = tsgx + +!if $(DEBUG) +BUILDDIRTOP = Debug +!else +BUILDDIRTOP = Release +!endif + +!if "$(MACHINE)" != "IX86" +BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE) +!endif +!if $(VCVER) > 6 +BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER) +!endif + +!if !$(DEBUG) || $(TCL_VERSION) > 86 || $(DEBUG) && $(UNCHECKED) +SUFX = $(SUFX:g=) +!endif + +TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX + +!if !$(STATIC_BUILD) +TMP_DIRFULL = $(TMP_DIRFULL:Static=) +SUFX = $(SUFX:s=) +EXT = dll +TMP_DIRFULL = $(TMP_DIRFULL:X=) +SUFX = $(SUFX:x=) +!else +TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=) +EXT = lib +!if !$(MSVCRT) +TMP_DIRFULL = $(TMP_DIRFULL:X=) +SUFX = $(SUFX:x=) +!endif +!endif + +!if !$(TCL_THREADS) || $(TCL_VERSION) > 86 +TMP_DIRFULL = $(TMP_DIRFULL:Threaded=) +SUFX = $(SUFX:t=) +!endif + +!ifndef TMP_DIR +TMP_DIR = $(TMP_DIRFULL) +!ifndef OUT_DIR +OUT_DIR = .\$(BUILDDIRTOP) +!endif +!else +!ifndef OUT_DIR +OUT_DIR = $(TMP_DIR) +!endif +!endif + +# Relative paths -> absolute +!if [echo OUT_DIR = \> nmakehlp.out] \ + || [nmakehlp -Q "$(OUT_DIR)" >> nmakehlp.out] +!error *** Could not fully qualify path OUT_DIR=$(OUT_DIR) +!endif +!if [echo TMP_DIR = \>> nmakehlp.out] \ + || [nmakehlp -Q "$(TMP_DIR)" >> nmakehlp.out] +!error *** Could not fully qualify path TMP_DIR=$(TMP_DIR) +!endif +!include nmakehlp.out + +# The name of the stubs library for the project being built +STUBPREFIX = $(PROJECT)stub + +# +# Set up paths to various Tcl executables and libraries needed by extensions +# + +# TIP 430. Unused for 8.6 but no harm defining it to allow a common rules.vc +TCLSCRIPTZIPNAME = libtcl$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)$(TCL_PATCH_LETTER)$(TCL_RELEASE_SERIAL).zip +TKSCRIPTZIPNAME = libtk$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)$(TK_PATCH_LETTER)$(TK_RELEASE_SERIAL).zip + +!if $(DOING_TCL) +TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe +TCLSH = $(OUT_DIR)\$(TCLSHNAME) +TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib +TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) +TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) +TCLSCRIPTZIP = $(OUT_DIR)\$(TCLSCRIPTZIPNAME) + +!if $(TCL_MAJOR_VERSION) == 8 +TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib +!else +TCLSTUBLIBNAME = $(STUBPREFIX).lib +!endif +TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) +TCL_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)" + +!else # !$(DOING_TCL) + +!if $(TCLINSTALL) # Building against an installed Tcl + +# When building extensions, we need to locate tclsh. Depending on version +# of Tcl we are building against, this may or may not have a "t" suffix. +# Try various possibilities in turn. +TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe +!if !exist("$(TCLSH)") +TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX:t=).exe +!endif + +!if $(TCL_MAJOR_VERSION) == 8 +TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib +!else +TCLSTUBLIB = $(_TCLDIR)\lib\tclstub.lib +!endif +TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib +# When building extensions, may be linking against Tcl that does not add +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. +!if !exist("$(TCLIMPLIB)") +TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)t$(SUFX:t=).lib +!endif +TCL_LIBRARY = $(_TCLDIR)\lib +TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib +TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib +TCLSCRIPTZIP = $(_TCLDIR)\lib\$(TCLSCRIPTZIPNAME) +TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target +TCL_INCLUDES = -I"$(_TCLDIR)\include" + +!else # Building against Tcl sources + +TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe +!if !exist($(TCLSH)) +TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX:t=).exe +!endif +!if $(TCL_MAJOR_VERSION) == 8 +TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib +!else +TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub.lib +!endif +TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib +# When building extensions, may be linking against Tcl that does not add +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. +!if !exist("$(TCLIMPLIB)") +TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)t$(SUFX:t=).lib +!endif +TCL_LIBRARY = $(_TCLDIR)\library +TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib +TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib +TCLSCRIPTZIP = $(_TCLDIR)\win\$(BUILDDIRTOP)\$(TCLSCRIPTZIPNAME) +TCLTOOLSDIR = $(_TCLDIR)\tools +TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" + +!endif # TCLINSTALL + +!if !$(STATIC_BUILD) && "$(TCL_BUILD_FOR)" == "8" +tcllibs = "$(TCLSTUBLIB)" +!else +tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)" +!endif + +!endif # $(DOING_TCL) + +# We need a tclsh that will run on the host machine as part of the build. +# IX86 runs on all architectures. +!ifndef TCLSH_NATIVE +!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)" +TCLSH_NATIVE = $(TCLSH) +!else +!error You must explicitly set TCLSH_NATIVE for cross-compilation +!endif +!endif + +# Do the same for Tk and Tk extensions that require the Tk libraries +!if $(DOING_TK) || $(NEED_TK) +WISHNAMEPREFIX = wish +WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe +TKLIBNAME8 = tk$(TK_VERSION)$(SUFX).$(EXT) +TKLIBNAME9 = tcl9tk$(TK_VERSION)$(SUFX).$(EXT) +!if $(TCL_MAJOR_VERSION) == 8 || "$(TCL_BUILD_FOR)" == "8" +TKLIBNAME = tk$(TK_VERSION)$(SUFX).$(EXT) +TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib +!else +TKLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).$(EXT) +TKIMPLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).lib +!endif +!if $(TK_MAJOR_VERSION) == 8 +TKSTUBLIBNAME = tkstub$(TK_VERSION).lib +!else +TKSTUBLIBNAME = tkstub.lib +!endif + +!if $(DOING_TK) +WISH = $(OUT_DIR)\$(WISHNAME) +TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) +TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME) +TKLIB = $(OUT_DIR)\$(TKLIBNAME) +TK_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)" +TKSCRIPTZIP = $(OUT_DIR)\$(TKSCRIPTZIPNAME) + +!else # effectively NEED_TK + +!if $(TKINSTALL) # Building against installed Tk +WISH = $(_TKDIR)\bin\$(WISHNAME) +TKSTUBLIB = $(_TKDIR)\lib\$(TKSTUBLIBNAME) +TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) +# When building extensions, may be linking against Tk that does not add +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. +!if !exist("$(TKIMPLIB)") +TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib +TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) +!endif +TK_INCLUDES = -I"$(_TKDIR)\include" +TKSCRIPTZIP = $(_TKDIR)\lib\$(TKSCRIPTZIPNAME) + +!else # Building against Tk sources + +WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME) +TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME) +TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) +# When building extensions, may be linking against Tk that does not add +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. +!if !exist("$(TKIMPLIB)") +TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib +TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) +!endif +TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" +TKSCRIPTZIP = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSCRIPTZIPNAME) + +!endif # TKINSTALL + +tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" + +!endif # $(DOING_TK) +!endif # $(DOING_TK) || $(NEED_TK) + +# Various output paths +PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib +PRJLIBNAME8 = $(PROJECT)$(VERSION)$(SUFX).$(EXT) +PRJLIBNAME9 = tcl9$(PROJECT)$(VERSION)$(SUFX).$(EXT) +!if $(TCL_MAJOR_VERSION) == 8 || "$(TCL_BUILD_FOR)" == "8" +PRJLIBNAME = $(PRJLIBNAME8) +!else +PRJLIBNAME = $(PRJLIBNAME9) +!endif +PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) + +!if $(TCL_MAJOR_VERSION) == 8 +PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib +!else +PRJSTUBLIBNAME = $(STUBPREFIX).lib +!endif +PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) + +# If extension parent makefile has not defined a resource definition file, +# we will generate one from standard template. +!if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD) +!ifdef RCFILE +RESFILE = $(TMP_DIR)\$(RCFILE:.rc=.res) +!else +RESFILE = $(TMP_DIR)\$(PROJECT).res +!endif +!endif + +################################################################### +# 11. Construct the paths for the installation directories +# The following macros get defined in this section: +# LIB_INSTALL_DIR - where libraries should be installed +# BIN_INSTALL_DIR - where the executables should be installed +# DOC_INSTALL_DIR - where documentation should be installed +# SCRIPT_INSTALL_DIR - where scripts should be installed +# INCLUDE_INSTALL_DIR - where C include files should be installed +# DEMO_INSTALL_DIR - where demos should be installed +# PRJ_INSTALL_DIR - where package will be installed (not set for Tcl and Tk) + +!if $(DOING_TCL) || $(DOING_TK) +LIB_INSTALL_DIR = $(_INSTALLDIR)\lib +BIN_INSTALL_DIR = $(_INSTALLDIR)\bin +DOC_INSTALL_DIR = $(_INSTALLDIR)\doc +!if $(DOING_TCL) +SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) +MODULE_INSTALL_DIR = $(_INSTALLDIR)\lib\tcl$(TCL_MAJOR_VERSION) +!else # DOING_TK +SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) +!endif +DEMO_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\demos +INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include + +!else # extension other than Tk + +PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) +!if $(MULTIPLATFORM_INSTALL) +LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR)\$(PLATFORM_IDENTIFY) +BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR)\$(PLATFORM_IDENTIFY) +!else +LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR) +BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR) +!endif +DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) +SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) +DEMO_INSTALL_DIR = $(PRJ_INSTALL_DIR)\demos +INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include + +!endif + +################################################################### +# 12. Set up actual options to be passed to the compiler and linker +# Now we have all the information we need, set up the actual flags and +# options that we will pass to the compiler and linker. The main +# makefile should use these in combination with whatever other flags +# and switches are specific to it. +# The following macros are defined, names are for historical compatibility: +# OPTDEFINES - /Dxxx C macro flags based on user-specified OPTS +# COMPILERFLAGS - /Dxxx C macro flags independent of any configuration options +# crt - Compiler switch that selects the appropriate C runtime +# cdebug - Compiler switches related to debug AND optimizations +# cwarn - Compiler switches that set warning levels +# cflags - complete compiler switches (subsumes cdebug and cwarn) +# ldebug - Linker switches controlling debug information and optimization +# lflags - complete linker switches (subsumes ldebug) except subsystem type +# dlllflags - complete linker switches to build DLLs (subsumes lflags) +# conlflags - complete linker switches for console program (subsumes lflags) +# guilflags - complete linker switches for GUI program (subsumes lflags) +# baselibs - minimum Windows libraries required. Parent makefile can +# define PRJ_LIBS before including rules.rc if additional libs are needed + +OPTDEFINES = /DSTDC_HEADERS /DUSE_NMAKE=1 +!if $(VCVERSION) > 1600 +OPTDEFINES = $(OPTDEFINES) /DHAVE_STDINT_H=1 +!else +OPTDEFINES = $(OPTDEFINES) /DMP_NO_STDINT=1 +!endif +!if $(VCVERSION) >= 1800 +OPTDEFINES = $(OPTDEFINES) /DHAVE_INTTYPES_H=1 /DHAVE_STDBOOL_H=1 +!endif + +!if $(TCL_MEM_DEBUG) +OPTDEFINES = $(OPTDEFINES) /DTCL_MEM_DEBUG +!endif +!if $(TCL_COMPILE_DEBUG) +OPTDEFINES = $(OPTDEFINES) /DTCL_COMPILE_DEBUG /DTCL_COMPILE_STATS +!endif +!if $(TCL_THREADS) && $(TCL_VERSION) < 87 +OPTDEFINES = $(OPTDEFINES) /DTCL_THREADS=1 +!if $(USE_THREAD_ALLOC) && $(TCL_VERSION) < 87 +OPTDEFINES = $(OPTDEFINES) /DUSE_THREAD_ALLOC=1 +!endif +!endif +!if $(STATIC_BUILD) +OPTDEFINES = $(OPTDEFINES) /DSTATIC_BUILD +!elseif $(TCL_VERSION) > 86 +OPTDEFINES = $(OPTDEFINES) /DTCL_WITH_EXTERNAL_TOMMATH +!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64" +OPTDEFINES = $(OPTDEFINES) /DMP_64BIT +!endif +!endif +!if $(TCL_NO_DEPRECATED) +OPTDEFINES = $(OPTDEFINES) /DTCL_NO_DEPRECATED +!endif + +!if $(USE_STUBS) +# Note we do not define USE_TCL_STUBS even when building tk since some +# test targets in tk do not use stubs +!if !$(DOING_TCL) +USE_STUBS_DEFS = /DUSE_TCL_STUBS /DUSE_TCLOO_STUBS +!if $(NEED_TK) +USE_STUBS_DEFS = $(USE_STUBS_DEFS) /DUSE_TK_STUBS +!endif +!endif +!endif # USE_STUBS + +!if !$(DEBUG) +OPTDEFINES = $(OPTDEFINES) /DNDEBUG +!if $(OPTIMIZING) +OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_OPTIMIZED +!endif +!endif +!if $(PROFILE) +OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_PROFILED +!endif +!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64" +OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_DO64BIT +!endif +!if $(VCVERSION) < 1300 +OPTDEFINES = $(OPTDEFINES) /DNO_STRTOI64=1 +!endif + +!if $(TCL_MAJOR_VERSION) == 8 +!if "$(_USE_64BIT_TIME_T)" == "1" +OPTDEFINES = $(OPTDEFINES) /D_USE_64BIT_TIME_T=1 +!endif + +# _ATL_XP_TARGETING - Newer SDK's need this to build for XP +COMPILERFLAGS = /D_ATL_XP_TARGETING +!endif +!if "$(TCL_BUILD_FOR)" == "8" +OPTDEFINES = $(OPTDEFINES) /DTCL_MAJOR_VERSION=8 +!endif + +# Like the TEA system only set this non empty for non-Tk extensions +# Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME +# so we pass both +!if !$(DOING_TCL) && !$(DOING_TK) +PKGNAMEFLAGS = /DPACKAGE_NAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ + /DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ + /DPACKAGE_VERSION="\"$(DOTVERSION)\"" \ + /DMODULE_SCOPE=extern +!endif + +# crt picks the C run time based on selected OPTS +!if $(MSVCRT) +!if $(DEBUG) && !$(UNCHECKED) +crt = -MDd +!else +crt = -MD +!endif +!else +!if $(DEBUG) && !$(UNCHECKED) +crt = -MTd +!else +crt = -MT +!endif +!endif + +# cdebug includes compiler options for debugging as well as optimization. +!if $(DEBUG) + +# In debugging mode, optimizations need to be disabled +cdebug = -Zi -Od $(DEBUGFLAGS) + +!else + +cdebug = $(OPTIMIZATIONS) +!if $(SYMBOLS) +cdebug = $(cdebug) -Zi +!endif + +!endif # $(DEBUG) + +# cwarn includes default warning levels, also C4090 (buggy) and C4146 is useless. +cwarn = $(WARNINGS) -wd4090 -wd4146 + +!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64" +# Disable pointer<->int warnings related to cast between different sizes +# There are a gadzillion of these due to use of ClientData and +# clutter up compiler +# output increasing chance of a real warning getting lost. So disable them. +# Eventually some day, Tcl will be 64-bit clean. +cwarn = $(cwarn) -wd4311 -wd4312 +!endif + +### Common compiler options that are architecture specific +!if "$(MACHINE)" == "ARM" +carch = /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE +!else +carch = +!endif + +# cpuid is only available on intel machines +!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "AMD64" +carch = $(carch) /DHAVE_CPUID=1 +!endif + +!if $(DEBUG) +# Turn warnings into errors +cwarn = $(cwarn) -WX +!endif + +INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) +!if !$(DOING_TCL) && !$(DOING_TK) +INCLUDES = $(INCLUDES) -I"$(GENERICDIR)" -I"$(WIN_DIR)" -I"$(COMPATDIR)" +!endif + +# These flags are defined roughly in the order of the pre-reform +# rules.vc/makefile.vc to help visually compare that the pre- and +# post-reform build logs + +# cflags contains generic flags used for building practically all object files +cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) + +!if $(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) < 7 +cflags = $(cflags) -DTcl_Size=int +!endif + +# appcflags contains $(cflags) and flags for building the application +# object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus +# flags used for building shared object files The two differ in the +# BUILD_$(PROJECT) macro which should be defined only for the shared +# library *implementation* and not for its caller interface + +appcflags_nostubs = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) +appcflags = $(appcflags_nostubs) $(USE_STUBS_DEFS) +pkgcflags = $(appcflags) $(PKGNAMEFLAGS) /DBUILD_$(PROJECT) +pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) /DBUILD_$(PROJECT) + +# stubscflags contains $(cflags) plus flags used for building a stubs +# library for the package. Note: /DSTATIC_BUILD is defined in +# $(OPTDEFINES) only if the OPTS configuration indicates a static +# library. However the stubs library is ALWAYS static hence included +# here irrespective of the OPTS setting. +# +# TBD - tclvfs has a comment that stubs libs should not be compiled with -GL +# without stating why. Tcl itself compiled stubs libs with this flag. +# so we do not remove it from cflags. -GL may prevent extensions +# compiled with one VC version to fail to link against stubs library +# compiled with another VC version. Check for this and fix accordingly. +stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) /Zl /GL- /DSTATIC_BUILD $(INCLUDES) $(USE_STUBS_DEFS) + +# Link flags + +!if $(DEBUG) +ldebug = -debug -debugtype:cv +!else +ldebug = -release -opt:ref -opt:icf,3 +!if $(SYMBOLS) +ldebug = $(ldebug) -debug -debugtype:cv +!endif +!endif + +# Note: Profiling is currently only possible with the Visual Studio Enterprise +!if $(PROFILE) +ldebug= $(ldebug) -profile +!endif + +### Declarations common to all linker versions +lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) + +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 +lflags = $(lflags) -nodefaultlib:libucrt.lib +!endif + +dlllflags = $(lflags) -dll +conlflags = $(lflags) -subsystem:console +guilflags = $(lflags) -subsystem:windows + +# Libraries that are required for every image. +# Extensions should define any additional libraries with $(PRJ_LIBS) +winlibs = kernel32.lib advapi32.lib + +!if $(NEED_TK) +winlibs = $(winlibs) gdi32.lib user32.lib uxtheme.lib +!endif + +# Avoid 'unresolved external symbol __security_cookie' errors. +# c.f. http://support.microsoft.com/?id=894573 +!if "$(MACHINE)" == "AMD64" +!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500 +winlibs = $(winlibs) bufferoverflowU.lib +!endif +!endif + +baselibs = $(winlibs) $(PRJ_LIBS) + +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 +baselibs = $(baselibs) ucrt.lib +!endif + +################################################################ +# 13. Define standard commands, common make targets and implicit rules + +CCPKGCMD = $(cc32) $(pkgcflags) -Fo$(TMP_DIR)^\ +CCAPPCMD = $(cc32) $(appcflags) -Fo$(TMP_DIR)^\ +CCSTUBSCMD = $(cc32) $(stubscflags) -Fo$(TMP_DIR)^\ + +LIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ +DLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) + +CONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) +GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) +RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ + $(TCL_INCLUDES) \ + /DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ + /DCOMMAVERSION=$(RCCOMMAVERSION) \ + /DDOTVERSION=\"$(DOTVERSION)\" \ + /DVERSION=\"$(VERSION)\" \ + /DSUFX=\"$(SUFX)\" \ + /DPROJECT=\"$(PROJECT)\" \ + /DPRJLIBNAME=\"$(PRJLIBNAME)\" + +!ifndef DEFAULT_BUILD_TARGET +DEFAULT_BUILD_TARGET = $(PROJECT) +!endif + +default-target: $(DEFAULT_BUILD_TARGET) + +!if $(MULTIPLATFORM_INSTALL) +default-pkgindex: + @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl + @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ + [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl + @echo } else { >> $(OUT_DIR)\pkgIndex.tcl + @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ + [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl + @echo } >> $(OUT_DIR)\pkgIndex.tcl +!else +default-pkgindex: + @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl + @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ + [list load [file join $$dir $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl + @echo } else { >> $(OUT_DIR)\pkgIndex.tcl + @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ + [list load [file join $$dir $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl + @echo } >> $(OUT_DIR)\pkgIndex.tcl +!endif + +default-pkgindex-tea: + @if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl +@PACKAGE_VERSION@ $(DOTVERSION) +@PACKAGE_NAME@ $(PRJ_PACKAGE_TCLNAME) +@PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME) +@PKG_LIB_FILE@ $(PRJLIBNAME) +@PKG_LIB_FILE8@ $(PRJLIBNAME8) +@PKG_LIB_FILE9@ $(PRJLIBNAME9) +<< + +default-install: default-install-binaries default-install-libraries +!if $(SYMBOLS) +default-install: default-install-pdbs +!endif + +# Again to deal with historical brokenness, there is some confusion +# in terminlogy. For extensions, the "install-binaries" was used to +# locate target directory for *binary shared libraries* and thus +# the appropriate macro is LIB_INSTALL_DIR since BIN_INSTALL_DIR is +# for executables (exes). On the other hand the "install-libraries" +# target is for *scripts* and should have been called "install-scripts". +default-install-binaries: $(PRJLIB) + @echo Installing binaries to '$(LIB_INSTALL_DIR)' + @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" + @$(CPY) $(PRJLIB) "$(LIB_INSTALL_DIR)" >NUL + +# Alias for default-install-scripts +default-install-libraries: default-install-scripts + +default-install-scripts: $(OUT_DIR)\pkgIndex.tcl + @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)' + @if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)" + @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' + @$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR) + +default-install-stubs: + @echo Installing stubs library to '$(SCRIPT_INSTALL_DIR)' + @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" + @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL + +default-install-pdbs: + @echo Installing PDBs to '$(LIB_INSTALL_DIR)' + @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" + @$(CPY) "$(OUT_DIR)\*.pdb" "$(LIB_INSTALL_DIR)\" + +# "emacs font-lock highlighting fix + +default-install-docs-html: + @echo Installing documentation files to '$(DOC_INSTALL_DIR)' + @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" + @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)" + +default-install-docs-n: + @echo Installing documentation files to '$(DOC_INSTALL_DIR)' + @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" + @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.n") do @$(COPY) %f "$(DOC_INSTALL_DIR)" + +default-install-demos: + @echo Installing demos to '$(DEMO_INSTALL_DIR)' + @if not exist "$(DEMO_INSTALL_DIR)" mkdir "$(DEMO_INSTALL_DIR)" + @if exist $(DEMODIR) $(CPYDIR) "$(DEMODIR)" "$(DEMO_INSTALL_DIR)" + +default-clean: + @echo Cleaning $(TMP_DIR)\* ... + @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) + @echo Cleaning $(WIN_DIR)\nmakehlp.obj, nmakehlp.exe ... + @if exist $(WIN_DIR)\nmakehlp.obj del $(WIN_DIR)\nmakehlp.obj + @if exist $(WIN_DIR)\nmakehlp.exe del $(WIN_DIR)\nmakehlp.exe + @if exist $(WIN_DIR)\nmakehlp.out del $(WIN_DIR)\nmakehlp.out + @echo Cleaning $(WIN_DIR)\nmhlp-out.txt ... + @if exist $(WIN_DIR)\nmhlp-out.txt del $(WIN_DIR)\nmhlp-out.txt + @echo Cleaning $(WIN_DIR)\_junk.pch ... + @if exist $(WIN_DIR)\_junk.pch del $(WIN_DIR)\_junk.pch + @echo Cleaning $(WIN_DIR)\vercl.x, vercl.i ... + @if exist $(WIN_DIR)\vercl.x del $(WIN_DIR)\vercl.x + @if exist $(WIN_DIR)\vercl.i del $(WIN_DIR)\vercl.i + @echo Cleaning $(WIN_DIR)\versions.vc, version.vc ... + @if exist $(WIN_DIR)\versions.vc del $(WIN_DIR)\versions.vc + @if exist $(WIN_DIR)\version.vc del $(WIN_DIR)\version.vc + +default-hose: default-clean + @echo Hosing $(OUT_DIR)\* ... + @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) + +# Only for backward compatibility +default-distclean: default-hose + +default-setup: + @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) + @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) + +!if "$(TESTPAT)" != "" +TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT) +!endif + +default-test: default-setup $(PROJECT) + @set TCLLIBPATH=$(OUT_DIR:\=/) + @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)" + cd "$(TESTDIR)" && $(DEBUGGER) $(TCLSH) all.tcl $(TESTFLAGS) + +default-shell: default-setup $(PROJECT) + @set TCLLIBPATH=$(OUT_DIR:\=/) + @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)" + $(DEBUGGER) $(TCLSH) + +# Generation of Windows version resource +!ifdef RCFILE + +# Note: don't use $** in below rule because there may be other dependencies +# and only the "main" rc must be passed to the resource compiler +$(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc + $(RESCMD) $(RCDIR)\$(PROJECT).rc + +!else + +# If parent makefile has not defined a resource definition file, +# we will generate one from standard template. +$(TMP_DIR)\$(PROJECT).res: $(TMP_DIR)\$(PROJECT).rc + +$(TMP_DIR)\$(PROJECT).rc: + @$(COPY) << $(TMP_DIR)\$(PROJECT).rc +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION COMMAVERSION + PRODUCTVERSION COMMAVERSION + FILEFLAGSMASK 0x3fL +#ifdef DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "Tcl extension " PROJECT + VALUE "OriginalFilename", PRJLIBNAME + VALUE "FileVersion", DOTVERSION + VALUE "ProductName", "Package " PROJECT " for Tcl" + VALUE "ProductVersion", DOTVERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +<< + +!endif # ifdef RCFILE + +!ifndef DISABLE_IMPLICIT_RULES +DISABLE_IMPLICIT_RULES = 0 +!endif + +!if !$(DISABLE_IMPLICIT_RULES) +# Implicit rule definitions - only for building library objects. For stubs and +# main application, the makefile should define explicit rules. + +{$(ROOT)}.c{$(TMP_DIR)}.obj:: + $(CCPKGCMD) @<< +$< +<< + +{$(WIN_DIR)}.c{$(TMP_DIR)}.obj:: + $(CCPKGCMD) @<< +$< +<< + +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj:: + $(CCPKGCMD) @<< +$< +<< + +{$(COMPATDIR)}.c{$(TMP_DIR)}.obj:: + $(CCPKGCMD) @<< +$< +<< + +{$(RCDIR)}.rc{$(TMP_DIR)}.res: + $(RESCMD) $< + +{$(WIN_DIR)}.rc{$(TMP_DIR)}.res: + $(RESCMD) $< + +{$(TMP_DIR)}.rc{$(TMP_DIR)}.res: + $(RESCMD) $< + +.SUFFIXES: +.SUFFIXES:.c .rc + +!endif + +################################################################ +# 14. Sanity check selected options against Tcl build options +# When building an extension, certain configuration options should +# match the ones used when Tcl was built. Here we check and +# warn on a mismatch. +!if !$(DOING_TCL) + +!if $(TCLINSTALL) # Building against an installed Tcl +!if exist("$(_TCLDIR)\lib\nmake\tcl.nmake") +TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake" +!endif +!else # !$(TCLINSTALL) - building against Tcl source +!if exist("$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl.nmake") +TCLNMAKECONFIG = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl.nmake" +!endif +!endif # TCLINSTALL + +!if $(CONFIG_CHECK) +!ifdef TCLNMAKECONFIG +!include $(TCLNMAKECONFIG) + +!if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)" +!error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). +!endif +!if $(TCL_VERSION) < 87 && defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC) +!message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)). +!endif +!if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG) +!message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)). +!endif +!endif + +!endif # TCLNMAKECONFIG + +!endif # !$(DOING_TCL) + + +#---------------------------------------------------------- +# Display stats being used. +#---------------------------------------------------------- + +!if !$(DOING_TCL) +!message *** Building against Tcl at '$(_TCLDIR)' +!endif +!if !$(DOING_TK) && $(NEED_TK) +!message *** Building against Tk at '$(_TKDIR)' +!endif +!message *** Intermediate directory will be '$(TMP_DIR)' +!message *** Output directory will be '$(OUT_DIR)' +!message *** Installation, if selected, will be in '$(_INSTALLDIR)' +!message *** Suffix for binaries will be '$(SUFX)' +!message *** Compiler version $(VCVER). Target $(MACHINE), host $(NATIVE_ARCH). + +!endif # ifdef _RULES_VC ADDED win/x86_64-w64-mingw32-nmakehlp.exe Index: win/x86_64-w64-mingw32-nmakehlp.exe ================================================================== --- /dev/null +++ win/x86_64-w64-mingw32-nmakehlp.exe cannot compute difference between binary files