Index: python-config.in =================================================================== --- python-config.in (revision 82663) +++ python-config.in (working copy) @@ -49,8 +49,21 @@ for opt in opt_flags: # add the prefix/lib/pythonX.Y/config dir, but only if there is no # shared library in prefix/lib/. if opt == '--ldflags': + # Provide the location where the Python library is installed. + # We always provide it, because Python may have been installed + # at a non-standard location. if not getvar('Py_ENABLE_SHARED'): - libs.insert(0, '-L' + getvar('LIBPL')) + # There is no shared library in prefix/lib. The static + # library is in prefix/lib/pythonX.Y/config. + # + # Note that we cannot use getvar('LIBPL') like we used to, + # because it provides the location at build time, which might + # be different from the actual location at runtime. + libdir = sysconfig.get_python_lib(standard_lib=True) + '/config' + else: + # The Python shared library is installed in prefix/lib. + libdir = sysconfig.PREFIX + '/lib' + libs.insert(0, '-L' + libdir) libs.extend(getvar('LINKFORSHARED').split()) print ' '.join(libs)