Skip to content

Commit e65f01f

Browse files
authored
bpo-36508: python-config don't export LINKFORSHARED (GH-12661)
python-config --ldflags no longer includes flags of the LINKFORSHARED variable. The LINKFORSHARED variable must only be used to build executables.
1 parent 2ee077f commit e65f01f

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

Makefile.pre.in

+2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
104104
NO_AS_NEEDED= @NO_AS_NEEDED@
105105
SGI_ABI= @SGI_ABI@
106106
CCSHARED= @CCSHARED@
107+
# LINKFORSHARED are the flags passed to the $(CC) command that links
108+
# the python executable -- this is only needed for a few systems
107109
LINKFORSHARED= @LINKFORSHARED@
108110
ARFLAGS= @ARFLAGS@
109111
# Extra C flags added for building the interpreter object files.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``python-config --ldflags`` no longer includes flags of the
2+
``LINKFORSHARED`` variable. The ``LINKFORSHARED`` variable must only be used
3+
to build executables.

Misc/python-config.in

-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ for opt in opt_flags:
5555
if opt == '--ldflags':
5656
if not getvar('Py_ENABLE_SHARED'):
5757
libs.insert(0, '-L' + getvar('LIBPL'))
58-
if not getvar('PYTHONFRAMEWORK'):
59-
libs.extend(getvar('LINKFORSHARED').split())
6058
print(' '.join(libs))
6159

6260
elif opt == '--extension-suffix':

Misc/python-config.sh.in

+1-6
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ ABIFLAGS="@ABIFLAGS@"
4444
LIBS="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS"
4545
BASECFLAGS="@BASECFLAGS@"
4646
LDLIBRARY="@LDLIBRARY@"
47-
LINKFORSHARED="@LINKFORSHARED@"
4847
OPT="@OPT@"
4948
PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
5049
LDVERSION="@LDVERSION@"
@@ -89,15 +88,11 @@ do
8988
echo "$LIBS"
9089
;;
9190
--ldflags)
92-
LINKFORSHAREDUSED=
93-
if [ -z "$PYTHONFRAMEWORK" ] ; then
94-
LINKFORSHAREDUSED=$LINKFORSHARED
95-
fi
9691
LIBPLUSED=
9792
if [ "$PY_ENABLE_SHARED" = "0" ] ; then
9893
LIBPLUSED="-L$LIBPL"
9994
fi
100-
echo "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED"
95+
echo "$LIBPLUSED -L$libdir $LIBS"
10196
;;
10297
--extension-suffix)
10398
echo "$SO"

0 commit comments

Comments
 (0)