--- a/Makefile.in
+++ b/Makefile.in
@@ -15,10 +15,11 @@
 	$(BUILD) -c -o $@ $<
 	
 
-BINDIR=@exedir@
-MANDIR=@mandir@
-LIBDIR=@libdir@
-INCDIR=@prefix@/include
+PREFIX=/usr
+BINDIR=$(PREFIX)/bin
+MANDIR=$(PREFIX)/share/man
+LIBDIR=$(PREFIX)/lib
+INCDIR=$(PREFIX)/include
 @MK_PKGCONFIG@PKGDIR=$(LIBDIR)/pkgconfig
 
 PGMS=markdown
@@ -37,7 +38,7 @@
 
 MAN3PAGES=mkd-callbacks.3 mkd-functions.3 markdown.3 mkd-line.3
 
-all: $(PGMS) $(SAMPLE_PGMS) $(TESTFRAMEWORK) all_subdirs
+all: $(PGMS) $(SAMPLE_PGMS) all_subdirs
 
 install: $(PGMS) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) $(DESTDIR)$(PKGDIR)
 	$(INSTALL_PROGRAM) $(PGMS) $(DESTDIR)$(BINDIR)
@@ -71,8 +72,6 @@
 	$(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man1
 	$(INSTALL_DATA) markdown.1 $(DESTDIR)$(MANDIR)/man1
 
-install.everything: install install.man
-
 $(DESTDIR)$(BINDIR):
 	$(INSTALL_DIR) $(DESTDIR)$(BINDIR)
 
--- a/configure.inc
+++ b/configure.inc
@@ -768,7 +768,11 @@
     if [ "$DEST" ]; then
 	rm -f /tmp/b$$
 	$DEST -s /tmp/a$$ /tmp/b$$
-	if [ "`$PROG_FIND /tmp/b$$ -type l -print`" ]; then
+	if [ "$AC_LN_PROG" ]; then
+        TLOG " ($AC_LN_PROG)"
+		PROG_LN_S="$AC_LN_PROG"
+	    AC_SUB 'LN_S' "$AC_LN_PROG"
+	elif [ "`$PROG_FIND /tmp/b$$ -type l -print`" ]; then
 	    TLOG " ($DEST)"
 	    echo "$DEST exists, and ln -s works"
 	    PROG_LN_S="$DEST -s"
@@ -1394,6 +1398,9 @@
     AC_PROG_CC
 
     LOGN "checking for C compiler option to produce PIC "
+	if uname -a | grep MINGW >/dev/null; then
+	    LOG "(not needed)"
+	else
     echo "int some_variable = 0;" > ngc$$.c 
 
     if $AC_CC -c -fPIC -o ngc$$ ngc$$.c $LIBS; then
@@ -1406,6 +1413,7 @@
     fi
     __remove ngc$$ ngc$$.c
     return $__rc
+	fi
 }
 
 
@@ -1512,6 +1520,41 @@
     chmod +x librarian.sh
 }
 
+# Generate an binary librarian (for Windows)
+#
+__AC_DLL_LIBRARIAN() {
+    __config_files="$__config_files librarian.sh"
+    cat > librarian.sh << EOF
+#! /bin/sh
+#
+#  Build shared libraries, hiding (some) ickiness from the makefile
+
+ACTION=\$1; shift
+LIBRARY=\$1; shift
+	
+eval \`awk -F. '{ printf "MAJOR=%d\n", \$1;
+		  printf "VERSION=%d.%d.%d\n", \$1, \$2, \$3; }' \$1\`
+shift
+
+LIBNAME=\$LIBRARY
+FULLNAME=\$LIBNAME.dll
+IMPLIB=\$LIBNAME.dll.a
+
+case "\$ACTION" in
+make)   FLAGS="$AC_CFLAGS -shared"
+
+	rm -f \$FULLNAME \$IMPLIB
+	$AC_CC \$FLAGS -Wl,--out-implib,\$IMPLIB -o \$FULLNAME "\$@"
+	;;
+files)  echo "\$FULLNAME" "\$IMPLIB"
+	;;
+install)$PROG_INSTALL -c \$FULLNAME "\$1"
+	$PROG_INSTALL -c \$IMPLIB "\$1"
+	;;
+esac
+EOF
+    chmod +x librarian.sh
+}
 
 #
 # AC_CC_SHLIBS checks if the C compiler can produce shared libraries
@@ -1538,6 +1581,10 @@
 	    LOG "(no)"
 	    __rc=1
 	fi
+	elif uname -a | grep MINGW >/dev/null; then
+	__AC_DLL_LIBRARIAN
+        LOG "(yes; -shared)"
+	__rc=0	
     elif $AC_CC $AC_PICFLAG -shared -o ngc$$.so ngc$$.c; then
 	__AC_ELF_LIBRARIAN
         LOG "(yes; -shared)"
@@ -1614,7 +1661,7 @@
 
     AC_SUB 'INSTALL' "$PROG_INSTALL"
     AC_SUB 'INSTALL_PROGRAM' "$PROG_INSTALL $_strip -m 755"
-    AC_SUB 'INSTALL_DATA' "$PROG_INSTALL -m 444"
+    AC_SUB 'INSTALL_DATA' "$PROG_INSTALL -m 644"
 
     # finally build a little directory installer
     # if mkdir -p works, use that, otherwise use install -d,
--- a/main.c
+++ b/main.c
@@ -15,7 +15,9 @@
 #include <stdarg.h>
 #include <ctype.h>
 #include <unistd.h>
+#ifndef _WIN32
 #include <sys/wait.h>
+#endif
 
 #include "config.h"
 #include "amalloc.h"
@@ -106,6 +108,7 @@
 #define RECEIVER 0
 #define SENDER 1
 
+#ifndef _WIN32
 char *
 external_codefmt(char *src, int len, char *lang)
 {
@@ -165,7 +168,7 @@
     strcpy(res, src);
     return res;
 }
-
+#endif
 
 struct h_opt opts[] = {
     { 0, "html5",  '5', 0,           "recognise html5 block elements" },
@@ -201,7 +204,9 @@
     int with_html5 = 0;
     int styles = 0;
     int use_mkd_line = 0;
+#ifndef _WIN32
     int use_e_codefmt = 0;
+#endif
     int github_flavoured = 0;
     int squash = 0;
     char *extra_footnote_prefix = 0;
@@ -293,11 +298,13 @@
 		    break;
 	case 'x':   squash = 1;
 		    break;
+#ifndef _WIN32
 	case 'X':   use_e_codefmt = 1;
 		    mkd_set_flag_num(flags, MKD_FENCEDCODE);
 		    external_formatter = hoptarg(&blob);
 		    fprintf(stderr, "selected external formatter (%s)\n", external_formatter);
 		    break;
+#endif
 	case '?':   hoptdescribe(pgm, opts, NROPTS, "[file]", 1);
 		    return 0;
 	}
@@ -352,10 +359,10 @@
 
 	if ( squash )
 	    mkd_e_anchor(doc, (mkd_callback_t) anchor_format, callback_free, 0);
-
+#ifndef _WIN32
 	if ( use_e_codefmt )
 	    mkd_e_code_format(doc, (mkd_callback_t)external_codefmt, callback_free, 0);
-
+#endif
 
 	if ( extra_footnote_prefix )
 	    mkd_ref_prefix(doc, extra_footnote_prefix);
