From e26dd66028d4b21355dcfe0f893844d5e1f0043a Mon Sep 17 00:00:00 2001
From: Julien Palard <julien@palard.fr>
Date: Tue, 14 Mar 2023 15:27:18 +0100
Subject: [PATCH 1/2] Documenting --prefix and --exec-prefix.

---
 Doc/c-api/init.rst      |  2 +-
 Doc/c-api/intro.rst     | 10 +++++-----
 Doc/library/sys.rst     |  2 +-
 Doc/using/configure.rst | 16 ++++++++++++++++
 Doc/using/unix.rst      |  2 +-
 5 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index b50ee3b3803e29..38e324fb6409bc 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -513,7 +513,7 @@ Process-wide parameters
    program name is ``'/usr/local/bin/python'``, the prefix is ``'/usr/local'``. The
    returned string points into static storage; the caller should not modify its
    value.  This corresponds to the :makevar:`prefix` variable in the top-level
-   :file:`Makefile` and the ``--prefix`` argument to the :program:`configure`
+   :file:`Makefile` and the :option:`--prefix` argument to the :program:`configure`
    script at build time.  The value is available to Python code as ``sys.prefix``.
    It is only useful on Unix.  See also the next function.
 
diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst
index 85eb24a495b640..acd4e033dfbc4b 100644
--- a/Doc/c-api/intro.rst
+++ b/Doc/c-api/intro.rst
@@ -78,19 +78,19 @@ used by extension writers. Structure member names do not have a reserved prefix.
 
 The header files are typically installed with Python.  On Unix, these  are
 located in the directories :file:`{prefix}/include/pythonversion/` and
-:file:`{exec_prefix}/include/pythonversion/`, where :envvar:`prefix` and
-:envvar:`exec_prefix` are defined by the corresponding parameters to Python's
+:file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` and
+:option:`exec_prefix <--exec-prefix>` are defined by the corresponding parameters to Python's
 :program:`configure` script and *version* is
 ``'%d.%d' % sys.version_info[:2]``.  On Windows, the headers are installed
-in :file:`{prefix}/include`, where :envvar:`prefix` is the installation
+in :file:`{prefix}/include`, where ``prefix`` is the installation
 directory specified to the installer.
 
 To include the headers, place both directories (if different) on your compiler's
 search path for includes.  Do *not* place the parent directories on the search
 path and then use ``#include <pythonX.Y/Python.h>``; this will break on
 multi-platform builds since the platform independent headers under
-:envvar:`prefix` include the platform specific headers from
-:envvar:`exec_prefix`.
+:option:`prefix <--prefix>` include the platform specific headers from
+:option:`exec_prefix <--exec-prefix>`.
 
 C++ users should note that although the API is defined entirely using C, the
 header files properly declare the entry points to be ``extern "C"``. As a result,
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 23c5bbed0c6f9c..a2b1e5162dc753 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -1323,7 +1323,7 @@ always available.
 
    A string giving the site-specific directory prefix where the platform
    independent Python files are installed; on Unix, the default is
-   ``'/usr/local'``.  This can be set at build time with the ``--prefix``
+   ``'/usr/local'``.  This can be set at build time with the :option:`--prefix`
    argument to the :program:`configure` script.  See
    :ref:`installation_paths` for derived paths.
 
diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst
index 8936bd381c9d97..ce858ab2c8d79e 100644
--- a/Doc/using/configure.rst
+++ b/Doc/using/configure.rst
@@ -216,6 +216,22 @@ WebAssembly Options
 Install Options
 ---------------
 
+.. cmdoption:: --prefix=PREFIX
+
+   Install architecture-independent files in PREFIX. On Unix, it
+   defaults to :file:`/usr/local`.
+
+   This value can be retrived at runtime using :data:`sys.prefix`.
+
+   As an example, one can use ``--prefix="$HOME/.local/"`` to install
+   a Python in its home directory.
+
+.. cmdoption:: --exec-prefix=EPREFIX
+
+   Install architecture-dependent files in EPREFIX, defaults to :option:`--prefix`.
+
+   This value can be retrived at runtime using :data:`sys.exec_prefix`.
+
 .. cmdoption:: --disable-test-modules
 
    Don't build nor install test modules, like the :mod:`test` package or the
diff --git a/Doc/using/unix.rst b/Doc/using/unix.rst
index 24c02c99f871d5..067ff4cce5e48d 100644
--- a/Doc/using/unix.rst
+++ b/Doc/using/unix.rst
@@ -93,7 +93,7 @@ Python-related paths and files
 ==============================
 
 These are subject to difference depending on local installation conventions;
-:envvar:`prefix` (``${prefix}``) and :envvar:`exec_prefix` (``${exec_prefix}``)
+:option:`prefix <--prefix>` and :option:`exec_prefix <--exec-prefix>`
 are installation-dependent and should be interpreted as for GNU software; they
 may be the same.
 

From e2edebf4fa429ad622b9f5ff367407b32140dfdd Mon Sep 17 00:00:00 2001
From: Julien Palard <julien@palard.fr>
Date: Wed, 15 Mar 2023 13:20:55 +0100
Subject: [PATCH 2/2] Update Doc/library/sys.rst

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
---
 Doc/library/sys.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index a2b1e5162dc753..a53d4908783e15 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -1323,7 +1323,7 @@ always available.
 
    A string giving the site-specific directory prefix where the platform
    independent Python files are installed; on Unix, the default is
-   ``'/usr/local'``.  This can be set at build time with the :option:`--prefix`
+   :file:`/usr/local`. This can be set at build time with the :option:`--prefix`
    argument to the :program:`configure` script.  See
    :ref:`installation_paths` for derived paths.