--- acinclude.m4.old	2011-07-05 14:33:18.000000000 +0200
+++ acinclude.m4	2011-07-05 14:34:23.000000000 +0200
@@ -85,14 +85,8 @@
 
 	# Check for Python library path
         AC_MSG_CHECKING([for Python library path])
-        python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
-        for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
-                python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
-                if test -n "$python_path" ; then
-                        break
-                fi
-        done
-        python_path=`echo $python_path | sed "s,/libpython.*$,,"`
+	[python_path=`$PYTHON -c 'import distutils.sysconfig, os; \
+		print(os.path.sep.join(distutils.sysconfig.get_python_lib(standard_lib=True).split(os.path.sep)[:-1]))'`]
         AC_MSG_RESULT([$python_path])
         if test -z "$python_path" ; then
                 AC_MSG_ERROR([cannot find Python library path])
