# pythonx.y-config --ldflags out of /usr and missing -L<install_lib_dir>
# https://bugs.python.org/issue7352

--- Misc/python-config.in.orig	2023-02-04 10:09:53 UTC
+++ Misc/python-config.in
@@ -21,6 +21,7 @@ except getopt.error:
 if not opts:
     exit_with_usage()
 
+libdir = sysconfig.EXEC_PREFIX + '/lib'
 pyver = sysconfig.get_config_var('VERSION')
 getvar = sysconfig.get_config_var
 
@@ -48,6 +49,7 @@ for opt in opt_flags:
         libs += getvar('LIBS').split()
         libs += getvar('SYSLIBS').split()
         if opt == '--ldflags':
+            libs.insert(0, '-L' + libdir)
             if not getvar('PYTHONFRAMEWORK'):
                 libs.extend(getvar('LINKFORSHARED').split())
         print ' '.join(libs)
