|
| 1 | +commit 6187c3916ac1e7e6eb2bff7ca5f976c99cbe273b |
| 2 | +Author: Zanie Blue < [email protected]> |
| 3 | +Date: Sat Nov 15 08:47:20 2025 -0600 |
| 4 | + |
| 5 | + Add an `--enable-relocatable` configure flag |
| 6 | + |
| 7 | +diff --git a/Makefile.pre.in b/Makefile.pre.in |
| 8 | +index 19423c11545..6c9cba59e27 100644 |
| 9 | +--- a/Makefile.pre.in |
| 10 | ++++ b/Makefile.pre.in |
| 11 | +@@ -60,6 +60,7 @@ DSYMUTIL= @DSYMUTIL@ |
| 12 | + DSYMUTIL_PATH= @DSYMUTIL_PATH@ |
| 13 | + |
| 14 | + GNULD= @GNULD@ |
| 15 | ++RELOCATABLE= @RELOCATABLE@ |
| 16 | + |
| 17 | + # Shell used by make (some versions default to the login shell, which is bad) |
| 18 | + SHELL= /bin/sh -e |
| 19 | +diff --git a/configure b/configure |
| 20 | +index 9757b3419d3..38f2d4dfbf2 100755 |
| 21 | +--- a/configure |
| 22 | ++++ b/configure |
| 23 | +@@ -949,6 +949,7 @@ LINK_PYTHON_DEPS |
| 24 | + LIBRARY_DEPS |
| 25 | + HOSTRUNNER |
| 26 | + NODE |
| 27 | ++RELOCATABLE |
| 28 | + STATIC_LIBPYTHON |
| 29 | + GNULD |
| 30 | + EXPORTSFROM |
| 31 | +@@ -1091,6 +1092,7 @@ with_suffix |
| 32 | + enable_shared |
| 33 | + with_static_libpython |
| 34 | + enable_profiling |
| 35 | ++enable_relocatable |
| 36 | + enable_gil |
| 37 | + with_pydebug |
| 38 | + with_trace_refs |
| 39 | +@@ -1826,6 +1828,8 @@ Optional Features: |
| 40 | + no) |
| 41 | + --enable-profiling enable C-level code profiling with gprof (default is |
| 42 | + no) |
| 43 | ++ --enable-relocatable enable build of a relocatable Python distribution |
| 44 | ++ (default is no) |
| 45 | + --disable-gil enable support for running without the GIL (default |
| 46 | + is no) |
| 47 | + --enable-pystats enable internal statistics gathering (default is no) |
| 48 | +@@ -7673,6 +7677,31 @@ if test "x$enable_profiling" = xyes; then |
| 49 | + LDFLAGS="-pg $LDFLAGS" |
| 50 | + fi |
| 51 | + |
| 52 | ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --enable-relocatable" >&5 |
| 53 | ++printf %s "checking for --enable-relocatable... " >&6; } |
| 54 | ++# Check whether --enable-relocatable was given. |
| 55 | ++if test ${enable_relocatable+y} |
| 56 | ++then : |
| 57 | ++ enableval=$enable_relocatable; |
| 58 | ++fi |
| 59 | ++ |
| 60 | ++if test -z "$enable_relocatable" |
| 61 | ++then |
| 62 | ++ enable_relocatable="no" |
| 63 | ++fi |
| 64 | ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_relocatable" >&5 |
| 65 | ++printf "%s\n" "$enable_relocatable" >&6; } |
| 66 | ++ |
| 67 | ++if test "x$enable_relocatable" = xyes; then |
| 68 | ++ |
| 69 | ++printf "%s\n" "#define Py_ENABLE_RELOCATABLE 1" >>confdefs.h |
| 70 | ++ |
| 71 | ++ RELOCATABLE=yes |
| 72 | ++else |
| 73 | ++ RELOCATABLE=no |
| 74 | ++fi |
| 75 | ++ |
| 76 | ++ |
| 77 | + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking LDLIBRARY" >&5 |
| 78 | + printf %s "checking LDLIBRARY... " >&6; } |
| 79 | + |
| 80 | +diff --git a/configure.ac b/configure.ac |
| 81 | +index f244e0b71a6..b1c859071f4 100644 |
| 82 | +--- a/configure.ac |
| 83 | ++++ b/configure.ac |
| 84 | +@@ -1523,6 +1523,23 @@ if test "x$enable_profiling" = xyes; then |
| 85 | + LDFLAGS="-pg $LDFLAGS" |
| 86 | + fi |
| 87 | + |
| 88 | ++AC_MSG_CHECKING([for --enable-relocatable]) |
| 89 | ++AC_ARG_ENABLE([relocatable], |
| 90 | ++ AS_HELP_STRING([--enable-relocatable], [enable build of a relocatable Python distribution (default is no)])) |
| 91 | ++if test -z "$enable_relocatable" |
| 92 | ++then |
| 93 | ++ enable_relocatable="no" |
| 94 | ++fi |
| 95 | ++AC_MSG_RESULT([$enable_relocatable]) |
| 96 | ++ |
| 97 | ++if test "x$enable_relocatable" = xyes; then |
| 98 | ++ AC_DEFINE([Py_ENABLE_RELOCATABLE], [1], [Define if --enable-relocatable is used]) |
| 99 | ++ RELOCATABLE=yes |
| 100 | ++else |
| 101 | ++ RELOCATABLE=no |
| 102 | ++fi |
| 103 | ++AC_SUBST([RELOCATABLE]) |
| 104 | ++ |
| 105 | + AC_MSG_CHECKING([LDLIBRARY]) |
| 106 | + |
| 107 | + # Apple framework builds need more magic. LDLIBRARY is the dynamic |
| 108 | +diff --git a/pyconfig.h.in b/pyconfig.h.in |
| 109 | +index 72870411bc0..76fe6a9b52c 100644 |
| 110 | +--- a/pyconfig.h.in |
| 111 | ++++ b/pyconfig.h.in |
| 112 | +@@ -1733,6 +1733,9 @@ |
| 113 | + /* Define if you want to build an interpreter with many run-time checks. */ |
| 114 | + #undef Py_DEBUG |
| 115 | + |
| 116 | ++/* Define if --enable-relocatable is used */ |
| 117 | ++#undef Py_ENABLE_RELOCATABLE |
| 118 | ++ |
| 119 | + /* Defined if Python is built as a shared library. */ |
| 120 | + #undef Py_ENABLE_SHARED |
| 121 | + |
0 commit comments