diff --git a/src/Makefile.in b/src/Makefile.in
index b2cd9b2a57a6213a0c21cd464c2a827f8085ac53..a5cc849b413f19d69815a5d9eafc0448fedc7d1b 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.in,v 1.440 2006/08/02 21:02:25 mast Exp $
+# $Id: Makefile.in,v 1.441 2006/08/02 21:19:03 mast Exp $
 #
 
 # This line is needed on some machines.
@@ -338,6 +338,7 @@ pike pike.lib: main.o $(OBJ) master-stamp pike.syms modules/linker_options @STAT
 	$(LD) $(LDFLAGS) main.o $(OBJ) \
 	  `cat modules/linker_options @STATIC_POST_MODULES_LINKOPTS@` \
 	  $(LIBS) -o pike
+	@MT_FIX_PIKE_EXE@
 # The dumped modules are removed whenever Pike is relinked since some
 # of the bytecode methods (e.g. ia32) stores absolute addresses to
 # global structs. That should probably be fixed in them so that dumped
diff --git a/src/configure.in b/src/configure.in
index fa8e5f523d7661744022f1db98895adbc136772f..bc58c870851c6d0a000c956497ebecfcfc6119f4 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1,4 +1,4 @@
-AC_REVISION("$Id: configure.in,v 1.977 2006/08/02 20:29:18 mast Exp $")
+AC_REVISION("$Id: configure.in,v 1.978 2006/08/02 21:19:02 mast Exp $")
 AC_INIT(interpret.c)
 AC_CONFIG_HEADER(machine.h)
 
@@ -2265,7 +2265,7 @@ if test "x$PIKE_PATH_TRANSLATE" = "x"; then
     # MinGW system.
     cat <<\EOF
 #!/bin/sh
-# Automatically generated by $Id: configure.in,v 1.977 2006/08/02 20:29:18 mast Exp $.
+# Automatically generated by $Id: configure.in,v 1.978 2006/08/02 21:19:02 mast Exp $.
 # MinGW-version. Do NOT edit.
 posix_name="`cat`"
 posix_prefix="/"
@@ -2303,7 +2303,7 @@ EOF
     # Native POSIX system.
   cat <<\EOF
 #!/bin/sh
-# Automatically generated by $Id: configure.in,v 1.977 2006/08/02 20:29:18 mast Exp $.
+# Automatically generated by $Id: configure.in,v 1.978 2006/08/02 21:19:02 mast Exp $.
 # POSIX-version. Do NOT edit.
 cat
 EOF
@@ -2312,7 +2312,7 @@ else
   # rntcl-style
   cat <<\EOF
 #!/bin/sh
-# Automatically generated by $Id: configure.in,v 1.977 2006/08/02 20:29:18 mast Exp $.
+# Automatically generated by $Id: configure.in,v 1.978 2006/08/02 21:19:02 mast Exp $.
 # RNTCL-version. Do NOT edit.
 sed -e "$PIKE_PATH_TRANSLATE"
 EOF
@@ -2609,6 +2609,12 @@ if test "x${TALLOW-}" = x ; then
 fi
 AC_SUBST(TALLOW)
 
+# VC8 manifest tool
+if test "x${MTEXE-}" = x ; then
+  AC_PATH_PROG(MTEXE, mt.exe, $RNTANY mt.exe, $PATH:$EXTRA_PATH)
+  export MTEXE
+fi
+
 #############################################################################
 
 # installbsd seems to be broken on some versions of AIX
@@ -7640,6 +7646,40 @@ AC_SUBST(PMOD_TARGETS)
 
 #############################################################################
 
+# Microsoft has decided to make our lives yet more complicated by
+# introducing a fancy dependency tracking system in VC8. It got
+# manifest files (oooh!) written in xml (aahh!). It got a linker that
+# can't make binaries with the dependency info built in from the
+# beginning. It got an amazing array of special cases and quirky rules
+# on how crt dlls may be loaded and not that's almost certain to nail
+# you sooner or later. All in all, it's the most insanely overcomplex
+# system to keep your exe and dlls from loading that stinkin' little
+# crt dll you can ever imagine. For the full story, see
+# http://www.codeproject.com/cpp/vcredists_x86.asp.
+
+if test "x$MTEXE" != x; then
+  # Embed the manifests. C.f. http://msdn2.microsoft.com/en-us/library/ms235591.aspx
+  # You might want to disable this if you want to try private crts.
+  # See also the PRIVATE_CRT parts of install.pike.
+  MT_FIX_PIKE_EXE="\
+    @if test -f pike.exe.manifest; then \
+      echo \"$MTEXE -nologo -manifest pike.exe.manifest '-outputresource:pike.exe;1'\"; \
+      $MTEXE -nologo -manifest pike.exe.manifest '-outputresource:pike.exe;1'; \
+    else :; fi"
+  MT_FIX_MODULE_SO="\
+    @if test -f module.so.manifest; then \
+      echo \"$MTEXE -nologo -manifest module.so.manifest '-outputresource:module.so;2'\"; \
+      $MTEXE -nologo -manifest module.so.manifest '-outputresource:module.so;2'; \
+    else :; fi"
+else
+  MT_FIX_PIKE_EXE=@:
+  MT_FIX_MODULE_SO=@:
+fi
+
+AC_SUBST(MT_FIX_PIKE_EXE)
+
+#############################################################################
+
 echo
 echo "Compiler summary:"
 echo
diff --git a/src/modules/dynamic_module_makefile.in b/src/modules/dynamic_module_makefile.in
index c2475e0e62ba912294992a0cdc7164585ea34322..7968efa056a5ae062fce50025e4582f234422bc1 100644
--- a/src/modules/dynamic_module_makefile.in
+++ b/src/modules/dynamic_module_makefile.in
@@ -1,5 +1,5 @@
 #
-# $Id: dynamic_module_makefile.in,v 1.122 2006/08/02 20:59:47 mast Exp $
+# $Id: dynamic_module_makefile.in,v 1.123 2006/08/02 21:19:03 mast Exp $
 #
 
 LIBGCC=@LIBGCC@
@@ -82,6 +82,7 @@ module.so: $(MODULE_ARCHIVES) $(OBJS) $(LDSHARED_MODULE_REQS)
 	  echo $(TMP_BINDIR)/smartlink $(MOD_LDSHARED) $(LDFLAGS) -o module.@SO@ $(OBJS) $(MODULE_ARCHIVES) $(MODULE_LDFLAGS) $(LIBGCC) $(LC_REQ) $(LIBGCC) >&2 ;\
 	  exit 1; \
 	fi
+	$(MT_FIX_MODULE_SO)
 
 $(OBJS): propagated_variables