Skip to content

Commit 3f0e18b

Browse files
committed
Move -L. to a conditional Makefile variable
1 parent efc7c5f commit 3f0e18b

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

Makefile.pre.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ABIFLAGS= @ABIFLAGS@
4444
ABI_THREAD= @ABI_THREAD@
4545
LDVERSION= @LDVERSION@
4646
LIBPYTHON=@LIBPYTHON@
47+
MODULE_LDFLAGS_SHARED=$(if $(LIBPYTHON),-L. $(LIBPYTHON))
4748
GITVERSION= @GITVERSION@
4849
GITTAG= @GITTAG@
4950
GITBRANCH= @GITBRANCH@

Modules/makesetup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
277277
;;
278278
esac
279279
rule="$file: $objs \$(MODULE_${mods_upper}_LDEPS)"
280-
rule="$rule; \$(BLDSHARED) $objs $libs -L. \$(LIBPYTHON) -o $file"
280+
rule="$rule; \$(BLDSHARED) $objs $libs \$(MODULE_LDFLAGS_SHARED) -o $file"
281281
echo "$rule" >>$rulesf
282282
done
283283
done

configure

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6669,15 +6669,18 @@ LDVERSION='$(VERSION)$(ABIFLAGS)'
66696669
AC_MSG_RESULT([$LDVERSION])
66706670

66716671
# Configure the flags and dependencies used when compiling shared modules.
6672-
# Do not rename LIBPYTHON - it's accessed via sysconfig by package build
6673-
# systems (e.g. Meson) to decide whether to link extension modules against
6674-
# libpython.
66756672
AC_SUBST([MODULE_DEPS_SHARED])
66766673
AC_SUBST([LIBPYTHON])
66776674
MODULE_DEPS_SHARED='$(MODULE_DEPS_STATIC) $(EXPORTSYMS)'
6675+
6676+
# On most platforms, extension modules aren't linked against libpython, so
6677+
# LIBPYTHON must be empty.
66786678
LIBPYTHON=''
66796679

66806680
# On Android and Cygwin the shared libraries must be linked with libpython.
6681+
# LIBPYTHON is used by python-config, python3.pc, the commands for building the
6682+
# stdlib's own extension modules, and external package build systems via
6683+
# sysconfig, so its value must be suitable for all those contexts.
66816684
if test "$PY_ENABLE_SHARED" = "1" && ( test -n "$ANDROID_API_LEVEL" || test "$MACHDEP" = "cygwin"); then
66826685
MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(LDLIBRARY)"
66836686
LIBPYTHON="-lpython${VERSION}${ABIFLAGS}"

0 commit comments

Comments
 (0)