diff -r 27e02518993b Misc/python-config.in --- a/Misc/python-config.in Wed Oct 01 19:42:09 2014 +0200 +++ b/Misc/python-config.in Thu Oct 02 02:34:31 2014 +0800 @@ -47,8 +47,9 @@ print(' '.join(flags)) elif opt in ('--libs', '--ldflags'): - libs = getvar('LIBS').split() + getvar('SYSLIBS').split() - libs.append('-lpython' + pyver + sys.abiflags) + libs = ['-lpython' + pyver + sys.abiflags] + libs += getvar('LIBS').split() + libs += getvar('SYSLIBS').split() # add the prefix/lib/pythonX.Y/config dir, but only if there is no # shared library in prefix/lib/. if opt == '--ldflags': diff -r 27e02518993b Misc/python-config.sh.in --- a/Misc/python-config.sh.in Wed Oct 01 19:42:09 2014 +0200 +++ b/Misc/python-config.sh.in Thu Oct 02 02:34:31 2014 +0800 @@ -40,7 +40,7 @@ LIBC="@LIBC@" SYSLIBS="$LIBM $LIBC" ABIFLAGS="@ABIFLAGS@" -LIBS="@LIBS@ $SYSLIBS -lpython${VERSION}${ABIFLAGS}" +LIBS="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS" BASECFLAGS="@BASECFLAGS@" LDLIBRARY="@LDLIBRARY@" LINKFORSHARED="@LINKFORSHARED@"