--- configure.in.org	2007-08-23 18:53:36 +0400
+++ configure.in	2010-01-18 03:44:27 +0300
@@ -668,17 +668,23 @@
         echo Found python in $with_python/bin/python
         PYTHON="$with_python/bin/python"
     else
-	if test -x "$with_python"
-	then
-	    echo Found python in $with_python
-	    PYTHON="$with_python"
-	else
-	    if test -x "$PYTHON"
-	    then
-	        echo Found python in environment PYTHON=$PYTHON
-		with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
-	    else
-		AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
+        if test -x "$with_python/python.exe"
+        then
+            echo Found python in $with_python/python.exe
+            PYTHON="$with_python/python.exe"
+        else
+    	    if test -x "$with_python"
+    	    then
+    	        echo Found python in $with_python
+    	        PYTHON="$with_python"
+    	    else
+	        if test -x "$PYTHON"
+	        then
+	            echo Found python in environment PYTHON=$PYTHON
+	    	    with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+	        else
+	   	    AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
+		fi
 	    fi
 	fi
     fi
@@ -705,7 +711,14 @@
 		    PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
 	            PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
 		else
-		    echo could not find python$PYTHON_VERSION/Python.h
+	            if test -r $with_python/include/Python.h -a \
+	               -d $with_python/lib/site-packages
+	            then
+	                PYTHON_INCLUDES=$with_python/include
+	                PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
+	            else
+		        echo could not find python$PYTHON_VERSION/Python.h
+		    fi
 		fi
 	    fi
 	    if test ! -d "$PYTHON_SITE_PACKAGES"
@@ -1326,6 +1339,7 @@
 WIN32_EXTRA_LDFLAGS=
 CYGWIN_EXTRA_LDFLAGS=
 CYGWIN_EXTRA_PYTHON_LIBADD=
+WIN32_EXTRA_PYTHON_LIBADD=
 case "$host" in
  *-*-mingw*)
  CPPFLAGS="$CPPFLAGS -DWIN32"
@@ -1334,6 +1348,10 @@
  AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
  AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
  AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
+ if test "${PYTHON}" != ""
+ then
+   WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}"
+ fi
  ;;
  *-*-cygwin*)
  CYGWIN_EXTRA_LDFLAGS="-no-undefined"
--- python/Makefile.am.org	2010-01-18 03:45:35 +0300
+++ python/Makefile.am	2010-01-18 03:45:46 +0300
@@ -36,7 +36,7 @@
 python_LTLIBRARIES = libxml2mod.la
 
 libxml2mod_la_SOURCES = libxml.c types.c libxml2-py.c
-libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@
+libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@ @WIN32_EXTRA_PYTHON_LIBADD@
 
 libxml2.py: $(srcdir)/libxml.py libxml2class.py
 	cat $(srcdir)/libxml.py libxml2class.py > libxml2.py
