Tcl Extension Architecture (TEA) Sample Extension

Check-in [92455ee4f9]
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:Allows to compile direct from Visual Studio IDE (prevents throwing error "LNK1561: entry point must be defined" by testing linker). Patch by sebres
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 92455ee4f96fce2e6ce8adec25c3f0747cda13ea
User & Date: jan.nijtmans 2017-01-13 13:19:42
Context
2017-05-14
08:50
All the world was a VAX. check-in: 575df1b1bf user: stu tags: trunk
2017-01-13
13:19
Allows to compile direct from Visual Studio IDE (prevents throwing error "LNK1561: entry point must be defined" by testing linker). Patch by sebres check-in: 92455ee4f9 user: jan.nijtmans tags: trunk
2016-06-11
11:14
Tweak to fix a typo in the latest TEA which was preventing --disable-shared --enable-stubs from being expressed properly check-in: b993542e50 user: seandeelywoods tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to configure.

   617    617   #ifdef HAVE_UNISTD_H
   618    618   # include <unistd.h>
   619    619   #endif"
   620    620   
   621    621   ac_subst_vars='LTLIBOBJS
   622    622   LIBOBJS
   623    623   TCLSH_PROG
   624         -PRACTCL_NAME_LIBRARY
   625         -PRACTCL_VC_MANIFEST_EMBED_EXE
   626         -PRACTCL_VC_MANIFEST_EMBED_DLL
   627         -PRACTCL_STUB_LIB
   628         -PRACTCL_STATIC_LIB
   629         -PRACTCL_SHARED_LIB
   630         -PRACTCL_TOOLSET
   631    624   VC_MANIFEST_EMBED_EXE
   632    625   VC_MANIFEST_EMBED_DLL
   633    626   RANLIB_STUB
   634    627   MAKE_STUB_LIB
   635    628   MAKE_STATIC_LIB
   636    629   MAKE_SHARED_LIB
   637    630   MAKE_LIB
   638    631   TCL_DBGX
   639    632   LDFLAGS_DEFAULT
   640    633   CFLAGS_DEFAULT
   641    634   LD_LIBRARY_PATH_VAR
   642    635   SHLIB_CFLAGS
   643    636   SHLIB_LD_LIBS
   644         -SHLIB_SUFFIX
   645    637   SHLIB_LD
   646    638   STLIB_LD
   647    639   CFLAGS_WARNING
   648    640   CFLAGS_OPTIMIZE
   649    641   CFLAGS_DEBUG
   650    642   RC
   651    643   CELIB_DIR
................................................................................
  2438   2430   	    fi
  2439   2431   
  2440   2432   	    # check in a few common install locations
  2441   2433   	    if test x"${ac_cv_c_tclconfig}" = x ; then
  2442   2434   		for i in `ls -d ${libdir} 2>/dev/null` \
  2443   2435   			`ls -d ${exec_prefix}/lib 2>/dev/null` \
  2444   2436   			`ls -d ${prefix}/lib 2>/dev/null` \
  2445         -			`ls -d /usr/local/lib 2>/dev/null` \
  2446   2437   			`ls -d /usr/contrib/lib 2>/dev/null` \
         2438  +			`ls -d /usr/local/lib 2>/dev/null` \
         2439  +			`ls -d /usr/pkg/lib 2>/dev/null` \
  2447   2440   			`ls -d /usr/lib 2>/dev/null` \
  2448   2441   			`ls -d /usr/lib64 2>/dev/null` \
  2449   2442   			`ls -d /usr/lib/tcl8.6 2>/dev/null` \
  2450   2443   			`ls -d /usr/lib/tcl8.5 2>/dev/null` \
  2451   2444   			; do
  2452   2445   		    if test -f "$i/tclConfig.sh" ; then
  2453   2446   			ac_cv_c_tclconfig="`(cd $i; pwd)`"
................................................................................
  6686   6679     RC="$ac_cv_prog_RC"
  6687   6680   fi
  6688   6681   
  6689   6682   		CFLAGS_DEBUG="-g"
  6690   6683   		CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
  6691   6684   		SHLIB_LD='${CC} -shared'
  6692   6685   		UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  6693         -  	PRACTCL_UNSHARED_LIB_SUFFIX='.a'
  6694         -
  6695   6686   		LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
  6696   6687   		LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
  6697   6688   
  6698   6689   		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cross-compile version of gcc" >&5
  6699   6690   $as_echo_n "checking for cross-compile version of gcc... " >&6; }
  6700   6691   if ${ac_cv_cross+:} false; then :
  6701   6692     $as_echo_n "(cached) " >&6
................................................................................
  7941   7932   
  7942   7933   fi
  7943   7934   
  7944   7935       if test "$SHARED_LIB_SUFFIX" = ""; then :
  7945   7936   
  7946   7937       # TEA specific: use PACKAGE_VERSION instead of VERSION
  7947   7938       SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
  7948         -
  7949   7939   fi
  7950   7940       if test "$UNSHARED_LIB_SUFFIX" = ""; then :
  7951   7941   
  7952   7942       # TEA specific: use PACKAGE_VERSION instead of VERSION
  7953   7943       UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
  7954         -
  7955   7944   fi
  7956   7945   
  7957   7946       if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then
  7958   7947   	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5
  7959   7948   $as_echo_n "checking for SEH support in compiler... " >&6; }
  7960   7949   if ${tcl_cv_seh+:} false; then :
  7961   7950     $as_echo_n "(cached) " >&6
................................................................................
  8125   8114   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5
  8126   8115   $as_echo "$tcl_cv_cast_to_union" >&6; }
  8127   8116   	if test "$tcl_cv_cast_to_union" = "yes"; then
  8128   8117   
  8129   8118   $as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h
  8130   8119   
  8131   8120   	fi
  8132         -
  8133   8121   
  8134   8122   
  8135   8123   
  8136   8124   
  8137   8125   
  8138   8126   
  8139   8127   
................................................................................
  8545   8533   #--------------------------------------------------------------------
  8546   8534   # This macro generates a line to use when building a library.  It
  8547   8535   # depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
  8548   8536   # and TEA_LOAD_TCLCONFIG macros above.
  8549   8537   #--------------------------------------------------------------------
  8550   8538   
  8551   8539   
  8552         -  PRACTCL_TOOLSET="gcc"
  8553         -	PRACTCL_VC_MANIFEST_EMBED_DLL=:
  8554         -	PRACTCL_VC_MANIFEST_EMBED_EXE=:
  8555         -  if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
  8556         -	  PRACTCL_TOOLSET="msvc"
  8557         -	  PRACTCL_STATIC_LIB="%STLIB_LD% -out:%OUTFILE% %LIBRARY_OBJECTS%"
  8558         -	  PRACTCL_SHARED_LIB="%SHLIB_LD% %SHLIB_LD_LIBS% %LDFLAGS_DEFAULT% -out:%OUTFILE% %LIBRARY_OBJECTS%"
  8559         -	  MAKE_STATIC_LIB="\${STLIB_LD} -out:\[email protected] \$(PKG_OBJECTS)"
  8560         -	  MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[email protected] \$(PKG_OBJECTS)"
  8561         -	  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
         8540  +    if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
         8541  +	MAKE_STATIC_LIB="\${STLIB_LD} -out:\[email protected] \$(PKG_OBJECTS)"
         8542  +	MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[email protected] \$(PKG_OBJECTS)"
         8543  +	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  8562   8544   /* end confdefs.h.  */
  8563   8545   
  8564   8546   #if defined(_MSC_VER) && _MSC_VER >= 1400
  8565   8547   print("manifest needed")
  8566   8548   #endif
  8567   8549   
  8568   8550   _ACEOF
  8569   8551   if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  8570   8552     $EGREP "manifest needed" >/dev/null 2>&1; then :
  8571   8553   
  8572         -	    # Could do a CHECK_PROG for mt, but should always be with MSVC8+
  8573         -	    PRACTCL_VC_MANIFEST_EMBED_DLL="mt.exe -nologo -manifest %OUTFILE%.manifest -outputresource:%OUTFILE%\;2"
  8574         -	    PRACTCL_VC_MANIFEST_EMBED_EXE="mt.exe -nologo -manifest %OUTFILE%.manifest -outputresource:%OUTFILE%\;1"
  8575         -	    VC_MANIFEST_EMBED_DLL="if test -f \[email protected] ; then mt.exe -nologo -manifest \[email protected] -outputresource:\[email protected]\;2 ; fi"
  8576         -	    VC_MANIFEST_EMBED_EXE="if test -f \[email protected] ; then mt.exe -nologo -manifest \[email protected] -outputresource:\[email protected]\;1 ; fi"
  8577         -	    MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
         8554  +	# Could do a CHECK_PROG for mt, but should always be with MSVC8+
         8555  +	VC_MANIFEST_EMBED_DLL="if test -f \[email protected] ; then mt.exe -nologo -manifest \[email protected] -outputresource:\[email protected]\;2 ; fi"
         8556  +	VC_MANIFEST_EMBED_EXE="if test -f \[email protected] ; then mt.exe -nologo -manifest \[email protected] -outputresource:\[email protected]\;1 ; fi"
         8557  +	MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
  8578   8558   
  8579   8559       CLEANFILES="$CLEANFILES *.manifest"
  8580   8560   
  8581   8561   
  8582   8562   fi
  8583   8563   rm -f conftest*
  8584   8564   
  8585         -		PRACTCL_STUB_LIB="%STLIB_LD% -nodefaultlib -out:%OUTFILE% %LIBRARY_OBJECTS%"
  8586         -	  MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[email protected] \$(PKG_STUB_OBJECTS)"
  8587         -  else
  8588         -	  MAKE_STATIC_LIB="\${STLIB_LD} \[email protected] \$(PKG_OBJECTS)"
  8589         -	  MAKE_SHARED_LIB="\${SHLIB_LD} -o \[email protected] \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
  8590         -	  MAKE_STUB_LIB="\${STLIB_LD} \[email protected] \$(PKG_STUB_OBJECTS)"
  8591         -
  8592         -	  PRACTCL_STATIC_LIB="%STLIB_LD% %OUTFILE% %LIBRARY_OBJECTS%"
  8593         -	  PRACTCL_SHARED_LIB="%SHLIB_LD% -o %OUTFILE% %LIBRARY_OBJECTS% %SHLIB_LD_LIBS%"
  8594         -    PRACTCL_STUB_LIB="%STLIB_LD% %OUTFILE% %LIBRARY_OBJECTS%"
  8595         -  fi
  8596         -
  8597         -  if test "${SHARED_BUILD}" = "1" ; then
  8598         -	  MAKE_LIB="${MAKE_SHARED_LIB} "
  8599         -  else
  8600         -	  MAKE_LIB="${MAKE_STATIC_LIB} "
  8601         -  fi
  8602         -
  8603         -  #--------------------------------------------------------------------
  8604         -  # Shared libraries and static libraries have different names.
  8605         -  # Use the double eval to make sure any variables in the suffix is
  8606         -  # substituted. (@@@ Might not be necessary anymore)
  8607         -  #--------------------------------------------------------------------
  8608         -  if test "${TEA_PLATFORM}" = "windows" ; then
  8609         -	  PRACTCL_NAME_LIBRARY="%LIBRARY_PREFIX%%LIBRARY_NAME%%LIBRARY_VERSION_NODOTS%"
  8610         -	  if test "${SHARED_BUILD}" = "1" ; then
         8565  +	MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[email protected] \$(PKG_STUB_OBJECTS)"
         8566  +    else
         8567  +	MAKE_STATIC_LIB="\${STLIB_LD} \[email protected] \$(PKG_OBJECTS)"
         8568  +	MAKE_SHARED_LIB="\${SHLIB_LD} -o \[email protected] \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
         8569  +	MAKE_STUB_LIB="\${STLIB_LD} \[email protected] \$(PKG_STUB_OBJECTS)"
         8570  +    fi
         8571  +
         8572  +    if test "${SHARED_BUILD}" = "1" ; then
         8573  +	MAKE_LIB="${MAKE_SHARED_LIB} "
         8574  +    else
         8575  +	MAKE_LIB="${MAKE_STATIC_LIB} "
         8576  +    fi
         8577  +
         8578  +    #--------------------------------------------------------------------
         8579  +    # Shared libraries and static libraries have different names.
         8580  +    # Use the double eval to make sure any variables in the suffix is
         8581  +    # substituted. (@@@ Might not be necessary anymore)
         8582  +    #--------------------------------------------------------------------
         8583  +
         8584  +    if test "${TEA_PLATFORM}" = "windows" ; then
         8585  +	if test "${SHARED_BUILD}" = "1" ; then
  8611   8586   	    # We force the unresolved linking of symbols that are really in
  8612   8587   	    # the private libraries of Tcl and Tk.
  8613   8588   	    if test x"${TK_BIN_DIR}" != x ; then
  8614         -			  SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
         8589  +		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
  8615   8590   	    fi
  8616   8591   	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
  8617   8592   	    if test "$GCC" = "yes"; then
  8618         -        SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
         8593  +		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
  8619   8594   	    fi
  8620   8595   	    eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  8621         -	  else
         8596  +	else
  8622   8597   	    eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
  8623   8598   	    if test "$GCC" = "yes"; then
  8624         -        PKG_LIB_FILE=lib${PKG_LIB_FILE}
         8599  +		PKG_LIB_FILE=lib${PKG_LIB_FILE}
  8625   8600   	    fi
  8626         -	  fi
  8627         -	  # Some packages build their own stubs libraries
  8628         -	  eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
  8629         -    if test "$GCC" = "yes"; then
  8630         -      PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
  8631         -    fi
  8632         -	  # These aren't needed on Windows (either MSVC or gcc)
  8633         -	  RANLIB=:
  8634         -	  RANLIB_STUB=:
  8635         -  else
  8636         -	  PRACTCL_NAME_LIBRARY="lib%LIBRARY_PREFIX%%LIBRARY_NAME%%LIBRARY_VERSION%"
  8637         -	  RANLIB_STUB="${RANLIB}"
  8638         -	  if test "${SHARED_BUILD}" = "1" ; then
  8639         -      SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
  8640         -      if test x"${TK_BIN_DIR}" != x ; then
  8641         -        SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
  8642         -      fi
  8643         -      eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  8644         -      RANLIB=:
         8601  +	fi
         8602  +	# Some packages build their own stubs libraries
         8603  +	eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
         8604  +	if test "$GCC" = "yes"; then
         8605  +	    PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
         8606  +	fi
         8607  +	# These aren't needed on Windows (either MSVC or gcc)
         8608  +	RANLIB=:
         8609  +	RANLIB_STUB=:
  8645   8610       else
  8646         -      eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
         8611  +	RANLIB_STUB="${RANLIB}"
         8612  +	if test "${SHARED_BUILD}" = "1" ; then
         8613  +	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
         8614  +	    if test x"${TK_BIN_DIR}" != x ; then
         8615  +		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
         8616  +	    fi
         8617  +	    eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
         8618  +	    RANLIB=:
         8619  +	else
         8620  +	    eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
         8621  +	fi
         8622  +	# Some packages build their own stubs libraries
         8623  +	eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
  8647   8624       fi
  8648         -    # Some packages build their own stubs libraries
  8649         -    eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
  8650         -  fi
  8651   8625   
  8652         -  # These are escaped so that only CFLAGS is picked up at configure time.
  8653         -  # The other values will be substituted at make time.
  8654         -  CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
  8655         -  if test "${SHARED_BUILD}" = "1" ; then
  8656         -    CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
  8657         -  fi
  8658         -
  8659         -
  8660         -
  8661         -
  8662         -
  8663         -
  8664         -
         8626  +    # These are escaped so that only CFLAGS is picked up at configure time.
         8627  +    # The other values will be substituted at make time.
         8628  +    CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
         8629  +    if test "${SHARED_BUILD}" = "1" ; then
         8630  +	CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
         8631  +    fi
  8665   8632   
  8666   8633   
  8667   8634   
  8668   8635   
  8669   8636   
  8670   8637   
  8671   8638   

Changes to win/nmakehlp.c.

    39     39   #endif
    40     40   
    41     41   
    42     42   
    43     43   /* protos */
    44     44   
    45     45   static int CheckForCompilerFeature(const char *option);
    46         -static int CheckForLinkerFeature(const char *option);
           46  +static int CheckForLinkerFeature(const char **options, int count);
    47     47   static int IsIn(const char *string, const char *substring);
    48     48   static int SubstituteFile(const char *substs, const char *filename);
    49     49   static int QualifyPath(const char *path);
    50     50   static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
    51     51   static DWORD WINAPI ReadFromPipe(LPVOID args);
    52     52   
    53     53   /* globals */
................................................................................
    98     98   			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
    99     99   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
   100    100   			&dwWritten, NULL);
   101    101   		return 2;
   102    102   	    }
   103    103   	    return CheckForCompilerFeature(argv[2]);
   104    104   	case 'l':
   105         -	    if (argc != 3) {
          105  +	    if (argc < 3) {
   106    106   		chars = snprintf(msg, sizeof(msg) - 1,
   107         -	       		"usage: %s -l <linker option>\n"
          107  +	       		"usage: %s -l <linker option> ?<mandatory option> ...?\n"
   108    108   			"Tests for whether link.exe supports an option\n"
   109    109   			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
   110    110   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
   111    111   			&dwWritten, NULL);
   112    112   		return 2;
   113    113   	    }
   114         -	    return CheckForLinkerFeature(argv[2]);
          114  +	    return CheckForLinkerFeature(&argv[2], argc-2);
   115    115   	case 'f':
   116    116   	    if (argc == 2) {
   117    117   		chars = snprintf(msg, sizeof(msg) - 1,
   118    118   			"usage: %s -f <string> <substring>\n"
   119    119   			"Find a substring within another\n"
   120    120   			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
   121    121   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
................................................................................
   309    309                || strstr(Err.buffer, "D9002") != NULL
   310    310                || strstr(Out.buffer, "D2021") != NULL
   311    311                || strstr(Err.buffer, "D2021") != NULL);
   312    312   }
   313    313   
   314    314   static int
   315    315   CheckForLinkerFeature(
   316         -    const char *option)
          316  +    const char **options,
          317  +    int count)
   317    318   {
   318    319       STARTUPINFO si;
   319    320       PROCESS_INFORMATION pi;
   320    321       SECURITY_ATTRIBUTES sa;
   321    322       DWORD threadID;
   322    323       char msg[300];
   323    324       BOOL ok;
   324    325       HANDLE hProcess, h, pipeThreads[2];
   325         -    char cmdline[100];
          326  +    int i;
          327  +    char cmdline[255];
   326    328   
   327    329       hProcess = GetCurrentProcess();
   328    330   
   329    331       ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
   330    332       ZeroMemory(&si, sizeof(STARTUPINFO));
   331    333       si.cb = sizeof(STARTUPINFO);
   332    334       si.dwFlags   = STARTF_USESTDHANDLES;
................................................................................
   364    366   
   365    367       lstrcpy(cmdline, "link.exe -nologo ");
   366    368   
   367    369       /*
   368    370        * Append our option for testing.
   369    371        */
   370    372   
   371         -    lstrcat(cmdline, option);
          373  +    for (i = 0; i < count; i++) {
          374  +	lstrcat(cmdline, " \"");
          375  +	lstrcat(cmdline, options[i]);
          376  +	lstrcat(cmdline, "\"");
          377  +    }
   372    378   
   373    379       ok = CreateProcess(
   374    380   	    NULL,	    /* Module name. */
   375    381   	    cmdline,	    /* Command line. */
   376    382   	    NULL,	    /* Process handle not inheritable. */
   377    383   	    NULL,	    /* Thread handle not inheritable. */
   378    384   	    TRUE,	    /* yes, inherit handles. */
................................................................................
   429    435       /*
   430    436        * Look for the commandline warning code in the stderr stream.
   431    437        */
   432    438   
   433    439       return !(strstr(Out.buffer, "LNK1117") != NULL ||
   434    440   	    strstr(Err.buffer, "LNK1117") != NULL ||
   435    441   	    strstr(Out.buffer, "LNK4044") != NULL ||
   436         -	    strstr(Err.buffer, "LNK4044") != NULL);
          442  +	    strstr(Err.buffer, "LNK4044") != NULL ||
          443  +	    strstr(Out.buffer, "LNK4224") != NULL ||
          444  +	    strstr(Err.buffer, "LNK4224") != NULL);
   437    445   }
   438    446   
   439    447   static DWORD WINAPI
   440    448   ReadFromPipe(
   441    449       LPVOID args)
   442    450   {
   443    451       pipeinfo *pi = (pipeinfo *) args;

Changes to win/rules.vc.

   150    150   
   151    151   !if [nmakehlp -c -RTC1]
   152    152   DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
   153    153   !elseif [nmakehlp -c -GZ]
   154    154   DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
   155    155   !endif
   156    156   
   157         -COMPILERFLAGS  =-W3
          157  +COMPILERFLAGS  =-W3 /D_ATL_XP_TARGETING
   158    158   
   159    159   # In v13 -GL and -YX are incompatible.
   160    160   !if [nmakehlp -c -YX]
   161    161   !if ![nmakehlp -c -GL]
   162    162   OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
   163    163   !endif
   164    164   !endif
................................................................................
   178    178   !if [nmakehlp -c -QIA64_Bx]
   179    179   !message *** Compiler has 'B-stepping errata workarounds'
   180    180   COMPILERFLAGS   = $(COMPILERFLAGS) -QIA64_Bx
   181    181   !else
   182    182   !message *** Compiler does not have 'B-stepping errata workarounds'
   183    183   !endif
   184    184   !endif
          185  +
          186  +# Prevents "LNK1561: entry point must be defined" error compiling from VS-IDE:
          187  +!ifndef LINKER_TESTFLAGS
          188  +LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmhlp-out.txt
          189  +!endif
   185    190   
   186    191   !if "$(MACHINE)" == "IX86"
   187    192   ### test for -align:4096, when align:512 will do.
   188         -!if [nmakehlp -l -opt:nowin98]
          193  +!if [nmakehlp -l -opt:nowin98 $(LINKER_TESTFLAGS)]
   189    194   !message *** Linker has 'Win98 alignment problem'
   190    195   ALIGN98_HACK	= 1
   191    196   !else
   192    197   !message *** Linker does not have 'Win98 alignment problem'
   193    198   ALIGN98_HACK	= 0
   194    199   !endif
   195    200   !else
   196    201   ALIGN98_HACK	= 0
   197    202   !endif
   198    203   
   199    204   LINKERFLAGS     =
   200    205   
   201         -!if [nmakehlp -l -ltcg]
          206  +!if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)]
   202    207   LINKERFLAGS     =-ltcg
   203    208   !endif
   204    209   
   205    210   #----------------------------------------------------------
   206    211   # Decode the options requested.
   207    212   #----------------------------------------------------------
   208    213   
................................................................................
   385    390   TCL_NO_DEPRECATED	    = 1
   386    391   !else
   387    392   TCL_NO_DEPRECATED	    = 0
   388    393   !endif
   389    394   !if [nmakehlp -f $(CHECKS) "fullwarn"]
   390    395   !message *** Doing full warnings check
   391    396   WARNINGS		    = -W4
   392         -!if [nmakehlp -l -warn:3]
          397  +!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)]
   393    398   LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
   394    399   !endif
   395    400   !else
   396    401   WARNINGS		    = -W3
   397    402   !endif
   398    403   !if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
   399    404   !message *** Doing 64bit portability warnings
   400    405   WARNINGS		    = $(WARNINGS) -Wp64
   401    406   !endif
   402    407   !endif
   403    408   
   404    409   !if $(PGO) > 1
   405         -!if [nmakehlp -l -ltcg:pgoptimize]
          410  +!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)]
   406    411   LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
   407    412   !else
   408    413   MSG=^
   409    414   This compiler does not support profile guided optimization.
   410    415   !error $(MSG)
   411    416   !endif
   412    417   !elseif $(PGO) > 0
   413         -!if [nmakehlp -l -ltcg:pginstrument]
          418  +!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)]
   414    419   LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
   415    420   !else
   416    421   MSG=^
   417    422   This compiler does not support profile guided optimization.
   418    423   !error $(MSG)
   419    424   !endif
   420    425   !endif