Use a simpler check for Python's libs that returns an actual linker invocation (e.g. -lpython2.6) instead of the .so file. This fixes the case with forced as-needed where the .so gets re-ordered to the front during link. --- configure.in.~1~ 2010-12-08 03:20:38.000000000 +0100 +++ configure.in 2010-12-15 19:10:11.716940123 +0100 @@ -280,12 +280,7 @@ AC_CHECK_PROG(PYTHON27, python2.7, [yes]) # Python headers AC_MSG_CHECKING(for Python libraries) -PYTHON_LIBS=[$(python -c "from distutils import sysconfig -import os -cfg=sysconfig.get_config_vars() -lib = os.path.join(cfg['LIBDIR'], cfg['LDLIBRARY']) -if os.path.exists(lib): - print lib")] +PYTHON_LIBS=[$(python -c 'import sys; print("-lpython%s.%s" % sys.version_info[:2])')] PYTHON_CFLAGS=[$(python -c "from distutils import sysconfig print sysconfig.get_python_inc()")] PYTHON_CFLAGS="-I$PYTHON_CFLAGS"