Tcl Extension Architecture (TEA) Sample Extension

Check-in [9011a8649b]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge with trunk
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | practcl
Files: files | file ages | folders
SHA3-256: 9011a8649bf65cf7b5662171831cbdc831dabfba6fb910303d77893e6497d549
User & Date: seandeelywoods 2018-10-28 06:55:12
Context
2018-10-28
07:02
Adding local resident copy of practcl Leaf check-in: a2f82d04ff user: seandeelywoods tags: practcl
06:55
Merge with trunk check-in: 9011a8649b user: seandeelywoods tags: practcl
2018-08-13
08:30
Replace broken autoconf tokens. Untangle CFLAGS_DEFAULT, CFLAGS_WARNING, and SHLIB_CFLAGS from CFLAGS. Leaf check-in: 4767411521 user: pooryorick tags: trunk
2018-01-25
18:33
Improvements to the practcl project builder. Added a new facility to pull authors from Changelog check-in: 9b70b161ae user: seandeelywoods tags: practcl
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added .fossil-settings/crlf-glob.

            1  +win/*.vc

Changes to .fossil-settings/crnl-glob.

     1         -win/makefile.vc
     2         -win/rules.vc
            1  +win/*.vc

Changes to .fossil-settings/ignore-glob.

    11     11   *.so
    12     12   Makefile
    13     13   config.cache
    14     14   config.log
    15     15   config.status
    16     16   pkgIndex.tcl
    17     17   */versions.vc
           18  +win/Release*
           19  +win/Debug*
           20  +win/nmhlp-out.txt
           21  +tclconfig/*
           22  +*~

Changes to Makefile.in.

    76     76   DESTDIR		=
    77     77   
    78     78   PKG_DIR		= $(PACKAGE_NAME)$(PACKAGE_VERSION)
    79     79   pkgdatadir	= $(datadir)/$(PKG_DIR)
    80     80   pkglibdir	= $(libdir)/$(PKG_DIR)
    81     81   pkgincludedir	= $(includedir)/$(PKG_DIR)
    82     82   
    83         -top_builddir	= .
           83  +top_builddir	= @[email protected]
    84     84   
    85     85   INSTALL_OPTIONS	=
    86         -INSTALL		= @[email protected] ${INSTALL_OPTIONS}
    87         -INSTALL_DATA_DIR = @[email protected]
           86  +INSTALL		= @[email protected] $(INSTALL_OPTIONS)
           87  +INSTALL_DATA_DIR = ${INSTALL} -d -m 755
    88     88   INSTALL_DATA	= @[email protected]
    89     89   INSTALL_PROGRAM	= @[email protected]
    90     90   INSTALL_SCRIPT	= @[email protected]
    91         -INSTALL_LIBRARY	= @[email protected]
           91  +INSTALL_LIBRARY	= ${INSTALL_DATA}
    92     92   
    93     93   PACKAGE_NAME	= @[email protected]
    94     94   PACKAGE_VERSION	= @[email protected]
    95     95   CC		= @[email protected]
    96     96   CFLAGS_DEFAULT	= @[email protected]
    97     97   CFLAGS_WARNING	= @[email protected]
    98     98   EXEEXT		= @[email protected]
................................................................................
   129    129   TCLLIBPATH	= $(top_builddir)
   130    130   TCLSH_ENV	= TCL_LIBRARY=`@[email protected] $(TCL_SRC_DIR)/library`
   131    131   PKG_ENV		= @[email protected]="$(EXTRA_PATH):$(@[email protected])" \
   132    132   		  PATH="$(EXTRA_PATH):$(PATH)" \
   133    133   		  TCLLIBPATH="$(TCLLIBPATH)"
   134    134   
   135    135   TCLSH_PROG	= @[email protected]
   136         -TCLSH		= $(PKG_ENV) $(TCLSH_ENV) $(TCLSH_PROG)
          136  +TCLSH		= $(TCLSH_ENV) $(PKG_ENV) $(TCLSH_PROG)
   137    137   
   138    138   #WISH_ENV	= TK_LIBRARY=`@[email protected] $(TK_SRC_DIR)/library`
   139    139   #WISH_PROG	= @[email protected]
   140         -#WISH		= $(PKG_ENV) $(TCLSH_ENV) $(WISH_ENV) $(WISH_PROG)
          140  +#WISH		= $(TCLSH_ENV) $(WISH_ENV) $(PKG_ENV) $(WISH_PROG)
   141    141   
   142    142   SHARED_BUILD	= @[email protected]
   143    143   
   144    144   INCLUDES	= @[email protected] @[email protected]
   145    145   #INCLUDES	= @[email protected] @[email protected] @[email protected] @[email protected]
   146    146   
   147    147   PKG_CFLAGS	= @[email protected]
................................................................................
   158    158   CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
   159    159   CLEANFILES	= @[email protected]
   160    160   
   161    161   CPPFLAGS	= @[email protected]
   162    162   LIBS		= @[email protected] @[email protected]
   163    163   AR		= @[email protected]
   164    164   CFLAGS		= @[email protected]
   165         -COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
          165  +COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) \
          166  +			  $(CFLAGS_DEFAULT) $(CFLAGS_WARNING) $(SHLIB_CFLAGS) $(CFLAGS)
          167  +
          168  +GDB		= gdb
          169  +VALGRIND	= valgrind
          170  +VALGRINDARGS	= --tool=memcheck --num-callers=8 --leak-resolution=high \
          171  +		  --leak-check=yes --show-reachable=yes -v
   166    172   
   167    173   .SUFFIXES: .c .$(OBJEXT)
   168    174   
   169    175   #========================================================================
   170    176   # Start of user-definable TARGETS section
   171    177   #========================================================================
   172    178   
................................................................................
   212    218   # Performs a minimum install of the dll and Tcl library files
   213    219   #========================================================================
   214    220   install-package:
   215    221   	$(TCLSH) ${srcdir}/make.tcl install-package $(DESTDIR)
   216    222   
   217    223   test: binaries libraries
   218    224   	$(TCLSH) `@[email protected] $(srcdir)/tests/all.tcl` $(TESTFLAGS) \
   219         -		-load "package ifneeded ${PACKAGE_NAME} ${PACKAGE_VERSION} \
   220         -			[list load `@[email protected] $(PKG_LIB_FILE)` $(PACKAGE_NAME)]"
          225  +	    -load "package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
          226  +		[list load `@[email protected] $(PKG_LIB_FILE)` $(PACKAGE_NAME)]"
   221    227   
   222    228   shell: binaries libraries
   223    229   	@$(TCLSH) $(SCRIPT)
   224    230   
   225    231   gdb:
   226         -	$(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT)
          232  +	$(TCLSH_ENV) $(PKG_ENV) $(GDB) $(TCLSH_PROG) $(SCRIPT)
   227    233   
   228         -VALGRINDARGS =	--tool=memcheck --num-callers=8 --leak-resolution=high \
   229         -		--leak-check=yes --show-reachable=yes -v
          234  +gdb-test: binaries libraries 
          235  +	$(TCLSH_ENV) $(PKG_ENV) $(GDB) \
          236  +	    --args $(TCLSH_PROG) `@[email protected] $(srcdir)/tests/all.tcl` \
          237  +	    $(TESTFLAGS) -singleproc 1 \
          238  +	    -load "package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
          239  +		[list load `@[email protected] $(PKG_LIB_FILE)` $(PACKAGE_NAME)]"
   230    240   
   231    241   valgrind: binaries libraries
   232         -	$(TCLSH_ENV) valgrind $(VALGRINDARGS) $(TCLSH_PROG) \
   233         -		`@[email protected] $(srcdir)/tests/all.tcl` $(TESTFLAGS)
          242  +	$(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) \
          243  +	    `@[email protected] $(srcdir)/tests/all.tcl` $(TESTFLAGS)
   234    244   
   235    245   valgrindshell: binaries libraries
   236         -	$(TCLSH_ENV) valgrind $(VALGRINDARGS) $(TCLSH_PROG) $(SCRIPT)
          246  +	$(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) $(SCRIPT)
   237    247   
   238    248   depend:
   239    249   
   240    250   #========================================================================
   241    251   # $(PKG_LIB_FILE) should be listed as part of the BINARIES variable
   242    252   # mentioned above.  That will ensure that this target is built when you
   243    253   # run "make binaries".
................................................................................
   278    288   #========================================================================
   279    289   
   280    290   #COMPRESS	= tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar
   281    291   COMPRESS	= tar zcvf $(PKG_DIR).tar.gz $(PKG_DIR)
   282    292   DIST_ROOT	= /tmp/dist
   283    293   DIST_DIR	= $(DIST_ROOT)/$(PKG_DIR)
   284    294   
          295  +DIST_INSTALL_DATA	= CPPROG='cp -p' $(INSTALL) -m 644
          296  +DIST_INSTALL_SCRIPT	= CPPROG='cp -p' $(INSTALL) -m 755
          297  +
   285    298   dist-clean:
   286    299   	rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*
   287    300   
   288    301   dist: dist-clean
   289    302   	$(INSTALL_DATA_DIR) $(DIST_DIR)
   290         -	cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \
   291         -		$(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \
   292         -		$(srcdir)/configure.ac $(DIST_DIR)/
   293         -	chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4
   294         -	chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.ac
   295    303   
   296         -	for i in $(srcdir)/*.[ch]; do \
   297         -	    if [ -f $$i ]; then \
   298         -		cp -p $$i $(DIST_DIR)/ ; \
   299         -	    fi; \
   300         -	done;
          304  +	# TEA files
          305  +	$(DIST_INSTALL_DATA) $(srcdir)/Makefile.in \
          306  +	    $(srcdir)/aclocal.m4 $(srcdir)/configure.ac \
          307  +	    $(DIST_DIR)/
          308  +	$(DIST_INSTALL_SCRIPT) $(srcdir)/configure $(DIST_DIR)/
   301    309   
   302    310   	$(INSTALL_DATA_DIR) $(DIST_DIR)/tclconfig
   303         -	cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \
   304         -		$(DIST_DIR)/tclconfig/
   305         -	chmod 664 $(DIST_DIR)/tclconfig/tcl.m4
   306         -	chmod +x $(DIST_DIR)/tclconfig/install-sh
          311  +	$(DIST_INSTALL_DATA) $(srcdir)/tclconfig/README.txt \
          312  +	    $(srcdir)/tclconfig/tcl.m4 $(srcdir)/tclconfig/install-sh \
          313  +	    $(DIST_DIR)/tclconfig/
          314  +
          315  +	# Extension files
          316  +	$(DIST_INSTALL_DATA) \
          317  +	    $(srcdir)/ChangeLog \
          318  +	    $(srcdir)/README.sha \
          319  +	    $(srcdir)/license.terms \
          320  +	    $(srcdir)/README \
          321  +	    $(srcdir)/pkgIndex.tcl.in \
          322  +	    $(DIST_DIR)/
   307    323   
   308    324   	list='demos doc generic library mac tests unix win'; \
   309    325   	for p in $$list; do \
   310    326   	    if test -d $(srcdir)/$$p ; then \
   311    327   		$(INSTALL_DATA_DIR) $(DIST_DIR)/$$p; \
   312         -		cp -p $(srcdir)/$$p/*.* $(DIST_DIR)/$$p/; \
          328  +		$(DIST_INSTALL_DATA) $(srcdir)/$$p/* $(DIST_DIR)/$$p/; \
   313    329   	    fi; \
   314    330   	done
   315    331   
   316    332   	(cd $(DIST_ROOT); $(COMPRESS);)
   317    333   
   318    334   #========================================================================
   319    335   # End of user-definable section
................................................................................
   347    363   
   348    364   install-lib-binaries: binaries
   349    365   	@$(INSTALL_DATA_DIR) $(DESTDIR)$(pkglibdir)
   350    366   	@list='$(lib_BINARIES)'; for p in $$list; do \
   351    367   	  if test -f $$p; then \
   352    368   	    echo " $(INSTALL_LIBRARY) $$p $(DESTDIR)$(pkglibdir)/$$p"; \
   353    369   	    $(INSTALL_LIBRARY) $$p $(DESTDIR)$(pkglibdir)/$$p; \
   354         -	    stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \
   355         -	    if test "x$$stub" = "xstub"; then \
   356         -		echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \
   357         -		$(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \
   358         -	    else \
   359         -		echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \
   360         -		$(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \
   361         -	    fi; \
   362    370   	    ext=`echo $$p|sed -e "s/.*\.//"`; \
   363    371   	    if test "x$$ext" = "xdll"; then \
   364    372   		lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \
   365    373   		if test -f $$lib; then \
   366    374   		    echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \
   367    375   	            $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \
   368    376   		fi; \
................................................................................
   412    420   	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
   413    421   	done
   414    422   	list='$(bin_BINARIES)'; for p in $$list; do \
   415    423   	  rm -f $(DESTDIR)$(bindir)/$$p; \
   416    424   	done
   417    425   
   418    426   .PHONY: all binaries clean depend distclean doc install libraries test
          427  +.PHONY: gdb gdb-test valgrind valgrindshell
   419    428   
   420    429   # Tell versions [3.59,3.63) of GNU make to not export all variables.
   421    430   # Otherwise a system limit (for SysV at least) may be exceeded.
   422    431   .NOEXPORT:

Changes to configure.

   660    660   AR
   661    661   STUBS_BUILD
   662    662   SHARED_BUILD
   663    663   TCL_THREADS
   664    664   TCL_INCLUDES
   665    665   PKG_OBJECTS
   666    666   PKG_SOURCES
   667         -MATH_LIBS
   668    667   EGREP
   669    668   GREP
   670    669   RANLIB
   671    670   SET_MAKE
   672         -INSTALL_LIBRARY
   673         -INSTALL_SCRIPT
   674         -INSTALL_PROGRAM
   675         -INSTALL_DATA
   676         -INSTALL_DATA_DIR
   677         -INSTALL
   678    671   CPP
   679    672   TCL_SHLIB_LD_LIBS
   680    673   TCL_LD_FLAGS
   681    674   TCL_EXTRA_CFLAGS
   682    675   TCL_DEFS
   683    676   TCL_LIBS
   684    677   CLEANFILES
................................................................................
   696    689   TCL_LIB_FILE
   697    690   TCL_SRC_DIR
   698    691   TCL_BIN_DIR
   699    692   TCL_PATCH_LEVEL
   700    693   TCL_VERSION
   701    694   CONFIG_CLEAN_FILES
   702    695   LN_S
          696  +INSTALL_LIBRARY
          697  +INSTALL_SCRIPT
          698  +INSTALL_PROGRAM
          699  +INSTALL_DATA
          700  +INSTALL_DATA_DIR
          701  +INSTALL
   703    702   PKG_CFLAGS
   704    703   PKG_LIBS
   705    704   PKG_INCLUDES
   706    705   PKG_HEADERS
   707    706   PKG_TCL_SOURCES
   708    707   PKG_STUB_OBJECTS
   709    708   PKG_STUB_SOURCES
................................................................................
  1380   1379      esac
  1381   1380     cat <<\_ACEOF
  1382   1381   
  1383   1382   Optional Features:
  1384   1383     --disable-option-checking  ignore unrecognized --enable/--with options
  1385   1384     --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  1386   1385     --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  1387         -  --enable-threads        build with threads
         1386  +  --enable-threads        build with threads (default: on)
  1388   1387     --enable-shared         build and link with shared libraries (default: on)
  1389   1388     --enable-stubs          build and link with stub libraries. Always true for
  1390   1389                             shared builds (default: on)
  1391   1390     --enable-64bit          enable 64bit support (default: off)
  1392   1391     --enable-64bit-vis      enable 64bit Sparc VIS support (default: off)
  1393   1392     --disable-rpath         disable rpath support (default: on)
  1394   1393     --enable-wince          enable Win/CE support (where applicable)
................................................................................
  1749   1748   fi
  1750   1749   eval ac_res=\$$3
  1751   1750   	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  1752   1751   $as_echo "$ac_res" >&6; }
  1753   1752     eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1754   1753   
  1755   1754   } # ac_fn_c_check_func
  1756         -
  1757         -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
  1758         -# -------------------------------------------------------
  1759         -# Tests whether HEADER exists, giving a warning if it cannot be compiled using
  1760         -# the include files in INCLUDES and setting the cache variable VAR
  1761         -# accordingly.
  1762         -ac_fn_c_check_header_mongrel ()
  1763         -{
  1764         -  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  1765         -  if eval \${$3+:} false; then :
  1766         -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
  1767         -$as_echo_n "checking for $2... " >&6; }
  1768         -if eval \${$3+:} false; then :
  1769         -  $as_echo_n "(cached) " >&6
  1770         -fi
  1771         -eval ac_res=\$$3
  1772         -	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  1773         -$as_echo "$ac_res" >&6; }
  1774         -else
  1775         -  # Is the header compilable?
  1776         -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
  1777         -$as_echo_n "checking $2 usability... " >&6; }
  1778         -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  1779         -/* end confdefs.h.  */
  1780         -$4
  1781         -#include <$2>
  1782         -_ACEOF
  1783         -if ac_fn_c_try_compile "$LINENO"; then :
  1784         -  ac_header_compiler=yes
  1785         -else
  1786         -  ac_header_compiler=no
  1787         -fi
  1788         -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  1789         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
  1790         -$as_echo "$ac_header_compiler" >&6; }
  1791         -
  1792         -# Is the header present?
  1793         -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
  1794         -$as_echo_n "checking $2 presence... " >&6; }
  1795         -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  1796         -/* end confdefs.h.  */
  1797         -#include <$2>
  1798         -_ACEOF
  1799         -if ac_fn_c_try_cpp "$LINENO"; then :
  1800         -  ac_header_preproc=yes
  1801         -else
  1802         -  ac_header_preproc=no
  1803         -fi
  1804         -rm -f conftest.err conftest.i conftest.$ac_ext
  1805         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
  1806         -$as_echo "$ac_header_preproc" >&6; }
  1807         -
  1808         -# So?  What about this header?
  1809         -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
  1810         -  yes:no: )
  1811         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
  1812         -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
  1813         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
  1814         -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
  1815         -    ;;
  1816         -  no:yes:* )
  1817         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
  1818         -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
  1819         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
  1820         -$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
  1821         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
  1822         -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
  1823         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
  1824         -$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
  1825         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
  1826         -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
  1827         -    ;;
  1828         -esac
  1829         -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
  1830         -$as_echo_n "checking for $2... " >&6; }
  1831         -if eval \${$3+:} false; then :
  1832         -  $as_echo_n "(cached) " >&6
  1833         -else
  1834         -  eval "$3=\$ac_header_compiler"
  1835         -fi
  1836         -eval ac_res=\$$3
  1837         -	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  1838         -$as_echo "$ac_res" >&6; }
  1839         -fi
  1840         -  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1841         -
  1842         -} # ac_fn_c_check_header_mongrel
  1843   1755   cat >config.log <<_ACEOF
  1844   1756   This file contains any messages produced by compilers while
  1845   1757   running configure, to aid debugging if configure makes a mistake.
  1846   1758   
  1847   1759   It was created by sample $as_me 0.6, which was
  1848   1760   generated by GNU Autoconf 2.69.  Invocation command line was
  1849   1761   
................................................................................
  2195   2107   
  2196   2108   #--------------------------------------------------------------------
  2197   2109   # Call TEA_INIT as the first TEA_ macro to set up initial vars.
  2198   2110   # This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
  2199   2111   # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
  2200   2112   #--------------------------------------------------------------------
  2201   2113   
  2202         -
  2203         -    # TEA extensions pass this us the version of TEA they think they
  2204         -    # are compatible with.
  2205         -    TEA_VERSION="3.10"
  2206         -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5
  2207         -$as_echo_n "checking for correct TEA configuration... " >&6; }
         2114  +    TEA_VERSION="4.0"
         2115  +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking TEA configuration" >&5
         2116  +$as_echo_n "checking TEA configuration... " >&6; }
  2208   2117       if test x"${PACKAGE_NAME}" = x ; then
  2209   2118   	as_fn_error $? "
  2210   2119   The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5
  2211   2120       fi
  2212         -    if test x"4.0]" = x ; then
  2213         -	as_fn_error $? "
  2214         -TEA version not specified." "$LINENO" 5
  2215         -    elif test "4.0]" != "${TEA_VERSION}" ; then
  2216         -	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"4.0\"" >&5
  2217         -$as_echo "warning: requested TEA version \"4.0\"" >&6; }
  2218         -    else
  2219         -	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
         2121  +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
  2220   2122   $as_echo "ok (TEA ${TEA_VERSION})" >&6; }
  2221         -    fi
  2222   2123   
  2223   2124       # If the user did not set CFLAGS, set it now to keep macros
  2224   2125       # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
  2225   2126       if test "${CFLAGS+set}" != "set" ; then
  2226   2127   	CFLAGS=""
  2227   2128       fi
  2228   2129   		TEA_TK_EXTENSION=0
  2229   2130   
  2230   2131       case "`uname -s`" in
  2231         -	*win32*|*WIN32*|*MINGW32_*)
         2132  +	*win32*|*WIN32*|*MINGW32_*|*MINGW64_*)
  2232   2133   	    # Extract the first word of "cygpath", so it can be a program name with args.
  2233   2134   set dummy cygpath; ac_word=$2
  2234   2135   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  2235   2136   $as_echo_n "checking for $ac_word... " >&6; }
  2236   2137   if ${ac_cv_prog_CYGPATH+:} false; then :
  2237   2138     $as_echo_n "(cached) " >&6
  2238   2139   else
................................................................................
  2315   2216   
  2316   2217   
  2317   2218   
  2318   2219   
  2319   2220   
  2320   2221   
  2321   2222   
         2223  +
         2224  +    # Configure the installer.
         2225  +
         2226  +    INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c'
         2227  +    INSTALL_DATA_DIR='${INSTALL} -d -m 755'
         2228  +    INSTALL_DATA='${INSTALL} -m 644'
         2229  +    INSTALL_PROGRAM='${INSTALL} -m 755'
         2230  +    INSTALL_SCRIPT='${INSTALL} -m 755'
         2231  +
         2232  +
         2233  +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking system version" >&5
         2234  +$as_echo_n "checking system version... " >&6; }
         2235  +if ${tcl_cv_sys_version+:} false; then :
         2236  +  $as_echo_n "(cached) " >&6
         2237  +else
         2238  +
         2239  +	# TEA specific:
         2240  +	if test "${TEA_PLATFORM}" = "windows" ; then
         2241  +	    tcl_cv_sys_version=windows
         2242  +	else
         2243  +	    tcl_cv_sys_version=`uname -s`-`uname -r`
         2244  +	    if test "$?" -ne 0 ; then
         2245  +		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: can't find uname command" >&5
         2246  +$as_echo "$as_me: WARNING: can't find uname command" >&2;}
         2247  +		tcl_cv_sys_version=unknown
         2248  +	    else
         2249  +		if test "`uname -s`" = "AIX" ; then
         2250  +		    tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
         2251  +		fi
         2252  +	    fi
         2253  +	fi
         2254  +
         2255  +fi
         2256  +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_sys_version" >&5
         2257  +$as_echo "$tcl_cv_sys_version" >&6; }
         2258  +    system=$tcl_cv_sys_version
         2259  +
         2260  +    case $system in
         2261  +	HP-UX-*) INSTALL_LIBRARY='${INSTALL} -m 755' ;;
         2262  +	      *) INSTALL_LIBRARY='${INSTALL} -m 644' ;;
         2263  +    esac
         2264  +
         2265  +
         2266  +
         2267  +
         2268  +
         2269  +
         2270  +
         2271  +
  2322   2272   
  2323   2273   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
  2324   2274   $as_echo_n "checking whether ln -s works... " >&6; }
  2325   2275   LN_S=$as_ln_s
  2326   2276   if test "$LN_S" = "ln -s"; then
  2327   2277     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  2328   2278   $as_echo "yes" >&6; }
................................................................................
  2334   2284   CONFIG_CLEAN_FILES=
  2335   2285   if test ! -d $srcdir/tclconfig ; then
  2336   2286       if test -d $srcdir/../tclconfig ; then
  2337   2287           $LN_S $srcdir/../tclconfig tclconfig
  2338   2288           CONFIG_CLEAN_FILES=tclconfig
  2339   2289       fi
  2340   2290   fi
         2291  +
  2341   2292   
  2342   2293   ac_aux_dir=
  2343   2294   for ac_dir in tclconfig "$srcdir"/tclconfig; do
  2344   2295     if test -f "$ac_dir/install-sh"; then
  2345   2296       ac_aux_dir=$ac_dir
  2346   2297       ac_install_sh="$ac_aux_dir/install-sh -c"
  2347   2298       break
................................................................................
  2443   2394   
  2444   2395   	    # on Darwin, check in Framework installation locations
  2445   2396   	    if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
  2446   2397   		for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
  2447   2398   			`ls -d /Library/Frameworks 2>/dev/null` \
  2448   2399   			`ls -d /Network/Library/Frameworks 2>/dev/null` \
  2449   2400   			`ls -d /System/Library/Frameworks 2>/dev/null` \
         2401  +			`ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks/Tcl.framework 2>/dev/null` \
         2402  +			`ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Network/Library/Frameworks/Tcl.framework 2>/dev/null` \
         2403  +			`ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework 2>/dev/null` \
  2450   2404   			; do
  2451   2405   		    if test -f "$i/Tcl.framework/tclConfig.sh" ; then
  2452   2406   			ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
  2453   2407   			break
  2454   2408   		    fi
  2455   2409   		done
  2456   2410   	    fi
................................................................................
  2469   2423   	    fi
  2470   2424   
  2471   2425   	    # check in a few common install locations
  2472   2426   	    if test x"${ac_cv_c_tclconfig}" = x ; then
  2473   2427   		for i in `ls -d ${libdir} 2>/dev/null` \
  2474   2428   			`ls -d ${exec_prefix}/lib 2>/dev/null` \
  2475   2429   			`ls -d ${prefix}/lib 2>/dev/null` \
  2476         -			`ls -d /usr/contrib/lib 2>/dev/null` \
  2477   2430   			`ls -d /usr/local/lib 2>/dev/null` \
         2431  +			`ls -d /usr/contrib/lib 2>/dev/null` \
  2478   2432   			`ls -d /usr/pkg/lib 2>/dev/null` \
  2479   2433   			`ls -d /usr/lib 2>/dev/null` \
  2480   2434   			`ls -d /usr/lib64 2>/dev/null` \
  2481   2435   			`ls -d /usr/lib/tcl8.6 2>/dev/null` \
  2482   2436   			`ls -d /usr/lib/tcl8.5 2>/dev/null` \
         2437  +			`ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
         2438  +			`ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
         2439  +			`ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \
         2440  +			`ls -d /usr/local/lib/tcl/tcl8.5 2>/dev/null` \
  2483   2441   			; do
  2484   2442   		    if test -f "$i/tclConfig.sh" ; then
  2485   2443   			ac_cv_c_tclconfig="`(cd $i; pwd)`"
  2486   2444   			break
  2487   2445   		    fi
  2488   2446   		done
  2489   2447   	    fi
................................................................................
  4195   4153   
  4196   4154   ac_ext=c
  4197   4155   ac_cpp='$CPP $CPPFLAGS'
  4198   4156   ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  4199   4157   ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  4200   4158   ac_compiler_gnu=$ac_cv_c_compiler_gnu
  4201   4159   
  4202         -
  4203         -    INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c'
  4204         -    INSTALL_DATA_DIR='${INSTALL} -d -m 755'
  4205         -    INSTALL_DATA='${INSTALL} -m 644'
  4206         -    INSTALL_PROGRAM='${INSTALL}'
  4207         -    INSTALL_SCRIPT='${INSTALL}'
  4208         -    INSTALL_LIBRARY='${INSTALL_DATA}'
  4209         -
  4210         -
  4211         -
  4212         -
  4213         -
  4214         -
  4215         -
  4216   4160   
  4217   4161       #--------------------------------------------------------------------
  4218   4162       # Checks to see if the make program sets the $MAKE variable.
  4219   4163       #--------------------------------------------------------------------
  4220   4164   
  4221   4165       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
  4222   4166   $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
................................................................................
  4881   4825   
  4882   4826        ;; #(
  4883   4827      *)
  4884   4828        as_fn_error $? "unknown endianness
  4885   4829    presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
  4886   4830    esac
  4887   4831   
  4888         -    if test "${TEA_PLATFORM}" = "unix" ; then
  4889         -
  4890         -    #--------------------------------------------------------------------
  4891         -    # On a few very rare systems, all of the libm.a stuff is
  4892         -    # already in libc.a.  Set compiler flags accordingly.
  4893         -    # Also, Linux requires the "ieee" library for math to work
  4894         -    # right (and it must appear before "-lm").
  4895         -    #--------------------------------------------------------------------
  4896         -
  4897         -    ac_fn_c_check_func "$LINENO" "sin" "ac_cv_func_sin"
  4898         -if test "x$ac_cv_func_sin" = xyes; then :
  4899         -  MATH_LIBS=""
  4900         -else
  4901         -  MATH_LIBS="-lm"
  4902         -fi
  4903         -
  4904         -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lieee" >&5
  4905         -$as_echo_n "checking for main in -lieee... " >&6; }
  4906         -if ${ac_cv_lib_ieee_main+:} false; then :
  4907         -  $as_echo_n "(cached) " >&6
  4908         -else
  4909         -  ac_check_lib_save_LIBS=$LIBS
  4910         -LIBS="-lieee  $LIBS"
  4911         -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  4912         -/* end confdefs.h.  */
  4913         -
  4914         -
  4915         -int
  4916         -main ()
  4917         -{
  4918         -return main ();
  4919         -  ;
  4920         -  return 0;
  4921         -}
  4922         -_ACEOF
  4923         -if ac_fn_c_try_link "$LINENO"; then :
  4924         -  ac_cv_lib_ieee_main=yes
  4925         -else
  4926         -  ac_cv_lib_ieee_main=no
  4927         -fi
  4928         -rm -f core conftest.err conftest.$ac_objext \
  4929         -    conftest$ac_exeext conftest.$ac_ext
  4930         -LIBS=$ac_check_lib_save_LIBS
  4931         -fi
  4932         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee_main" >&5
  4933         -$as_echo "$ac_cv_lib_ieee_main" >&6; }
  4934         -if test "x$ac_cv_lib_ieee_main" = xyes; then :
  4935         -  MATH_LIBS="-lieee $MATH_LIBS"
  4936         -fi
  4937         -
  4938         -
  4939         -    #--------------------------------------------------------------------
  4940         -    # Interactive UNIX requires -linet instead of -lsocket, plus it
  4941         -    # needs net/errno.h to define the socket-related error codes.
  4942         -    #--------------------------------------------------------------------
  4943         -
  4944         -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -linet" >&5
  4945         -$as_echo_n "checking for main in -linet... " >&6; }
  4946         -if ${ac_cv_lib_inet_main+:} false; then :
  4947         -  $as_echo_n "(cached) " >&6
  4948         -else
  4949         -  ac_check_lib_save_LIBS=$LIBS
  4950         -LIBS="-linet  $LIBS"
  4951         -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  4952         -/* end confdefs.h.  */
  4953         -
  4954         -
  4955         -int
  4956         -main ()
  4957         -{
  4958         -return main ();
  4959         -  ;
  4960         -  return 0;
  4961         -}
  4962         -_ACEOF
  4963         -if ac_fn_c_try_link "$LINENO"; then :
  4964         -  ac_cv_lib_inet_main=yes
  4965         -else
  4966         -  ac_cv_lib_inet_main=no
  4967         -fi
  4968         -rm -f core conftest.err conftest.$ac_objext \
  4969         -    conftest$ac_exeext conftest.$ac_ext
  4970         -LIBS=$ac_check_lib_save_LIBS
  4971         -fi
  4972         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_main" >&5
  4973         -$as_echo "$ac_cv_lib_inet_main" >&6; }
  4974         -if test "x$ac_cv_lib_inet_main" = xyes; then :
  4975         -  LIBS="$LIBS -linet"
  4976         -fi
  4977         -
  4978         -    ac_fn_c_check_header_mongrel "$LINENO" "net/errno.h" "ac_cv_header_net_errno_h" "$ac_includes_default"
  4979         -if test "x$ac_cv_header_net_errno_h" = xyes; then :
  4980         -
  4981         -
  4982         -$as_echo "#define HAVE_NET_ERRNO_H 1" >>confdefs.h
  4983         -
  4984         -fi
  4985         -
  4986         -
  4987         -
  4988         -    #--------------------------------------------------------------------
  4989         -    #	Check for the existence of the -lsocket and -lnsl libraries.
  4990         -    #	The order here is important, so that they end up in the right
  4991         -    #	order in the command line generated by make.  Here are some
  4992         -    #	special considerations:
  4993         -    #	1. Use "connect" and "accept" to check for -lsocket, and
  4994         -    #	   "gethostbyname" to check for -lnsl.
  4995         -    #	2. Use each function name only once:  can't redo a check because
  4996         -    #	   autoconf caches the results of the last check and won't redo it.
  4997         -    #	3. Use -lnsl and -lsocket only if they supply procedures that
  4998         -    #	   aren't already present in the normal libraries.  This is because
  4999         -    #	   IRIX 5.2 has libraries, but they aren't needed and they're
  5000         -    #	   bogus:  they goof up name resolution if used.
  5001         -    #	4. On some SVR4 systems, can't use -lsocket without -lnsl too.
  5002         -    #	   To get around this problem, check for both libraries together
  5003         -    #	   if -lsocket doesn't work by itself.
  5004         -    #--------------------------------------------------------------------
  5005         -
  5006         -    tcl_checkBoth=0
  5007         -    ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
  5008         -if test "x$ac_cv_func_connect" = xyes; then :
  5009         -  tcl_checkSocket=0
  5010         -else
  5011         -  tcl_checkSocket=1
  5012         -fi
  5013         -
  5014         -    if test "$tcl_checkSocket" = 1; then
  5015         -	ac_fn_c_check_func "$LINENO" "setsockopt" "ac_cv_func_setsockopt"
  5016         -if test "x$ac_cv_func_setsockopt" = xyes; then :
  5017         -
  5018         -else
  5019         -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setsockopt in -lsocket" >&5
  5020         -$as_echo_n "checking for setsockopt in -lsocket... " >&6; }
  5021         -if ${ac_cv_lib_socket_setsockopt+:} false; then :
  5022         -  $as_echo_n "(cached) " >&6
  5023         -else
  5024         -  ac_check_lib_save_LIBS=$LIBS
  5025         -LIBS="-lsocket  $LIBS"
  5026         -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5027         -/* end confdefs.h.  */
  5028         -
  5029         -/* Override any GCC internal prototype to avoid an error.
  5030         -   Use char because int might match the return type of a GCC
  5031         -   builtin and then its argument prototype would still apply.  */
  5032         -#ifdef __cplusplus
  5033         -extern "C"
  5034         -#endif
  5035         -char setsockopt ();
  5036         -int
  5037         -main ()
  5038         -{
  5039         -return setsockopt ();
  5040         -  ;
  5041         -  return 0;
  5042         -}
  5043         -_ACEOF
  5044         -if ac_fn_c_try_link "$LINENO"; then :
  5045         -  ac_cv_lib_socket_setsockopt=yes
  5046         -else
  5047         -  ac_cv_lib_socket_setsockopt=no
  5048         -fi
  5049         -rm -f core conftest.err conftest.$ac_objext \
  5050         -    conftest$ac_exeext conftest.$ac_ext
  5051         -LIBS=$ac_check_lib_save_LIBS
  5052         -fi
  5053         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_setsockopt" >&5
  5054         -$as_echo "$ac_cv_lib_socket_setsockopt" >&6; }
  5055         -if test "x$ac_cv_lib_socket_setsockopt" = xyes; then :
  5056         -  LIBS="$LIBS -lsocket"
  5057         -else
  5058         -  tcl_checkBoth=1
  5059         -fi
  5060         -
  5061         -fi
  5062         -
  5063         -    fi
  5064         -    if test "$tcl_checkBoth" = 1; then
  5065         -	tk_oldLibs=$LIBS
  5066         -	LIBS="$LIBS -lsocket -lnsl"
  5067         -	ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept"
  5068         -if test "x$ac_cv_func_accept" = xyes; then :
  5069         -  tcl_checkNsl=0
  5070         -else
  5071         -  LIBS=$tk_oldLibs
  5072         -fi
  5073         -
  5074         -    fi
  5075         -    ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
  5076         -if test "x$ac_cv_func_gethostbyname" = xyes; then :
  5077         -
  5078         -else
  5079         -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
  5080         -$as_echo_n "checking for gethostbyname in -lnsl... " >&6; }
  5081         -if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
  5082         -  $as_echo_n "(cached) " >&6
  5083         -else
  5084         -  ac_check_lib_save_LIBS=$LIBS
  5085         -LIBS="-lnsl  $LIBS"
  5086         -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5087         -/* end confdefs.h.  */
  5088         -
  5089         -/* Override any GCC internal prototype to avoid an error.
  5090         -   Use char because int might match the return type of a GCC
  5091         -   builtin and then its argument prototype would still apply.  */
  5092         -#ifdef __cplusplus
  5093         -extern "C"
  5094         -#endif
  5095         -char gethostbyname ();
  5096         -int
  5097         -main ()
  5098         -{
  5099         -return gethostbyname ();
  5100         -  ;
  5101         -  return 0;
  5102         -}
  5103         -_ACEOF
  5104         -if ac_fn_c_try_link "$LINENO"; then :
  5105         -  ac_cv_lib_nsl_gethostbyname=yes
  5106         -else
  5107         -  ac_cv_lib_nsl_gethostbyname=no
  5108         -fi
  5109         -rm -f core conftest.err conftest.$ac_objext \
  5110         -    conftest$ac_exeext conftest.$ac_ext
  5111         -LIBS=$ac_check_lib_save_LIBS
  5112         -fi
  5113         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5
  5114         -$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; }
  5115         -if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
  5116         -  LIBS="$LIBS -lnsl"
  5117         -fi
  5118         -
  5119         -fi
  5120         -
  5121         -
  5122         -    # TEA specific: Don't perform the eval of the libraries here because
  5123         -    # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS
  5124         -
  5125         -    TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
  5126         -
  5127         -
  5128         -
  5129         -
  5130         -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dirent.h" >&5
  5131         -$as_echo_n "checking dirent.h... " >&6; }
  5132         -if ${tcl_cv_dirent_h+:} false; then :
  5133         -  $as_echo_n "(cached) " >&6
  5134         -else
  5135         -
  5136         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5137         -/* end confdefs.h.  */
  5138         -#include <sys/types.h>
  5139         -#include <dirent.h>
  5140         -int
  5141         -main ()
  5142         -{
  5143         -
  5144         -#ifndef _POSIX_SOURCE
  5145         -#   ifdef __Lynx__
  5146         -	/*
  5147         -	 * Generate compilation error to make the test fail:  Lynx headers
  5148         -	 * are only valid if really in the POSIX environment.
  5149         -	 */
  5150         -
  5151         -	missing_procedure();
  5152         -#   endif
  5153         -#endif
  5154         -DIR *d;
  5155         -struct dirent *entryPtr;
  5156         -char *p;
  5157         -d = opendir("foobar");
  5158         -entryPtr = readdir(d);
  5159         -p = entryPtr->d_name;
  5160         -closedir(d);
  5161         -
  5162         -  ;
  5163         -  return 0;
  5164         -}
  5165         -_ACEOF
  5166         -if ac_fn_c_try_link "$LINENO"; then :
  5167         -  tcl_cv_dirent_h=yes
  5168         -else
  5169         -  tcl_cv_dirent_h=no
  5170         -fi
  5171         -rm -f core conftest.err conftest.$ac_objext \
  5172         -    conftest$ac_exeext conftest.$ac_ext
  5173         -fi
  5174         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_dirent_h" >&5
  5175         -$as_echo "$tcl_cv_dirent_h" >&6; }
  5176         -
  5177         -    if test $tcl_cv_dirent_h = no; then
  5178         -
  5179         -$as_echo "#define NO_DIRENT_H 1" >>confdefs.h
  5180         -
  5181         -    fi
  5182         -
  5183         -    # TEA specific:
  5184         -    ac_fn_c_check_header_mongrel "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default"
  5185         -if test "x$ac_cv_header_errno_h" = xyes; then :
  5186         -
  5187         -else
  5188         -
  5189         -$as_echo "#define NO_ERRNO_H 1" >>confdefs.h
  5190         -
  5191         -fi
  5192         -
  5193         -
  5194         -    ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default"
  5195         -if test "x$ac_cv_header_float_h" = xyes; then :
  5196         -
  5197         -else
  5198         -
  5199         -$as_echo "#define NO_FLOAT_H 1" >>confdefs.h
  5200         -
  5201         -fi
  5202         -
  5203         -
  5204         -    ac_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default"
  5205         -if test "x$ac_cv_header_values_h" = xyes; then :
  5206         -
  5207         -else
  5208         -
  5209         -$as_echo "#define NO_VALUES_H 1" >>confdefs.h
  5210         -
  5211         -fi
  5212         -
  5213         -
  5214         -    ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default"
  5215         -if test "x$ac_cv_header_limits_h" = xyes; then :
  5216         -
  5217         -$as_echo "#define HAVE_LIMITS_H 1" >>confdefs.h
  5218         -
  5219         -else
  5220         -
  5221         -$as_echo "#define NO_LIMITS_H 1" >>confdefs.h
  5222         -
  5223         -fi
  5224         -
  5225         -
  5226         -    ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
  5227         -if test "x$ac_cv_header_stdlib_h" = xyes; then :
  5228         -  tcl_ok=1
  5229         -else
  5230         -  tcl_ok=0
  5231         -fi
  5232         -
  5233         -
  5234         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5235         -/* end confdefs.h.  */
  5236         -#include <stdlib.h>
  5237         -
  5238         -_ACEOF
  5239         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  5240         -  $EGREP "strtol" >/dev/null 2>&1; then :
  5241         -
  5242         -else
  5243         -  tcl_ok=0
  5244         -fi
  5245         -rm -f conftest*
  5246         -
  5247         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5248         -/* end confdefs.h.  */
  5249         -#include <stdlib.h>
  5250         -
  5251         -_ACEOF
  5252         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  5253         -  $EGREP "strtoul" >/dev/null 2>&1; then :
  5254         -
  5255         -else
  5256         -  tcl_ok=0
  5257         -fi
  5258         -rm -f conftest*
  5259         -
  5260         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5261         -/* end confdefs.h.  */
  5262         -#include <stdlib.h>
  5263         -
  5264         -_ACEOF
  5265         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  5266         -  $EGREP "strtod" >/dev/null 2>&1; then :
  5267         -
  5268         -else
  5269         -  tcl_ok=0
  5270         -fi
  5271         -rm -f conftest*
  5272         -
  5273         -    if test $tcl_ok = 0; then
  5274         -
  5275         -$as_echo "#define NO_STDLIB_H 1" >>confdefs.h
  5276         -
  5277         -    fi
  5278         -    ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default"
  5279         -if test "x$ac_cv_header_string_h" = xyes; then :
  5280         -  tcl_ok=1
  5281         -else
  5282         -  tcl_ok=0
  5283         -fi
  5284         -
  5285         -
  5286         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5287         -/* end confdefs.h.  */
  5288         -#include <string.h>
  5289         -
  5290         -_ACEOF
  5291         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  5292         -  $EGREP "strstr" >/dev/null 2>&1; then :
  5293         -
  5294         -else
  5295         -  tcl_ok=0
  5296         -fi
  5297         -rm -f conftest*
  5298         -
  5299         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5300         -/* end confdefs.h.  */
  5301         -#include <string.h>
  5302         -
  5303         -_ACEOF
  5304         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  5305         -  $EGREP "strerror" >/dev/null 2>&1; then :
  5306         -
  5307         -else
  5308         -  tcl_ok=0
  5309         -fi
  5310         -rm -f conftest*
  5311         -
  5312         -
  5313         -    # See also memmove check below for a place where NO_STRING_H can be
  5314         -    # set and why.
  5315         -
  5316         -    if test $tcl_ok = 0; then
  5317         -
  5318         -$as_echo "#define NO_STRING_H 1" >>confdefs.h
  5319         -
  5320         -    fi
  5321         -
  5322         -    ac_fn_c_check_header_mongrel "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default"
  5323         -if test "x$ac_cv_header_sys_wait_h" = xyes; then :
  5324         -
  5325         -else
  5326         -
  5327         -$as_echo "#define NO_SYS_WAIT_H 1" >>confdefs.h
  5328         -
  5329         -fi
  5330         -
  5331         -
  5332         -    ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default"
  5333         -if test "x$ac_cv_header_dlfcn_h" = xyes; then :
  5334         -
  5335         -else
  5336         -
  5337         -$as_echo "#define NO_DLFCN_H 1" >>confdefs.h
  5338         -
  5339         -fi
  5340         -
  5341         -
  5342         -
  5343         -    # OS/390 lacks sys/param.h (and doesn't need it, by chance).
  5344         -    for ac_header in sys/param.h
  5345         -do :
  5346         -  ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default"
  5347         -if test "x$ac_cv_header_sys_param_h" = xyes; then :
  5348         -  cat >>confdefs.h <<_ACEOF
  5349         -#define HAVE_SYS_PARAM_H 1
  5350         -_ACEOF
  5351         -
  5352         -fi
  5353         -
  5354         -done
  5355         -
  5356         -
  5357         -	# Let the user call this, because if it triggers, they will
  5358         -	# need a compat/strtod.c that is correct.  Users can also
  5359         -	# use Tcl_GetDouble(FromObj) instead.
  5360         -	#TEA_BUGGY_STRTOD
  5361         -    fi
  5362   4832   
  5363   4833   
  5364   4834   #-----------------------------------------------------------------------
  5365   4835   # __CHANGE__
  5366   4836   # Specify the C source files to compile in TEA_ADD_SOURCES,
  5367   4837   # public headers that need to be installed in TEA_ADD_HEADERS,
  5368   4838   # stub library C source files to compile in TEA_ADD_STUB_SOURCES,
................................................................................
  5614   5084     enableval=$enable_threads; tcl_ok=$enableval
  5615   5085   else
  5616   5086     tcl_ok=yes
  5617   5087   fi
  5618   5088   
  5619   5089   
  5620   5090       if test "${enable_threads+set}" = set; then
  5621         -	enableval="$enable_threads"
  5622         -	tcl_ok=$enableval
         5091  +        enableval="$enable_threads"
         5092  +        tcl_ok=$enableval
  5623   5093       else
  5624         -	tcl_ok=yes
         5094  +        tcl_ok=yes
  5625   5095       fi
  5626   5096   
  5627   5097       if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
  5628         -	TCL_THREADS=1
         5098  +        TCL_THREADS=1
  5629   5099   
  5630         -	if test "${TEA_PLATFORM}" != "windows" ; then
  5631         -	    # We are always OK on Windows, so check what this platform wants:
         5100  +        if test "${TEA_PLATFORM}" != "windows" ; then
         5101  +            # We are always OK on Windows, so check what this platform wants:
  5632   5102   
  5633         -	    # USE_THREAD_ALLOC tells us to try the special thread-based
  5634         -	    # allocator that significantly reduces lock contention
         5103  +            # USE_THREAD_ALLOC tells us to try the special thread-based
         5104  +            # allocator that significantly reduces lock contention
  5635   5105   
  5636   5106   $as_echo "#define USE_THREAD_ALLOC 1" >>confdefs.h
  5637   5107   
  5638   5108   
  5639   5109   $as_echo "#define _REENTRANT 1" >>confdefs.h
  5640   5110   
  5641         -	    if test "`uname -s`" = "SunOS" ; then
         5111  +            if test "`uname -s`" = "SunOS" ; then
  5642   5112   
  5643   5113   $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
  5644   5114   
  5645         -	    fi
         5115  +            fi
  5646   5116   
  5647   5117   $as_echo "#define _THREAD_SAFE 1" >>confdefs.h
  5648   5118   
  5649         -	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthread" >&5
         5119  +            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthread" >&5
  5650   5120   $as_echo_n "checking for pthread_mutex_init in -lpthread... " >&6; }
  5651   5121   if ${ac_cv_lib_pthread_pthread_mutex_init+:} false; then :
  5652   5122     $as_echo_n "(cached) " >&6
  5653   5123   else
  5654   5124     ac_check_lib_save_LIBS=$LIBS
  5655   5125   LIBS="-lpthread  $LIBS"
  5656   5126   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
................................................................................
  5684   5154   $as_echo "$ac_cv_lib_pthread_pthread_mutex_init" >&6; }
  5685   5155   if test "x$ac_cv_lib_pthread_pthread_mutex_init" = xyes; then :
  5686   5156     tcl_ok=yes
  5687   5157   else
  5688   5158     tcl_ok=no
  5689   5159   fi
  5690   5160   
  5691         -	    if test "$tcl_ok" = "no"; then
  5692         -		# Check a little harder for __pthread_mutex_init in the same
  5693         -		# library, as some systems hide it there until pthread.h is
  5694         -		# defined.  We could alternatively do an AC_TRY_COMPILE with
  5695         -		# pthread.h, but that will work with libpthread really doesn't
  5696         -		# exist, like AIX 4.2.  [Bug: 4359]
  5697         -		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_mutex_init in -lpthread" >&5
         5161  +            if test "$tcl_ok" = "no"; then
         5162  +                # Check a little harder for __pthread_mutex_init in the same
         5163  +                # library, as some systems hide it there until pthread.h is
         5164  +                # defined.  We could alternatively do an AC_TRY_COMPILE with
         5165  +                # pthread.h, but that will work with libpthread really doesn't
         5166  +                # exist, like AIX 4.2.  [Bug: 4359]
         5167  +                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_mutex_init in -lpthread" >&5
  5698   5168   $as_echo_n "checking for __pthread_mutex_init in -lpthread... " >&6; }
  5699   5169   if ${ac_cv_lib_pthread___pthread_mutex_init+:} false; then :
  5700   5170     $as_echo_n "(cached) " >&6
  5701   5171   else
  5702   5172     ac_check_lib_save_LIBS=$LIBS
  5703   5173   LIBS="-lpthread  $LIBS"
  5704   5174   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
................................................................................
  5732   5202   $as_echo "$ac_cv_lib_pthread___pthread_mutex_init" >&6; }
  5733   5203   if test "x$ac_cv_lib_pthread___pthread_mutex_init" = xyes; then :
  5734   5204     tcl_ok=yes
  5735   5205   else
  5736   5206     tcl_ok=no
  5737   5207   fi
  5738   5208   
  5739         -	    fi
         5209  +            fi
  5740   5210   
  5741         -	    if test "$tcl_ok" = "yes"; then
  5742         -		# The space is needed
  5743         -		THREADS_LIBS=" -lpthread"
  5744         -	    else
  5745         -		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthreads" >&5
         5211  +            if test "$tcl_ok" = "yes"; then
         5212  +                # The space is needed
         5213  +                THREADS_LIBS=" -lpthread"
         5214  +            else
         5215  +                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthreads" >&5
  5746   5216   $as_echo_n "checking for pthread_mutex_init in -lpthreads... " >&6; }
  5747   5217   if ${ac_cv_lib_pthreads_pthread_mutex_init+:} false; then :
  5748   5218     $as_echo_n "(cached) " >&6
  5749   5219   else
  5750   5220     ac_check_lib_save_LIBS=$LIBS
  5751   5221   LIBS="-lpthreads  $LIBS"
  5752   5222   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
................................................................................
  5780   5250   $as_echo "$ac_cv_lib_pthreads_pthread_mutex_init" >&6; }
  5781   5251   if test "x$ac_cv_lib_pthreads_pthread_mutex_init" = xyes; then :
  5782   5252     tcl_ok=yes
  5783   5253   else
  5784   5254     tcl_ok=no
  5785   5255   fi
  5786   5256   
  5787         -		if test "$tcl_ok" = "yes"; then
  5788         -		    # The space is needed
  5789         -		    THREADS_LIBS=" -lpthreads"
  5790         -		else
  5791         -		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc" >&5
         5257  +                if test "$tcl_ok" = "yes"; then
         5258  +                    # The space is needed
         5259  +                    THREADS_LIBS=" -lpthreads"
         5260  +                else
         5261  +                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc" >&5
  5792   5262   $as_echo_n "checking for pthread_mutex_init in -lc... " >&6; }
  5793   5263   if ${ac_cv_lib_c_pthread_mutex_init+:} false; then :
  5794   5264     $as_echo_n "(cached) " >&6
  5795   5265   else
  5796   5266     ac_check_lib_save_LIBS=$LIBS
  5797   5267   LIBS="-lc  $LIBS"
  5798   5268   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
................................................................................
  5826   5296   $as_echo "$ac_cv_lib_c_pthread_mutex_init" >&6; }
  5827   5297   if test "x$ac_cv_lib_c_pthread_mutex_init" = xyes; then :
  5828   5298     tcl_ok=yes
  5829   5299   else
  5830   5300     tcl_ok=no
  5831   5301   fi
  5832   5302   
  5833         -		    if test "$tcl_ok" = "no"; then
  5834         -			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc_r" >&5
         5303  +                    if test "$tcl_ok" = "no"; then
         5304  +                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc_r" >&5
  5835   5305   $as_echo_n "checking for pthread_mutex_init in -lc_r... " >&6; }
  5836   5306   if ${ac_cv_lib_c_r_pthread_mutex_init+:} false; then :
  5837   5307     $as_echo_n "(cached) " >&6
  5838   5308   else
  5839   5309     ac_check_lib_save_LIBS=$LIBS
  5840   5310   LIBS="-lc_r  $LIBS"
  5841   5311   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
................................................................................
  5869   5339   $as_echo "$ac_cv_lib_c_r_pthread_mutex_init" >&6; }
  5870   5340   if test "x$ac_cv_lib_c_r_pthread_mutex_init" = xyes; then :
  5871   5341     tcl_ok=yes
  5872   5342   else
  5873   5343     tcl_ok=no
  5874   5344   fi
  5875   5345   
  5876         -			if test "$tcl_ok" = "yes"; then
  5877         -			    # The space is needed
  5878         -			    THREADS_LIBS=" -pthread"
  5879         -			else
  5880         -			    TCL_THREADS=0
  5881         -			    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&5
         5346  +                        if test "$tcl_ok" = "yes"; then
         5347  +                            # The space is needed
         5348  +                            THREADS_LIBS=" -pthread"
         5349  +                        else
         5350  +                            TCL_THREADS=0
         5351  +                            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&5
  5882   5352   $as_echo "$as_me: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&2;}
  5883         -			fi
  5884         -		    fi
  5885         -		fi
  5886         -	    fi
  5887         -	fi
         5353  +                        fi
         5354  +                    fi
         5355  +                fi
         5356  +            fi
         5357  +        fi
  5888   5358       else
  5889         -	TCL_THREADS=0
         5359  +        TCL_THREADS=0
  5890   5360       fi
  5891   5361       # Do checking message here to not mess up interleaved configure output
  5892   5362       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with threads" >&5
  5893   5363   $as_echo_n "checking for building with threads... " >&6; }
  5894   5364       if test "${TCL_THREADS}" = 1; then
  5895   5365   
  5896   5366   $as_echo "#define TCL_THREADS 1" >>confdefs.h
  5897   5367   
  5898         -	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5
         5368  +        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5
  5899   5369   $as_echo "yes (default)" >&6; }
  5900   5370       else
  5901         -	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
         5371  +        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  5902   5372   $as_echo "no" >&6; }
  5903   5373       fi
  5904   5374       # TCL_THREADS sanity checking.  See if our request for building with
  5905   5375       # threads is the same as the way Tcl was built.  If not, warn the user.
  5906         -    case ${TCL_DEFS} in
  5907         -	*THREADS=1*)
  5908         -	    if test "${TCL_THREADS}" = "0"; then
  5909         -		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
         5376  +
         5377  +    if test "${TCL_VERSION}" > "8.6" ; then
         5378  +      TCL_HAS_THREADS=1
         5379  +    else
         5380  +      case ${TCL_DEFS} in
         5381  +          *THREADS=1*)
         5382  +              TCL_HAS_THREADS=1;
         5383  +          ;;
         5384  +          *)
         5385  +              TCL_HAS_THREADS=0;
         5386  +          ;;
         5387  +      esac
         5388  +    fi
         5389  +    if test "${TCL_HAS_THREADS}" = "1"; then
         5390  +      if test "${TCL_THREADS}" = "0"; then
         5391  +        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
  5910   5392       Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
  5911   5393       that IS thread-enabled.  It is recommended to use --enable-threads." >&5
  5912   5394   $as_echo "$as_me: WARNING:
  5913   5395       Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
  5914   5396       that IS thread-enabled.  It is recommended to use --enable-threads." >&2;}
  5915         -	    fi
  5916         -	    ;;
  5917         -	*)
  5918         -	    if test "${TCL_THREADS}" = "1"; then
  5919         -		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
         5397  +      fi
         5398  +    else
         5399  +      if test "${TCL_THREADS}" = "1"; then
         5400  +        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
  5920   5401       --enable-threads requested, but building against a Tcl that is NOT
  5921   5402       thread-enabled.  This is an OK configuration that will also run in
  5922   5403       a thread-enabled core." >&5
  5923   5404   $as_echo "$as_me: WARNING:
  5924   5405       --enable-threads requested, but building against a Tcl that is NOT
  5925   5406       thread-enabled.  This is an OK configuration that will also run in
  5926   5407       a thread-enabled core." >&2;}
  5927         -	    fi
  5928         -	    ;;
  5929         -    esac
         5408  +      fi
         5409  +    fi
  5930   5410   
  5931   5411   
  5932   5412   
  5933   5413   #--------------------------------------------------------------------
  5934   5414   # The statement below defines a collection of symbols related to
  5935   5415   # building as a shared library instead of a static library.
  5936   5416   #--------------------------------------------------------------------
................................................................................
  6961   6441   	    CC_SEARCH_FLAGS=""
  6962   6442   	    LD_SEARCH_FLAGS=""
  6963   6443   	    ;;
  6964   6444   	Haiku*)
  6965   6445   	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  6966   6446   	    SHLIB_CFLAGS="-fPIC"
  6967   6447   	    SHLIB_SUFFIX=".so"
  6968         -	    SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
         6448  +	    SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
  6969   6449   	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lnetwork" >&5
  6970   6450   $as_echo_n "checking for inet_ntoa in -lnetwork... " >&6; }
  6971   6451   if ${ac_cv_lib_network_inet_ntoa+:} false; then :
  6972   6452     $as_echo_n "(cached) " >&6
  6973   6453   else
  6974   6454     ac_check_lib_save_LIBS=$LIBS
  6975   6455   LIBS="-lnetwork  $LIBS"
................................................................................
  7188   6668   	    SHLIB_CFLAGS="-fPIC"
  7189   6669   	    SHLIB_SUFFIX=".so"
  7190   6670   
  7191   6671   	    # TEA specific:
  7192   6672   	    CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
  7193   6673   
  7194   6674   	    # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
  7195         -	    SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}'
         6675  +	    SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS_DEFAULT} -shared'
  7196   6676   	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  7197   6677   	    if test $doRpath = yes; then :
  7198   6678   
  7199   6679   		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  7200   6680   fi
  7201   6681   	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  7202   6682   	    if test "`uname -m`" = "alpha"; then :
................................................................................
  7271   6751   	    alpha|sparc64)
  7272   6752   		SHLIB_CFLAGS="-fPIC"
  7273   6753   		;;
  7274   6754   	    *)
  7275   6755   		SHLIB_CFLAGS="-fpic"
  7276   6756   		;;
  7277   6757   	    esac
  7278         -	    SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
         6758  +	    SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
  7279   6759   	    SHLIB_SUFFIX=".so"
  7280   6760   	    if test $doRpath = yes; then :
  7281   6761   
  7282   6762   		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  7283   6763   fi
  7284   6764   	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  7285   6765   	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
................................................................................
  7296   6776   	    # OpenBSD doesn't do version numbers with dots.
  7297   6777   	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  7298   6778   	    TCL_LIB_VERSIONS_OK=nodots
  7299   6779   	    ;;
  7300   6780   	NetBSD-*)
  7301   6781   	    # NetBSD has ELF and can use 'cc -shared' to build shared libs
  7302   6782   	    SHLIB_CFLAGS="-fPIC"
  7303         -	    SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
         6783  +	    SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
  7304   6784   	    SHLIB_SUFFIX=".so"
  7305   6785   	    LDFLAGS="$LDFLAGS -export-dynamic"
  7306   6786   	    if test $doRpath = yes; then :
  7307   6787   
  7308   6788   		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  7309   6789   fi
  7310   6790   	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
................................................................................
  7947   7427       # standard manufacturer compiler.
  7948   7428   
  7949   7429       if test "$GCC" = yes; then :
  7950   7430   
  7951   7431   	case $system in
  7952   7432   	    AIX-*) ;;
  7953   7433   	    BSD/OS*) ;;
  7954         -	    CYGWIN_*|MINGW32_*) ;;
         7434  +	    CYGWIN_*|MINGW32_*|MINGW64_*) ;;
  7955   7435   	    IRIX*) ;;
  7956   7436   	    NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
  7957   7437   	    Darwin-*) ;;
  7958   7438   	    SCO_SV-3.2*) ;;
  7959   7439   	    windows) ;;
  7960   7440   	    *) SHLIB_CFLAGS="-fPIC" ;;
  7961   7441   	esac
................................................................................
  8875   8355   
  8876   8356   
  8877   8357   
  8878   8358   
  8879   8359   
  8880   8360   
  8881   8361   #--------------------------------------------------------------------
  8882         -# Finally, substitute all of the various values into the Makefile.
  8883         -# You may alternatively have a special pkgIndex.tcl.in or other files
  8884         -# which require substituting th AC variables in.  Include these here.
         8362  +# Setup a *Config.sh.in configuration file.
         8363  +#--------------------------------------------------------------------
         8364  +
         8365  +#TEA_EXPORT_CONFIG([sample])
         8366  +#AC_SUBST(SAMPLE_VAR)
         8367  +
         8368  +#--------------------------------------------------------------------
         8369  +# Specify files to substitute AC variables in. You may alternatively
         8370  +# have a special pkgIndex.tcl.in or other files which require
         8371  +# substituting the AC variables in. Include these here.
         8372  +#--------------------------------------------------------------------
         8373  +
         8374  +ac_config_files="$ac_config_files Makefile pkgIndex.tcl"
         8375  +
         8376  +#AC_CONFIG_FILES([sampleConfig.sh])
         8377  +
         8378  +#--------------------------------------------------------------------
         8379  +# Finally, substitute all of the various values into the files
         8380  +# specified with AC_CONFIG_FILES.
  8885   8381   #--------------------------------------------------------------------
  8886         -
  8887         -ac_config_files="$ac_config_files Makefile pkgIndex.tcl config.tcl:tclconfig/config.tcl.in"
         8382  +ac_config_files="$ac_config_files config.tcl:tclconfig/config.tcl.in"
  8888   8383   
  8889   8384   cat >confcache <<\_ACEOF
  8890   8385   # This file is a shell script that caches the results of configure
  8891   8386   # tests run on this system so they can be shared between configure
  8892   8387   # scripts and configure runs, see configure's option --config-cache.
  8893   8388   # It is not useful on other systems.  If it contains results you don't
  8894   8389   # want to keep, you may remove or edit it.
................................................................................
 10041   9536     $ac_cs_success || as_fn_exit 1
 10042   9537   fi
 10043   9538   if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 10044   9539     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
 10045   9540   $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 10046   9541   fi
 10047   9542   
 10048         -${TCLSH_PROG} ${srcdir}/make.tcl autoconf
         9543  +

Changes to configure.ac.

    22     22   AC_INIT([sample], [0.6])
    23     23   
    24     24   #--------------------------------------------------------------------
    25     25   # Call TEA_INIT as the first TEA_ macro to set up initial vars.
    26     26   # This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
    27     27   # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
    28     28   #--------------------------------------------------------------------
    29         -
    30     29   TEA_INIT(4.0])
    31     30   AC_PROG_LN_S
    32     31   CONFIG_CLEAN_FILES=
    33     32   if test ! -d $srcdir/tclconfig ; then
    34     33       if test -d $srcdir/../tclconfig ; then
    35     34           $LN_S $srcdir/../tclconfig tclconfig
    36     35           CONFIG_CLEAN_FILES=tclconfig
    37     36       fi
    38     37   fi
    39     38   AC_SUBST(CONFIG_CLEAN_FILES)
           39  +
    40     40   AC_CONFIG_AUX_DIR(tclconfig)
    41     41   
    42     42   #--------------------------------------------------------------------
    43     43   # Load the tclConfig.sh file
    44     44   #--------------------------------------------------------------------
    45     45   
    46     46   TEA_PATH_TCLCONFIG
................................................................................
   173    173   #--------------------------------------------------------------------
   174    174   
   175    175   TEA_PROG_TCLSH
   176    176   #TEA_PROG_WISH
   177    177   TEA_CONFIG_TEAPOT
   178    178   
   179    179   #--------------------------------------------------------------------
   180         -# Finally, substitute all of the various values into the Makefile.
   181         -# You may alternatively have a special pkgIndex.tcl.in or other files
   182         -# which require substituting th AC variables in.  Include these here.
          180  +# Setup a *Config.sh.in configuration file.
          181  +#--------------------------------------------------------------------
          182  +
          183  +#TEA_EXPORT_CONFIG([sample])
          184  +#AC_SUBST(SAMPLE_VAR)
          185  +
          186  +#--------------------------------------------------------------------
          187  +# Specify files to substitute AC variables in. You may alternatively
          188  +# have a special pkgIndex.tcl.in or other files which require
          189  +# substituting the AC variables in. Include these here.
   183    190   #--------------------------------------------------------------------
          191  +
          192  +AC_CONFIG_FILES([Makefile pkgIndex.tcl])
          193  +#AC_CONFIG_FILES([sampleConfig.sh])
   184    194   
   185         -AC_OUTPUT([Makefile pkgIndex.tcl config.tcl:tclconfig/config.tcl.in])
   186         -${TCLSH_PROG} ${srcdir}/make.tcl autoconf
          195  +#--------------------------------------------------------------------
          196  +# Finally, substitute all of the various values into the files
          197  +# specified with AC_CONFIG_FILES.
          198  +#--------------------------------------------------------------------
          199  +AC_OUTPUT([config.tcl:tclconfig/config.tcl.in])
          200  +

Changes to generic/sample.h.

    23     23   #else
    24     24   #   if ((1<<31)<0)
    25     25   typedef unsigned long sha_uint32_t;
    26     26   #   else
    27     27   typedef unsigned int sha_uint32_t;
    28     28   #   endif
    29     29   #endif
           30  +
    30     31   
    31     32   /*
    32     33    * For C++ compilers, use extern "C"
    33     34    */
    34     35   
    35     36   #ifdef __cplusplus
    36     37   extern "C" {

Changes to make.tcl.

     9      9     source [file join $SRCDIR tclconfig practcl.tcl]
    10     10   }
    11     11   
    12     12   array set ::project [::practcl::config.tcl $CWD]
    13     13   ::practcl::library create LIBRARY [array get ::project]
    14     14   LIBRARY define set builddir $CWD
    15     15   LIBRARY define set srcdir $SRCDIR
    16         -LIBRARY meta set license BSD
    17         -LIBRARY meta set description {The Reference TEA Extension for Developers}
           16  +LIBRARY clay set meta license BSD
           17  +LIBRARY clay set meta description {The Reference TEA Extension for Developers}
    18     18   ###
    19     19   # Generate List of Authors
    20     20   ###
           21  +set authors {}
    21     22   foreach match [::practcl::grep \<.*\@ [file join $SRCDIR ChangeLog]] {
    22         -  LIBRARY meta add authors [lrange $match 1 end]
           23  +  lappend authors [lrange $match 1 end]
    23     24   }
           25  +LIBRARY clay set meta authors $authors
    24     26   
    25     27   LIBRARY add [file join $::SRCDIR generic sample.c]
    26     28   LIBRARY add [file join $::SRCDIR generic sample.tcl]
    27     29   LIBRARY define add public-verbatim [file join $::SRCDIR generic sample.h]
    28     30   
    29     31   if {![LIBRARY define exists TCL_SRC_DIR]} {
    30     32     # Did not detect the Tcl source directory. Run autoconf
................................................................................
    57     59   # Generate the dynamic library and pkgIndex.tcl
    58     60   LIBRARY make target library {
    59     61     triggers implement
    60     62     files {sample.c sample.h pkgIndex.tcl [LIBRARY define get libfile]}
    61     63   } {
    62     64     # Collect configuration
    63     65     my go
    64         -  
           66  +
    65     67     ##
    66     68     # Generate dynamic C files
    67     69     ##
    68     70     set builddir [my define get builddir]
    69     71     my implement $builddir
    70     72   
    71     73     ###
    72     74     # Compile the library
    73     75     ###
    74     76     puts "BUILDING [my define get libfile]"
    75     77     my build-library [file join $builddir [my define get libfile]] [self]
    76         -  
           78  +
    77     79     ##
    78     80     # Generate pkgIndex.tcl
    79     81     ##
    80     82     set fout [open [file join $builddir pkgIndex.tcl] w]
    81     83     puts $fout "
    82     84   #
    83     85   # Tcl package index file
................................................................................
   222    224       puts $fout [list Meta practcl::build_date [clock format [file mtime [LIBRARY define get libfile]]]]
   223    225       # Pull SCM checkout info
   224    226       ::practcl::distribution select LIBRARY
   225    227       set info [LIBRARY scm_info]
   226    228       foreach item {scm hash isodate tags} {
   227    229         if {![dict exists $info $item]} continue
   228    230         set value [dict get $info $item]
   229         -      if {$value eq {}} continue     
          231  +      if {$value eq {}} continue
   230    232         puts $fout [list Meta practcl::scm_$item $value]
   231    233       }
   232    234   
   233         -    set mdat [LIBRARY meta dump]
          235  +    set mdat [LIBRARY clay get meta]
   234    236       foreach {field value} $mdat {
   235         -      if {[string index $field end] eq ":"} {
   236         -        puts $fout [list Meta [string trimright $field :] $value]
   237         -      } else {
          237  +      if {$field in {authors requires}} {
   238    238           foreach item $value {
   239    239             puts $fout [list Meta $field $item]
   240    240           }
          241  +      } else {
          242  +        puts $fout [list Meta [string trimright $field :] $value]
   241    243         }
   242    244       }
   243    245       close $fout
   244    246       ::practcl::tcllib_require zipfile::mkzip
   245    247       ::zipfile::mkzip::mkzip [dict get $dat zipfile] -directory $teapotvfs
   246    248     }
   247    249     default {
   248    250       LIBRARY make trigger {*}$argv
   249    251       LIBRARY make do
   250    252     }
   251    253   }

Changes to win/makefile.vc.

     1         -#-------------------------------------------------------------
     2         -# makefile.vc --
            1  +#------------------------------------------------------------- -*- makefile -*-
            2  +#
            3  +# Sample makefile for building Tcl extensions.
     3      4   #
     4         -#	Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
            5  +# Basic build, test and install
            6  +#   nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\tcl
            7  +#   nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\tcl test
            8  +#   nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\tcl install
     5      9   #
     6         -# This makefile is based upon the Tcl 8.6 Makefile.vc and modified to
     7         -# make it suitable as a general package makefile. Look for the word EDIT
     8         -# which marks sections that may need modification. As a minumum you will
     9         -# need to change the PROJECT, DOTVERSION and DLLOBJS variables to values
    10         -# relevant to your package.
    11         -#
           10  +# For other build options (debug, static etc.)
           11  +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for
           12  +# detailed documentation.
           13  +# 
    12     14   # See the file "license.terms" for information on usage and redistribution
    13     15   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    14     16   #
    15         -# Copyright (c) 1995-1996 Sun Microsystems, Inc.
    16         -# Copyright (c) 1998-2000 Ajuba Solutions.
    17         -# Copyright (c) 2001-2005 ActiveState Corporation.
    18         -# Copyright (c) 2001-2004 David Gravereaux.
    19         -# Copyright (c) 2003-2008 Pat Thoyts.
    20     17   #------------------------------------------------------------------------------
    21     18   
    22         -# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
    23         -# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
    24         -!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR)
    25         -MSG = ^
    26         -You need to run vcvars32.bat from Developer Studio or setenv.bat from the^
    27         -Platform SDK first to setup the environment.  Jump to this line to read^
    28         -the build instructions.
    29         -!error $(MSG)
    30         -!endif
    31         -
    32         -#------------------------------------------------------------------------------
    33         -# HOW TO USE this makefile:
    34         -#
    35         -# 1)  It is now necessary to have MSVCDir, MSDevDir or MSSDK set in the
    36         -#     environment.  This is used as a check to see if vcvars32.bat had been
    37         -#     run prior to running nmake or during the installation of Microsoft
    38         -#     Visual C++, MSVCDir had been set globally and the PATH adjusted.
    39         -#     Either way is valid.
    40         -#
    41         -#     You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin
    42         -#     directory to setup the proper environment, if needed, for your
    43         -#     current setup.  This is a needed bootstrap requirement and allows the
    44         -#     swapping of different environments to be easier.
    45         -#
    46         -# 2)  To use the Platform SDK (not expressly needed), run setenv.bat after
    47         -#     vcvars32.bat according to the instructions for it.  This can also
    48         -#     turn on the 64-bit compiler, if your SDK has it.
    49         -#
    50         -# 3)  Targets are:
    51         -#	all       -- Builds everything.
    52         -#	<project> -- Builds the project (eg: nmake sample)
    53         -#	test      -- Builds and runs the test suite.
    54         -#	install   -- Installs the built binaries and libraries to $(INSTALLDIR)
    55         -#		     in an appropriate subdirectory.
    56         -#	clean/realclean/distclean -- varying levels of cleaning.
    57         -#
    58         -# 4)  Macros usable on the commandline:
    59         -#	INSTALLDIR=<path>
    60         -#		Sets where to install Tcl from the built binaries.
    61         -#		C:\Progra~1\Tcl is assumed when not specified.
    62         -#
    63         -#	OPTS=loimpact,msvcrt,nothreads,pdbs,profile,static,symbols,unchecked,none
    64         -#		Sets special options for the core.  The default is for none.
    65         -#		Any combination of the above may be used (comma separated).
    66         -#		'none' will over-ride everything to nothing.
    67         -#
    68         -#		loimpact = Adds a flag for how NT treats the heap to keep memory
    69         -#			   in use, low.  This is said to impact alloc performance.
    70         -#		msvcrt   = Affects the static option only to switch it from
    71         -#			   using libcmt(d) as the C runtime [by default] to
    72         -#			   msvcrt(d). This is useful for static embedding
    73         -#			   support.
    74         -#		nothreads = Turns off multithreading support (not recommended)
    75         -#		static  =  Builds a static library of the core instead of a
    76         -#			   dll.  The shell will be static (and large), as well.
    77         -#		pdbs     = Build detached symbols for release builds.
    78         -#		profile  = Adds profiling hooks.  Map file is assumed.
    79         -#		symbols  = Debug build. Links to the debug C runtime, disables
    80         -#			   optimizations and creates pdb symbols files.
    81         -#		unchecked= Allows a symbols build to not use the debug
    82         -#			   enabled runtime (msvcrt.dll not msvcrtd.dll
    83         -#			   or libcmt.lib not libcmtd.lib).
    84         -#
    85         -#	STATS=compdbg,memdbg,none
    86         -#		Sets optional memory and bytecode compiler debugging code added
    87         -#		to the core.  The default is for none.  Any combination of the
    88         -#		above may be used (comma separated).  'none' will over-ride
    89         -#		everything to nothing.
    90         -#
    91         -#		compdbg  = Enables byte compilation logging.
    92         -#		memdbg   = Enables the debugging memory allocator.
    93         -#
    94         -#	CHECKS=64bit,fullwarn,nodep,none
    95         -#		Sets special macros for checking compatability.
    96         -#
    97         -#		64bit    = Enable 64bit portability warnings (if available)
    98         -#		fullwarn = Builds with full compiler and link warnings enabled.
    99         -#			    Very verbose.
   100         -#		nodep	 = Turns off compatability macros to ensure the extension
   101         -#			    isn't being built with deprecated functions.
   102         -#
   103         -#	MACHINE=(ALPHA|AMD64|IA64|IX86)
   104         -#		Set the machine type used for the compiler, linker, and
   105         -#		resource compiler.  This hook is needed to tell the tools
   106         -#		when alternate platforms are requested.  IX86 is the default
   107         -#		when not specified. If the CPU environment variable has been
   108         -#		set (ie: recent Platform SDK) then MACHINE is set from CPU.
   109         -#
   110         -#	TMP_DIR=<path>
   111         -#	OUT_DIR=<path>
   112         -#		Hooks to allow the intermediate and output directories to be
   113         -#		changed.  $(OUT_DIR) is assumed to be
   114         -#		$(BINROOT)\(Release|Debug) based on if symbols are requested.
   115         -#		$(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default.
   116         -#
   117         -#	TESTPAT=<file>
   118         -#		Reads the tests requested to be run from this file.
   119         -#
   120         -# 5)  Examples:
   121         -#
   122         -#	Basic syntax of calling nmake looks like this:
   123         -#	nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]]
   124         -#
   125         -#                        Standard (no frills)
   126         -#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
   127         -#       Setting environment for using Microsoft Visual C++ tools.
   128         -#       c:\tcl_src\win\>nmake -f makefile.vc all
   129         -#       c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
   130         -#
   131         -#                         Building for Win64
   132         -#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
   133         -#       Setting environment for using Microsoft Visual C++ tools.
   134         -#       c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL
   135         -#       Targeting Windows pre64 RETAIL
   136         -#       c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64
   137         -#
   138         -#------------------------------------------------------------------------------
   139         -#==============================================================================
   140         -#------------------------------------------------------------------------------
   141         -
   142         -!if !exist("makefile.vc")
   143         -MSG = ^
   144         -You must run this makefile only from the directory it is in.^
   145         -Please `cd` to its location first.
   146         -!error $(MSG)
   147         -!endif
   148         -
   149         -#-------------------------------------------------------------------------
   150         -# Project specific information (EDIT)
   151         -#
   152         -# You should edit this with the name and version of your project. This
   153         -# information is used to generate the name of the package library and
   154         -# it's install location.
   155         -#
   156         -# For example, the sample extension is  going to build sample05.dll and
   157         -# would install it into $(INSTALLDIR)\lib\sample05
   158         -#
   159         -# You need to specify the object files that need to be linked into your
   160         -# binary here.
   161         -#
   162         -#-------------------------------------------------------------------------
   163         -
           19  +# The name of the package
   164     20   PROJECT = sample
   165     21   
   166         -# Uncomment the following line if this is a Tk extension.
   167         -#PROJECT_REQUIRES_TK=1
   168         -!include "rules.vc"
           22  +!include "rules-ext.vc"
           23  +
           24  +# Define the object files and resource file that make up the extension.
           25  +# Note the resource file does not makes sense if doing a static library build
           26  +# hence it is under that condition. TMP_DIR is the output directory
           27  +# defined by rules for object files.
           28  +PRJ_OBJS = \
           29  +	$(TMP_DIR)\tclsample.obj \
           30  +	$(TMP_DIR)\sample.obj
   169     31   
   170         -# nmakehelp -V <file> <tag> will search the file for tag, skips until a
   171         -#	number and returns all character until a character not in [0-9.ab]
   172         -#	is read.
           32  +# Define any additional compiler flags that might be required for the project
           33  +PRJ_DEFINES = -D_CRT_SECURE_NO_DEPRECATE
   173     34   
   174         -!if [echo REM = This file is generated from Makefile.vc > versions.vc]
   175         -!endif
   176         -# get project version from row "AC_INIT([project], [????])"
   177         -!if [echo DOTVERSION = \>> versions.vc] \
   178         -   && [nmakehlp -V ..\configure.ac sample >> versions.vc]
   179         -!endif
   180         -!include "versions.vc"
           35  +# Define the standard targets
           36  +!include "$(_RULESDIR)\targets.vc"
   181     37   
   182         -VERSION         = $(DOTVERSION:.=)
   183         -STUBPREFIX      = $(PROJECT)stub
   184         -
   185         -DLLOBJS = \
   186         -	$(TMP_DIR)\tclsample.obj \
   187         -	$(TMP_DIR)\sample.obj \
   188         -!if !$(STATIC_BUILD)
   189         -	$(TMP_DIR)\sample.res
   190         -!endif
           38  +# We must define a pkgindex target that will create a pkgIndex.tcl
           39  +# file in the $(OUT_DIR) directory. We can just redirect to the
           40  +# default-pkgindex target for our sample extension.
           41  +pkgindex: default-pkgindex
   191     42   
   192         -PRJHEADERS =
   193         -
   194         -#-------------------------------------------------------------------------
   195         -# Target names and paths ( shouldn't need changing )
   196         -#-------------------------------------------------------------------------
   197         -
   198         -BINROOT		= $(MAKEDIR)
   199         -ROOT            = $(MAKEDIR)\..
   200         -
   201         -PRJIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
   202         -PRJLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
   203         -PRJLIB		= $(OUT_DIR)\$(PRJLIBNAME)
   204         -
   205         -PRJSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
   206         -PRJSTUBLIB	= $(OUT_DIR)\$(PRJSTUBLIBNAME)
   207         -
   208         -### Make sure we use backslash only.
   209         -PRJ_INSTALL_DIR         = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
   210         -LIB_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
   211         -BIN_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
   212         -DOC_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
   213         -SCRIPT_INSTALL_DIR	= $(PRJ_INSTALL_DIR)
   214         -INCLUDE_INSTALL_DIR	= $(_TCLDIR)\include
   215         -
   216         -### The following paths CANNOT have spaces in them.
   217         -GENERICDIR	= $(ROOT)\generic
   218         -WINDIR		= $(ROOT)\win
   219         -LIBDIR          = $(ROOT)\library
   220         -DOCDIR		= $(ROOT)\doc
   221         -TOOLSDIR	= $(ROOT)\tools
   222         -COMPATDIR	= $(ROOT)\compat
   223         -
   224         -#---------------------------------------------------------------------
   225         -# Compile flags
   226         -#---------------------------------------------------------------------
   227         -
   228         -!if !$(DEBUG)
   229         -!if $(OPTIMIZING)
   230         -### This cranks the optimization level to maximize speed
   231         -cdebug	= $(OPTIMIZATIONS)
   232         -!else
   233         -cdebug	=
   234         -!endif
   235         -!else if "$(MACHINE)" == "IA64"
   236         -### Warnings are too many, can't support warnings into errors.
   237         -cdebug	= -Zi -Od $(DEBUGFLAGS)
   238         -!else
   239         -cdebug	= -Zi -WX $(DEBUGFLAGS)
   240         -!endif
   241         -
   242         -### Declarations common to all compiler options
   243         -cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
   244         -cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\
   245         -
   246         -!if $(MSVCRT)
   247         -!if $(DEBUG) && !$(UNCHECKED)
   248         -crt = -MDd
   249         -!else
   250         -crt = -MD
   251         -!endif
   252         -!else
   253         -!if $(DEBUG) && !$(UNCHECKED)
   254         -crt = -MTd
   255         -!else
   256         -crt = -MT
   257         -!endif
   258         -!endif
   259         -
   260         -cflags = $(cflags) -DMODULE_SCOPE=extern
   261         -
   262         -!if !$(STATIC_BUILD)
   263         -cflags = $(cflags) -DUSE_TCL_STUBS
   264         -!if defined(TKSTUBLIB)
   265         -cflags = $(cflags) -DUSE_TK_STUBS
   266         -!endif
   267         -!endif
   268         -
   269         -INCLUDES	= $(TCL_INCLUDES) -I"$(WINDIR)" -I"$(GENERICDIR)"
   270         -BASE_CFLAGS	= $(cflags) $(cdebug) $(crt) $(INCLUDES)
   271         -CON_CFLAGS	= $(cflags) $(cdebug) $(crt) -DCONSOLE
   272         -TCL_CFLAGS	= -DPACKAGE_NAME="\"$(PROJECT)\"" \
   273         -		  -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
   274         -		  -DBUILD_$(PROJECT) \
   275         -		  $(BASE_CFLAGS) $(OPTDEFINES)
   276         -
   277         -#---------------------------------------------------------------------
   278         -# Link flags
   279         -#---------------------------------------------------------------------
   280         -
   281         -!if $(DEBUG)
   282         -ldebug	= -debug -debugtype:cv
   283         -!if $(MSVCRT)
   284         -ldebug = $(ldebug) -nodefaultlib:msvcrt
   285         -!endif
   286         -!else
   287         -ldebug	= -release -opt:ref -opt:icf,3
   288         -!endif
   289         -
   290         -### Declarations common to all linker options
   291         -lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
   292         -
   293         -!if $(PROFILE)
   294         -lflags	= $(lflags) -profile
   295         -!endif
   296         -
   297         -!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
   298         -lflags	= $(lflags) -nodefaultlib:libucrt.lib
   299         -!endif
   300         -
   301         -!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
   302         -### Align sections for PE size savings.
   303         -lflags	= $(lflags) -opt:nowin98
   304         -!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)
   305         -### Align sections for speed in loading by choosing the virtual page size.
   306         -lflags	= $(lflags) -align:4096
   307         -!endif
   308         -
   309         -!if $(LOIMPACT)
   310         -lflags	= $(lflags) -ws:aggressive
   311         -!endif
   312         -
   313         -dlllflags = $(lflags) -dll
   314         -conlflags = $(lflags) -subsystem:console
   315         -guilflags = $(lflags) -subsystem:windows
   316         -!if !$(STATIC_BUILD)
   317         -baselibs  = $(TCLSTUBLIB)
   318         -!if defined(TKSTUBLIB)
   319         -baselibs  = $(baselibs) $(TKSTUBLIB)
   320         -!endif
   321         -!endif
   322         -
   323         -# Avoid 'unresolved external symbol __security_cookie' errors.
   324         -# c.f. http://support.microsoft.com/?id=894573
   325         -!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
   326         -!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
   327         -baselibs   = $(baselibs) bufferoverflowU.lib
   328         -!endif
   329         -!endif
   330         -!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
   331         -baselibs   = $(baselibs) ucrt.lib
   332         -!endif
   333         -
   334         -baselibs   = $(baselibs) user32.lib gdi32.lib
   335         -
   336         -#---------------------------------------------------------------------
   337         -# TclTest flags
   338         -#---------------------------------------------------------------------
   339         -
   340         -!if "$(TESTPAT)" != ""
   341         -TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
   342         -!endif
   343         -
   344         -#---------------------------------------------------------------------
   345         -# Project specific targets (EDIT)
   346         -#---------------------------------------------------------------------
   347         -
   348         -all:	    setup $(PROJECT)
   349         -$(PROJECT): setup pkgIndex $(PRJLIB)
   350         -install:    install-binaries install-libraries install-docs
   351         -pkgIndex:   $(OUT_DIR)\pkgIndex.tcl
   352         -
   353         -test: setup $(PROJECT)
   354         -	@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
   355         -	@set TCLLIBPATH=$(OUT_DIR_PATH:\=/)
   356         -!if $(TCLINSTALL)
   357         -	@set PATH=$(_TCLDIR)\bin;$(PATH)
   358         -!else
   359         -	@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
   360         -!endif
   361         -	$(DEBUGGER) $(TCLSH) "$(ROOT)/tests/all.tcl" $(TESTFLAGS)
   362         -
   363         -shell: setup $(PROJECT)
   364         -	@set VLERQ_LIBRARY=$(LIBDIR:\=/)
   365         -	@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
   366         -	@set TCLLIBPATH=$(OUT_DIR_PATH:\=/)
   367         -!if $(TCLINSTALL)
   368         -	@set PATH=$(_TCLDIR)\bin;$(PATH)
   369         -!else
   370         -	@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
   371         -!endif
   372         -	$(DEBUGGER) $(TCLSH) $(SCRIPT)
   373         -
   374         -setup:
   375         -	@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
   376         -	@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
   377         -
   378         -# See <tcl>/win/coffbase.txt for extension base addresses.
   379         -$(PRJLIB): $(DLLOBJS)
   380         -!if $(STATIC_BUILD)
   381         -	$(lib32) -nologo -out:[email protected] @<<
   382         -$**
   383         -<<
   384         -!else
   385         -	$(link32) $(dlllflags) -base:@$(COFFBASE),thread -out:[email protected] $(baselibs) @<<
   386         -$**
   387         -<<
   388         -	$(_VC_MANIFEST_EMBED_DLL)
   389         -	[email protected] $*.exp
   390         -!endif
   391         -
   392         -$(PRJSTUBLIB): $(PRJSTUBOBJS)
   393         -	$(lib32) -nologo -out:[email protected] $(PRJSTUBOBJS)
   394         -
   395         -#---------------------------------------------------------------------
   396         -# Implicit rules
   397         -#---------------------------------------------------------------------
   398         -
   399         -{$(WINDIR)}.c{$(TMP_DIR)}.obj::
   400         -    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   401         -$<
   402         -<<
   403         -
   404         -{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
   405         -    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   406         -$<
   407         -<<
   408         -
   409         -{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
   410         -    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   411         -$<
   412         -<<
   413         -
   414         -{$(WINDIR)}.rc{$(TMP_DIR)}.res:
   415         -	$(rc32) -fo [email protected] -r -i "$(GENERICDIR)" -D__WIN32__ \
   416         -		-DCOMMAVERSION=$(DOTVERSION:.=,),0 \
   417         -		-DDOTVERSION=\"$(DOTVERSION)\" \
   418         -		-DVERSION=\"$(VERSION)$(SUFX)\" \
   419         -!if $(DEBUG)
   420         -	-d DEBUG \
   421         -!endif
   422         -!if $(TCL_THREADS)
   423         -	-d TCL_THREADS \
   424         -!endif
   425         -!if $(STATIC_BUILD)
   426         -	-d STATIC_BUILD \
   427         -!endif
   428         -	$<
   429         -
   430         -.SUFFIXES:
   431         -.SUFFIXES:.c .rc
   432         -
   433         -#-------------------------------------------------------------------------
   434         -# Explicit dependency rules
   435         -#
   436         -#-------------------------------------------------------------------------
   437         -
   438         -$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in
   439         -	@nmakehlp -s << $** > [email protected]
   440         -@[email protected]    $(DOTVERSION)
   441         -@[email protected]       $(PROJECT)
   442         -@[email protected]       $(PRJLIBNAME)
   443         -<<
   444         -	@echo package ifneeded sample $(DOTVERSION) \
   445         -	    [list load [file join $$dir $(PRJLIBNAME)] Sample] >> [email protected]
   446         -
   447         -#---------------------------------------------------------------------
   448         -# Installation. (EDIT)
   449         -#
   450         -# You may need to modify this section to reflect the final distribution
   451         -# of your files and possibly to generate documentation.
   452         -#
   453         -#---------------------------------------------------------------------
   454         -
   455         -install-binaries:
   456         -	@echo Installing binaries to '$(SCRIPT_INSTALL_DIR)'
   457         -	@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
   458         -	@$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
   459         -
   460         -install-libraries: $(OUT_DIR)\pkgIndex.tcl
   461         -	@echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
   462         -	@if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)"
   463         -	@echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
   464         -	@$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR)
   465         -
   466         -install-docs:
   467         -	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
   468         -	@if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)"
   469         -
   470         -#---------------------------------------------------------------------
   471         -# Clean up
   472         -#---------------------------------------------------------------------
   473         -
   474         -clean:
   475         -	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
   476         -	@if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc
   477         -	@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
   478         -	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
   479         -	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
   480         -	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
   481         -
   482         -realclean: clean
   483         -	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)
   484         -
   485         -distclean: realclean
   486         -	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
   487         -	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
           43  +# The default install target only installs binaries and scripts so add
           44  +# an additional target for our documentation. Note this *adds* a target
           45  +# since no commands are listed after it. The original targets for
           46  +# install (from targets.vc) will remain.
           47  +install: default-install-docs-n

Changes to win/nmakehlp.c.

    10     10    * See the file "license.terms" for information on usage and redistribution of
    11     11    * this file, and for a DISCLAIMER OF ALL WARRANTIES.
    12     12    * ----------------------------------------------------------------------------
    13     13    */
    14     14   
    15     15   #define _CRT_SECURE_NO_DEPRECATE
    16     16   #include <windows.h>
    17         -#define NO_SHLWAPI_GDI
    18         -#define NO_SHLWAPI_STREAM
    19         -#define NO_SHLWAPI_REG
    20         -#include <shlwapi.h>
    21     17   #pragma comment (lib, "user32.lib")
    22     18   #pragma comment (lib, "kernel32.lib")
    23         -#pragma comment (lib, "shlwapi.lib")
    24     19   #include <stdio.h>
    25     20   #include <math.h>
    26     21   
    27     22   /*
    28     23    * This library is required for x64 builds with _some_ versions of MSVC
    29     24    */
    30     25   #if defined(_M_IA64) || defined(_M_AMD64)
................................................................................
    35     30   
    36     31   /* ISO hack for dumb VC++ */
    37     32   #ifdef _MSC_VER
    38     33   #define   snprintf	_snprintf
    39     34   #endif
    40     35   
    41     36   
    42         -
    43     37   /* protos */
    44     38   
    45     39   static int CheckForCompilerFeature(const char *option);
    46         -static int CheckForLinkerFeature(const char *option);
           40  +static int CheckForLinkerFeature(const char **options, int count);
    47     41   static int IsIn(const char *string, const char *substring);
    48     42   static int SubstituteFile(const char *substs, const char *filename);
    49     43   static int QualifyPath(const char *path);
           44  +static int LocateDependency(const char *keyfile);
    50     45   static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
    51     46   static DWORD WINAPI ReadFromPipe(LPVOID args);
    52     47   
    53     48   /* globals */
    54     49   
    55     50   #define CHUNK	25
    56     51   #define STATICBUFFERSIZE    1000
................................................................................
    70     65   main(
    71     66       int argc,
    72     67       char *argv[])
    73     68   {
    74     69       char msg[300];
    75     70       DWORD dwWritten;
    76     71       int chars;
           72  +    const char *s;
    77     73   
    78     74       /*
    79     75        * Make sure children (cl.exe and link.exe) are kept quiet.
    80     76        */
    81     77   
    82     78       SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
    83     79   
................................................................................
    98     94   			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
    99     95   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
   100     96   			&dwWritten, NULL);
   101     97   		return 2;
   102     98   	    }
   103     99   	    return CheckForCompilerFeature(argv[2]);
   104    100   	case 'l':
   105         -	    if (argc != 3) {
          101  +	    if (argc < 3) {
   106    102   		chars = snprintf(msg, sizeof(msg) - 1,
   107         -	       		"usage: %s -l <linker option>\n"
          103  +	       		"usage: %s -l <linker option> ?<mandatory option> ...?\n"
   108    104   			"Tests for whether link.exe supports an option\n"
   109    105   			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
   110    106   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
   111    107   			&dwWritten, NULL);
   112    108   		return 2;
   113    109   	    }
   114         -	    return CheckForLinkerFeature(argv[2]);
          110  +	    return CheckForLinkerFeature(&argv[2], argc-2);
   115    111   	case 'f':
   116    112   	    if (argc == 2) {
   117    113   		chars = snprintf(msg, sizeof(msg) - 1,
   118    114   			"usage: %s -f <string> <substring>\n"
   119    115   			"Find a substring within another\n"
   120    116   			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
   121    117   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
................................................................................
   149    145   		    "Extract a version from a file:\n"
   150    146   		    "eg: pkgIndex.tcl \"package ifneeded http\"",
   151    147   		    argv[0]);
   152    148   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
   153    149   		    &dwWritten, NULL);
   154    150   		return 0;
   155    151   	    }
   156         -	    printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'));
   157         -	    return 0;
          152  +	    s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0');
          153  +	    if (s && *s) {
          154  +		printf("%s\n", s);
          155  +		return 0;
          156  +	    } else
          157  +		return 1; /* Version not found. Return non-0 exit code */
          158  +
   158    159   	case 'Q':
   159    160   	    if (argc != 3) {
   160    161   		chars = snprintf(msg, sizeof(msg) - 1,
   161    162   		    "usage: %s -Q path\n"
   162    163   		    "Emit the fully qualified path\n"
   163    164   		    "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
   164    165   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
   165    166   		    &dwWritten, NULL);
   166    167   		return 2;
   167    168   	    }
   168    169   	    return QualifyPath(argv[2]);
          170  +
          171  +	case 'L':
          172  +	    if (argc != 3) {
          173  +		chars = snprintf(msg, sizeof(msg) - 1,
          174  +		    "usage: %s -L keypath\n"
          175  +		    "Emit the fully qualified path of directory containing keypath\n"
          176  +		    "exitcodes: 0 == success, 1 == not found, 2 == error\n", argv[0]);
          177  +		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
          178  +		    &dwWritten, NULL);
          179  +		return 2;
          180  +	    }
          181  +	    return LocateDependency(argv[2]);
   169    182   	}
   170    183       }
   171    184       chars = snprintf(msg, sizeof(msg) - 1,
   172    185   	    "usage: %s -c|-f|-l|-Q|-s|-V ...\n"
   173    186   	    "This is a little helper app to equalize shell differences between WinNT and\n"
   174    187   	    "Win9x and get nmake.exe to accomplish its job.\n",
   175    188   	    argv[0]);
................................................................................
   309    322                || strstr(Err.buffer, "D9002") != NULL
   310    323                || strstr(Out.buffer, "D2021") != NULL
   311    324                || strstr(Err.buffer, "D2021") != NULL);
   312    325   }
   313    326   
   314    327   static int
   315    328   CheckForLinkerFeature(
   316         -    const char *option)
          329  +    const char **options,
          330  +    int count)
   317    331   {
   318    332       STARTUPINFO si;
   319    333       PROCESS_INFORMATION pi;
   320    334       SECURITY_ATTRIBUTES sa;
   321    335       DWORD threadID;
   322    336       char msg[300];
   323    337       BOOL ok;
   324    338       HANDLE hProcess, h, pipeThreads[2];
   325         -    char cmdline[100];
          339  +    int i;
          340  +    char cmdline[255];
   326    341   
   327    342       hProcess = GetCurrentProcess();
   328    343   
   329    344       ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
   330    345       ZeroMemory(&si, sizeof(STARTUPINFO));
   331    346       si.cb = sizeof(STARTUPINFO);
   332    347       si.dwFlags   = STARTF_USESTDHANDLES;
................................................................................
   364    379   
   365    380       lstrcpy(cmdline, "link.exe -nologo ");
   366    381   
   367    382       /*
   368    383        * Append our option for testing.
   369    384        */
   370    385   
   371         -    lstrcat(cmdline, option);
          386  +    for (i = 0; i < count; i++) {
          387  +	lstrcat(cmdline, " \"");
          388  +	lstrcat(cmdline, options[i]);
          389  +	lstrcat(cmdline, "\"");
          390  +    }
   372    391   
   373    392       ok = CreateProcess(
   374    393   	    NULL,	    /* Module name. */
   375    394   	    cmdline,	    /* Command line. */
   376    395   	    NULL,	    /* Process handle not inheritable. */
   377    396   	    NULL,	    /* Thread handle not inheritable. */
   378    397   	    TRUE,	    /* yes, inherit handles. */
................................................................................
   429    448       /*
   430    449        * Look for the commandline warning code in the stderr stream.
   431    450        */
   432    451   
   433    452       return !(strstr(Out.buffer, "LNK1117") != NULL ||
   434    453   	    strstr(Err.buffer, "LNK1117") != NULL ||
   435    454   	    strstr(Out.buffer, "LNK4044") != NULL ||
   436         -	    strstr(Err.buffer, "LNK4044") != NULL);
          455  +	    strstr(Err.buffer, "LNK4044") != NULL ||
          456  +	    strstr(Out.buffer, "LNK4224") != NULL ||
          457  +	    strstr(Err.buffer, "LNK4224") != NULL);
   437    458   }
   438    459   
   439    460   static DWORD WINAPI
   440    461   ReadFromPipe(
   441    462       LPVOID args)
   442    463   {
   443    464       pipeinfo *pi = (pipeinfo *) args;
................................................................................
   658    679   
   659    680   	list_free(&substPtr);
   660    681       }
   661    682       fclose(fp);
   662    683       return 0;
   663    684   }
   664    685   
          686  +BOOL FileExists(LPCTSTR szPath)
          687  +{
          688  +#ifndef INVALID_FILE_ATTRIBUTES
          689  +    #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) 
          690  +#endif
          691  +    DWORD pathAttr = GetFileAttributes(szPath);
          692  +    return (pathAttr != INVALID_FILE_ATTRIBUTES && 
          693  +	    !(pathAttr & FILE_ATTRIBUTE_DIRECTORY));
          694  +}
          695  +
          696  +
   665    697   /*
   666    698    * QualifyPath --
   667    699    *
   668    700    *	This composes the current working directory with a provided path
   669    701    *	and returns the fully qualified and normalized path.
   670    702    *	Mostly needed to setup paths for testing.
   671    703    */
   672    704   
   673    705   static int
   674    706   QualifyPath(
   675    707       const char *szPath)
   676    708   {
   677    709       char szCwd[MAX_PATH + 1];
   678         -    char szTmp[MAX_PATH + 1];
   679         -    char *p;
   680         -    GetCurrentDirectory(MAX_PATH, szCwd);
   681         -    while ((p = strchr(szPath, '/')) && *p)
   682         -	*p = '\\';
   683         -    PathCombine(szTmp, szCwd, szPath);
   684         -    PathCanonicalize(szCwd, szTmp);
          710  +
          711  +	GetFullPathName(szPath, sizeof(szCwd)-1, szCwd, NULL);
   685    712       printf("%s\n", szCwd);
   686    713       return 0;
   687    714   }
          715  +
          716  +/*
          717  + * Implements LocateDependency for a single directory. See that command
          718  + * for an explanation.
          719  + * Returns 0 if found after printing the directory.
          720  + * Returns 1 if not found but no errors.
          721  + * Returns 2 on any kind of error
          722  + * Basically, these are used as exit codes for the process.
          723  + */
          724  +static int LocateDependencyHelper(const char *dir, const char *keypath)
          725  +{
          726  +    HANDLE hSearch;
          727  +    char path[MAX_PATH+1];
          728  +    int dirlen, keylen, ret;
          729  +    WIN32_FIND_DATA finfo;
          730  +
          731  +    if (dir == NULL || keypath == NULL)
          732  +	return 2; /* Have no real error reporting mechanism into nmake */
          733  +    dirlen = strlen(dir);
          734  +    if ((dirlen + 3) > sizeof(path))
          735  +	return 2;
          736  +    strncpy(path, dir, dirlen);
          737  +    strncpy(path+dirlen, "\\*", 3);	/* Including terminating \0 */
          738  +    keylen = strlen(keypath);
          739  +
          740  +#if 0 /* This function is not available in Visual C++ 6 */
          741  +    /*
          742  +     * Use numerics 0 -> FindExInfoStandard,
          743  +     * 1 -> FindExSearchLimitToDirectories, 
          744  +     * as these are not defined in Visual C++ 6
          745  +     */
          746  +    hSearch = FindFirstFileEx(path, 0, &finfo, 1, NULL, 0);
          747  +#else
          748  +    hSearch = FindFirstFile(path, &finfo);
          749  +#endif
          750  +    if (hSearch == INVALID_HANDLE_VALUE)
          751  +	return 1; /* Not found */
          752  +
          753  +    /* Loop through all subdirs checking if the keypath is under there */
          754  +    ret = 1; /* Assume not found */
          755  +    do {
          756  +	int sublen;
          757  +	/*
          758  +	 * We need to check it is a directory despite the 
          759  +	 * FindExSearchLimitToDirectories in the above call. See SDK docs
          760  +	 */
          761  +	if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
          762  +	    continue;
          763  +	sublen = strlen(finfo.cFileName);
          764  +	if ((dirlen+1+sublen+1+keylen+1) > sizeof(path))
          765  +	    continue;		/* Path does not fit, assume not matched */
          766  +	strncpy(path+dirlen+1, finfo.cFileName, sublen);
          767  +	path[dirlen+1+sublen] = '\\';
          768  +	strncpy(path+dirlen+1+sublen+1, keypath, keylen+1);
          769  +	if (FileExists(path)) {
          770  +	    /* Found a match, print to stdout */
          771  +	    path[dirlen+1+sublen] = '\0';
          772  +	    QualifyPath(path);
          773  +	    ret = 0;
          774  +	    break;
          775  +	}
          776  +    } while (FindNextFile(hSearch, &finfo));
          777  +    FindClose(hSearch);
          778  +    return ret;
          779  +}
          780  +
          781  +/*
          782  + * LocateDependency --
          783  + *
          784  + *	Locates a dependency for a package.
          785  + *        keypath - a relative path within the package directory
          786  + *          that is used to confirm it is the correct directory.
          787  + *	The search path for the package directory is currently only
          788  + *      the parent and grandparent of the current working directory.
          789  + *      If found, the command prints 
          790  + *         name_DIRPATH=<full path of located directory>
          791  + *      and returns 0. If not found, does not print anything and returns 1.
          792  + */
          793  +static int LocateDependency(const char *keypath)
          794  +{
          795  +    int i, ret;
          796  +    static char *paths[] = {"..", "..\\..", "..\\..\\.."};
          797  +    
          798  +    for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
          799  +	ret = LocateDependencyHelper(paths[i], keypath);
          800  +	if (ret == 0)
          801  +	    return ret;
          802  +    }
          803  +    return ret;
          804  +}
          805  +
   688    806   
   689    807   /*
   690    808    * Local variables:
   691    809    *   mode: c
   692    810    *   c-basic-offset: 4
   693    811    *   fill-column: 78
   694    812    *   indent-tabs-mode: t
   695    813    *   tab-width: 8
   696    814    * End:
   697    815    */

Added win/rules-ext.vc.

            1  +# This file should only be included in makefiles for Tcl extensions,
            2  +# NOT in the makefile for Tcl itself.
            3  +
            4  +!ifndef _RULES_EXT_VC
            5  +
            6  +# We need to run from the directory the parent makefile is located in.
            7  +# nmake does not tell us what makefile was used to invoke it so parent
            8  +# makefile has to set the MAKEFILEVC macro or we just make a guess and
            9  +# warn if we think that is not the case.
           10  +!if "$(MAKEFILEVC)" == ""
           11  +
           12  +!if exist("$(PROJECT).vc")
           13  +MAKEFILEVC = $(PROJECT).vc
           14  +!elseif exist("makefile.vc")
           15  +MAKEFILEVC = makefile.vc
           16  +!endif
           17  +!endif # "$(MAKEFILEVC)" == ""
           18  +
           19  +!if !exist("$(MAKEFILEVC)")
           20  +MSG = ^
           21  +You must run nmake from the directory containing the project makefile.^
           22  +If you are doing that and getting this message, set the MAKEFILEVC^
           23  +macro to the name of the project makefile.
           24  +!message WARNING: $(MSG)
           25  +!endif
           26  +
           27  +!if "$(PROJECT)" == "tcl"
           28  +!error The rules-ext.vc file is not intended for Tcl itself.
           29  +!endif
           30  +
           31  +# We extract version numbers using the nmakehlp program. For now use
           32  +# the local copy of nmakehlp. Once we locate Tcl, we will use that
           33  +# one if it is newer.
           34  +!if [$(CC) -nologo "nmakehlp.c" -link -subsystem:console > nul]
           35  +!endif
           36  +
           37  +# First locate the Tcl directory that we are working with.
           38  +!if "$(TCLDIR)" != ""
           39  +
           40  +_RULESDIR = $(TCLDIR:/=\)
           41  +
           42  +!else
           43  +
           44  +# If an installation path is specified, that is also the Tcl directory.
           45  +# Also Tk never builds against an installed Tcl, it needs Tcl sources
           46  +!if defined(INSTALLDIR) && "$(PROJECT)" != "tk"
           47  +_RULESDIR=$(INSTALLDIR:/=\)
           48  +!else
           49  +# Locate Tcl sources
           50  +!if [echo _RULESDIR = \> nmakehlp.out] \
           51  +   || [nmakehlp -L generic\tcl.h >> nmakehlp.out]
           52  +_RULESDIR = ..\..\tcl
           53  +!else
           54  +!include nmakehlp.out
           55  +!endif
           56  +
           57  +!endif # defined(INSTALLDIR)....
           58  +
           59  +!endif # ifndef TCLDIR
           60  +
           61  +# Now look for the targets.vc file under the Tcl root. Note we check this
           62  +# file and not rules.vc because the latter also exists on older systems.
           63  +!if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl
           64  +_RULESDIR = $(_RULESDIR)\lib\nmake
           65  +!elseif exist("$(_RULESDIR)\win\targets.vc")   # Building against Tcl sources
           66  +_RULESDIR = $(_RULESDIR)\win
           67  +!else
           68  +# If we have not located Tcl's targets file, most likely we are compiling
           69  +# against an older version of Tcl and so must use our own support files.
           70  +_RULESDIR = .
           71  +!endif
           72  +
           73  +!if "$(_RULESDIR)" != "."
           74  +# Potentially using Tcl's support files. If this extension has its own
           75  +# nmake support files, need to compare the versions and pick newer.
           76  +
           77  +!if exist("rules.vc") # The extension has its own copy
           78  +
           79  +!if [echo TCL_RULES_MAJOR = \> versions.vc] \
           80  +   && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc]
           81  +!endif
           82  +!if [echo TCL_RULES_MINOR = \>> versions.vc] \
           83  +   && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc]
           84  +!endif
           85  +
           86  +!if [echo OUR_RULES_MAJOR = \>> versions.vc] \
           87  +   && [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc]
           88  +!endif
           89  +!if [echo OUR_RULES_MINOR = \>> versions.vc] \
           90  +   && [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc]
           91  +!endif
           92  +!include versions.vc
           93  +# We have a newer version of the support files, use them
           94  +!if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR))
           95  +_RULESDIR = .
           96  +!endif
           97  +
           98  +!endif # if exist("rules.vc")
           99  +
          100  +!endif # if $(_RULESDIR) != "."
          101  +
          102  +# Let rules.vc know what copy of nmakehlp.c to use.
          103  +NMAKEHLPC = $(_RULESDIR)\nmakehlp.c
          104  +
          105  +# Get rid of our internal defines before calling rules.vc
          106  +!undef TCL_RULES_MAJOR
          107  +!undef TCL_RULES_MINOR
          108  +!undef OUR_RULES_MAJOR
          109  +!undef OUR_RULES_MINOR
          110  +
          111  +!if exist("$(_RULESDIR)\rules.vc")
          112  +!message *** Using $(_RULESDIR)\rules.vc
          113  +!include "$(_RULESDIR)\rules.vc"
          114  +!else
          115  +!error *** Could not locate rules.vc in $(_RULESDIR)
          116  +!endif
          117  +
          118  +!endif # _RULES_EXT_VC

Changes to win/rules.vc.

     1         -#------------------------------------------------------------------------------
            1  +#------------------------------------------------------------- -*- makefile -*-
     2      2   # rules.vc --
     3      3   #
     4         -#	Microsoft Visual C++ makefile include for decoding the commandline
     5         -#	macros.  This file does not need editing to build Tcl.
            4  +# Part of the nmake based build system for Tcl and its extensions.
            5  +# This file does all the hard work in terms of parsing build options,
            6  +# compiler switches, defining common targets and macros. The Tcl makefile
            7  +# directly includes this. Extensions include it via "rules-ext.vc".
     6      8   #
     7         -#	This version is modified from the Tcl source version to support
     8         -#	building extensions using nmake.
            9  +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for
           10  +# detailed documentation.
     9     11   #
    10     12   # See the file "license.terms" for information on usage and redistribution
    11     13   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    12     14   #
    13     15   # Copyright (c) 2001-2003 David Gravereaux.
    14     16   # Copyright (c) 2003-2008 Patrick Thoyts
           17  +# Copyright (c) 2017      Ashok P. Nadkarni
    15     18   #------------------------------------------------------------------------------
    16     19   
    17     20   !ifndef _RULES_VC
    18     21   _RULES_VC = 1
    19     22   
    20         -cc32		= $(CC)   # built-in default.
    21         -link32		= link
    22         -lib32		= lib
    23         -rc32		= $(RC)   # built-in default.
    24         -
    25         -!ifndef INSTALLDIR
    26         -### Assume the normal default.
    27         -_INSTALLDIR	= C:\Program Files\Tcl
    28         -!else
    29         -### Fix the path separators.
    30         -_INSTALLDIR	= $(INSTALLDIR:/=\)
    31         -!endif
           23  +# The following macros define the version of the rules.vc nmake build system
           24  +# For modifications that are not backward-compatible, you *must* change
           25  +# the major version.
           26  +RULES_VERSION_MAJOR = 1
           27  +RULES_VERSION_MINOR = 2
           28  +
           29  +# The PROJECT macro must be defined by parent makefile.
           30  +!if "$(PROJECT)" == ""
           31  +!error *** Error: Macro PROJECT not defined! Please define it before including rules.vc
           32  +!endif
           33  +
           34  +!if "$(PRJ_PACKAGE_TCLNAME)" == ""
           35  +PRJ_PACKAGE_TCLNAME = $(PROJECT)
           36  +!endif
           37  +
           38  +# Also special case Tcl and Tk to save some typing later
           39  +DOING_TCL = 0
           40  +DOING_TK  = 0
           41  +!if "$(PROJECT)" == "tcl"
           42  +DOING_TCL = 1
           43  +!elseif "$(PROJECT)" == "tk"
           44  +DOING_TK = 1
           45  +!endif
           46  +
           47  +!ifndef NEED_TK
           48  +# Backwards compatibility
           49  +!ifdef PROJECT_REQUIRES_TK
           50  +NEED_TK = $(PROJECT_REQUIRES_TK)
           51  +!else
           52  +NEED_TK = 0
           53  +!endif
           54  +!endif
           55  +
           56  +!ifndef NEED_TCL_SOURCE
           57  +NEED_TCL_SOURCE = 0
           58  +!endif
           59  +
           60  +!ifdef NEED_TK_SOURCE
           61  +!if $(NEED_TK_SOURCE)
           62  +NEED_TK = 1
           63  +!endif
           64  +!else
           65  +NEED_TK_SOURCE = 0
           66  +!endif
           67  +
           68  +################################################################
           69  +# Nmake is a pretty weak environment in syntax and capabilities
           70  +# so this file is necessarily verbose. It's broken down into
           71  +# the following parts.
           72  +#
           73  +# 0. Sanity check that compiler environment is set up and initialize
           74  +#    any built-in settings from the parent makefile
           75  +# 1. First define the external tools used for compiling, copying etc.
           76  +#    as this is independent of everything else.
           77  +# 2. Figure out our build structure in terms of the directory, whether
           78  +#    we are building Tcl or an extension, etc.
           79  +# 3. Determine the compiler and linker versions
           80  +# 4. Build the nmakehlp helper application
           81  +# 5. Determine the supported compiler options and features
           82  +# 6. Parse the OPTS macro value for user-specified build configuration
           83  +# 7. Parse the STATS macro value for statistics instrumentation
           84  +# 8. Parse the CHECKS macro for additional compilation checks
           85  +# 9. Extract Tcl, and possibly Tk, version numbers from the headers
           86  +# 10. Based on this selected configuration, construct the output
           87  +#     directory and file paths
           88  +# 11. Construct the paths where the package is to be installed
           89  +# 12. Set up the actual options passed to compiler and linker based
           90  +#     on the information gathered above.
           91  +# 13. Define some standard build targets and implicit rules. These may
           92  +#     be optionally disabled by the parent makefile.
           93  +# 14. (For extensions only.) Compare the configuration of the target
           94  +#     Tcl and the extensions and warn against discrepancies.
           95  +#
           96  +# One final note about the macro names used. They are as they are
           97  +# for historical reasons. We would like legacy extensions to
           98  +# continue to work with this make include file so be wary of
           99  +# changing them for consistency or clarity.
          100  +
          101  +# 0. Sanity check compiler environment
          102  +
          103  +# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
          104  +# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
          105  +
          106  +!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR)
          107  +MSG = ^
          108  +Visual C++ compiler environment not initialized.
          109  +!error $(MSG)
          110  +!endif
          111  +
          112  +# We need to run from the directory the parent makefile is located in.
          113  +# nmake does not tell us what makefile was used to invoke it so parent
          114  +# makefile has to set the MAKEFILEVC macro or we just make a guess and
          115  +# warn if we think that is not the case.
          116  +!if "$(MAKEFILEVC)" == ""
          117  +
          118  +!if exist("$(PROJECT).vc")
          119  +MAKEFILEVC = $(PROJECT).vc
          120  +!elseif exist("makefile.vc")
          121  +MAKEFILEVC = makefile.vc
          122  +!endif
          123  +!endif # "$(MAKEFILEVC)" == ""
          124  +
          125  +!if !exist("$(MAKEFILEVC)")
          126  +MSG = ^
          127  +You must run nmake from the directory containing the project makefile.^
          128  +If you are doing that and getting this message, set the MAKEFILEVC^
          129  +macro to the name of the project makefile.
          130  +!message WARNING: $(MSG)
          131  +!endif
          132  +
          133  +
          134  +################################################################
          135  +# 1. Define external programs being used
    32    136   
    33    137   #----------------------------------------------------------
    34    138   # Set the proper copy method to avoid overwrite questions
    35    139   # to the user when copying files and selecting the right
    36    140   # "delete all" method.
    37    141   #----------------------------------------------------------
    38    142   
    39    143   RMDIR	= rmdir /S /Q
    40         -ERRNULL  = 2>NUL
    41         -!if ![ver | find "4.0" > nul]
    42         -CPY	= echo y | xcopy /i >NUL
    43         -COPY	= copy >NUL
    44         -!else
    45    144   CPY	= xcopy /i /y >NUL
          145  +CPYDIR  = xcopy /e /i /y >NUL
    46    146   COPY	= copy /y >NUL
    47         -!endif
    48    147   MKDIR   = mkdir
    49    148   
    50         -#------------------------------------------------------------------------------
    51         -# Determine the host and target architectures and compiler version.
    52         -#------------------------------------------------------------------------------
          149  +######################################################################
          150  +# 2. Figure out our build environment in terms of what we're building.
          151  +#
          152  +# (a) Tcl itself
          153  +# (b) Tk
          154  +# (c) a Tcl extension using libraries/includes from an *installed* Tcl
          155  +# (d) a Tcl extension using libraries/includes from Tcl source directory
          156  +#
          157  +# This last is needed because some extensions still need
          158  +# some Tcl interfaces that are not publicly exposed.
          159  +#
          160  +# The fragment will set the following macros:
          161  +# ROOT - root of this module sources
          162  +# COMPATDIR - source directory that holds compatibility sources
          163  +# DOCDIR - source directory containing documentation files
          164  +# GENERICDIR - platform-independent source directory
          165  +# WINDIR - Windows-specific source directory
          166  +# TESTDIR - directory containing test files
          167  +# TOOLSDIR - directory containing build tools
          168  +# _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set
          169  +#    when building Tcl itself.
          170  +# _INSTALLDIR - native form of the installation path. For Tcl
          171  +#    this will be the root of the Tcl installation. For extensions
          172  +#    this will be the lib directory under the root.
          173  +# TCLINSTALL  - set to 1 if _TCLDIR refers to
          174  +#    headers and libraries from an installed Tcl, and 0 if built against
          175  +#    Tcl sources. Not set when building Tcl itself. Yes, not very well
          176  +#    named.
          177  +# _TCL_H - native path to the tcl.h file
          178  +#
          179  +# If Tk is involved, also sets the following
          180  +# _TKDIR - native form Tk installation OR Tk source. Not set if building
          181  +#    Tk itself.
          182  +# TKINSTALL - set 1 if _TKDIR refers to installed Tk and 0 if Tk sources
          183  +# _TK_H - native path to the tk.h file
          184  +
          185  +# Root directory for sources and assumed subdirectories
          186  +ROOT = $(MAKEDIR)\..
          187  +# The following paths CANNOT have spaces in them as they appear on the
          188  +# left side of implicit rules.
          189  +!ifndef COMPATDIR
          190  +COMPATDIR	= $(ROOT)\compat
          191  +!endif
          192  +!ifndef DOCDIR
          193  +DOCDIR		= $(ROOT)\doc
          194  +!endif
          195  +!ifndef GENERICDIR
          196  +GENERICDIR	= $(ROOT)\generic
          197  +!endif
          198  +!ifndef TOOLSDIR
          199  +TOOLSDIR	= $(ROOT)\tools
          200  +!endif
          201  +!ifndef TESTDIR
          202  +TESTDIR	= $(ROOT)\tests
          203  +!endif
          204  +!ifndef LIBDIR
          205  +!if exist("$(ROOT)\library")
          206  +LIBDIR          = $(ROOT)\library
          207  +!else
          208  +LIBDIR          = $(ROOT)\lib
          209  +!endif
          210  +!endif
          211  +!ifndef DEMODIR
          212  +!if exist("$(LIBDIR)\demos")
          213  +DEMODIR		= $(LIBDIR)\demos
          214  +!else
          215  +DEMODIR		= $(ROOT)\demos
          216  +!endif
          217  +!endif # ifndef DEMODIR
          218  +# Do NOT enclose WINDIR in a !ifndef because Windows always defines
          219  +# WINDIR env var to point to c:\windows!
          220  +# TBD - This is a potentially dangerous conflict, rename WINDIR to
          221  +# something else
          222  +WINDIR		= $(ROOT)\win
          223  +
          224  +!ifndef RCDIR
          225  +!if exist("$(WINDIR)\rc")
          226  +RCDIR           = $(WINDIR)\rc
          227  +!else
          228  +RCDIR           = $(WINDIR)
          229  +!endif
          230  +!endif
          231  +RCDIR = $(RCDIR:/=\)
          232  +
          233  +# The target directory where the built packages and binaries will be installed.
          234  +# INSTALLDIR is the (optional) path specified by the user.
          235  +# _INSTALLDIR is INSTALLDIR using the backslash separator syntax
          236  +!ifdef INSTALLDIR
          237  +### Fix the path separators.
          238  +_INSTALLDIR	= $(INSTALLDIR:/=\)
          239  +!else
          240  +### Assume the normal default.
          241  +_INSTALLDIR	= $(HOMEDRIVE)\Tcl
          242  +!endif
          243  +
          244  +!if $(DOING_TCL)
          245  +
          246  +# BEGIN Case 2(a) - Building Tcl itself
          247  +
          248  +# Only need to define _TCL_H
          249  +_TCL_H = ..\generic\tcl.h
          250  +
          251  +# END Case 2(a) - Building Tcl itself
          252  +
          253  +!elseif $(DOING_TK)
          254  +
          255  +# BEGIN Case 2(b) - Building Tk
          256  +
          257  +TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl
          258  +!if "$(TCLDIR)" == ""
          259  +!if [echo TCLDIR = \> nmakehlp.out] \
          260  +   || [nmakehlp -L generic\tcl.h >> nmakehlp.out]
          261  +!error *** Could not locate Tcl source directory.
          262  +!endif
          263  +!include nmakehlp.out
          264  +!endif # TCLDIR == ""
          265  +
          266  +_TCLDIR	= $(TCLDIR:/=\)
          267  +_TCL_H  = $(_TCLDIR)\generic\tcl.h
          268  +!if !exist("$(_TCL_H)")
          269  +!error Could not locate tcl.h. Please set the TCLDIR macro to point to the Tcl *source* directory.
          270  +!endif
          271  +
          272  +_TK_H = ..\generic\tk.h
          273  +
          274  +# END Case 2(b) - Building Tk
          275  +
          276  +!else
          277  +
          278  +# BEGIN Case 2(c) or (d) - Building an extension other than Tk
          279  +
          280  +# If command line has specified Tcl location through TCLDIR, use it
          281  +# else default to the INSTALLDIR setting
          282  +!if "$(TCLDIR)" != ""
          283  +
          284  +_TCLDIR	= $(TCLDIR:/=\)
          285  +!if exist("$(_TCLDIR)\include\tcl.h") # Case 2(c) with TCLDIR defined
          286  +TCLINSTALL	= 1
          287  +_TCL_H          = $(_TCLDIR)\include\tcl.h
          288  +!elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(d) with TCLDIR defined
          289  +TCLINSTALL	= 0
          290  +_TCL_H          = $(_TCLDIR)\generic\tcl.h
          291  +!endif
          292  +
          293  +!else  #  # Case 2(c) for extensions with TCLDIR undefined
          294  +
          295  +# Need to locate Tcl depending on whether it needs Tcl source or not.
          296  +# If we don't, check the INSTALLDIR for an installed Tcl first
          297  +
          298  +!if exist("$(_INSTALLDIR)\include\tcl.h") && !$(NEED_TCL_SOURCE)
          299  +
          300  +TCLINSTALL	= 1
          301  +TCLDIR          = $(_INSTALLDIR)\..
          302  +# NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions
          303  +# later so the \.. accounts for the /lib
          304  +_TCLDIR		= $(_INSTALLDIR)\..
          305  +_TCL_H          = $(_TCLDIR)\include\tcl.h
          306  +
          307  +!else # exist(...) && ! $(NEED_TCL_SOURCE)
          308  +
          309  +!if [echo _TCLDIR = \> nmakehlp.out] \
          310  +   || [nmakehlp -L generic\tcl.h >> nmakehlp.out]
          311  +!error *** Could not locate Tcl source directory.
          312  +!endif
          313  +!include nmakehlp.out
          314  +TCLINSTALL      = 0
          315  +TCLDIR         = $(_TCLDIR)
          316  +_TCL_H          = $(_TCLDIR)\generic\tcl.h
          317  +
          318  +!endif # exist(...) && ! $(NEED_TCL_SOURCE)
          319  +
          320  +!endif # TCLDIR
          321  +
          322  +!ifndef _TCL_H
          323  +MSG =^
          324  +Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h.
          325  +!error $(MSG)
          326  +!endif
          327  +
          328  +# Now do the same to locate Tk headers and libs if project requires Tk
          329  +!if $(NEED_TK)
          330  +
          331  +!if "$(TKDIR)" != ""
          332  +
          333  +_TKDIR = $(TKDIR:/=\)
          334  +!if exist("$(_TKDIR)\include\tk.h")
          335  +TKINSTALL      = 1
          336  +_TK_H          = $(_TKDIR)\include\tk.h
          337  +!elseif exist("$(_TKDIR)\generic\tk.h")
          338  +TKINSTALL      = 0
          339  +_TK_H          = $(_TKDIR)\generic\tk.h
          340  +!endif
          341  +
          342  +!else # TKDIR not defined
          343  +
          344  +# Need to locate Tcl depending on whether it needs Tcl source or not.
          345  +# If we don't, check the INSTALLDIR for an installed Tcl first
          346  +
          347  +!if exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE)
          348  +
          349  +TKINSTALL      = 1
          350  +# NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions
          351  +# later so the \.. accounts for the /lib
          352  +_TKDIR         = $(_INSTALLDIR)\..
          353  +_TK_H          = $(_TKDIR)\include\tk.h
          354  +TKDIR          = $(_TKDIR)
          355  +
          356  +!else # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE)
          357  +
          358  +!if [echo _TKDIR = \> nmakehlp.out] \
          359  +   || [nmakehlp -L generic\tk.h >> nmakehlp.out]
          360  +!error *** Could not locate Tk source directory.
          361  +!endif
          362  +!include nmakehlp.out
          363  +TKINSTALL      = 0
          364  +TKDIR          = $(_TKDIR)
          365  +_TK_H          = $(_TKDIR)\generic\tk.h
          366  +
          367  +!endif # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE)
          368  +
          369  +!endif # TKDIR
          370  +
          371  +!ifndef _TK_H
          372  +MSG =^
          373  +Failed to find tk.h. The TKDIR macro is set incorrectly or is not set and default path does not contain tk.h.
          374  +!error $(MSG)
          375  +!endif
          376  +
          377  +!endif # NEED_TK
          378  +
          379  +!if $(NEED_TCL_SOURCE) && $(TCLINSTALL)
          380  +MSG = ^
          381  +*** Warning: This extension requires the source distribution of Tcl.^
          382  +*** Please set the TCLDIR macro to point to the Tcl sources.
          383  +!error $(MSG)
          384  +!endif
          385  +
          386  +!if $(NEED_TK_SOURCE)
          387  +!if $(TKINSTALL)
          388  +MSG = ^
          389  +*** Warning: This extension requires the source distribution of Tk.^
          390  +*** Please set the TKDIR macro to point to the Tk sources.
          391  +!error $(MSG)
          392  +!endif
          393  +!endif
          394  +
          395  +
          396  +# If INSTALLDIR set to Tcl installation root dir then reset to the
          397  +# lib dir for installing extensions
          398  +!if exist("$(_INSTALLDIR)\include\tcl.h")
          399  +_INSTALLDIR=$(_INSTALLDIR)\lib
          400  +!endif
          401  +
          402  +# END Case 2(c) or (d) - Building an extension
          403  +!endif # if $(DOING_TCL)
          404  +
          405  +################################################################
          406  +# 3. Determine compiler version and architecture
          407  +# In this section, we figure out the compiler version and the
          408  +# architecture for which we are building. This sets the
          409  +# following macros:
          410  +# VCVERSION - the internal compiler version as 1200, 1400, 1910 etc.
          411  +#     This is also printed by the compiler in dotted form 19.10 etc.
          412  +# VCVER - the "marketing version", for example Visual C++ 6 for internal
          413  +#     compiler version 1200. This is kept only for legacy reasons as it
          414  +#     does not make sense for recent Microsoft compilers. Only used for
          415  +#     output directory names.
          416  +# ARCH - set to IX86 or AMD64 depending on 32- or 64-bit target
          417  +# NATIVE_ARCH - set to IX86 or AMD64 for the host machine
          418  +# MACHINE - same as $(ARCH) - legacy
          419  +# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed
          420  +# CFG_ENCODING - set to an character encoding.
          421  +#   TBD - this is passed to compiler as TCL_CFGVAL_ENCODING but can't
          422  +#   see where it is used
          423  +
          424  +cc32		= $(CC)   # built-in default.
          425  +link32		= link
          426  +lib32		= lib
          427  +rc32		= $(RC)   # built-in default.
          428  +
          429  +#----------------------------------------------------------------
          430  +# Figure out the compiler architecture and version by writing
          431  +# the C macros to a file, preprocessing them with the C
          432  +# preprocessor and reading back the created file
    53    433   
    54    434   _HASH=^#
    55    435   _VC_MANIFEST_EMBED_EXE=
    56    436   _VC_MANIFEST_EMBED_DLL=
    57    437   VCVER=0
    58    438   !if ![echo VCVERSION=_MSC_VER > vercl.x] \
    59    439       && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
    60    440       && ![echo ARCH=IX86 >> vercl.x] \
    61    441       && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
    62    442       && ![echo ARCH=AMD64 >> vercl.x] \
    63    443       && ![echo $(_HASH)endif >> vercl.x] \
    64         -    && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
          444  +    && ![$(cc32) -nologo -TC -P vercl.x 2>NUL]
    65    445   !include vercl.i
          446  +!if $(VCVERSION) < 1900
    66    447   !if ![echo VCVER= ^\> vercl.vc] \
    67    448       && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
    68    449   !include vercl.vc
    69    450   !endif
          451  +!else
          452  +# The simple calculation above does not apply to new Visual Studio releases
          453  +# Keep the compiler version in its native form.
          454  +VCVER = $(VCVERSION)
    70    455   !endif
    71         -!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
    72    456   !endif
    73    457   
          458  +!if ![del 2>NUL /q/f vercl.x vercl.i vercl.vc]
          459  +!endif
          460  +
          461  +#----------------------------------------------------------------
          462  +# The MACHINE macro is used by legacy makefiles so set it as well
          463  +!ifdef MACHINE
          464  +!if "$(MACHINE)" == "x86"
          465  +!undef MACHINE
          466  +MACHINE = IX86
          467  +!elseif "$(MACHINE)" == "x64"
          468  +!undef MACHINE
          469  +MACHINE = AMD64
          470  +!endif
          471  +!if "$(MACHINE)" != "$(ARCH)"
          472  +!error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH).
          473  +!endif
          474  +!else
          475  +MACHINE=$(ARCH)
          476  +!endif
          477  +
          478  +#------------------------------------------------------------
          479  +# Figure out the *host* architecture by reading the registry
          480  +
    74    481   !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
    75    482   NATIVE_ARCH=IX86
    76    483   !else
    77    484   NATIVE_ARCH=AMD64
    78    485   !endif
    79    486   
    80    487   # Since MSVC8 we must deal with manifest resources.
    81    488   !if $(VCVERSION) >= 1400
    82    489   _VC_MANIFEST_EMBED_EXE=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:[email protected];1
    83    490   _VC_MANIFEST_EMBED_DLL=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:[email protected];2
    84    491   !endif
    85    492   
    86         -!ifndef MACHINE
    87         -MACHINE=$(ARCH)
    88         -!endif
    89         -
    90    493   !ifndef CFG_ENCODING
    91    494   CFG_ENCODING	= \"cp1252\"
    92    495   !endif
    93    496   
    94         -!message ===============================================================================
    95         -
    96         -#----------------------------------------------------------
    97         -# build the helper app we need to overcome nmake's limiting
    98         -# environment.
    99         -#----------------------------------------------------------
   100         -
   101         -!if !exist(nmakehlp.exe)
   102         -!if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul]
   103         -!endif
   104         -!endif
   105         -
   106         -#----------------------------------------------------------
   107         -# Test for compiler features
   108         -#----------------------------------------------------------
   109         -
   110         -### test for optimizations
   111         -!if [nmakehlp -c -Ot]
   112         -!message *** Compiler has 'Optimizations'
   113         -OPTIMIZING	= 1
   114         -!else
   115         -!message *** Compiler does not have 'Optimizations'
   116         -OPTIMIZING	= 0
   117         -!endif
   118         -
   119         -OPTIMIZATIONS   =
   120         -
   121         -!if [nmakehlp -c -Ot]
   122         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -Ot
   123         -!endif
   124         -
   125         -!if [nmakehlp -c -Oi]
   126         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -Oi
   127         -!endif
   128         -
          497  +################################################################
          498  +# 4. Build the nmakehlp program
          499  +# This is a helper app we need to overcome nmake's limiting
          500  +# environment. We will call out to it to get various bits of
          501  +# information about supported compiler options etc.
          502  +#
          503  +# Tcl itself will always use the nmakehlp.c program which is
          504  +# in its own source. This is the "master" copy and kept updated.
          505  +#
          506  +# Extensions built against an installed Tcl will use the installed
          507  +# copy of Tcl's nmakehlp.c if there is one and their own version
          508  +# otherwise. In the latter case, they would also be using their own
          509  +# rules.vc. Note that older versions of Tcl do not install nmakehlp.c
          510  +# or rules.vc.
          511  +#
          512  +# Extensions built against Tcl sources will use the one from the Tcl source.
          513  +#
          514  +# When building an extension using a sufficiently new version of Tcl,
          515  +# rules-ext.vc will define NMAKEHLPC appropriately to point to the
          516  +# copy of nmakehlp.c to be used.
          517  +
          518  +!ifndef NMAKEHLPC
          519  +# Default to the one in the current directory (the extension's own nmakehlp.c)
          520  +NMAKEHLPC = nmakehlp.c
          521  +
          522  +!if !$(DOING_TCL)
          523  +!if $(TCLINSTALL)
          524  +!if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c")
          525  +NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c
          526  +!endif
          527  +!else # ! $(TCLINSTALL)
          528  +!if exist("$(_TCLDIR)\win\nmakehlp.c")
          529  +NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c
          530  +!endif
          531  +!endif # $(TCLINSTALL)
          532  +!endif # !$(DOING_TCL)
          533  +
          534  +!endif # NMAKEHLPC
          535  +
          536  +# We always build nmakehlp even if it exists since we do not know
          537  +# what source it was built from.
          538  +!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
          539  +!endif
          540  +
          541  +################################################################
          542  +# 5. Test for compiler features
          543  +# Visual C++ compiler options have changed over the years. Check
          544  +# which options are supported by the compiler in use.
          545  +#
          546  +# The following macros are set:
          547  +# OPTIMIZATIONS - the compiler flags to be used for optimized builds
          548  +# DEBUGFLAGS - the compiler flags to be used for debug builds
          549  +# LINKERFLAGS - Flags passed to the linker
          550  +#
          551  +# Note that these are the compiler settings *available*, not those
          552  +# that will be *used*. The latter depends on the OPTS macro settings
          553  +# which we have not yet parsed.
          554  +#
          555  +# Also note that some of the flags in OPTIMIZATIONS are not really
          556  +# related to optimization. They are placed there only for legacy reasons
          557  +# as some extensions expect them to be included in that macro.
          558  +
          559  +# -Op improves float consistency. Note only needed for older compilers
          560  +# Newer compilers do not need or support this option.
   129    561   !if [nmakehlp -c -Op]
   130         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -Op
          562  +FPOPTS  = -Op
   131    563   !endif
   132    564   
          565  +# Strict floating point semantics - present in newer compilers in lieu of -Op
   133    566   !if [nmakehlp -c -fp:strict]
   134         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -fp:strict
   135         -!endif
   136         -
   137         -!if [nmakehlp -c -Gs]
   138         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -Gs
   139         -!endif
   140         -
   141         -!if [nmakehlp -c -GS]
   142         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -GS
   143         -!endif
   144         -
   145         -!if [nmakehlp -c -GL]
   146         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -GL
   147         -!endif
   148         -
   149         -DEBUGFLAGS     =
   150         -
   151         -!if [nmakehlp -c -RTC1]
   152         -DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
   153         -!elseif [nmakehlp -c -GZ]
   154         -DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
   155         -!endif
   156         -
   157         -COMPILERFLAGS  =-W3
   158         -
   159         -# In v13 -GL and -YX are incompatible.
   160         -!if [nmakehlp -c -YX]
   161         -!if ![nmakehlp -c -GL]
   162         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
   163         -!endif
          567  +FPOPTS  = $(FPOPTS) -fp:strict
   164    568   !endif
   165    569   
   166    570   !if "$(MACHINE)" == "IX86"
   167    571   ### test for pentium errata
   168    572   !if [nmakehlp -c -QI0f]
   169    573   !message *** Compiler has 'Pentium 0x0f fix'
   170         -COMPILERFLAGS  = $(COMPILERFLAGS) -QI0f
          574  +FPOPTS  = $(FPOPTS) -QI0f
   171    575   !else
   172    576   !message *** Compiler does not have 'Pentium 0x0f fix'
   173    577   !endif
   174    578   !endif
   175    579   
   176         -!if "$(MACHINE)" == "IA64"
   177         -### test for Itanium errata
   178         -!if [nmakehlp -c -QIA64_Bx]
   179         -!message *** Compiler has 'B-stepping errata workarounds'
   180         -COMPILERFLAGS   = $(COMPILERFLAGS) -QIA64_Bx
   181         -!else
   182         -!message *** Compiler does not have 'B-stepping errata workarounds'
   183         -!endif
   184         -!endif
   185         -
   186         -!if "$(MACHINE)" == "IX86"
   187         -### test for -align:4096, when align:512 will do.
   188         -!if [nmakehlp -l -opt:nowin98]
   189         -!message *** Linker has 'Win98 alignment problem'
   190         -ALIGN98_HACK	= 1
   191         -!else
   192         -!message *** Linker does not have 'Win98 alignment problem'
   193         -ALIGN98_HACK	= 0
   194         -!endif
   195         -!else
   196         -ALIGN98_HACK	= 0
          580  +### test for optimizations
          581  +# /O2 optimization includes /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy as per
          582  +# documentation. Note we do NOT want /Gs as that inserts a _chkstk
          583  +# stack probe at *every* function entry, not just those with more than
          584  +# a page of stack allocation resulting in a performance hit.  However,
          585  +# /O2 documentation is misleading as its stack probes are simply the
          586  +# default page size locals allocation probes and not what is implied
          587  +# by an explicit /Gs option.
          588  +
          589  +OPTIMIZATIONS = $(FPOPTS)
          590  +
          591  +!if [nmakehlp -c -O2]
          592  +OPTIMIZING = 1
          593  +OPTIMIZATIONS   = $(OPTIMIZATIONS) -O2
          594  +!else
          595  +# Legacy, really. All modern compilers support this
          596  +!message *** Compiler does not have 'Optimizations'
          597  +OPTIMIZING = 0
          598  +!endif
          599  +
          600  +# Checks for buffer overflows in local arrays
          601  +!if [nmakehlp -c -GS]
          602  +OPTIMIZATIONS  = $(OPTIMIZATIONS) -GS
          603  +!endif
          604  +
          605  +# Link time optimization. Note that this option (potentially) makes
          606  +# generated libraries only usable by the specific VC++ version that
          607  +# created it. Requires /LTCG linker option
          608  +!if [nmakehlp -c -GL]
          609  +OPTIMIZATIONS  = $(OPTIMIZATIONS) -GL
          610  +CC_GL_OPT_ENABLED = 1
          611  +!else
          612  +# In newer compilers -GL and -YX are incompatible.
          613  +!if [nmakehlp -c -YX]
          614  +OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
          615  +!endif
          616  +!endif # [nmakehlp -c -GL]
          617  +
          618  +DEBUGFLAGS     = $(FPOPTS)
          619  +
          620  +# Run time error checks. Not available or valid in a release, non-debug build
          621  +# RTC is for modern compilers, -GZ is legacy
          622  +!if [nmakehlp -c -RTC1]
          623  +DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
          624  +!elseif [nmakehlp -c -GZ]
          625  +DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
          626  +!endif
          627  +
          628  +#----------------------------------------------------------------
          629  +# Linker flags
          630  +
          631  +# LINKER_TESTFLAGS are for internal use when we call nmakehlp to test
          632  +# if the linker supports a specific option. Without these flags link will
          633  +# return "LNK1561: entry point must be defined" error compiling from VS-IDE:
          634  +# They are not passed through to the actual application / extension
          635  +# link rules.
          636  +!ifndef LINKER_TESTFLAGS
          637  +LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmakehlp.out
   197    638   !endif
   198    639   
   199    640   LINKERFLAGS     =
   200    641   
   201         -!if [nmakehlp -l -ltcg]
   202         -LINKERFLAGS     =-ltcg
          642  +# If compiler has enabled link time optimization, linker must too with -ltcg
          643  +!ifdef CC_GL_OPT_ENABLED
          644  +!if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)]
          645  +LINKERFLAGS     = $(LINKERFLAGS) -ltcg
          646  +!endif
   203    647   !endif
   204    648   
   205         -#----------------------------------------------------------
   206         -# Decode the options requested.
   207         -#----------------------------------------------------------
          649  +########################################################################
          650  +# 6. Parse the OPTS macro to work out the requested build configuration.
          651  +# Based on this, we will construct the actual switches to be passed to the
          652  +# compiler and linker using the macros defined in the previous section.
          653  +# The following macros are defined by this section based on OPTS
          654  +# STATIC_BUILD - 0 -> Tcl is to be built as a shared library
          655  +#                1 -> build as a static library and shell
          656  +# TCL_THREADS - legacy but always 1 on Windows since winsock requires it.
          657  +# DEBUG - 1 -> debug build, 0 -> release builds
          658  +# SYMBOLS - 1 -> generate PDB's, 0 -> no PDB's
          659  +# PROFILE - 1 -> generate profiling info, 0 -> no profiling
          660  +# PGO     - 1 -> profile based optimization, 0 -> no
          661  +# MSVCRT  - 1 -> link to dynamic C runtime even when building static Tcl build
          662  +#           0 -> link to static C runtime for static Tcl build.
          663  +#           Does not impact shared Tcl builds (STATIC_BUILD == 0)
          664  +# TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions
          665  +#           in the Tcl shell. 0 -> keep them as shared libraries
          666  +#           Does not impact shared Tcl builds.
          667  +# USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation.
          668  +#           0 -> Use the non-thread allocator.
          669  +# UNCHECKED - 1 -> when doing a debug build with symbols, use the release
          670  +#           C runtime, 0 -> use the debug C runtime.
          671  +# USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking
          672  +# CONFIG_CHECK - 1 -> check current build configuration against Tcl
          673  +#           configuration (ignored for Tcl itself)
          674  +# Further, LINKERFLAGS are modified based on above.
   208    675   
   209         -!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
          676  +# Default values for all the above
   210    677   STATIC_BUILD	= 0
   211    678   TCL_THREADS	= 1
   212    679   DEBUG		= 0
   213    680   SYMBOLS		= 0
   214    681   PROFILE		= 0
   215    682   PGO		= 0
   216         -MSVCRT		= 0
   217         -LOIMPACT	= 0
          683  +MSVCRT		= 1
          684  +TCL_USE_STATIC_PACKAGES	= 0
          685  +USE_THREAD_ALLOC = 1
   218    686   UNCHECKED	= 0
          687  +CONFIG_CHECK    = 1
          688  +!if $(DOING_TCL)
          689  +USE_STUBS       = 0
   219    690   !else
          691  +USE_STUBS       = 1
          692  +!endif
          693  +
          694  +# If OPTS is not empty AND does not contain "none" which turns off all OPTS
          695  +# set the above macros based on OPTS content
          696  +!if "$(OPTS)" != "" && ![nmakehlp -f "$(OPTS)" "none"]
          697  +
          698  +# OPTS are specified, parse them
          699  +
   220    700   !if [nmakehlp -f $(OPTS) "static"]
   221    701   !message *** Doing static
   222    702   STATIC_BUILD	= 1
          703  +!endif
          704  +
          705  +!if [nmakehlp -f $(OPTS) "nostubs"]
          706  +!message *** Not using stubs
          707  +USE_STUBS	= 0
          708  +!endif
          709  +
          710  +!if [nmakehlp -f $(OPTS) "nomsvcrt"]
          711  +!message *** Doing nomsvcrt
          712  +MSVCRT		= 0
   223    713   !else
   224         -STATIC_BUILD	= 0
   225         -!endif
   226    714   !if [nmakehlp -f $(OPTS) "msvcrt"]
   227    715   !message *** Doing msvcrt
   228    716   MSVCRT		= 1
   229    717   !else
          718  +!if !$(STATIC_BUILD)
          719  +MSVCRT		= 1
          720  +!else
   230    721   MSVCRT		= 0
   231    722   !endif
          723  +!endif
          724  +!endif # [nmakehlp -f $(OPTS) "nomsvcrt"]
          725  +
          726  +!if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD)
          727  +!message *** Doing staticpkg
          728  +TCL_USE_STATIC_PACKAGES	= 1
          729  +!else
          730  +TCL_USE_STATIC_PACKAGES	= 0
          731  +!endif
          732  +
   232    733   !if [nmakehlp -f $(OPTS) "nothreads"]
   233    734   !message *** Compile explicitly for non-threaded tcl
   234    735   TCL_THREADS	= 0
          736  +USE_THREAD_ALLOC= 0
   235    737   !else
   236    738   TCL_THREADS	= 1
          739  +USE_THREAD_ALLOC= 1
   237    740   !endif
          741  +
   238    742   !if [nmakehlp -f $(OPTS) "symbols"]
   239    743   !message *** Doing symbols
   240    744   DEBUG		= 1
   241    745   !else
   242    746   DEBUG		= 0
   243    747   !endif
          748  +
   244    749   !if [nmakehlp -f $(OPTS) "pdbs"]
   245    750   !message *** Doing pdbs
   246    751   SYMBOLS		= 1
   247    752   !else
   248    753   SYMBOLS		= 0
   249    754   !endif
          755  +
   250    756   !if [nmakehlp -f $(OPTS) "profile"]
   251    757   !message *** Doing profile
   252    758   PROFILE		= 1
   253    759   !else
   254    760   PROFILE		= 0
   255    761   !endif
          762  +
   256    763   !if [nmakehlp -f $(OPTS) "pgi"]
   257    764   !message *** Doing profile guided optimization instrumentation
   258    765   PGO		= 1
   259    766   !elseif [nmakehlp -f $(OPTS) "pgo"]
   260    767   !message *** Doing profile guided optimization
   261    768   PGO		= 2
   262    769   !else
   263    770   PGO		= 0
   264    771   !endif
          772  +
   265    773   !if [nmakehlp -f $(OPTS) "loimpact"]
   266         -!message *** Doing loimpact
   267         -LOIMPACT	= 1
   268         -!else
   269         -LOIMPACT	= 0
          774  +!message *** Warning: ignoring option "loimpact" - deprecated on modern Windows.
   270    775   !endif
          776  +
          777  +# TBD - should get rid of this option
          778  +!if [nmakehlp -f $(OPTS) "thrdalloc"]
          779  +!message *** Doing thrdalloc
          780  +USE_THREAD_ALLOC = 1
          781  +!endif
          782  +
          783  +!if [nmakehlp -f $(OPTS) "tclalloc"]
          784  +USE_THREAD_ALLOC = 0
          785  +!endif
          786  +
   271    787   !if [nmakehlp -f $(OPTS) "unchecked"]
   272    788   !message *** Doing unchecked
   273    789   UNCHECKED = 1
   274    790   !else
   275    791   UNCHECKED = 0
   276    792   !endif
   277         -!endif
   278         -
   279         -!if !$(STATIC_BUILD)
   280         -# Make sure we don't build overly fat DLLs.
   281         -MSVCRT		= 1
   282         -# We shouldn't statically put the extensions inside the shell when dynamic.
   283         -TCL_USE_STATIC_PACKAGES = 0
   284         -!endif
   285         -
   286         -#----------------------------------------------------------
          793  +
          794  +!if [nmakehlp -f $(OPTS) "noconfigcheck"]
          795  +CONFIG_CHECK = 1
          796  +!else
          797  +CONFIG_CHECK = 0
          798  +!endif
          799  +
          800  +!endif # "$(OPTS)" != ""  && ... parsing of OPTS
          801  +
          802  +# Set linker flags based on above
          803  +
          804  +!if $(PGO) > 1
          805  +!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)]
          806  +LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
          807  +!else
          808  +MSG=^
          809  +This compiler does not support profile guided optimization.
          810  +!error $(MSG)
          811  +!endif
          812  +!elseif $(PGO) > 0
          813  +!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)]
          814  +LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
          815  +!else
          816  +MSG=^
          817  +This compiler does not support profile guided optimization.
          818  +!error $(MSG)
          819  +!endif
          820  +!endif
          821  +
          822  +################################################################
          823  +# 7. Parse the STATS macro to configure code instrumentation
          824  +# The following macros are set by this section:
          825  +# TCL_MEM_DEBUG - 1 -> enables memory allocation instrumentation
          826  +#                 0 -> disables
          827  +# TCL_COMPILE_DEBUG - 1 -> enables byte compiler logging
          828  +#                     0 -> disables
          829  +
          830  +# Default both are off
          831  +TCL_MEM_DEBUG	    = 0
          832  +TCL_COMPILE_DEBUG   = 0
          833  +
          834  +!if "$(STATS)" != "" && ![nmakehlp -f "$(STATS)" "none"]
          835  +
          836  +!if [nmakehlp -f $(STATS) "memdbg"]
          837  +!message *** Doing memdbg
          838  +TCL_MEM_DEBUG	    = 1
          839  +!else
          840  +TCL_MEM_DEBUG	    = 0
          841  +!endif
          842  +
          843  +!if [nmakehlp -f $(STATS) "compdbg"]
          844  +!message *** Doing compdbg
          845  +TCL_COMPILE_DEBUG   = 1
          846  +!else
          847  +TCL_COMPILE_DEBUG   = 0
          848  +!endif
          849  +
          850  +!endif
          851  +
          852  +####################################################################
          853  +# 8. Parse the CHECKS macro to configure additional compiler checks
          854  +# The following macros are set by this section:
          855  +# WARNINGS - compiler switches that control the warnings level
          856  +# TCL_NO_DEPRECATED - 1 -> disable support for deprecated functions
          857  +#                     0 -> enable deprecated functions
          858  +
          859  +# Defaults - Permit deprecated functions and warning level 3
          860  +TCL_NO_DEPRECATED	    = 0
          861  +WARNINGS		    = -W3
          862  +
          863  +!if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"]
          864  +
          865  +!if [nmakehlp -f $(CHECKS) "nodep"]
          866  +!message *** Doing nodep check
          867  +TCL_NO_DEPRECATED	    = 1
          868  +!endif
          869  +
          870  +!if [nmakehlp -f $(CHECKS) "fullwarn"]
          871  +!message *** Doing full warnings check
          872  +WARNINGS		    = -W4
          873  +!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)]
          874  +LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
          875  +!endif
          876  +!endif
          877  +
          878  +!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
          879  +!message *** Doing 64bit portability warnings
          880  +WARNINGS		    = $(WARNINGS) -Wp64
          881  +!endif
          882  +
          883  +!endif
          884  +
          885  +################################################################
          886  +# 9. Extract various version numbers
          887  +# For Tcl and Tk, version numbers are extracted from tcl.h and tk.h
          888  +# respectively. For extensions, versions are extracted from the
          889  +# configure.in or configure.ac from the TEA configuration if it
          890  +# exists, and unset otherwise.
          891  +# Sets the following macros:
          892  +# TCL_MAJOR_VERSION
          893  +# TCL_MINOR_VERSION
          894  +# TCL_PATCH_LEVEL
          895  +# TCL_VERSION
          896  +# TK_MAJOR_VERSION
          897  +# TK_MINOR_VERSION
          898  +# TK_PATCH_LEVEL
          899  +# TK_VERSION
          900  +# DOTVERSION - set as (for example) 2.5
          901  +# VERSION - set as (for example 25)
          902  +#--------------------------------------------------------------
          903  +
          904  +!if [echo REM = This file is generated from rules.vc > versions.vc]
          905  +!endif
          906  +!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
          907  +   && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
          908  +!endif
          909  +!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
          910  +   && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
          911  +!endif
          912  +!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
          913  +   && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
          914  +!endif
          915  +
          916  +!if defined(_TK_H)
          917  +!if [echo TK_MAJOR_VERSION = \>> versions.vc] \
          918  +   && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc]
          919  +!endif
          920  +!if [echo TK_MINOR_VERSION = \>> versions.vc] \
          921  +   && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
          922  +!endif
          923  +!if [echo TK_PATCH_LEVEL = \>> versions.vc] \
          924  +   && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
          925  +!endif
          926  +!endif # _TK_H
          927  +
          928  +!include versions.vc
          929  +
          930  +TCL_VERSION	= $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
          931  +TCL_DOTVERSION	= $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
          932  +!if defined(_TK_H)
          933  +TK_VERSION	= $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
          934  +TK_DOTVERSION	= $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
          935  +!endif
          936  +
          937  +# Set DOTVERSION and VERSION
          938  +!if $(DOING_TCL)
          939  +
          940  +DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
          941  +VERSION = $(TCL_VERSION)
          942  +
          943  +!elseif $(DOING_TK)
          944  +
          945  +DOTVERSION = $(TK_DOTVERSION)
          946  +VERSION = $(TK_VERSION)
          947  +
          948  +!else # Doing a non-Tk extension
          949  +
          950  +# If parent makefile has not defined DOTVERSION, try to get it from TEA
          951  +# first from a configure.in file, and then from configure.ac
          952  +!ifndef DOTVERSION
          953  +!if [echo DOTVERSION = \> versions.vc] \
          954  +   || [nmakehlp -V $(ROOT)\configure.in ^[$(PROJECT)^] >> versions.vc]
          955  +!if [echo DOTVERSION = \> versions.vc] \
          956  +   || [nmakehlp -V $(ROOT)\configure.ac ^[$(PROJECT)^] >> versions.vc]
          957  +!error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc.
          958  +!endif
          959  +!endif
          960  +!include versions.vc
          961  +!endif # DOTVERSION
          962  +VERSION         = $(DOTVERSION:.=)
          963  +
          964  +!endif # $(DOING_TCL) ... etc.
          965  +
          966  +################################################################
          967  +# 10. Construct output directory and file paths
   287    968   # Figure-out how to name our intermediate and output directories.
   288         -# We wouldn't want different builds to use the same .obj files
   289         -# by accident.
   290         -#----------------------------------------------------------
   291         -
   292         -#----------------------------------------
   293         -# Naming convention:
          969  +# In order to avoid inadvertent mixing of object files built using
          970  +# different compilers, build configurations etc.,
          971  +#
          972  +# Naming convention (suffixes):
   294    973   #   t = full thread support.
   295         -#   s = static library (as opposed to an
   296         -#	import library)
   297         -#   g = linked to the debug enabled C
   298         -#	run-time.
   299         -#   x = special static build when it
   300         -#	links to the dynamic C run-time.
   301         -#----------------------------------------
   302         -SUFX	    = sgx
          974  +#   s = static library (as opposed to an import library)
          975  +#   g = linked to the debug enabled C run-time.
          976  +#   x = special static build when it links to the dynamic C run-time.
          977  +#
          978  +# The following macros are set in this section:
          979  +# SUFX - the suffix to use for binaries based on above naming convention
          980  +# BUILDDIRTOP - the toplevel default output directory
          981  +#      is of the form {Release,Debug}[_AMD64][_COMPILERVERSION]
          982  +# TMP_DIR - directory where object files are created
          983  +# OUT_DIR - directory where output executables are created
          984  +# Both TMP_DIR and OUT_DIR are defaulted only if not defined by the
          985  +# parent makefile (or command line). The default values are
          986  +# based on BUILDDIRTOP.
          987  +# STUBPREFIX - name of the stubs library for this project
          988  +# PRJIMPLIB - output path of the generated project import library
          989  +# PRJLIBNAME - name of generated project library
          990  +# PRJLIB     - output path of generated project library
          991  +# PRJSTUBLIBNAME - name of the generated project stubs library
          992  +# PRJSTUBLIB - output path of the generated project stubs library
          993  +# RESFILE - output resource file (only if not static build)
          994  +
          995  +SUFX	    = tsgx
   303    996   
   304    997   !if $(DEBUG)
   305    998   BUILDDIRTOP = Debug
   306    999   !else
   307   1000   BUILDDIRTOP = Release
   308   1001   !endif
   309   1002   
................................................................................
   310   1003   !if "$(MACHINE)" != "IX86"
   311   1004   BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
   312   1005   !endif
   313   1006   !if $(VCVER) > 6
   314   1007   BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
   315   1008   !endif
   316   1009   
   317         -!if !$(DEBUG) || $(UNCHECKED)
         1010  +!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED)
   318   1011   SUFX	    = $(SUFX:g=)
   319   1012   !endif
   320   1013   
   321         -TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_DynamicStaticX
         1014  +TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX
   322   1015   
   323   1016   !if !$(STATIC_BUILD)
   324   1017   TMP_DIRFULL = $(TMP_DIRFULL:Static=)
   325   1018   SUFX	    = $(SUFX:s=)
   326   1019   EXT	    = dll
   327         -!if $(MSVCRT)
   328   1020   TMP_DIRFULL = $(TMP_DIRFULL:X=)
   329   1021   SUFX	    = $(SUFX:x=)
   330         -!endif
   331   1022   !else
   332   1023   TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
   333   1024   EXT	    = lib
   334   1025   !if !$(MSVCRT)
   335   1026   TMP_DIRFULL = $(TMP_DIRFULL:X=)
   336   1027   SUFX	    = $(SUFX:x=)
   337   1028   !endif
   338   1029   !endif
         1030  +
         1031  +!if !$(TCL_THREADS)
         1032  +TMP_DIRFULL = $(TMP_DIRFULL:Threaded=)
         1033  +SUFX	    = $(SUFX:t=)
         1034  +!endif
   339   1035   
   340   1036   !ifndef TMP_DIR
   341   1037   TMP_DIR	    = $(TMP_DIRFULL)
   342   1038   !ifndef OUT_DIR
   343   1039   OUT_DIR	    = .\$(BUILDDIRTOP)
   344   1040   !endif
   345   1041   !else
   346   1042   !ifndef OUT_DIR
   347   1043   OUT_DIR	    = $(TMP_DIR)
   348   1044   !endif
   349   1045   !endif
   350   1046   
   351         -
   352         -#----------------------------------------------------------
   353         -# Decode the statistics requested.
   354         -#----------------------------------------------------------
   355         -
   356         -!if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"]
   357         -TCL_MEM_DEBUG	    = 0
   358         -TCL_COMPILE_DEBUG   = 0
   359         -!else
   360         -!if [nmakehlp -f $(STATS) "memdbg"]
   361         -!message *** Doing memdbg
   362         -TCL_MEM_DEBUG	    = 1
   363         -!else
   364         -TCL_MEM_DEBUG	    = 0
   365         -!endif
   366         -!if [nmakehlp -f $(STATS) "compdbg"]
   367         -!message *** Doing compdbg
   368         -TCL_COMPILE_DEBUG   = 1
   369         -!else
   370         -TCL_COMPILE_DEBUG   = 0
   371         -!endif
   372         -!endif
   373         -
   374         -
   375         -#----------------------------------------------------------
   376         -# Decode the checks requested.
   377         -#----------------------------------------------------------
   378         -
   379         -!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
   380         -TCL_NO_DEPRECATED	    = 0
   381         -WARNINGS		    = -W3
         1047  +# Relative paths -> absolute
         1048  +!if [echo OUT_DIR = \> nmakehlp.out] \
         1049  +   || [nmakehlp -Q "$(OUT_DIR)" >> nmakehlp.out]
         1050  +!error *** Could not fully qualify path OUT_DIR=$(OUT_DIR)
         1051  +!endif
         1052  +!if [echo TMP_DIR = \>> nmakehlp.out] \
         1053  +   || [nmakehlp -Q "$(TMP_DIR)" >> nmakehlp.out]
         1054  +!error *** Could not fully qualify path TMP_DIR=$(TMP_DIR)
         1055  +!endif
         1056  +!include nmakehlp.out
         1057  +
         1058  +# The name of the stubs library for the project being built
         1059  +STUBPREFIX      = $(PROJECT)stub
         1060  +
         1061  +# Set up paths to various Tcl executables and libraries needed by extensions
         1062  +!if $(DOING_TCL)
         1063  +
         1064  +TCLSHNAME       = $(PROJECT)sh$(VERSION)$(SUFX).exe
         1065  +TCLSH		= $(OUT_DIR)\$(TCLSHNAME)
         1066  +TCLIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
         1067  +TCLLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
         1068  +TCLLIB		= $(OUT_DIR)\$(TCLLIBNAME)
         1069  +
         1070  +TCLSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
         1071  +TCLSTUBLIB	= $(OUT_DIR)\$(TCLSTUBLIBNAME)
         1072  +TCL_INCLUDES    = -I"$(WINDIR)" -I"$(GENERICDIR)"
         1073  +
         1074  +!else # ! $(DOING_TCL)
         1075  +
         1076  +!if $(TCLINSTALL) # Building against an installed Tcl
         1077  +
         1078  +# When building extensions, we need to locate tclsh. Depending on version
         1079  +# of Tcl we are building against, this may or may not have a "t" suffix.
         1080  +# Try various possibilities in turn.
         1081  +TCLSH		= $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe
         1082  +!if !exist("$(TCLSH)") && $(TCL_THREADS)
         1083  +TCLSH           = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe
         1084  +!endif
         1085  +!if !exist("$(TCLSH)")
         1086  +TCLSH           = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe
         1087  +!endif
         1088  +
         1089  +TCLSTUBLIB	= $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib
         1090  +TCLIMPLIB	= $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib
         1091  +# When building extensions, may be linking against Tcl that does not add
         1092  +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
         1093  +!if !exist("$(TCLIMPLIB)")
         1094  +TCLIMPLIB	= $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib
         1095  +!endif
         1096  +TCL_LIBRARY	= $(_TCLDIR)\lib
         1097  +TCLREGLIB	= $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib
         1098  +TCLDDELIB	= $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib
         1099  +TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
         1100  +TCL_INCLUDES    = -I"$(_TCLDIR)\include"
         1101  +
         1102  +!else # Building against Tcl sources
         1103  +
         1104  +TCLSH		= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe
         1105  +!if !exist($(TCLSH)) && $(TCL_THREADS)
         1106  +TCLSH		= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe
         1107  +!endif
         1108  +!if !exist($(TCLSH))
         1109  +TCLSH		= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe
         1110  +!endif
         1111  +TCLSTUBLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib
         1112  +TCLIMPLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib
         1113  +# When building extensions, may be linking against Tcl that does not add
         1114  +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
         1115  +!if !exist("$(TCLIMPLIB)")
         1116  +TCLIMPLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib
         1117  +!endif
         1118  +TCL_LIBRARY	= $(_TCLDIR)\library
         1119  +TCLREGLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib
         1120  +TCLDDELIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib
         1121  +TCLTOOLSDIR	= $(_TCLDIR)\tools
         1122  +TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
         1123  +
         1124  +!endif # TCLINSTALL
         1125  +
         1126  +tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)"
         1127  +
         1128  +!endif # $(DOING_TCL)
         1129  +
         1130  +# We need a tclsh that will run on the host machine as part of the build.
         1131  +# IX86 runs on all architectures.
         1132  +!ifndef TCLSH_NATIVE
         1133  +!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
         1134  +TCLSH_NATIVE	= $(TCLSH)
   382   1135   !else
   383         -!if [nmakehlp -f $(CHECKS) "nodep"]
   384         -!message *** Doing nodep check
   385         -TCL_NO_DEPRECATED	    = 1
   386         -!else
   387         -TCL_NO_DEPRECATED	    = 0
   388         -!endif
   389         -!if [nmakehlp -f $(CHECKS) "fullwarn"]
   390         -!message *** Doing full warnings check
   391         -WARNINGS		    = -W4
   392         -!if [nmakehlp -l -warn:3]
   393         -LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
   394         -!endif
         1136  +!error You must explicitly set TCLSH_NATIVE for cross-compilation
         1137  +!endif
         1138  +!endif
         1139  +
         1140  +# Do the same for Tk and Tk extensions that require the Tk libraries
         1141  +!if $(DOING_TK) || $(NEED_TK)
         1142  +WISHNAMEPREFIX = wish
         1143  +WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe
         1144  +TKLIBNAME	= $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT)
         1145  +TKSTUBLIBNAME	= tkstub$(TK_VERSION).lib
         1146  +TKIMPLIBNAME	= tk$(TK_VERSION)$(SUFX).lib
         1147  +
         1148  +!if $(DOING_TK)
         1149  +WISH 		= $(OUT_DIR)\$(WISHNAME)
         1150  +TKSTUBLIB	= $(OUT_DIR)\$(TKSTUBLIBNAME)
         1151  +TKIMPLIB	= $(OUT_DIR)\$(TKIMPLIBNAME)
         1152  +TKLIB		= $(OUT_DIR)\$(TKLIBNAME)
         1153  +TK_INCLUDES    = -I"$(WINDIR)" -I"$(GENERICDIR)"
         1154  +
         1155  +!else # effectively NEED_TK
         1156  +
         1157  +!if $(TKINSTALL) # Building against installed Tk
         1158  +WISH		= $(_TKDIR)\bin\$(WISHNAME)
         1159  +TKSTUBLIB	= $(_TKDIR)\lib\$(TKSTUBLIBNAME)
         1160  +TKIMPLIB	= $(_TKDIR)\lib\$(TKIMPLIBNAME)
         1161  +# When building extensions, may be linking against Tk that does not add
         1162  +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
         1163  +!if !exist("$(TKIMPLIB)")
         1164  +TKIMPLIBNAME	= tk$(TK_VERSION)$(SUFX:t=).lib
         1165  +TKIMPLIB	= $(_TKDIR)\lib\$(TKIMPLIBNAME)
         1166  +!endif
         1167  +TK_INCLUDES     = -I"$(_TKDIR)\include"
         1168  +!else # Building against Tk sources
         1169  +WISH		= $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME)
         1170  +TKSTUBLIB	= $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME)
         1171  +TKIMPLIB	= $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME)
         1172  +# When building extensions, may be linking against Tk that does not add
         1173  +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
         1174  +!if !exist("$(TKIMPLIB)")
         1175  +TKIMPLIBNAME	= tk$(TK_VERSION)$(SUFX:t=).lib
         1176  +TKIMPLIB	= $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME)
         1177  +!endif
         1178  +TK_INCLUDES     = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
         1179  +!endif # TKINSTALL
         1180  +tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)"
         1181  +
         1182  +!endif # $(DOING_TK)
         1183  +!endif # $(DOING_TK) || $(NEED_TK)
         1184  +
         1185  +# Various output paths
         1186  +PRJIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX:t=).lib
         1187  +PRJLIBNAME	= $(PROJECT)$(VERSION)$(SUFX:t=).$(EXT)
         1188  +PRJLIB		= $(OUT_DIR)\$(PRJLIBNAME)
         1189  +
         1190  +PRJSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
         1191  +PRJSTUBLIB	= $(OUT_DIR)\$(PRJSTUBLIBNAME)
         1192  +
         1193  +# If extension parent makefile has not defined a resource definition file,
         1194  +# we will generate one from standard template.
         1195  +!if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD)
         1196  +!ifdef RCFILE
         1197  +RESFILE = $(TMP_DIR)\$(RCFILE:.rc=.res)
   395   1198   !else
   396         -WARNINGS		    = -W3
   397         -!endif
   398         -!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
   399         -!message *** Doing 64bit portability warnings
   400         -WARNINGS		    = $(WARNINGS) -Wp64
   401         -!endif
   402         -!endif
   403         -
   404         -!if $(PGO) > 1
   405         -!if [nmakehlp -l -ltcg:pgoptimize]
   406         -LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
   407         -!else
   408         -MSG=^
   409         -This compiler does not support profile guided optimization.
   410         -!error $(MSG)
   411         -!endif
   412         -!elseif $(PGO) > 0
   413         -!if [nmakehlp -l -ltcg:pginstrument]
   414         -LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
   415         -!else
   416         -MSG=^
   417         -This compiler does not support profile guided optimization.
   418         -!error $(MSG)
   419         -!endif
   420         -!endif
   421         -
   422         -#----------------------------------------------------------
   423         -# Set our defines now armed with our options.
   424         -#----------------------------------------------------------
         1199  +RESFILE = $(TMP_DIR)\$(PROJECT).res
         1200  +!endif
         1201  +!endif
         1202  +
         1203  +###################################################################
         1204  +# 11. Construct the paths for the installation directories
         1205  +# The following macros get defined in this section:
         1206  +# LIB_INSTALL_DIR - where libraries should be installed
         1207  +# BIN_INSTALL_DIR - where the executables should be installed
         1208  +# DOC_INSTALL_DIR - where documentation should be installed
         1209  +# SCRIPT_INSTALL_DIR - where scripts should be installed
         1210  +# INCLUDE_INSTALL_DIR - where C include files should be installed
         1211  +# DEMO_INSTALL_DIR - where demos should be installed
         1212  +# PRJ_INSTALL_DIR - where package will be installed (not set for Tcl and Tk)
         1213  +
         1214  +!if $(DOING_TCL) || $(DOING_TK)
         1215  +LIB_INSTALL_DIR		= $(_INSTALLDIR)\lib
         1216  +BIN_INSTALL_DIR		= $(_INSTALLDIR)\bin
         1217  +DOC_INSTALL_DIR		= $(_INSTALLDIR)\doc
         1218  +!if $(DOING_TCL)
         1219  +SCRIPT_INSTALL_DIR	= $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
         1220  +!else # DOING_TK
         1221  +SCRIPT_INSTALL_DIR	= $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
         1222  +!endif
         1223  +DEMO_INSTALL_DIR	= $(SCRIPT_INSTALL_DIR)\demos
         1224  +INCLUDE_INSTALL_DIR	= $(_INSTALLDIR)\include
         1225  +
         1226  +!else # extension other than Tk
         1227  +
         1228  +PRJ_INSTALL_DIR         = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
         1229  +LIB_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
         1230  +BIN_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
         1231  +DOC_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
         1232  +SCRIPT_INSTALL_DIR	= $(PRJ_INSTALL_DIR)
         1233  +DEMO_INSTALL_DIR	= $(PRJ_INSTALL_DIR)\demos
         1234  +INCLUDE_INSTALL_DIR	= $(_INSTALLDIR)\..\include
         1235  +
         1236  +!endif
         1237  +
         1238  +###################################################################
         1239  +# 12. Set up actual options to be passed to the compiler and linker
         1240  +# Now we have all the information we need, set up the actual flags and
         1241  +# options that we will pass to the compiler and linker. The main
         1242  +# makefile should use these in combination with whatever other flags
         1243  +# and switches are specific to it.
         1244  +# The following macros are defined, names are for historical compatibility:
         1245  +# OPTDEFINES - /Dxxx C macro flags based on user-specified OPTS
         1246  +# COMPILERFLAGS - /Dxxx C macro flags independent of any configuration opttions
         1247  +# crt - Compiler switch that selects the appropriate C runtime
         1248  +# cdebug - Compiler switches related to debug AND optimizations
         1249  +# cwarn - Compiler switches that set warning levels
         1250  +# cflags - complete compiler switches (subsumes cdebug and cwarn)
         1251  +# ldebug - Linker switches controlling debug information and optimization
         1252  +# lflags - complete linker switches (subsumes ldebug) except subsystem type
         1253  +# dlllflags - complete linker switches to build DLLs (subsumes lflags)
         1254  +# conlflags - complete linker switches for console program (subsumes lflags)
         1255  +# guilflags - complete linker switches for GUI program (subsumes lflags)
         1256  +# baselibs - minimum Windows libraries required. Parent makefile can
         1257  +#    define PRJ_LIBS before including rules.rc if additional libs are needed
   425   1258   
   426   1259   OPTDEFINES	= -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS
   427   1260   
   428   1261   !if $(TCL_MEM_DEBUG)
   429   1262   OPTDEFINES	= $(OPTDEFINES) -DTCL_MEM_DEBUG
   430   1263   !endif
   431   1264   !if $(TCL_COMPILE_DEBUG)
   432   1265   OPTDEFINES	= $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
   433   1266   !endif
   434   1267   !if $(TCL_THREADS)
   435         -OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1
         1268  +OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1
         1269  +!if $(USE_THREAD_ALLOC)
         1270  +OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
         1271  +!endif
   436   1272   !endif
   437   1273   !if $(STATIC_BUILD)
   438   1274   OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
   439   1275   !endif
   440   1276   !if $(TCL_NO_DEPRECATED)
   441   1277   OPTDEFINES	= $(OPTDEFINES) -DTCL_NO_DEPRECATED
   442   1278   !endif
   443   1279   
         1280  +!if $(USE_STUBS)
         1281  +# Note we do not define USE_TCL_STUBS even when building tk since some
         1282  +# test targets in tk do not use stubs
         1283  +!if ! $(DOING_TCL)
         1284  +USE_STUBS_DEFS  = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS
         1285  +!if $(NEED_TK)
         1286  +USE_STUBS_DEFS  = $(USE_STUBS_DEFS) -DUSE_TK_STUBS
         1287  +!endif
         1288  +!endif
         1289  +!endif # USE_STUBS
         1290  +
   444   1291   !if !$(DEBUG)
   445   1292   OPTDEFINES	= $(OPTDEFINES) -DNDEBUG
   446   1293   !if $(OPTIMIZING)
   447   1294   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_OPTIMIZED
   448   1295   !endif
   449   1296   !endif
   450   1297   !if $(PROFILE)
   451   1298   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_PROFILED
   452   1299   !endif
   453         -!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
         1300  +!if "$(MACHINE)" == "AMD64"
   454   1301   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DO64BIT
   455   1302   !endif
   456         -
   457         -
   458         -#----------------------------------------------------------
   459         -# Get common info used when building extensions.
   460         -#----------------------------------------------------------
   461         -
   462         -!if "$(PROJECT)" != "tcl"
   463         -
   464         -# If INSTALLDIR set to tcl root dir then reset to the lib dir.
   465         -!if exist("$(_INSTALLDIR)\include\tcl.h")
   466         -_INSTALLDIR=$(_INSTALLDIR)\lib
         1303  +!if $(VCVERSION) < 1300
         1304  +OPTDEFINES	= $(OPTDEFINES) -DNO_STRTOI64
         1305  +!endif
         1306  +
         1307  +# _ATL_XP_TARGETING - Newer SDK's need this to build for XP
         1308  +COMPILERFLAGS  = /D_ATL_XP_TARGETING
         1309  +
         1310  +# Following is primarily for the benefit of extensions. Tcl 8.5 builds
         1311  +# Tcl without /DUNICODE, while 8.6 builds with it defined. When building
         1312  +# an extension, it is advisable (but not mandated) to use the same Windows
         1313  +# API as the Tcl build. This is accordingly defaulted below. A particular
         1314  +# extension can override this by pre-definining USE_WIDECHAR_API.
         1315  +!ifndef USE_WIDECHAR_API
         1316  +!if $(TCL_VERSION) > 85
         1317  +USE_WIDECHAR_API = 1
         1318  +!else
         1319  +USE_WIDECHAR_API = 0
         1320  +!endif
         1321  +!endif
         1322  +
         1323  +!if $(USE_WIDECHAR_API)
         1324  +COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE
         1325  +!endif
         1326  +
         1327  +# Like the TEA system only set this non empty for non-Tk extensions
         1328  +# Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME
         1329  +# so we pass both
         1330  +!if !$(DOING_TCL) && !$(DOING_TK)
         1331  +PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \
         1332  +               -DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \
         1333  +               -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
         1334  +               -DMODULE_SCOPE=extern
         1335  +!endif
         1336  +
         1337  +# crt picks the C run time based on selected OPTS
         1338  +!if $(MSVCRT)
         1339  +!if $(DEBUG) && !$(UNCHECKED)
         1340  +crt = -MDd
         1341  +!else
         1342  +crt = -MD
         1343  +!endif
         1344  +!else
         1345  +!if $(DEBUG) && !$(UNCHECKED)
         1346  +crt = -MTd
         1347  +!else
         1348  +crt = -MT
         1349  +!endif
         1350  +!endif
         1351  +
         1352  +# cdebug includes compiler options for debugging as well as optimization.
         1353  +!if $(DEBUG)
         1354  +
         1355  +# In debugging mode, optimizations need to be disabled
         1356  +cdebug = -Zi -Od $(DEBUGFLAGS)
         1357  +
         1358  +!else
         1359  +
         1360  +cdebug = $(OPTIMIZATIONS)
         1361  +!if $(SYMBOLS)
         1362  +cdebug = $(cdebug) -Zi
         1363  +!endif
         1364  +
         1365  +!endif # $(DEBUG)
         1366  +
         1367  +# cwarn includes default warning levels.
         1368  +cwarn = $(WARNINGS)
         1369  +
         1370  +!if "$(MACHINE)" == "AMD64"
         1371  +# Disable pointer<->int warnings related to cast between different sizes
         1372  +# There are a gadzillion of these due to use of ClientData and
         1373  +# clutter up compiler
         1374  +# output increasing chance of a real warning getting lost. So disable them.
         1375  +# Eventually some day, Tcl will be 64-bit clean.
         1376  +cwarn = $(cwarn) -wd4311 -wd4312
         1377  +!endif
         1378  +
         1379  +### Common compiler options that are architecture specific
         1380  +!if "$(MACHINE)" == "ARM"
         1381  +carch = -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
         1382  +!else
         1383  +carch =
         1384  +!endif
         1385  +
         1386  +!if $(DEBUG)
         1387  +# Turn warnings into errors
         1388  +cwarn = $(cwarn) -WX
         1389  +!endif
         1390  +
         1391  +INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES)
         1392  +!if !$(DOING_TCL) && !$(DOING_TK)
         1393  +INCLUDES = $(INCLUDES) -I"$(GENERICDIR)" -I"$(WINDIR)" -I"$(COMPATDIR)"
         1394  +!endif
         1395  +
         1396  +# These flags are defined roughly in the order of the pre-reform
         1397  +# rules.vc/makefile.vc to help visually compare that the pre- and
         1398  +# post-reform build logs
         1399  +
         1400  +# cflags contains generic flags used for building practically all object files
         1401  +cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug)
         1402  +
         1403  +# appcflags contains $(cflags) and flags for building the application
         1404  +# object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus
         1405  +# flags used for building shared object files The two differ in the
         1406  +# BUILD_$(PROJECT) macro which should be defined only for the shared
         1407  +# library *implementation* and not for its caller interface
         1408  +
         1409  +appcflags = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS)
         1410  +appcflags_nostubs = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES)
         1411  +pkgcflags = $(appcflags) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT)
         1412  +pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT)
         1413  +
         1414  +# stubscflags contains $(cflags) plus flags used for building a stubs
         1415  +# library for the package.  Note: -DSTATIC_BUILD is defined in
         1416  +# $(OPTDEFINES) only if the OPTS configuration indicates a static
         1417  +# library. However the stubs library is ALWAYS static hence included
         1418  +# here irrespective of the OPTS setting.
         1419  +#
         1420  +# TBD - tclvfs has a comment that stubs libs should not be compiled with -GL
         1421  +# without stating why. Tcl itself compiled stubs libs with this flag.
         1422  +# so we do not remove it from cflags. -GL may prevent extensions
         1423  +# compiled with one VC version to fail to link against stubs library
         1424  +# compiled with another VC version. Check for this and fix accordingly.
         1425  +stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES)
         1426  +
         1427  +# Link flags
         1428  +
         1429  +!if $(DEBUG)
         1430  +ldebug	= -debug -debugtype:cv
         1431  +!else
         1432  +ldebug	= -release -opt:ref -opt:icf,3
         1433  +!if $(SYMBOLS)
         1434  +ldebug	= $(ldebug) -debug -debugtype:cv
         1435  +!endif
         1436  +!endif
         1437  +
         1438  +# Note: Profiling is currently only possible with the Visual Studio Enterprise
         1439  +!if $(PROFILE)
         1440  +ldebug= $(ldebug) -profile
         1441  +!endif
         1442  +
         1443  +### Declarations common to all linker versions
         1444  +lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
         1445  +
         1446  +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
         1447  +lflags	= $(lflags) -nodefaultlib:libucrt.lib
         1448  +!endif
         1449  +
         1450  +dlllflags = $(lflags) -dll
         1451  +conlflags = $(lflags) -subsystem:console
         1452  +guilflags = $(lflags) -subsystem:windows
         1453  +
         1454  +# Libraries that are required for every image.
         1455  +# Extensions should define any additional libraries with $(PRJ_LIBS)
         1456  +winlibs   = kernel32.lib advapi32.lib
         1457  +
         1458  +!if $(NEED_TK)
         1459  +winlibs = $(winlibs) gdi32.lib user32.lib uxtheme.lib
         1460  +!endif
         1461  +
         1462  +# Avoid 'unresolved external symbol __security_cookie' errors.
         1463  +# c.f. http://support.microsoft.com/?id=894573
         1464  +!if "$(MACHINE)" == "AMD64"
         1465  +!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
         1466  +winlibs   = $(winlibs) bufferoverflowU.lib
         1467  +!endif
         1468  +!endif
         1469  +
         1470  +baselibs = $(winlibs) $(PRJ_LIBS)
         1471  +
         1472  +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
         1473  +baselibs   = $(baselibs) ucrt.lib
         1474  +!endif
         1475  +
         1476  +################################################################
         1477  +# 13. Define standard commands, common make targets and implicit rules
         1478  +
         1479  +CCPKGCMD = $(cc32) $(pkgcflags) -Fo$(TMP_DIR)^\
         1480  +CCAPPCMD = $(cc32) $(appcflags) -Fo$(TMP_DIR)^\
         1481  +CCSTUBSCMD = $(cc32) $(stubscflags) -Fo$(TMP_DIR)^\
         1482  +
         1483  +LIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:[email protected]
         1484  +DLLCMD = $(link32) $(dlllflags) -out:[email protected] $(baselibs) $(tcllibs) $(tklibs)
         1485  +
         1486  +CONEXECMD = $(link32) $(conlflags) -out:[email protected] $(baselibs) $(tcllibs) $(tklibs)
         1487  +GUIEXECMD = $(link32) $(guilflags) -out:[email protected] $(baselibs) $(tcllibs) $(tklibs)
         1488  +RESCMD  = $(rc32) -fo [email protected] -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \
         1489  +	    $(TCL_INCLUDES) \
         1490  +	    -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
         1491  +	    -DCOMMAVERSION=$(DOTVERSION:.=,),0 \
         1492  +	    -DDOTVERSION=\"$(DOTVERSION)\" \
         1493  +	    -DVERSION=\"$(VERSION)\" \
         1494  +	    -DSUFX=\"$(SUFX:t=)\" \
         1495  +	    -DPROJECT=\"$(PROJECT)\" \
         1496  +	    -DPRJLIBNAME=\"$(PRJLIBNAME)\"
         1497  +
         1498  +!ifndef DEFAULT_BUILD_TARGET
         1499  +DEFAULT_BUILD_TARGET = $(PROJECT)
   467   1500   !endif
   468   1501   
   469         -!if !defined(TCLDIR)
   470         -!if exist("$(_INSTALLDIR)\..\include\tcl.h")
   471         -TCLINSTALL	= 1
   472         -_TCLDIR		= $(_INSTALLDIR)\..
   473         -_TCL_H          = $(_INSTALLDIR)\..\include\tcl.h
   474         -TCLDIR          = $(_INSTALLDIR)\..
   475         -!else
   476         -MSG=^
   477         -Failed to find tcl.h.  Set the TCLDIR macro.
   478         -!error $(MSG)
   479         -!endif
   480         -!else
   481         -_TCLDIR	= $(TCLDIR:/=\)
   482         -!if exist("$(_TCLDIR)\include\tcl.h")
   483         -TCLINSTALL	= 1
   484         -_TCL_H          = $(_TCLDIR)\include\tcl.h
   485         -!elseif exist("$(_TCLDIR)\generic\tcl.h")
   486         -TCLINSTALL	= 0
   487         -_TCL_H          = $(_TCLDIR)\generic\tcl.h
   488         -!else
   489         -MSG =^
   490         -Failed to find tcl.h.  The TCLDIR macro does not appear correct.
   491         -!error $(MSG)
   492         -!endif
         1502  +default-target: $(DEFAULT_BUILD_TARGET)
         1503  +
         1504  +default-pkgindex:
         1505  +	@echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
         1506  +	    [list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl
         1507  +
         1508  +default-pkgindex-tea:
         1509  +	@if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl
         1510  +@[email protected]    $(DOTVERSION)
         1511  +@[email protected]       $(PRJ_PACKAGE_TCLNAME)
         1512  +@[email protected]    $(PRJ_PACKAGE_TCLNAME)
         1513  +@[email protected]       $(PRJLIBNAME)
         1514  +<<
         1515  +
         1516  +
         1517  +default-install: default-install-binaries default-install-libraries
         1518  +
         1519  +default-install-binaries: $(PRJLIB)
         1520  +	@echo Installing binaries to '$(SCRIPT_INSTALL_DIR)'
         1521  +	@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
         1522  +	@$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
         1523  +
         1524  +default-install-libraries: $(OUT_DIR)\pkgIndex.tcl
         1525  +	@echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
         1526  +	@if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)"
         1527  +	@echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
         1528  +	@$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR)
         1529  +
         1530  +default-install-stubs:
         1531  +	@echo Installing stubs library to '$(SCRIPT_INSTALL_DIR)'
         1532  +	@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
         1533  +	@$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
         1534  +
         1535  +default-install-docs-html:
         1536  +	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
         1537  +	@if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)"
         1538  +	@if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)"
         1539  +
         1540  +default-install-docs-n:
         1541  +	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
         1542  +	@if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)"
         1543  +	@if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.n") do @$(COPY) %f "$(DOC_INSTALL_DIR)"
         1544  +
         1545  +default-install-demos:
         1546  +	@echo Installing demos to '$(DEMO_INSTALL_DIR)'
         1547  +	@if not exist "$(DEMO_INSTALL_DIR)" mkdir "$(DEMO_INSTALL_DIR)"
         1548  +	@if exist $(DEMODIR) $(CPYDIR) "$(DEMODIR)" "$(DEMO_INSTALL_DIR)"
         1549  +
         1550  +default-clean:
         1551  +	@echo Cleaning $(TMP_DIR)\* ...
         1552  +	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
         1553  +	@echo Cleaning $(WINDIR)\nmakehlp.obj, nmakehlp.exe ...
         1554  +	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
         1555  +	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
         1556  +	@if exist $(WINDIR)\nmakehlp.out del $(WINDIR)\nmakehlp.out
         1557  +	@echo Cleaning $(WINDIR)\nmhlp-out.txt ...
         1558  +	@if exist $(WINDIR)\nmhlp-out.txt del $(WINDIR)\nmhlp-out.txt
         1559  +	@echo Cleaning $(WINDIR)\_junk.pch ...
         1560  +	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
         1561  +	@echo Cleaning $(WINDIR)\vercl.x, vercl.i ...
         1562  +	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
         1563  +	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
         1564  +	@echo Cleaning $(WINDIR)\versions.vc, version.vc ...
         1565  +	@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
         1566  +	@if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc
         1567  +
         1568  +default-hose: default-clean
         1569  +	@echo Hosing $(OUT_DIR)\* ...
         1570  +	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)
         1571  +
         1572  +# Only for backward compatibility
         1573  +default-distclean: default-hose
         1574  +
         1575  +default-setup:
         1576  +	@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
         1577  +	@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
         1578  +
         1579  +!if "$(TESTPAT)" != ""
         1580  +TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
   493   1581   !endif
   494   1582   
   495         -!if [echo REM = This file is generated from rules.vc > versions.vc]
   496         -!endif
   497         -!if exist("$(_TCL_H)")
   498         -!if [echo TCL_DOTVERSION = \>> versions.vc] \
   499         -   && [nmakehlp -V "$(_TCL_H)" TCL_VERSION >> versions.vc]
   500         -!endif
   501         -!endif
   502         -!include versions.vc
   503         -TCL_VERSION	= $(TCL_DOTVERSION:.=)
         1583  +default-test: default-setup $(PROJECT)
         1584  +	@set TCLLIBPATH=$(OUT_DIR:\=/)
         1585  +	@if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)"
         1586  +	cd "$(TESTDIR)" && $(DEBUGGER) $(TCLSH) all.tcl $(TESTFLAGS)
   504   1587   
   505         -!if $(TCLINSTALL)
   506         -TCLSH		= "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
   507         -!if !exist($(TCLSH)) && $(TCL_THREADS)
   508         -TCLSH           = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe"
   509         -!endif
   510         -TCLSTUBLIB	= "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib"
   511         -TCLIMPLIB	= "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib"
   512         -TCL_LIBRARY	= $(_TCLDIR)\lib
   513         -COFFBASE	= \must\have\tcl\sources\to\build\this\target
   514         -TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
   515         -TCL_INCLUDES    = -I"$(_TCLDIR)\include"
         1588  +default-shell: default-setup $(PROJECT)
         1589  +	@set TCLLIBPATH=$(OUT_DIR:\=/)
         1590  +	@if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)"
         1591  +	$(DEBUGGER) $(TCLSH)
         1592  +
         1593  +# Generation of Windows version resource
         1594  +!ifdef RCFILE
         1595  +
         1596  +# Note: don't use $** in below rule because there may be other dependencies
         1597  +# and only the "master" rc must be passed to the resource compiler
         1598  +$(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc
         1599  +	$(RESCMD) $(RCDIR)\$(PROJECT).rc
         1600  +
   516   1601   !else
   517         -TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe"
   518         -!if !exist($(TCLSH)) && $(TCL_THREADS)
   519         -TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe"
         1602  +
         1603  +# If parent makefile has not defined a resource definition file,
         1604  +# we will generate one from standard template.
         1605  +$(TMP_DIR)\$(PROJECT).res: $(TMP_DIR)\$(PROJECT).rc
         1606  +
         1607  +$(TMP_DIR)\$(PROJECT).rc:
         1608  +	@$(COPY) << $(TMP_DIR)\$(PROJECT).rc
         1609  +#include <winver.h>
         1610  +
         1611  +VS_VERSION_INFO VERSIONINFO
         1612  + FILEVERSION	COMMAVERSION
         1613  + PRODUCTVERSION	COMMAVERSION
         1614  + FILEFLAGSMASK	0x3fL
         1615  +#ifdef DEBUG
         1616  + FILEFLAGS	VS_FF_DEBUG
         1617  +#else
         1618  + FILEFLAGS	0x0L
         1619  +#endif
         1620  + FILEOS		VOS_NT_WINDOWS32
         1621  + FILETYPE	VFT_DLL
         1622  + FILESUBTYPE	0x0L
         1623  +BEGIN
         1624  +    BLOCK "StringFileInfo"
         1625  +    BEGIN
         1626  +        BLOCK "040904b0"
         1627  +        BEGIN
         1628  +            VALUE "FileDescription",  "Tcl extension " PROJECT
         1629  +            VALUE "OriginalFilename", PRJLIBNAME
         1630  +            VALUE "FileVersion",      DOTVERSION
         1631  +            VALUE "ProductName",      "Package " PROJECT " for Tcl"
         1632  +            VALUE "ProductVersion",   DOTVERSION
         1633  +        END
         1634  +    END
         1635  +    BLOCK "VarFileInfo"
         1636  +    BEGIN
         1637  +        VALUE "Translation", 0x409, 1200
         1638  +    END
         1639  +END
         1640  +
         1641  +<<
         1642  +
         1643  +!endif # ifdef RCFILE
         1644  +
         1645  +!ifndef DISABLE_IMPLICIT_RULES
         1646  +DISABLE_IMPLICIT_RULES = 0
         1647  +!endif
         1648  +
         1649  +!if !$(DISABLE_IMPLICIT_RULES)
         1650  +# Implicit rule definitions - only for building library objects. For stubs and
         1651  +# main application, the master makefile should define explicit rules.
         1652  +
         1653  +{$(ROOT)}.c{$(TMP_DIR)}.obj::
         1654  +	$(CCPKGCMD) @<<
         1655  +$<
         1656  +<<
         1657  +
         1658  +{$(WINDIR)}.c{$(TMP_DIR)}.obj::
         1659  +	$(CCPKGCMD) @<<
         1660  +$<
         1661  +<<
         1662  +
         1663  +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
         1664  +	$(CCPKGCMD) @<<
         1665  +$<
         1666  +<<
         1667  +
         1668  +{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
         1669  +	$(CCPKGCMD) @<<
         1670  +$<
         1671  +<<
         1672  +
         1673  +{$(RCDIR)}.rc{$(TMP_DIR)}.res:
         1674  +	$(RESCMD) $<
         1675  +
         1676  +{$(WINDIR)}.rc{$(TMP_DIR)}.res:
         1677  +	$(RESCMD) $<
         1678  +
         1679  +{$(TMP_DIR)}.rc{$(TMP_DIR)}.res:
         1680  +	$(RESCMD) $<
         1681  +
         1682  +.SUFFIXES:
         1683  +.SUFFIXES:.c .rc
         1684  +
         1685  +!endif
         1686  +
         1687  +################################################################
         1688  +# 14. Sanity check selected options against Tcl build options
         1689  +# When building an extension, certain configuration options should
         1690  +# match the ones used when Tcl was built. Here we check and
         1691  +# warn on a mismatch.
         1692  +!if ! $(DOING_TCL)
         1693  +
         1694  +!if $(TCLINSTALL) # Building against an installed Tcl
         1695  +!if exist("$(_TCLDIR)\lib\nmake\tcl.nmake")
         1696  +TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake"
   520   1697   !endif
   521         -TCLSTUBLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
   522         -TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
   523         -TCL_LIBRARY	= $(_TCLDIR)\library
   524         -COFFBASE	= "$(_TCLDIR)\win\coffbase.txt"
   525         -TCLTOOLSDIR	= $(_TCLDIR)\tools
   526         -TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
         1698  +!else # ! $(TCLINSTALL) - building against Tcl source
         1699  +!if exist("$(OUT_DIR)\tcl.nmake")
         1700  +TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake"
   527   1701   !endif
   528         -
   529         -!endif
         1702  +!endif # TCLINSTALL
   530   1703   
   531         -#----------------------------------------------------------
   532         -# Optionally check for Tk info for building extensions.
   533         -#----------------------------------------------------------
   534         -
   535         -!ifdef PROJECT_REQUIRES_TK
   536         -!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk"
         1704  +!if $(CONFIG_CHECK)
         1705  +!ifdef TCLNMAKECONFIG
         1706  +!include $(TCLNMAKECONFIG)
   537   1707   
   538         -!if !defined(TKDIR)
   539         -!if exist("$(_INSTALLDIR)\..\include\tk.h")
   540         -TKINSTALL      = 1
   541         -_TKDIR         = $(_INSTALLDIR)\..
   542         -_TK_H          = $(_TKDIR)\include\tk.h
   543         -TKDIR          = $(_TKDIR)
   544         -!elseif exist("$(_TCLDIR)\include\tk.h")
   545         -TKINSTALL      = 1
   546         -_TKDIR         = $(_TCLDIR)
   547         -_TK_H          = $(_TKDIR)\include\tk.h
   548         -TKDIR          = $(_TKDIR)
         1708  +!if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)"
         1709  +!error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)).
         1710  +!endif
         1711  +!if defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC)
         1712  +!message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)).
   549   1713   !endif
   550         -!else
   551         -_TKDIR = $(TKDIR:/=\)
   552         -!if exist("$(_TKDIR)\include\tk.h")
   553         -TKINSTALL      = 1
   554         -_TK_H          = $(_TKDIR)\include\tk.h
   555         -!elseif exist("$(_TKDIR)\generic\tk.h")
   556         -TKINSTALL      = 0
   557         -_TK_H          = $(_TKDIR)\generic\tk.h
   558         -!else
   559         -MSG =^
   560         -Failed to find tk.h. The TKDIR macro does not appear correct.
   561         -!error $(MSG)
         1714  +!if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG)
         1715  +!message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)).
   562   1716   !endif
   563   1717   !endif
   564   1718   
   565         -!if defined(TKDIR)
   566         -TK_DOTVERSION = 8.4
   567         -!if exist("$(_TK_H)")
   568         -!if [echo TK_DOTVERSION = \>> versions.vc] \
   569         -   && [nmakehlp -V "$(_TK_H)" TK_VERSION >> versions.vc]
   570         -!endif
   571         -!endif
   572         -!include versions.vc
   573         -TK_VERSION = $(TK_DOTVERSION:.=)
         1719  +!endif # TCLNMAKECONFIG
   574   1720   
   575         -!if $(TKINSTALL)
   576         -WISH		= "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe"
   577         -!if !exist($(WISH)) && $(TCL_THREADS)
   578         -WISH		= "$(_TKDIR)\bin\wish$(TK_VERSION)t$(SUFX).exe"
   579         -!endif
   580         -TKSTUBLIB	= "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib"
   581         -TKIMPLIB	= "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib"
   582         -TK_INCLUDES     = -I"$(_TKDIR)\include"
   583         -!else
   584         -WISH		= "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe"
   585         -!if !exist($(WISH)) && $(TCL_THREADS)
   586         -WISH		= "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)t$(SUFX).exe"
   587         -!endif
   588         -TKSTUBLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib"
   589         -TKIMPLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib"
   590         -TK_INCLUDES     = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
   591         -!endif
   592         -
   593         -!endif
   594         -!endif
   595         -!endif
   596         -
   597         -
   598         -#----------------------------------------------------------
   599         -# Setup the fully qualified OUT_DIR path as OUT_DIR_PATH
   600         -#----------------------------------------------------------
   601         -!if [echo OUT_DIR_PATH = \>> versions.vc] \
   602         -    && [nmakehlp -Q "$(OUT_DIR)" >> versions.vc]
   603         -!endif
   604         -!include versions.vc
         1721  +!endif # ! $(DOING_TCL)
   605   1722   
   606   1723   
   607   1724   #----------------------------------------------------------
   608   1725   # Display stats being used.
   609   1726   #----------------------------------------------------------
   610   1727   
         1728  +!if !$(DOING_TCL)
         1729  +!message *** Building against Tcl at '$(_TCLDIR)'
         1730  +!endif
         1731  +!if !$(DOING_TK) && $(NEED_TK)
         1732  +!message *** Building against Tk at '$(_TKDIR)'
         1733  +!endif
   611   1734   !message *** Intermediate directory will be '$(TMP_DIR)'
   612   1735   !message *** Output directory will be '$(OUT_DIR)'
         1736  +!message *** Installation, if selected, will be in '$(_INSTALLDIR)'
   613   1737   !message *** Suffix for binaries will be '$(SUFX)'
   614         -!message *** Optional defines are '$(OPTDEFINES)'
   615         -!message *** Compiler version $(VCVER). Target machine is $(MACHINE)
   616         -!message *** Host architecture is $(NATIVE_ARCH)
   617         -!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'
   618         -!message *** Link options '$(LINKERFLAGS)'
         1738  +!message *** Compiler version $(VCVER). Target $(MACHINE), host $(NATIVE_ARCH).
   619   1739   
   620         -!endif
         1740  +!endif # ifdef _RULES_VC

Deleted win/sample.rc.

     1         -// sample.rc - Copyright (C) 2006 Pat Thoyts <[email protected]>
     2         -//
     3         -// There is no need to modify this file.
     4         -//
     5         -
     6         -#include <winver.h>
     7         -
     8         -VS_VERSION_INFO VERSIONINFO
     9         - FILEVERSION	COMMAVERSION
    10         - PRODUCTVERSION	COMMAVERSION
    11         - FILEFLAGSMASK	0x3fL
    12         -#ifdef DEBUG
    13         - FILEFLAGS	VS_FF_DEBUG
    14         -#else
    15         - FILEFLAGS	0x0L
    16         -#endif
    17         - FILEOS		VOS__WINDOWS32
    18         - FILETYPE	VFT_DLL
    19         - FILESUBTYPE	0x0L
    20         -BEGIN
    21         -    BLOCK "StringFileInfo"
    22         -    BEGIN
    23         -        BLOCK "040904b0"
    24         -        BEGIN
    25         -            VALUE "FileDescription",  "Tcl Sample Extension " DOTVERSION "\0"
    26         -            VALUE "OriginalFilename", "sample" VERSION ".dll\0"
    27         -            VALUE "CompanyName",      "The Tcl Development Community\0"
    28         -            VALUE "FileVersion",      DOTVERSION "\0"
    29         -            VALUE "LegalCopyright",   "Copyright \251 1999 Scriptics Corp.\0"
    30         -            VALUE "ProductName",      "Tcl Sample Extension " DOTVERSION "\0"
    31         -            VALUE "ProductVersion",   DOTVERSION "\0"
    32         -        END
    33         -    END
    34         -    BLOCK "VarFileInfo"
    35         -    BEGIN
    36         -        VALUE "Translation", 0x409, 1200
    37         -    END
    38         -END

Added win/targets.vc.

            1  +#------------------------------------------------------------- -*- makefile -*-
            2  +# targets.vc --
            3  +#
            4  +# Part of the nmake based build system for Tcl and its extensions.
            5  +# This file defines some standard targets for the convenience of extensions
            6  +# and can be optionally included by the extension makefile.
            7  +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs.
            8  +
            9  +$(PROJECT): setup pkgindex $(PRJLIB)
           10  +
           11  +!ifdef PRJ_STUBOBJS
           12  +$(PROJECT): $(PRJSTUBLIB)
           13  +$(PRJSTUBLIB): $(PRJ_STUBOBJS)
           14  +	$(LIBCMD) $**
           15  +
           16  +$(PRJ_STUBOBJS):
           17  +	$(CCSTUBSCMD) %s
           18  +!endif # PRJ_STUBOBJS
           19  +
           20  +!ifdef PRJ_MANIFEST
           21  +$(PROJECT): $(PRJLIB).manifest
           22  +$(PRJLIB).manifest: $(PRJ_MANIFEST)
           23  +	@nmakehlp -s << $** >[email protected]
           24  +@[email protected]	  $(MACHINE:IX86=X86)
           25  +<<
           26  +!endif
           27  +
           28  +!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk"
           29  +$(PRJLIB): $(PRJ_OBJS) $(RESFILE)
           30  +!if $(STATIC_BUILD)
           31  +       $(LIBCMD) $**
           32  +!else
           33  +       $(DLLCMD) $**
           34  +       $(_VC_MANIFEST_EMBED_DLL)
           35  +!endif
           36  +       [email protected] $*.exp
           37  +!endif
           38  +
           39  +!if "$(PRJ_HEADERS)" != "" && "$(PRJ_OBJS)" != ""
           40  +$(PRJ_OBJS): $(PRJ_HEADERS)
           41  +!endif
           42  +
           43  +# If parent makefile has defined stub objects, add their installation
           44  +# to the default install
           45  +!if "$(PRJ_STUBOBJS)" != ""
           46  +default-install: default-install-stubs
           47  +!endif
           48  +
           49  +# Unlike the other default targets, these cannot be in rules.vc because
           50  +# the executed command depends on existence of macro PRJ_HEADERS_PUBLIC
           51  +# that the parent makefile will not define until after including rules-ext.vc
           52  +!if "$(PRJ_HEADERS_PUBLIC)" != ""
           53  +default-install: default-install-headers
           54  +default-install-headers:
           55  +	@echo Installing headers to '$(INCLUDE_INSTALL_DIR)'
           56  +	@for %f in ($(PRJ_HEADERS_PUBLIC)) do @$(COPY) %f "$(INCLUDE_INSTALL_DIR)"
           57  +!endif
           58  +
           59  +!if "$(DISABLE_STANDARD_TARGETS)" == ""
           60  +DISABLE_STANDARD_TARGETS = 0
           61  +!endif
           62  +
           63  +!if "$(DISABLE_TARGET_setup)" == ""
           64  +DISABLE_TARGET_setup = 0
           65  +!endif
           66  +!if "$(DISABLE_TARGET_install)" == ""
           67  +DISABLE_TARGET_install = 0
           68  +!endif
           69  +!if "$(DISABLE_TARGET_clean)" == ""
           70  +DISABLE_TARGET_clean = 0
           71  +!endif
           72  +!if "$(DISABLE_TARGET_test)" == ""
           73  +DISABLE_TARGET_test = 0
           74  +!endif
           75  +!if "$(DISABLE_TARGET_shell)" == ""
           76  +DISABLE_TARGET_shell = 0
           77  +!endif
           78  +
           79  +!if !$(DISABLE_STANDARD_TARGETS)
           80  +!if !$(DISABLE_TARGET_setup)
           81  +setup: default-setup
           82  +!endif
           83  +!if !$(DISABLE_TARGET_install)
           84  +install: default-install
           85  +!endif
           86  +!if !$(DISABLE_TARGET_clean)
           87  +clean: default-clean
           88  +realclean: hose
           89  +hose: default-hose
           90  +distclean: realclean default-distclean
           91  +!endif
           92  +!if !$(DISABLE_TARGET_test)
           93  +test: default-test
           94  +!endif
           95  +!if !$(DISABLE_TARGET_shell)
           96  +shell: default-shell
           97  +!endif
           98  +!endif # DISABLE_STANDARD_TARGETS