2153 lines
161 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="3. Configure Python" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://docs.python.org/3/using/configure.html" />
<meta property="og:site_name" content="Python documentation" />
<meta property="og:description" content="Build Requirements: Features and minimum versions required to build CPython: A C11 compiler. Optional C11 features are not required., On Windows, Microsoft Visual Studio 2017 or later is required.,..." />
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
<meta property="og:image:alt" content="Python documentation" />
<meta name="description" content="Build Requirements: Features and minimum versions required to build CPython: A C11 compiler. Optional C11 features are not required., On Windows, Microsoft Visual Studio 2017 or later is required.,..." />
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<meta name="theme-color" content="#3776ab">
<title>3. Configure Python &#8212; Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=23252803" />
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />
<script src="../_static/documentation_options.js?v=5d57ca2d"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/sidebar.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Python 3.13.3 documentation"
href="../_static/opensearch.xml"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="copyright" title="Copyright" href="../copyright.html" />
<link rel="next" title="4. Using Python on Windows" href="windows.html" />
<link rel="prev" title="2. Using Python on Unix platforms" href="unix.html" />
<link rel="canonical" href="https://docs.python.org/3/using/configure.html">
<style>
@media only screen {
table.full-width-table {
width: 100%;
}
}
</style>
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
<script type="text/javascript" src="../_static/copybutton.js"></script>
<script type="text/javascript" src="../_static/menu.js"></script>
<script type="text/javascript" src="../_static/search-focus.js"></script>
<script type="text/javascript" src="../_static/themetoggle.js"></script>
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
<meta name="readthedocs-addons-api-version" content="1">
</head>
<body>
<div class="mobile-nav">
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
<nav class="nav-content" role="navigation">
<label for="menuToggler" class="toggler__label">
<span></span>
</label>
<span class="nav-items-wrapper">
<a href="https://www.python.org/" class="nav-logo">
<img src="../_static/py.svg" alt="Python logo"/>
</a>
<span class="version_switcher_placeholder"></span>
<form role="search" class="search" action="../search.html" method="get">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
</svg>
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
<input type="submit" value="Go"/>
</form>
</span>
</nav>
<div class="menu-wrapper">
<nav class="menu" role="navigation" aria-label="main navigation">
<div class="language_switcher_placeholder"></div>
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label>
<div>
<h3><a href="../contents.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">3. Configure Python</a><ul>
<li><a class="reference internal" href="#build-requirements">3.1. Build Requirements</a></li>
<li><a class="reference internal" href="#generated-files">3.2. Generated files</a><ul>
<li><a class="reference internal" href="#configure-script">3.2.1. configure script</a></li>
</ul>
</li>
<li><a class="reference internal" href="#configure-options">3.3. Configure Options</a><ul>
<li><a class="reference internal" href="#general-options">3.3.1. General Options</a></li>
<li><a class="reference internal" href="#c-compiler-options">3.3.2. C compiler options</a></li>
<li><a class="reference internal" href="#linker-options">3.3.3. Linker options</a></li>
<li><a class="reference internal" href="#options-for-third-party-dependencies">3.3.4. Options for third-party dependencies</a></li>
<li><a class="reference internal" href="#webassembly-options">3.3.5. WebAssembly Options</a></li>
<li><a class="reference internal" href="#install-options">3.3.6. Install Options</a></li>
<li><a class="reference internal" href="#performance-options">3.3.7. Performance options</a></li>
<li><a class="reference internal" href="#python-debug-build">3.3.8. Python Debug Build</a></li>
<li><a class="reference internal" href="#debug-options">3.3.9. Debug options</a></li>
<li><a class="reference internal" href="#id2">3.3.10. Linker options</a></li>
<li><a class="reference internal" href="#libraries-options">3.3.11. Libraries options</a></li>
<li><a class="reference internal" href="#security-options">3.3.12. Security Options</a></li>
<li><a class="reference internal" href="#macos-options">3.3.13. macOS Options</a></li>
<li><a class="reference internal" href="#ios-options">3.3.14. iOS Options</a></li>
<li><a class="reference internal" href="#cross-compiling-options">3.3.15. Cross Compiling Options</a></li>
</ul>
</li>
<li><a class="reference internal" href="#python-build-system">3.4. Python Build System</a><ul>
<li><a class="reference internal" href="#main-files-of-the-build-system">3.4.1. Main files of the build system</a></li>
<li><a class="reference internal" href="#main-build-steps">3.4.2. Main build steps</a></li>
<li><a class="reference internal" href="#main-makefile-targets">3.4.3. Main Makefile targets</a><ul>
<li><a class="reference internal" href="#make">3.4.3.1. make</a></li>
<li><a class="reference internal" href="#make-platform">3.4.3.2. make platform</a></li>
<li><a class="reference internal" href="#make-profile-opt">3.4.3.3. make profile-opt</a></li>
<li><a class="reference internal" href="#make-clean">3.4.3.4. make clean</a></li>
<li><a class="reference internal" href="#make-distclean">3.4.3.5. make distclean</a></li>
<li><a class="reference internal" href="#make-install">3.4.3.6. make install</a></li>
<li><a class="reference internal" href="#make-test">3.4.3.7. make test</a></li>
<li><a class="reference internal" href="#make-buildbottest">3.4.3.8. make buildbottest</a></li>
<li><a class="reference internal" href="#make-regen-all">3.4.3.9. make regen-all</a></li>
</ul>
</li>
<li><a class="reference internal" href="#c-extensions">3.4.4. C extensions</a></li>
</ul>
</li>
<li><a class="reference internal" href="#compiler-and-linker-flags">3.5. Compiler and linker flags</a><ul>
<li><a class="reference internal" href="#preprocessor-flags">3.5.1. Preprocessor flags</a></li>
<li><a class="reference internal" href="#compiler-flags">3.5.2. Compiler flags</a></li>
<li><a class="reference internal" href="#linker-flags">3.5.3. Linker flags</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="unix.html"
title="previous chapter"><span class="section-number">2. </span>Using Python on Unix platforms</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="windows.html"
title="next chapter"><span class="section-number">4. </span>Using Python on Windows</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../bugs.html">Report a Bug</a></li>
<li>
<a href="https://github.com/python/cpython/blob/main/Doc/using/configure.rst"
rel="nofollow">Show Source
</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="windows.html" title="4. Using Python on Windows"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="unix.html" title="2. Using Python on Unix platforms"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> &#187;</li>
<li class="switchers">
<div class="language_switcher_placeholder"></div>
<div class="version_switcher_placeholder"></div>
</li>
<li>
</li>
<li id="cpython-language-and-version">
<a href="../index.html">3.13.3 Documentation</a> &#187;
</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Python Setup and Usage</a> &#187;</li>
<li class="nav-item nav-item-this"><a href=""><span class="section-number">3. </span>Configure Python</a></li>
<li class="right">
<div class="inline-search" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
<input type="submit" value="Go" />
</form>
</div>
|
</li>
<li class="right">
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="configure-python">
<h1><span class="section-number">3. </span>Configure Python<a class="headerlink" href="#configure-python" title="Link to this heading"></a></h1>
<section id="build-requirements">
<h2><span class="section-number">3.1. </span>Build Requirements<a class="headerlink" href="#build-requirements" title="Link to this heading"></a></h2>
<p>Features and minimum versions required to build CPython:</p>
<ul class="simple">
<li><p>A <a class="reference external" href="https://en.cppreference.com/w/c/11">C11</a> compiler. <a class="reference external" href="https://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optional_features">Optional C11
features</a>
are not required.</p></li>
<li><p>On Windows, Microsoft Visual Studio 2017 or later is required.</p></li>
<li><p>Support for <a class="reference external" href="https://en.wikipedia.org/wiki/IEEE_754">IEEE 754</a>
floating-point numbers and <a class="reference external" href="https://en.wikipedia.org/wiki/NaN#Floating_point">floating-point Not-a-Number (NaN)</a>.</p></li>
<li><p>Support for threads.</p></li>
<li><p>OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended
minimum version for the <a class="reference internal" href="../library/ssl.html#module-ssl" title="ssl: TLS/SSL wrapper for socket objects"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ssl</span></code></a> and <a class="reference internal" href="../library/hashlib.html#module-hashlib" title="hashlib: Secure hash and message digest algorithms."><code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code></a> extension modules.</p></li>
<li><p>SQLite 3.15.2 for the <a class="reference internal" href="../library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlite3</span></code></a> extension module.</p></li>
<li><p>Tcl/Tk 8.5.12 for the <a class="reference internal" href="../library/tkinter.html#module-tkinter" title="tkinter: Interface to Tcl/Tk for graphical user interfaces"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter</span></code></a> module.</p></li>
<li><p>Autoconf 2.71 and aclocal 1.16.5 are required to regenerate the
<code class="file docutils literal notranslate"><span class="pre">configure</span></code> script.</p></li>
</ul>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.1: </span>Tcl/Tk version 8.3.1 is now required.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.5: </span>On Windows, Visual Studio 2015 or later is now required.
Tcl/Tk version 8.4 is now required.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.6: </span>Selected C99 features are now required, like <code class="docutils literal notranslate"><span class="pre">&lt;stdint.h&gt;</span></code> and <code class="docutils literal notranslate"><span class="pre">static</span>
<span class="pre">inline</span></code> functions.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.7: </span>Thread support and OpenSSL 1.0.2 are now required.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.10: </span>OpenSSL 1.1.1 is now required.
Require SQLite 3.7.15.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>C11 compiler, IEEE 754 and NaN support are now required.
On Windows, Visual Studio 2017 or later is required.
Tcl/Tk version 8.5.12 is now required for the <a class="reference internal" href="../library/tkinter.html#module-tkinter" title="tkinter: Interface to Tcl/Tk for graphical user interfaces"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter</span></code></a> module.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>Autoconf 2.71, aclocal 1.16.5 and SQLite 3.15.2 are now required.</p>
</div>
<p>See also <span class="target" id="index-0"></span><a class="pep reference external" href="https://peps.python.org/pep-0007/"><strong>PEP 7</strong></a> “Style Guide for C Code” and <span class="target" id="index-1"></span><a class="pep reference external" href="https://peps.python.org/pep-0011/"><strong>PEP 11</strong></a> “CPython platform
support”.</p>
</section>
<section id="generated-files">
<h2><span class="section-number">3.2. </span>Generated files<a class="headerlink" href="#generated-files" title="Link to this heading"></a></h2>
<p>To reduce build dependencies, Python source code contains multiple generated
files. Commands to regenerate all generated files:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>make<span class="w"> </span>regen-all
make<span class="w"> </span>regen-stdlib-module-names
make<span class="w"> </span>regen-limited-abi
make<span class="w"> </span>regen-configure
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">Makefile.pre.in</span></code> file documents generated files, their inputs, and tools used
to regenerate them. Search for <code class="docutils literal notranslate"><span class="pre">regen-*</span></code> make targets.</p>
<section id="configure-script">
<h3><span class="section-number">3.2.1. </span>configure script<a class="headerlink" href="#configure-script" title="Link to this heading"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">regen-configure</span></code> command regenerates the <code class="docutils literal notranslate"><span class="pre">aclocal.m4</span></code> file and
the <code class="docutils literal notranslate"><span class="pre">configure</span></code> script using the <code class="docutils literal notranslate"><span class="pre">Tools/build/regen-configure.sh</span></code> shell
script which uses an Ubuntu container to get the same tools versions and have a
reproducible output.</p>
<p>The container is optional, the following command can be run locally:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>autoreconf<span class="w"> </span>-ivf<span class="w"> </span>-Werror
</pre></div>
</div>
<p>The generated files can change depending on the exact <code class="docutils literal notranslate"><span class="pre">autoconf-archive</span></code>,
<code class="docutils literal notranslate"><span class="pre">aclocal</span></code> and <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code> versions.</p>
</section>
</section>
<section id="configure-options">
<span id="id1"></span><h2><span class="section-number">3.3. </span>Configure Options<a class="headerlink" href="#configure-options" title="Link to this heading"></a></h2>
<p>List all <code class="file docutils literal notranslate"><span class="pre">configure</span></code> script options using:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>./configure<span class="w"> </span>--help
</pre></div>
</div>
<p>See also the <code class="file docutils literal notranslate"><span class="pre">Misc/SpecialBuilds.txt</span></code> in the Python source distribution.</p>
<section id="general-options">
<h3><span class="section-number">3.3.1. </span>General Options<a class="headerlink" href="#general-options" title="Link to this heading"></a></h3>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-loadable-sqlite-extensions">
<span class="sig-name descname"><span class="pre">--enable-loadable-sqlite-extensions</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-loadable-sqlite-extensions" title="Link to this definition"></a></dt>
<dd><p>Support loadable extensions in the <code class="xref py py-mod docutils literal notranslate"><span class="pre">_sqlite</span></code> extension module (default
is no) of the <a class="reference internal" href="../library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlite3</span></code></a> module.</p>
<p>See the <a class="reference internal" href="../library/sqlite3.html#sqlite3.Connection.enable_load_extension" title="sqlite3.Connection.enable_load_extension"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlite3.Connection.enable_load_extension()</span></code></a> method of the
<a class="reference internal" href="../library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlite3</span></code></a> module.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-disable-ipv6">
<span class="sig-name descname"><span class="pre">--disable-ipv6</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-disable-ipv6" title="Link to this definition"></a></dt>
<dd><p>Disable IPv6 support (enabled by default if supported), see the
<a class="reference internal" href="../library/socket.html#module-socket" title="socket: Low-level networking interface."><code class="xref py py-mod docutils literal notranslate"><span class="pre">socket</span></code></a> module.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-big-digits">
<span class="sig-name descname"><span class="pre">--enable-big-digits</span></span><span class="sig-prename descclassname"><span class="pre">=[15|30]</span></span><a class="headerlink" href="#cmdoption-enable-big-digits" title="Link to this definition"></a></dt>
<dd><p>Define the size in bits of Python <a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a> digits: 15 or 30 bits.</p>
<p>By default, the digit size is 30.</p>
<p>Define the <code class="docutils literal notranslate"><span class="pre">PYLONG_BITS_IN_DIGIT</span></code> to <code class="docutils literal notranslate"><span class="pre">15</span></code> or <code class="docutils literal notranslate"><span class="pre">30</span></code>.</p>
<p>See <a class="reference internal" href="../library/sys.html#sys.int_info" title="sys.int_info"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.int_info.bits_per_digit</span></code></a>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-suffix">
<span class="sig-name descname"><span class="pre">--with-suffix</span></span><span class="sig-prename descclassname"><span class="pre">=SUFFIX</span></span><a class="headerlink" href="#cmdoption-with-suffix" title="Link to this definition"></a></dt>
<dd><p>Set the Python executable suffix to <em>SUFFIX</em>.</p>
<p>The default suffix is <code class="docutils literal notranslate"><span class="pre">.exe</span></code> on Windows and macOS (<code class="docutils literal notranslate"><span class="pre">python.exe</span></code>
executable), <code class="docutils literal notranslate"><span class="pre">.js</span></code> on Emscripten node, <code class="docutils literal notranslate"><span class="pre">.html</span></code> on Emscripten browser,
<code class="docutils literal notranslate"><span class="pre">.wasm</span></code> on WASI, and an empty string on other platforms (<code class="docutils literal notranslate"><span class="pre">python</span></code>
executable).</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>The default suffix on WASM platform is one of <code class="docutils literal notranslate"><span class="pre">.js</span></code>, <code class="docutils literal notranslate"><span class="pre">.html</span></code>
or <code class="docutils literal notranslate"><span class="pre">.wasm</span></code>.</p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-tzpath">
<span class="sig-name descname"><span class="pre">--with-tzpath</span></span><span class="sig-prename descclassname"><span class="pre">=&lt;list</span> <span class="pre">of</span> <span class="pre">absolute</span> <span class="pre">paths</span> <span class="pre">separated</span> <span class="pre">by</span> <span class="pre">pathsep&gt;</span></span><a class="headerlink" href="#cmdoption-with-tzpath" title="Link to this definition"></a></dt>
<dd><p>Select the default time zone search path for <a class="reference internal" href="../library/zoneinfo.html#zoneinfo.TZPATH" title="zoneinfo.TZPATH"><code class="xref py py-const docutils literal notranslate"><span class="pre">zoneinfo.TZPATH</span></code></a>.
See the <a class="reference internal" href="../library/zoneinfo.html#zoneinfo-data-compile-time-config"><span class="std std-ref">Compile-time configuration</span></a> of the <a class="reference internal" href="../library/zoneinfo.html#module-zoneinfo" title="zoneinfo: IANA time zone support"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zoneinfo</span></code></a> module.</p>
<p>Default: <code class="docutils literal notranslate"><span class="pre">/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo</span></code>.</p>
<p>See <a class="reference internal" href="../library/os.html#os.pathsep" title="os.pathsep"><code class="xref py py-data docutils literal notranslate"><span class="pre">os.pathsep</span></code></a> path separator.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-without-decimal-contextvar">
<span class="sig-name descname"><span class="pre">--without-decimal-contextvar</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-decimal-contextvar" title="Link to this definition"></a></dt>
<dd><p>Build the <code class="docutils literal notranslate"><span class="pre">_decimal</span></code> extension module using a thread-local context rather
than a coroutine-local context (default), see the <a class="reference internal" href="../library/decimal.html#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code class="xref py py-mod docutils literal notranslate"><span class="pre">decimal</span></code></a> module.</p>
<p>See <a class="reference internal" href="../library/decimal.html#decimal.HAVE_CONTEXTVAR" title="decimal.HAVE_CONTEXTVAR"><code class="xref py py-const docutils literal notranslate"><span class="pre">decimal.HAVE_CONTEXTVAR</span></code></a> and the <a class="reference internal" href="../library/contextvars.html#module-contextvars" title="contextvars: Context Variables"><code class="xref py py-mod docutils literal notranslate"><span class="pre">contextvars</span></code></a> module.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-dbmliborder">
<span class="sig-name descname"><span class="pre">--with-dbmliborder</span></span><span class="sig-prename descclassname"><span class="pre">=&lt;list</span> <span class="pre">of</span> <span class="pre">backend</span> <span class="pre">names&gt;</span></span><a class="headerlink" href="#cmdoption-with-dbmliborder" title="Link to this definition"></a></dt>
<dd><p>Override order to check db backends for the <a class="reference internal" href="../library/dbm.html#module-dbm" title="dbm: Interfaces to various Unix &quot;database&quot; formats."><code class="xref py py-mod docutils literal notranslate"><span class="pre">dbm</span></code></a> module</p>
<p>A valid value is a colon (<code class="docutils literal notranslate"><span class="pre">:</span></code>) separated string with the backend names:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">ndbm</span></code>;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">gdbm</span></code>;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">bdb</span></code>.</p></li>
</ul>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-without-c-locale-coercion">
<span class="sig-name descname"><span class="pre">--without-c-locale-coercion</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-c-locale-coercion" title="Link to this definition"></a></dt>
<dd><p>Disable C locale coercion to a UTF-8 based locale (enabled by default).</p>
<p>Dont define the <code class="docutils literal notranslate"><span class="pre">PY_COERCE_C_LOCALE</span></code> macro.</p>
<p>See <span class="target" id="index-2"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONCOERCECLOCALE"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONCOERCECLOCALE</span></code></a> and the <span class="target" id="index-3"></span><a class="pep reference external" href="https://peps.python.org/pep-0538/"><strong>PEP 538</strong></a>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-without-freelists">
<span class="sig-name descname"><span class="pre">--without-freelists</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-freelists" title="Link to this definition"></a></dt>
<dd><p>Disable all freelists except the empty tuple singleton.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-platlibdir">
<span class="sig-name descname"><span class="pre">--with-platlibdir</span></span><span class="sig-prename descclassname"><span class="pre">=DIRNAME</span></span><a class="headerlink" href="#cmdoption-with-platlibdir" title="Link to this definition"></a></dt>
<dd><p>Python library directory name (default is <code class="docutils literal notranslate"><span class="pre">lib</span></code>).</p>
<p>Fedora and SuSE use <code class="docutils literal notranslate"><span class="pre">lib64</span></code> on 64-bit platforms.</p>
<p>See <a class="reference internal" href="../library/sys.html#sys.platlibdir" title="sys.platlibdir"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.platlibdir</span></code></a>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-wheel-pkg-dir">
<span class="sig-name descname"><span class="pre">--with-wheel-pkg-dir</span></span><span class="sig-prename descclassname"><span class="pre">=PATH</span></span><a class="headerlink" href="#cmdoption-with-wheel-pkg-dir" title="Link to this definition"></a></dt>
<dd><p>Directory of wheel packages used by the <a class="reference internal" href="../library/ensurepip.html#module-ensurepip" title="ensurepip: Bootstrapping the &quot;pip&quot; installer into an existing Python installation or virtual environment."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ensurepip</span></code></a> module
(none by default).</p>
<p>Some Linux distribution packaging policies recommend against bundling
dependencies. For example, Fedora installs wheel packages in the
<code class="docutils literal notranslate"><span class="pre">/usr/share/python-wheels/</span></code> directory and dont install the
<code class="xref py py-mod docutils literal notranslate"><span class="pre">ensurepip._bundled</span></code> package.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-pkg-config">
<span class="sig-name descname"><span class="pre">--with-pkg-config</span></span><span class="sig-prename descclassname"><span class="pre">=[check|yes|no]</span></span><a class="headerlink" href="#cmdoption-with-pkg-config" title="Link to this definition"></a></dt>
<dd><p>Whether configure should use <strong class="program">pkg-config</strong> to detect build
dependencies.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">check</span></code> (default): <strong class="program">pkg-config</strong> is optional</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">yes</span></code>: <strong class="program">pkg-config</strong> is mandatory</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">no</span></code>: configure does not use <strong class="program">pkg-config</strong> even when present</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-pystats">
<span class="sig-name descname"><span class="pre">--enable-pystats</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-pystats" title="Link to this definition"></a></dt>
<dd><p>Turn on internal Python performance statistics gathering.</p>
<p>By default, statistics gathering is off. Use <code class="docutils literal notranslate"><span class="pre">python3</span> <span class="pre">-X</span> <span class="pre">pystats</span></code> command
or set <code class="docutils literal notranslate"><span class="pre">PYTHONSTATS=1</span></code> environment variable to turn on statistics
gathering at Python startup.</p>
<p>At Python exit, dump statistics if statistics gathering was on and not
cleared.</p>
<p>Effects:</p>
<ul class="simple">
<li><p>Add <a class="reference internal" href="cmdline.html#cmdoption-X"><code class="xref std std-option docutils literal notranslate"><span class="pre">-X</span> <span class="pre">pystats</span></code></a> command line option.</p></li>
<li><p>Add <code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONSTATS</span></code> environment variable.</p></li>
<li><p>Define the <code class="docutils literal notranslate"><span class="pre">Py_STATS</span></code> macro.</p></li>
<li><p>Add functions to the <a class="reference internal" href="../library/sys.html#module-sys" title="sys: Access system-specific parameters and functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys</span></code></a> module:</p>
<ul>
<li><p><code class="xref py py-func docutils literal notranslate"><span class="pre">sys._stats_on()</span></code>: Turns on statistics gathering.</p></li>
<li><p><code class="xref py py-func docutils literal notranslate"><span class="pre">sys._stats_off()</span></code>: Turns off statistics gathering.</p></li>
<li><p><code class="xref py py-func docutils literal notranslate"><span class="pre">sys._stats_clear()</span></code>: Clears the statistics.</p></li>
<li><p><code class="xref py py-func docutils literal notranslate"><span class="pre">sys._stats_dump()</span></code>: Dump statistics to file, and clears the statistics.</p></li>
</ul>
</li>
</ul>
<p>The statistics will be dumped to a arbitrary (probably unique) file in
<code class="docutils literal notranslate"><span class="pre">/tmp/py_stats/</span></code> (Unix) or <code class="docutils literal notranslate"><span class="pre">C:\temp\py_stats\</span></code> (Windows). If that
directory does not exist, results will be printed on stderr.</p>
<p>Use <code class="docutils literal notranslate"><span class="pre">Tools/scripts/summarize_stats.py</span></code> to read the stats.</p>
<p>Statistics:</p>
<ul class="simple">
<li><p>Opcode:</p>
<ul>
<li><p>Specialization: success, failure, hit, deferred, miss, deopt, failures;</p></li>
<li><p>Execution count;</p></li>
<li><p>Pair count.</p></li>
</ul>
</li>
<li><p>Call:</p>
<ul>
<li><p>Inlined Python calls;</p></li>
<li><p>PyEval calls;</p></li>
<li><p>Frames pushed;</p></li>
<li><p>Frame object created;</p></li>
<li><p>Eval calls: vector, generator, legacy, function VECTORCALL, build class,
slot, function “ex”, API, method.</p></li>
</ul>
</li>
<li><p>Object:</p>
<ul>
<li><p>incref and decref;</p></li>
<li><p>interpreter incref and decref;</p></li>
<li><p>allocations: all, 512 bytes, 4 kiB, big;</p></li>
<li><p>free;</p></li>
<li><p>to/from free lists;</p></li>
<li><p>dictionary materialized/dematerialized;</p></li>
<li><p>type cache;</p></li>
<li><p>optimization attempts;</p></li>
<li><p>optimization traces created/executed;</p></li>
<li><p>uops executed.</p></li>
</ul>
</li>
<li><p>Garbage collector:</p>
<ul>
<li><p>Garbage collections;</p></li>
<li><p>Objects visited;</p></li>
<li><p>Objects collected.</p></li>
</ul>
</li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std option" id="free-threading-build">
<dt class="sig sig-object std" id="cmdoption-disable-gil">
<span class="sig-name descname"><span class="pre">--disable-gil</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-disable-gil" title="Link to this definition"></a></dt>
<dd><p>Enables <strong>experimental</strong> support for running Python without the
<a class="reference internal" href="../glossary.html#term-global-interpreter-lock"><span class="xref std std-term">global interpreter lock</span></a> (GIL): free threading build.</p>
<p>Defines the <code class="docutils literal notranslate"><span class="pre">Py_GIL_DISABLED</span></code> macro and adds <code class="docutils literal notranslate"><span class="pre">&quot;t&quot;</span></code> to
<a class="reference internal" href="../library/sys.html#sys.abiflags" title="sys.abiflags"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.abiflags</span></code></a>.</p>
<p>See <a class="reference internal" href="../whatsnew/3.13.html#whatsnew313-free-threaded-cpython"><span class="std std-ref">Free-threaded CPython</span></a> for more detail.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-experimental-jit">
<span class="sig-name descname"><span class="pre">--enable-experimental-jit</span></span><span class="sig-prename descclassname"><span class="pre">=[no|yes|yes-off|interpreter]</span></span><a class="headerlink" href="#cmdoption-enable-experimental-jit" title="Link to this definition"></a></dt>
<dd><p>Indicate how to integrate the <a class="reference internal" href="../whatsnew/3.13.html#whatsnew313-jit-compiler"><span class="std std-ref">JIT compiler</span></a>.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">no</span></code> - build the interpreter without the JIT.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">yes</span></code> - build the interpreter with the JIT.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">yes-off</span></code> - build the interpreter with the JIT but disable it by default.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">interpreter</span></code> - build the interpreter without the JIT, but with the tier 2 enabled interpreter.</p></li>
</ul>
<p>By convention, <code class="docutils literal notranslate"><span class="pre">--enable-experimental-jit</span></code> is a shorthand for <code class="docutils literal notranslate"><span class="pre">--enable-experimental-jit=yes</span></code>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>When building CPython with JIT enabled, ensure that your system has Python 3.11 or later installed.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-PKG_CONFIG">
<span class="sig-name descname"><span class="pre">PKG_CONFIG</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-PKG_CONFIG" title="Link to this definition"></a></dt>
<dd><p>Path to <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code> utility.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-PKG_CONFIG_LIBDIR">
<span class="sig-name descname"><span class="pre">PKG_CONFIG_LIBDIR</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-PKG_CONFIG_LIBDIR" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-PKG_CONFIG_PATH">
<span class="sig-name descname"><span class="pre">PKG_CONFIG_PATH</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-PKG_CONFIG_PATH" title="Link to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">pkg-config</span></code> options.</p>
</dd></dl>
</section>
<section id="c-compiler-options">
<h3><span class="section-number">3.3.2. </span>C compiler options<a class="headerlink" href="#c-compiler-options" title="Link to this heading"></a></h3>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-CC">
<span class="sig-name descname"><span class="pre">CC</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-CC" title="Link to this definition"></a></dt>
<dd><p>C compiler command.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-CFLAGS">
<span class="sig-name descname"><span class="pre">CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-CFLAGS" title="Link to this definition"></a></dt>
<dd><p>C compiler flags.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-CPP">
<span class="sig-name descname"><span class="pre">CPP</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-CPP" title="Link to this definition"></a></dt>
<dd><p>C preprocessor command.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-CPPFLAGS">
<span class="sig-name descname"><span class="pre">CPPFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-CPPFLAGS" title="Link to this definition"></a></dt>
<dd><p>C preprocessor flags, e.g. <code class="samp docutils literal notranslate"><span class="pre">-I</span><em><span class="pre">include_dir</span></em></code>.</p>
</dd></dl>
</section>
<section id="linker-options">
<h3><span class="section-number">3.3.3. </span>Linker options<a class="headerlink" href="#linker-options" title="Link to this heading"></a></h3>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LDFLAGS">
<span class="sig-name descname"><span class="pre">LDFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LDFLAGS" title="Link to this definition"></a></dt>
<dd><p>Linker flags, e.g. <code class="samp docutils literal notranslate"><span class="pre">-L</span><em><span class="pre">library_directory</span></em></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBS">
<span class="sig-name descname"><span class="pre">LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBS" title="Link to this definition"></a></dt>
<dd><p>Libraries to pass to the linker, e.g. <code class="samp docutils literal notranslate"><span class="pre">-l</span><em><span class="pre">library</span></em></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-MACHDEP">
<span class="sig-name descname"><span class="pre">MACHDEP</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-MACHDEP" title="Link to this definition"></a></dt>
<dd><p>Name for machine-dependent library files.</p>
</dd></dl>
</section>
<section id="options-for-third-party-dependencies">
<h3><span class="section-number">3.3.4. </span>Options for third-party dependencies<a class="headerlink" href="#options-for-third-party-dependencies" title="Link to this heading"></a></h3>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-BZIP2_CFLAGS">
<span class="sig-name descname"><span class="pre">BZIP2_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-BZIP2_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-BZIP2_LIBS">
<span class="sig-name descname"><span class="pre">BZIP2_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-BZIP2_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags to link Python to <code class="docutils literal notranslate"><span class="pre">libbz2</span></code>, used by <a class="reference internal" href="../library/bz2.html#module-bz2" title="bz2: Interfaces for bzip2 compression and decompression."><code class="xref py py-mod docutils literal notranslate"><span class="pre">bz2</span></code></a>
module, overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-CURSES_CFLAGS">
<span class="sig-name descname"><span class="pre">CURSES_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-CURSES_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-CURSES_LIBS">
<span class="sig-name descname"><span class="pre">CURSES_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-CURSES_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libncurses</span></code> or <code class="docutils literal notranslate"><span class="pre">libncursesw</span></code>, used by
<a class="reference internal" href="../library/curses.html#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code></a> module, overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-GDBM_CFLAGS">
<span class="sig-name descname"><span class="pre">GDBM_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-GDBM_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-GDBM_LIBS">
<span class="sig-name descname"><span class="pre">GDBM_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-GDBM_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">gdbm</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBB2_CFLAGS">
<span class="sig-name descname"><span class="pre">LIBB2_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBB2_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBB2_LIBS">
<span class="sig-name descname"><span class="pre">LIBB2_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBB2_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libb2</span></code> (<a class="reference internal" href="../library/hashlib.html#hashlib-blake2"><span class="std std-ref">BLAKE2</span></a>),
used by <a class="reference internal" href="../library/hashlib.html#module-hashlib" title="hashlib: Secure hash and message digest algorithms."><code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code></a> module, overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBEDIT_CFLAGS">
<span class="sig-name descname"><span class="pre">LIBEDIT_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBEDIT_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBEDIT_LIBS">
<span class="sig-name descname"><span class="pre">LIBEDIT_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBEDIT_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libedit</span></code>, used by <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">readline</span></code></a> module,
overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBFFI_CFLAGS">
<span class="sig-name descname"><span class="pre">LIBFFI_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBFFI_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBFFI_LIBS">
<span class="sig-name descname"><span class="pre">LIBFFI_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBFFI_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libffi</span></code>, used by <a class="reference internal" href="../library/ctypes.html#module-ctypes" title="ctypes: A foreign function library for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ctypes</span></code></a> module,
overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBMPDEC_CFLAGS">
<span class="sig-name descname"><span class="pre">LIBMPDEC_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBMPDEC_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBMPDEC_LIBS">
<span class="sig-name descname"><span class="pre">LIBMPDEC_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBMPDEC_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libmpdec</span></code>, used by <a class="reference internal" href="../library/decimal.html#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code class="xref py py-mod docutils literal notranslate"><span class="pre">decimal</span></code></a> module,
overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>These environment variables have no effect unless
<a class="reference internal" href="#cmdoption-with-system-libmpdec"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-system-libmpdec</span></code></a> is specified.</p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBLZMA_CFLAGS">
<span class="sig-name descname"><span class="pre">LIBLZMA_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBLZMA_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBLZMA_LIBS">
<span class="sig-name descname"><span class="pre">LIBLZMA_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBLZMA_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">liblzma</span></code>, used by <a class="reference internal" href="../library/lzma.html#module-lzma" title="lzma: A Python wrapper for the liblzma compression library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">lzma</span></code></a> module,
overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBREADLINE_CFLAGS">
<span class="sig-name descname"><span class="pre">LIBREADLINE_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBREADLINE_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBREADLINE_LIBS">
<span class="sig-name descname"><span class="pre">LIBREADLINE_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBREADLINE_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libreadline</span></code>, used by <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">readline</span></code></a>
module, overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBSQLITE3_CFLAGS">
<span class="sig-name descname"><span class="pre">LIBSQLITE3_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBSQLITE3_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBSQLITE3_LIBS">
<span class="sig-name descname"><span class="pre">LIBSQLITE3_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBSQLITE3_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libsqlite3</span></code>, used by <a class="reference internal" href="../library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlite3</span></code></a>
module, overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBUUID_CFLAGS">
<span class="sig-name descname"><span class="pre">LIBUUID_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBUUID_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-LIBUUID_LIBS">
<span class="sig-name descname"><span class="pre">LIBUUID_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-LIBUUID_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libuuid</span></code>, used by <a class="reference internal" href="../library/uuid.html#module-uuid" title="uuid: UUID objects (universally unique identifiers) according to RFC 4122"><code class="xref py py-mod docutils literal notranslate"><span class="pre">uuid</span></code></a> module,
overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-PANEL_CFLAGS">
<span class="sig-name descname"><span class="pre">PANEL_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-PANEL_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-PANEL_LIBS">
<span class="sig-name descname"><span class="pre">PANEL_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-PANEL_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for PANEL, overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
<p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libpanel</span></code> or <code class="docutils literal notranslate"><span class="pre">libpanelw</span></code>, used by
<a class="reference internal" href="../library/curses.panel.html#module-curses.panel" title="curses.panel: A panel stack extension that adds depth to curses windows."><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.panel</span></code></a> module, overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-TCLTK_CFLAGS">
<span class="sig-name descname"><span class="pre">TCLTK_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-TCLTK_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-TCLTK_LIBS">
<span class="sig-name descname"><span class="pre">TCLTK_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-TCLTK_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for TCLTK, overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-ZLIB_CFLAGS">
<span class="sig-name descname"><span class="pre">ZLIB_CFLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-ZLIB_CFLAGS" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-ZLIB_LIBS">
<span class="sig-name descname"><span class="pre">ZLIB_LIBS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-ZLIB_LIBS" title="Link to this definition"></a></dt>
<dd><p>C compiler and linker flags for <code class="docutils literal notranslate"><span class="pre">libzlib</span></code>, used by <a class="reference internal" href="../library/gzip.html#module-gzip" title="gzip: Interfaces for gzip compression and decompression using file objects."><code class="xref py py-mod docutils literal notranslate"><span class="pre">gzip</span></code></a> module,
overriding <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>.</p>
</dd></dl>
</section>
<section id="webassembly-options">
<h3><span class="section-number">3.3.5. </span>WebAssembly Options<a class="headerlink" href="#webassembly-options" title="Link to this heading"></a></h3>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-emscripten-target">
<span class="sig-name descname"><span class="pre">--with-emscripten-target</span></span><span class="sig-prename descclassname"><span class="pre">=[browser|node]</span></span><a class="headerlink" href="#cmdoption-with-emscripten-target" title="Link to this definition"></a></dt>
<dd><p>Set build flavor for <code class="docutils literal notranslate"><span class="pre">wasm32-emscripten</span></code>.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">browser</span></code> (default): preload minimal stdlib, default MEMFS.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">node</span></code>: NODERAWFS and pthread support.</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-wasm-dynamic-linking">
<span class="sig-name descname"><span class="pre">--enable-wasm-dynamic-linking</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-wasm-dynamic-linking" title="Link to this definition"></a></dt>
<dd><p>Turn on dynamic linking support for WASM.</p>
<p>Dynamic linking enables <code class="docutils literal notranslate"><span class="pre">dlopen</span></code>. File size of the executable
increases due to limited dead code elimination and additional features.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-wasm-pthreads">
<span class="sig-name descname"><span class="pre">--enable-wasm-pthreads</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-wasm-pthreads" title="Link to this definition"></a></dt>
<dd><p>Turn on pthreads support for WASM.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
</section>
<section id="install-options">
<h3><span class="section-number">3.3.6. </span>Install Options<a class="headerlink" href="#install-options" title="Link to this heading"></a></h3>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-prefix">
<span class="sig-name descname"><span class="pre">--prefix</span></span><span class="sig-prename descclassname"><span class="pre">=PREFIX</span></span><a class="headerlink" href="#cmdoption-prefix" title="Link to this definition"></a></dt>
<dd><p>Install architecture-independent files in PREFIX. On Unix, it
defaults to <code class="file docutils literal notranslate"><span class="pre">/usr/local</span></code>.</p>
<p>This value can be retrieved at runtime using <a class="reference internal" href="../library/sys.html#sys.prefix" title="sys.prefix"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.prefix</span></code></a>.</p>
<p>As an example, one can use <code class="docutils literal notranslate"><span class="pre">--prefix=&quot;$HOME/.local/&quot;</span></code> to install
a Python in its home directory.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-exec-prefix">
<span class="sig-name descname"><span class="pre">--exec-prefix</span></span><span class="sig-prename descclassname"><span class="pre">=EPREFIX</span></span><a class="headerlink" href="#cmdoption-exec-prefix" title="Link to this definition"></a></dt>
<dd><p>Install architecture-dependent files in EPREFIX, defaults to <a class="reference internal" href="#cmdoption-prefix"><code class="xref std std-option docutils literal notranslate"><span class="pre">--prefix</span></code></a>.</p>
<p>This value can be retrieved at runtime using <a class="reference internal" href="../library/sys.html#sys.exec_prefix" title="sys.exec_prefix"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.exec_prefix</span></code></a>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-disable-test-modules">
<span class="sig-name descname"><span class="pre">--disable-test-modules</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-disable-test-modules" title="Link to this definition"></a></dt>
<dd><p>Dont build nor install test modules, like the <a class="reference internal" href="../library/test.html#module-test" title="test: Regression tests package containing the testing suite for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">test</span></code></a> package or the
<code class="xref py py-mod docutils literal notranslate"><span class="pre">_testcapi</span></code> extension module (built and installed by default).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-ensurepip">
<span class="sig-name descname"><span class="pre">--with-ensurepip</span></span><span class="sig-prename descclassname"><span class="pre">=[upgrade|install|no]</span></span><a class="headerlink" href="#cmdoption-with-ensurepip" title="Link to this definition"></a></dt>
<dd><p>Select the <a class="reference internal" href="../library/ensurepip.html#module-ensurepip" title="ensurepip: Bootstrapping the &quot;pip&quot; installer into an existing Python installation or virtual environment."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ensurepip</span></code></a> command run on Python installation:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">upgrade</span></code> (default): run <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">ensurepip</span> <span class="pre">--altinstall</span> <span class="pre">--upgrade</span></code>
command.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">install</span></code>: run <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">ensurepip</span> <span class="pre">--altinstall</span></code> command;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">no</span></code>: dont run ensurepip;</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
</section>
<section id="performance-options">
<h3><span class="section-number">3.3.7. </span>Performance options<a class="headerlink" href="#performance-options" title="Link to this heading"></a></h3>
<p>Configuring Python using <code class="docutils literal notranslate"><span class="pre">--enable-optimizations</span> <span class="pre">--with-lto</span></code> (PGO + LTO) is
recommended for best performance. The experimental <code class="docutils literal notranslate"><span class="pre">--enable-bolt</span></code> flag can
also be used to improve performance.</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-optimizations">
<span class="sig-name descname"><span class="pre">--enable-optimizations</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-optimizations" title="Link to this definition"></a></dt>
<dd><p>Enable Profile Guided Optimization (PGO) using <span class="target" id="index-4"></span><a class="reference internal" href="#envvar-PROFILE_TASK"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PROFILE_TASK</span></code></a>
(disabled by default).</p>
<p>The C compiler Clang requires <code class="docutils literal notranslate"><span class="pre">llvm-profdata</span></code> program for PGO. On
macOS, GCC also requires it: GCC is just an alias to Clang on macOS.</p>
<p>Disable also semantic interposition in libpython if <code class="docutils literal notranslate"><span class="pre">--enable-shared</span></code> and
GCC is used: add <code class="docutils literal notranslate"><span class="pre">-fno-semantic-interposition</span></code> to the compiler and linker
flags.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>During the build, you may encounter compiler warnings about
profile data not being available for some source files.
These warnings are harmless, as only a subset of the code is exercised
during profile data acquisition.
To disable these warnings on Clang, manually suppress them by adding
<code class="docutils literal notranslate"><span class="pre">-Wno-profile-instr-unprofiled</span></code> to <span class="target" id="index-5"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a>.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.10: </span>Use <code class="docutils literal notranslate"><span class="pre">-fno-semantic-interposition</span></code> on GCC.</p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PROFILE_TASK">
<span class="sig-name descname"><span class="pre">PROFILE_TASK</span></span><a class="headerlink" href="#envvar-PROFILE_TASK" title="Link to this definition"></a></dt>
<dd><p>Environment variable used in the Makefile: Python command line arguments for
the PGO generation task.</p>
<p>Default: <code class="docutils literal notranslate"><span class="pre">-m</span> <span class="pre">test</span> <span class="pre">--pgo</span> <span class="pre">--timeout=$(TESTTIMEOUT)</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.8.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>Task failure is no longer ignored silently.</p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-lto">
<span class="sig-name descname"><span class="pre">--with-lto</span></span><span class="sig-prename descclassname"><span class="pre">=[full|thin|no|yes]</span></span><a class="headerlink" href="#cmdoption-with-lto" title="Link to this definition"></a></dt>
<dd><p>Enable Link Time Optimization (LTO) in any build (disabled by default).</p>
<p>The C compiler Clang requires <code class="docutils literal notranslate"><span class="pre">llvm-ar</span></code> for LTO (<code class="docutils literal notranslate"><span class="pre">ar</span></code> on macOS), as well
as an LTO-aware linker (<code class="docutils literal notranslate"><span class="pre">ld.gold</span></code> or <code class="docutils literal notranslate"><span class="pre">lld</span></code>).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11: </span>To use ThinLTO feature, use <code class="docutils literal notranslate"><span class="pre">--with-lto=thin</span></code> on Clang.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>Use ThinLTO as the default optimization policy on Clang if the compiler accepts the flag.</p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-bolt">
<span class="sig-name descname"><span class="pre">--enable-bolt</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-bolt" title="Link to this definition"></a></dt>
<dd><p>Enable usage of the <a class="reference external" href="https://github.com/llvm/llvm-project/tree/main/bolt">BOLT post-link binary optimizer</a> (disabled by
default).</p>
<p>BOLT is part of the LLVM project but is not always included in their binary
distributions. This flag requires that <code class="docutils literal notranslate"><span class="pre">llvm-bolt</span></code> and <code class="docutils literal notranslate"><span class="pre">merge-fdata</span></code>
are available.</p>
<p>BOLT is still a fairly new project so this flag should be considered
experimental for now. Because this tool operates on machine code its success
is dependent on a combination of the build environment + the other
optimization configure args + the CPU architecture, and not all combinations
are supported.
BOLT versions before LLVM 16 are known to crash BOLT under some scenarios.
Use of LLVM 16 or newer for BOLT optimization is strongly encouraged.</p>
<p>The <code class="xref std std-envvar docutils literal notranslate"><span class="pre">BOLT_INSTRUMENT_FLAGS</span></code> and <code class="xref std std-envvar docutils literal notranslate"><span class="pre">BOLT_APPLY_FLAGS</span></code>
<strong class="program">configure</strong> variables can be defined to override the default set of
arguments for <strong class="program">llvm-bolt</strong> to instrument and apply BOLT data to
binaries, respectively.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-BOLT_APPLY_FLAGS">
<span class="sig-name descname"><span class="pre">BOLT_APPLY_FLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-BOLT_APPLY_FLAGS" title="Link to this definition"></a></dt>
<dd><p>Arguments to <code class="docutils literal notranslate"><span class="pre">llvm-bolt</span></code> when creating a <a class="reference external" href="https://github.com/facebookarchive/BOLT">BOLT optimized binary</a>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-BOLT_INSTRUMENT_FLAGS">
<span class="sig-name descname"><span class="pre">BOLT_INSTRUMENT_FLAGS</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-BOLT_INSTRUMENT_FLAGS" title="Link to this definition"></a></dt>
<dd><p>Arguments to <code class="docutils literal notranslate"><span class="pre">llvm-bolt</span></code> when instrumenting binaries.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-computed-gotos">
<span class="sig-name descname"><span class="pre">--with-computed-gotos</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-computed-gotos" title="Link to this definition"></a></dt>
<dd><p>Enable computed gotos in evaluation loop (enabled by default on supported
compilers).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-without-mimalloc">
<span class="sig-name descname"><span class="pre">--without-mimalloc</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-mimalloc" title="Link to this definition"></a></dt>
<dd><p>Disable the fast <a class="reference internal" href="../c-api/memory.html#mimalloc"><span class="std std-ref">mimalloc</span></a> allocator
(enabled by default).</p>
<p>See also <span class="target" id="index-6"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONMALLOC"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONMALLOC</span></code></a> environment variable.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-without-pymalloc">
<span class="sig-name descname"><span class="pre">--without-pymalloc</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-pymalloc" title="Link to this definition"></a></dt>
<dd><p>Disable the specialized Python memory allocator <a class="reference internal" href="../c-api/memory.html#pymalloc"><span class="std std-ref">pymalloc</span></a>
(enabled by default).</p>
<p>See also <span class="target" id="index-7"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONMALLOC"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONMALLOC</span></code></a> environment variable.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-without-doc-strings">
<span class="sig-name descname"><span class="pre">--without-doc-strings</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-doc-strings" title="Link to this definition"></a></dt>
<dd><p>Disable static documentation strings to reduce the memory footprint (enabled
by default). Documentation strings defined in Python are not affected.</p>
<p>Dont define the <code class="docutils literal notranslate"><span class="pre">WITH_DOC_STRINGS</span></code> macro.</p>
<p>See the <code class="docutils literal notranslate"><span class="pre">PyDoc_STRVAR()</span></code> macro.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-profiling">
<span class="sig-name descname"><span class="pre">--enable-profiling</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-profiling" title="Link to this definition"></a></dt>
<dd><p>Enable C-level code profiling with <code class="docutils literal notranslate"><span class="pre">gprof</span></code> (disabled by default).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-strict-overflow">
<span class="sig-name descname"><span class="pre">--with-strict-overflow</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-strict-overflow" title="Link to this definition"></a></dt>
<dd><p>Add <code class="docutils literal notranslate"><span class="pre">-fstrict-overflow</span></code> to the C compiler flags (by default we add
<code class="docutils literal notranslate"><span class="pre">-fno-strict-overflow</span></code> instead).</p>
</dd></dl>
</section>
<section id="python-debug-build">
<span id="debug-build"></span><h3><span class="section-number">3.3.8. </span>Python Debug Build<a class="headerlink" href="#python-debug-build" title="Link to this heading"></a></h3>
<p>A debug build is Python built with the <a class="reference internal" href="#cmdoption-with-pydebug"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-pydebug</span></code></a> configure
option.</p>
<p>Effects of a debug build:</p>
<ul class="simple">
<li><p>Display all warnings by default: the list of default warning filters is empty
in the <a class="reference internal" href="../library/warnings.html#module-warnings" title="warnings: Issue warning messages and control their disposition."><code class="xref py py-mod docutils literal notranslate"><span class="pre">warnings</span></code></a> module.</p></li>
<li><p>Add <code class="docutils literal notranslate"><span class="pre">d</span></code> to <a class="reference internal" href="../library/sys.html#sys.abiflags" title="sys.abiflags"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.abiflags</span></code></a>.</p></li>
<li><p>Add <code class="xref py py-func docutils literal notranslate"><span class="pre">sys.gettotalrefcount()</span></code> function.</p></li>
<li><p>Add <a class="reference internal" href="cmdline.html#cmdoption-X"><code class="xref std std-option docutils literal notranslate"><span class="pre">-X</span> <span class="pre">showrefcount</span></code></a> command line option.</p></li>
<li><p>Add <a class="reference internal" href="cmdline.html#cmdoption-d"><code class="xref std std-option docutils literal notranslate"><span class="pre">-d</span></code></a> command line option and <span class="target" id="index-8"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONDEBUG"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONDEBUG</span></code></a> environment
variable to debug the parser.</p></li>
<li><p>Add support for the <code class="docutils literal notranslate"><span class="pre">__lltrace__</span></code> variable: enable low-level tracing in the
bytecode evaluation loop if the variable is defined.</p></li>
<li><p>Install <a class="reference internal" href="../c-api/memory.html#default-memory-allocators"><span class="std std-ref">debug hooks on memory allocators</span></a>
to detect buffer overflow and other memory errors.</p></li>
<li><p>Define <code class="docutils literal notranslate"><span class="pre">Py_DEBUG</span></code> and <code class="docutils literal notranslate"><span class="pre">Py_REF_DEBUG</span></code> macros.</p></li>
<li><p>Add runtime checks: code surrounded by <code class="docutils literal notranslate"><span class="pre">#ifdef</span> <span class="pre">Py_DEBUG</span></code> and <code class="docutils literal notranslate"><span class="pre">#endif</span></code>.
Enable <code class="docutils literal notranslate"><span class="pre">assert(...)</span></code> and <code class="docutils literal notranslate"><span class="pre">_PyObject_ASSERT(...)</span></code> assertions: dont set
the <code class="docutils literal notranslate"><span class="pre">NDEBUG</span></code> macro (see also the <a class="reference internal" href="#cmdoption-with-assertions"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-assertions</span></code></a> configure
option). Main runtime checks:</p>
<ul>
<li><p>Add sanity checks on the function arguments.</p></li>
<li><p>Unicode and int objects are created with their memory filled with a pattern
to detect usage of uninitialized objects.</p></li>
<li><p>Ensure that functions which can clear or replace the current exception are
not called with an exception raised.</p></li>
<li><p>Check that deallocator functions dont change the current exception.</p></li>
<li><p>The garbage collector (<a class="reference internal" href="../library/gc.html#gc.collect" title="gc.collect"><code class="xref py py-func docutils literal notranslate"><span class="pre">gc.collect()</span></code></a> function) runs some basic checks
on objects consistency.</p></li>
<li><p>The <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_SAFE_DOWNCAST()</span></code> macro checks for integer underflow and
overflow when downcasting from wide types to narrow types.</p></li>
</ul>
</li>
</ul>
<p>See also the <a class="reference internal" href="../library/devmode.html#devmode"><span class="std std-ref">Python Development Mode</span></a> and the
<a class="reference internal" href="#cmdoption-with-trace-refs"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-trace-refs</span></code></a> configure option.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.8: </span>Release builds and debug builds are now ABI compatible: defining the
<code class="docutils literal notranslate"><span class="pre">Py_DEBUG</span></code> macro no longer implies the <code class="docutils literal notranslate"><span class="pre">Py_TRACE_REFS</span></code> macro (see the
<a class="reference internal" href="#cmdoption-with-trace-refs"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-trace-refs</span></code></a> option).</p>
</div>
</section>
<section id="debug-options">
<h3><span class="section-number">3.3.9. </span>Debug options<a class="headerlink" href="#debug-options" title="Link to this heading"></a></h3>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-pydebug">
<span class="sig-name descname"><span class="pre">--with-pydebug</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-pydebug" title="Link to this definition"></a></dt>
<dd><p><a class="reference internal" href="#debug-build"><span class="std std-ref">Build Python in debug mode</span></a>: define the <code class="docutils literal notranslate"><span class="pre">Py_DEBUG</span></code>
macro (disabled by default).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-trace-refs">
<span class="sig-name descname"><span class="pre">--with-trace-refs</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-trace-refs" title="Link to this definition"></a></dt>
<dd><p>Enable tracing references for debugging purpose (disabled by default).</p>
<p>Effects:</p>
<ul class="simple">
<li><p>Define the <code class="docutils literal notranslate"><span class="pre">Py_TRACE_REFS</span></code> macro.</p></li>
<li><p>Add <a class="reference internal" href="../library/sys.html#sys.getobjects" title="sys.getobjects"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.getobjects()</span></code></a> function.</p></li>
<li><p>Add <span class="target" id="index-9"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONDUMPREFS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONDUMPREFS</span></code></a> environment variable.</p></li>
</ul>
<p>The <span class="target" id="index-10"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONDUMPREFS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONDUMPREFS</span></code></a> environment variable can be used to dump
objects and reference counts still alive at Python exit.</p>
<p><a class="reference internal" href="../c-api/typeobj.html#static-types"><span class="std std-ref">Statically allocated objects</span></a> are not traced.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.8.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>This build is now ABI compatible with release build and <a class="reference internal" href="#debug-build"><span class="std std-ref">debug build</span></a>.</p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-assertions">
<span class="sig-name descname"><span class="pre">--with-assertions</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-assertions" title="Link to this definition"></a></dt>
<dd><p>Build with C assertions enabled (default is no): <code class="docutils literal notranslate"><span class="pre">assert(...);</span></code> and
<code class="docutils literal notranslate"><span class="pre">_PyObject_ASSERT(...);</span></code>.</p>
<p>If set, the <code class="docutils literal notranslate"><span class="pre">NDEBUG</span></code> macro is not defined in the <span class="target" id="index-11"></span><a class="reference internal" href="#envvar-OPT"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">OPT</span></code></a> compiler
variable.</p>
<p>See also the <a class="reference internal" href="#cmdoption-with-pydebug"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-pydebug</span></code></a> option (<a class="reference internal" href="#debug-build"><span class="std std-ref">debug build</span></a>) which also enables assertions.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-valgrind">
<span class="sig-name descname"><span class="pre">--with-valgrind</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-valgrind" title="Link to this definition"></a></dt>
<dd><p>Enable Valgrind support (default is no).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-dtrace">
<span class="sig-name descname"><span class="pre">--with-dtrace</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-dtrace" title="Link to this definition"></a></dt>
<dd><p>Enable DTrace support (default is no).</p>
<p>See <a class="reference internal" href="../howto/instrumentation.html#instrumentation"><span class="std std-ref">Instrumenting CPython with DTrace and SystemTap</span></a>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-address-sanitizer">
<span class="sig-name descname"><span class="pre">--with-address-sanitizer</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-address-sanitizer" title="Link to this definition"></a></dt>
<dd><p>Enable AddressSanitizer memory error detector, <code class="docutils literal notranslate"><span class="pre">asan</span></code> (default is no).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-memory-sanitizer">
<span class="sig-name descname"><span class="pre">--with-memory-sanitizer</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-memory-sanitizer" title="Link to this definition"></a></dt>
<dd><p>Enable MemorySanitizer allocation error detector, <code class="docutils literal notranslate"><span class="pre">msan</span></code> (default is no).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-undefined-behavior-sanitizer">
<span class="sig-name descname"><span class="pre">--with-undefined-behavior-sanitizer</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-undefined-behavior-sanitizer" title="Link to this definition"></a></dt>
<dd><p>Enable UndefinedBehaviorSanitizer undefined behaviour detector, <code class="docutils literal notranslate"><span class="pre">ubsan</span></code>
(default is no).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-thread-sanitizer">
<span class="sig-name descname"><span class="pre">--with-thread-sanitizer</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-thread-sanitizer" title="Link to this definition"></a></dt>
<dd><p>Enable ThreadSanitizer data race detector, <code class="docutils literal notranslate"><span class="pre">tsan</span></code>
(default is no).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
</section>
<section id="id2">
<h3><span class="section-number">3.3.10. </span>Linker options<a class="headerlink" href="#id2" title="Link to this heading"></a></h3>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-shared">
<span class="sig-name descname"><span class="pre">--enable-shared</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-shared" title="Link to this definition"></a></dt>
<dd><p>Enable building a shared Python library: <code class="docutils literal notranslate"><span class="pre">libpython</span></code> (default is no).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-without-static-libpython">
<span class="sig-name descname"><span class="pre">--without-static-libpython</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-static-libpython" title="Link to this definition"></a></dt>
<dd><p>Do not build <code class="docutils literal notranslate"><span class="pre">libpythonMAJOR.MINOR.a</span></code> and do not install <code class="docutils literal notranslate"><span class="pre">python.o</span></code>
(built and enabled by default).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
</section>
<section id="libraries-options">
<h3><span class="section-number">3.3.11. </span>Libraries options<a class="headerlink" href="#libraries-options" title="Link to this heading"></a></h3>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-libs">
<span class="sig-name descname"><span class="pre">--with-libs</span></span><span class="sig-prename descclassname"><span class="pre">='lib1</span> <span class="pre">...'</span></span><a class="headerlink" href="#cmdoption-with-libs" title="Link to this definition"></a></dt>
<dd><p>Link against additional libraries (default is no).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-system-expat">
<span class="sig-name descname"><span class="pre">--with-system-expat</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-system-expat" title="Link to this definition"></a></dt>
<dd><p>Build the <code class="xref py py-mod docutils literal notranslate"><span class="pre">pyexpat</span></code> module using an installed <code class="docutils literal notranslate"><span class="pre">expat</span></code> library
(default is no).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-system-libmpdec">
<span class="sig-name descname"><span class="pre">--with-system-libmpdec</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-system-libmpdec" title="Link to this definition"></a></dt>
<dd><p>Build the <code class="docutils literal notranslate"><span class="pre">_decimal</span></code> extension module using an installed <code class="docutils literal notranslate"><span class="pre">mpdecimal</span></code>
library, see the <a class="reference internal" href="../library/decimal.html#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code class="xref py py-mod docutils literal notranslate"><span class="pre">decimal</span></code></a> module (default is yes).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.3.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>Default to using the installed <code class="docutils literal notranslate"><span class="pre">mpdecimal</span></code> library.</p>
</div>
<div class="deprecated-removed">
<p><span class="versionmodified deprecated">Deprecated since version 3.13, will be removed in version 3.15: </span>A copy of the <code class="docutils literal notranslate"><span class="pre">mpdecimal</span></code> library sources will no longer be distributed
with Python 3.15.</p>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#cmdoption-arg-LIBMPDEC_CFLAGS"><code class="xref std std-option docutils literal notranslate"><span class="pre">LIBMPDEC_CFLAGS</span></code></a> and <a class="reference internal" href="#cmdoption-arg-LIBMPDEC_LIBS"><code class="xref std std-option docutils literal notranslate"><span class="pre">LIBMPDEC_LIBS</span></code></a>.</p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-readline">
<span class="sig-name descname"><span class="pre">--with-readline</span></span><span class="sig-prename descclassname"><span class="pre">=readline|editline</span></span><a class="headerlink" href="#cmdoption-with-readline" title="Link to this definition"></a></dt>
<dd><p>Designate a backend library for the <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">readline</span></code></a> module.</p>
<ul class="simple">
<li><p>readline: Use readline as the backend.</p></li>
<li><p>editline: Use editline as the backend.</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-without-readline">
<span class="sig-name descname"><span class="pre">--without-readline</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-readline" title="Link to this definition"></a></dt>
<dd><p>Dont build the <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">readline</span></code></a> module (built by default).</p>
<p>Dont define the <code class="docutils literal notranslate"><span class="pre">HAVE_LIBREADLINE</span></code> macro.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-libm">
<span class="sig-name descname"><span class="pre">--with-libm</span></span><span class="sig-prename descclassname"><span class="pre">=STRING</span></span><a class="headerlink" href="#cmdoption-with-libm" title="Link to this definition"></a></dt>
<dd><p>Override <code class="docutils literal notranslate"><span class="pre">libm</span></code> math library to <em>STRING</em> (default is system-dependent).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-libc">
<span class="sig-name descname"><span class="pre">--with-libc</span></span><span class="sig-prename descclassname"><span class="pre">=STRING</span></span><a class="headerlink" href="#cmdoption-with-libc" title="Link to this definition"></a></dt>
<dd><p>Override <code class="docutils literal notranslate"><span class="pre">libc</span></code> C library to <em>STRING</em> (default is system-dependent).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-openssl">
<span class="sig-name descname"><span class="pre">--with-openssl</span></span><span class="sig-prename descclassname"><span class="pre">=DIR</span></span><a class="headerlink" href="#cmdoption-with-openssl" title="Link to this definition"></a></dt>
<dd><p>Root of the OpenSSL directory.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.7.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-openssl-rpath">
<span class="sig-name descname"><span class="pre">--with-openssl-rpath</span></span><span class="sig-prename descclassname"><span class="pre">=[no|auto|DIR]</span></span><a class="headerlink" href="#cmdoption-with-openssl-rpath" title="Link to this definition"></a></dt>
<dd><p>Set runtime library directory (rpath) for OpenSSL libraries:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">no</span></code> (default): dont set rpath;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">auto</span></code>: auto-detect rpath from <a class="reference internal" href="#cmdoption-with-openssl"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-openssl</span></code></a> and
<code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>;</p></li>
<li><p><em>DIR</em>: set an explicit rpath.</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
</section>
<section id="security-options">
<h3><span class="section-number">3.3.12. </span>Security Options<a class="headerlink" href="#security-options" title="Link to this heading"></a></h3>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-hash-algorithm">
<span class="sig-name descname"><span class="pre">--with-hash-algorithm</span></span><span class="sig-prename descclassname"><span class="pre">=[fnv|siphash13|siphash24]</span></span><a class="headerlink" href="#cmdoption-with-hash-algorithm" title="Link to this definition"></a></dt>
<dd><p>Select hash algorithm for use in <code class="docutils literal notranslate"><span class="pre">Python/pyhash.c</span></code>:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">siphash13</span></code> (default);</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">siphash24</span></code>;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">fnv</span></code>.</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.4.</span></p>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11: </span><code class="docutils literal notranslate"><span class="pre">siphash13</span></code> is added and it is the new default.</p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-builtin-hashlib-hashes">
<span class="sig-name descname"><span class="pre">--with-builtin-hashlib-hashes</span></span><span class="sig-prename descclassname"><span class="pre">=md5,sha1,sha256,sha512,sha3,blake2</span></span><a class="headerlink" href="#cmdoption-with-builtin-hashlib-hashes" title="Link to this definition"></a></dt>
<dd><p>Built-in hash modules:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">md5</span></code>;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">sha1</span></code>;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">sha256</span></code>;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">sha512</span></code>;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">sha3</span></code> (with shake);</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">blake2</span></code>.</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-ssl-default-suites">
<span class="sig-name descname"><span class="pre">--with-ssl-default-suites</span></span><span class="sig-prename descclassname"><span class="pre">=[python|openssl|STRING]</span></span><a class="headerlink" href="#cmdoption-with-ssl-default-suites" title="Link to this definition"></a></dt>
<dd><p>Override the OpenSSL default cipher suites string:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">python</span></code> (default): use Pythons preferred selection;</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">openssl</span></code>: leave OpenSSLs defaults untouched;</p></li>
<li><p><em>STRING</em>: use a custom string</p></li>
</ul>
<p>See the <a class="reference internal" href="../library/ssl.html#module-ssl" title="ssl: TLS/SSL wrapper for socket objects"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ssl</span></code></a> module.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.7.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.10: </span>The settings <code class="docutils literal notranslate"><span class="pre">python</span></code> and <em>STRING</em> also set TLS 1.2 as minimum
protocol version.</p>
</div>
</dd></dl>
</section>
<section id="macos-options">
<h3><span class="section-number">3.3.13. </span>macOS Options<a class="headerlink" href="#macos-options" title="Link to this heading"></a></h3>
<p>See <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/3.13/Mac/README.rst">Mac/README.rst</a>.</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-universalsdk">
<span class="sig-name descname"><span class="pre">--enable-universalsdk</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-universalsdk" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-0">
<span class="sig-name descname"><span class="pre">--enable-universalsdk</span></span><span class="sig-prename descclassname"><span class="pre">=SDKDIR</span></span><a class="headerlink" href="#cmdoption-0" title="Link to this definition"></a></dt>
<dd><p>Create a universal binary build. <em>SDKDIR</em> specifies which macOS SDK should
be used to perform the build (default is no).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-enable-framework">
<span class="sig-name descname"><span class="pre">--enable-framework</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-framework" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-1">
<span class="sig-name descname"><span class="pre">--enable-framework</span></span><span class="sig-prename descclassname"><span class="pre">=INSTALLDIR</span></span><a class="headerlink" href="#cmdoption-1" title="Link to this definition"></a></dt>
<dd><p>Create a Python.framework rather than a traditional Unix install. Optional
<em>INSTALLDIR</em> specifies the installation path (default is no).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-universal-archs">
<span class="sig-name descname"><span class="pre">--with-universal-archs</span></span><span class="sig-prename descclassname"><span class="pre">=ARCH</span></span><a class="headerlink" href="#cmdoption-with-universal-archs" title="Link to this definition"></a></dt>
<dd><p>Specify the kind of universal binary that should be created. This option is
only valid when <a class="reference internal" href="#cmdoption-enable-universalsdk"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-universalsdk</span></code></a> is set.</p>
<p>Options:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">universal2</span></code> (x86-64 and arm64);</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">32-bit</span></code> (PPC and i386);</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">64-bit</span></code> (PPC64 and x86-64);</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">3-way</span></code> (i386, PPC and x86-64);</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">intel</span></code> (i386 and x86-64);</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">intel-32</span></code> (i386);</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">intel-64</span></code> (x86-64);</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">all</span></code> (PPC, i386, PPC64 and x86-64).</p></li>
</ul>
<p>Note that values for this configuration item are <em>not</em> the same as the
identifiers used for universal binary wheels on macOS. See the Python
Packaging User Guide for details on the <a class="reference external" href="https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#macos">packaging platform compatibility
tags used on macOS</a></p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-framework-name">
<span class="sig-name descname"><span class="pre">--with-framework-name</span></span><span class="sig-prename descclassname"><span class="pre">=FRAMEWORK</span></span><a class="headerlink" href="#cmdoption-with-framework-name" title="Link to this definition"></a></dt>
<dd><p>Specify the name for the python framework on macOS only valid when
<a class="reference internal" href="#cmdoption-enable-framework"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-framework</span></code></a> is set (default: <code class="docutils literal notranslate"><span class="pre">Python</span></code>).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-app-store-compliance">
<span class="sig-name descname"><span class="pre">--with-app-store-compliance</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-app-store-compliance" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-2">
<span class="sig-name descname"><span class="pre">--with-app-store-compliance</span></span><span class="sig-prename descclassname"><span class="pre">=PATCH-FILE</span></span><a class="headerlink" href="#cmdoption-2" title="Link to this definition"></a></dt>
<dd><p>The Python standard library contains strings that are known to trigger
automated inspection tool errors when submitted for distribution by
the macOS and iOS App Stores. If enabled, this option will apply the list of
patches that are known to correct app store compliance. A custom patch
file can also be specified. This option is disabled by default.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
</section>
<section id="ios-options">
<h3><span class="section-number">3.3.14. </span>iOS Options<a class="headerlink" href="#ios-options" title="Link to this heading"></a></h3>
<p>See <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/3.13/iOS/README.rst">iOS/README.rst</a>.</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-3">
<span class="sig-name descname"><span class="pre">--enable-framework</span></span><span class="sig-prename descclassname"><span class="pre">=INSTALLDIR</span></span><a class="headerlink" href="#cmdoption-3" title="Link to this definition"></a></dt>
<dd><p>Create a Python.framework. Unlike macOS, the <em>INSTALLDIR</em> argument
specifying the installation path is mandatory.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-4">
<span class="sig-name descname"><span class="pre">--with-framework-name</span></span><span class="sig-prename descclassname"><span class="pre">=FRAMEWORK</span></span><a class="headerlink" href="#cmdoption-4" title="Link to this definition"></a></dt>
<dd><p>Specify the name for the framework (default: <code class="docutils literal notranslate"><span class="pre">Python</span></code>).</p>
</dd></dl>
</section>
<section id="cross-compiling-options">
<h3><span class="section-number">3.3.15. </span>Cross Compiling Options<a class="headerlink" href="#cross-compiling-options" title="Link to this heading"></a></h3>
<p>Cross compiling, also known as cross building, can be used to build Python
for another CPU architecture or platform. Cross compiling requires a Python
interpreter for the build platform. The version of the build Python must match
the version of the cross compiled host Python.</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-build">
<span class="sig-name descname"><span class="pre">--build</span></span><span class="sig-prename descclassname"><span class="pre">=BUILD</span></span><a class="headerlink" href="#cmdoption-build" title="Link to this definition"></a></dt>
<dd><p>configure for building on BUILD, usually guessed by <strong class="program">config.guess</strong>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-host">
<span class="sig-name descname"><span class="pre">--host</span></span><span class="sig-prename descclassname"><span class="pre">=HOST</span></span><a class="headerlink" href="#cmdoption-host" title="Link to this definition"></a></dt>
<dd><p>cross-compile to build programs to run on HOST (target platform)</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-with-build-python">
<span class="sig-name descname"><span class="pre">--with-build-python</span></span><span class="sig-prename descclassname"><span class="pre">=path/to/python</span></span><a class="headerlink" href="#cmdoption-with-build-python" title="Link to this definition"></a></dt>
<dd><p>path to build <code class="docutils literal notranslate"><span class="pre">python</span></code> binary for cross compiling</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-CONFIG_SITE">
<span class="sig-name descname"><span class="pre">CONFIG_SITE</span></span><span class="sig-prename descclassname"><span class="pre">=file</span></span><a class="headerlink" href="#cmdoption-arg-CONFIG_SITE" title="Link to this definition"></a></dt>
<dd><p>An environment variable that points to a file with configure overrides.</p>
<p>Example <em>config.site</em> file:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="c1"># config.site-aarch64</span>
<span class="na">ac_cv_buggy_getaddrinfo</span><span class="o">=</span><span class="s">no</span>
<span class="na">ac_cv_file__dev_ptmx</span><span class="o">=</span><span class="s">yes</span>
<span class="na">ac_cv_file__dev_ptc</span><span class="o">=</span><span class="s">no</span>
</pre></div>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-arg-HOSTRUNNER">
<span class="sig-name descname"><span class="pre">HOSTRUNNER</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-arg-HOSTRUNNER" title="Link to this definition"></a></dt>
<dd><p>Program to run CPython for the host platform for cross-compilation.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<p>Cross compiling example:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nv">CONFIG_SITE</span><span class="o">=</span>config.site-aarch64<span class="w"> </span>../configure<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>--build<span class="o">=</span>x86_64-pc-linux-gnu<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>--host<span class="o">=</span>aarch64-unknown-linux-gnu<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>--with-build-python<span class="o">=</span>../x86_64/python
</pre></div>
</div>
</section>
</section>
<section id="python-build-system">
<h2><span class="section-number">3.4. </span>Python Build System<a class="headerlink" href="#python-build-system" title="Link to this heading"></a></h2>
<section id="main-files-of-the-build-system">
<h3><span class="section-number">3.4.1. </span>Main files of the build system<a class="headerlink" href="#main-files-of-the-build-system" title="Link to this heading"></a></h3>
<ul class="simple">
<li><p><code class="file docutils literal notranslate"><span class="pre">configure.ac</span></code> =&gt; <code class="file docutils literal notranslate"><span class="pre">configure</span></code>;</p></li>
<li><p><code class="file docutils literal notranslate"><span class="pre">Makefile.pre.in</span></code> =&gt; <code class="file docutils literal notranslate"><span class="pre">Makefile</span></code> (created by <code class="file docutils literal notranslate"><span class="pre">configure</span></code>);</p></li>
<li><p><code class="file docutils literal notranslate"><span class="pre">pyconfig.h</span></code> (created by <code class="file docutils literal notranslate"><span class="pre">configure</span></code>);</p></li>
<li><p><code class="file docutils literal notranslate"><span class="pre">Modules/Setup</span></code>: C extensions built by the Makefile using
<code class="file docutils literal notranslate"><span class="pre">Module/makesetup</span></code> shell script;</p></li>
</ul>
</section>
<section id="main-build-steps">
<h3><span class="section-number">3.4.2. </span>Main build steps<a class="headerlink" href="#main-build-steps" title="Link to this heading"></a></h3>
<ul class="simple">
<li><p>C files (<code class="docutils literal notranslate"><span class="pre">.c</span></code>) are built as object files (<code class="docutils literal notranslate"><span class="pre">.o</span></code>).</p></li>
<li><p>A static <code class="docutils literal notranslate"><span class="pre">libpython</span></code> library (<code class="docutils literal notranslate"><span class="pre">.a</span></code>) is created from objects files.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">python.o</span></code> and the static <code class="docutils literal notranslate"><span class="pre">libpython</span></code> library are linked into the
final <code class="docutils literal notranslate"><span class="pre">python</span></code> program.</p></li>
<li><p>C extensions are built by the Makefile (see <code class="file docutils literal notranslate"><span class="pre">Modules/Setup</span></code>).</p></li>
</ul>
</section>
<section id="main-makefile-targets">
<h3><span class="section-number">3.4.3. </span>Main Makefile targets<a class="headerlink" href="#main-makefile-targets" title="Link to this heading"></a></h3>
<section id="make">
<h4><span class="section-number">3.4.3.1. </span>make<a class="headerlink" href="#make" title="Link to this heading"></a></h4>
<p>For the most part, when rebuilding after editing some code or
refreshing your checkout from upstream, all you need to do is execute
<code class="docutils literal notranslate"><span class="pre">make</span></code>, which (per Makes semantics) builds the default target, the
first one defined in the Makefile. By tradition (including in the
CPython project) this is usually the <code class="docutils literal notranslate"><span class="pre">all</span></code> target. The
<code class="docutils literal notranslate"><span class="pre">configure</span></code> script expands an <code class="docutils literal notranslate"><span class="pre">autoconf</span></code> variable,
<code class="docutils literal notranslate"><span class="pre">&#64;DEF_MAKE_ALL_RULE&#64;</span></code> to describe precisely which targets <code class="docutils literal notranslate"><span class="pre">make</span>
<span class="pre">all</span></code> will build. The three choices are:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">profile-opt</span></code> (configured with <code class="docutils literal notranslate"><span class="pre">--enable-optimizations</span></code>)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">build_wasm</span></code> (configured with <code class="docutils literal notranslate"><span class="pre">--with-emscripten-target</span></code>)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">build_all</span></code> (configured without explicitly using either of the others)</p></li>
</ul>
<p>Depending on the most recent source file changes, Make will rebuild
any targets (object files and executables) deemed out-of-date,
including running <code class="docutils literal notranslate"><span class="pre">configure</span></code> again if necessary. Source/target
dependencies are many and maintained manually however, so Make
sometimes doesnt have all the information necessary to correctly
detect all targets which need to be rebuilt. Depending on which
targets arent rebuilt, you might experience a number of problems. If
you have build or test problems which you cant otherwise explain,
<code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">clean</span> <span class="pre">&amp;&amp;</span> <span class="pre">make</span></code> should work around most dependency problems, at
the expense of longer build times.</p>
</section>
<section id="make-platform">
<h4><span class="section-number">3.4.3.2. </span>make platform<a class="headerlink" href="#make-platform" title="Link to this heading"></a></h4>
<p>Build the <code class="docutils literal notranslate"><span class="pre">python</span></code> program, but dont build the standard library
extension modules. This generates a file named <code class="docutils literal notranslate"><span class="pre">platform</span></code> which
contains a single line describing the details of the build platform,
e.g., <code class="docutils literal notranslate"><span class="pre">macosx-14.3-arm64-3.12</span></code> or <code class="docutils literal notranslate"><span class="pre">linux-x86_64-3.13</span></code>.</p>
</section>
<section id="make-profile-opt">
<h4><span class="section-number">3.4.3.3. </span>make profile-opt<a class="headerlink" href="#make-profile-opt" title="Link to this heading"></a></h4>
<p>Build Python using profile-guided optimization (PGO). You can use the
configure <a class="reference internal" href="#cmdoption-enable-optimizations"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-optimizations</span></code></a> option to make this the
default target of the <code class="docutils literal notranslate"><span class="pre">make</span></code> command (<code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">all</span></code> or just
<code class="docutils literal notranslate"><span class="pre">make</span></code>).</p>
</section>
<section id="make-clean">
<h4><span class="section-number">3.4.3.4. </span>make clean<a class="headerlink" href="#make-clean" title="Link to this heading"></a></h4>
<p>Remove built files.</p>
</section>
<section id="make-distclean">
<h4><span class="section-number">3.4.3.5. </span>make distclean<a class="headerlink" href="#make-distclean" title="Link to this heading"></a></h4>
<p>In addition to the work done by <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">clean</span></code>, remove files
created by the configure script. <code class="docutils literal notranslate"><span class="pre">configure</span></code> will have to be run
before building again. <a class="footnote-reference brackets" href="#id5" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p>
</section>
<section id="make-install">
<h4><span class="section-number">3.4.3.6. </span>make install<a class="headerlink" href="#make-install" title="Link to this heading"></a></h4>
<p>Build the <code class="docutils literal notranslate"><span class="pre">all</span></code> target and install Python.</p>
</section>
<section id="make-test">
<h4><span class="section-number">3.4.3.7. </span>make test<a class="headerlink" href="#make-test" title="Link to this heading"></a></h4>
<p>Build the <code class="docutils literal notranslate"><span class="pre">all</span></code> target and run the Python test suite with the
<code class="docutils literal notranslate"><span class="pre">--fast-ci</span></code> option. Variables:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">TESTOPTS</span></code>: additional regrtest command-line options.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">TESTPYTHONOPTS</span></code>: additional Python command-line options.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">TESTTIMEOUT</span></code>: timeout in seconds (default: 10 minutes).</p></li>
</ul>
</section>
<section id="make-buildbottest">
<h4><span class="section-number">3.4.3.8. </span>make buildbottest<a class="headerlink" href="#make-buildbottest" title="Link to this heading"></a></h4>
<p>This is similar to <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test</span></code>, but uses the <code class="docutils literal notranslate"><span class="pre">--slow-ci</span></code>
option and default timeout of 20 minutes, instead of <code class="docutils literal notranslate"><span class="pre">--fast-ci</span></code> option.</p>
</section>
<section id="make-regen-all">
<h4><span class="section-number">3.4.3.9. </span>make regen-all<a class="headerlink" href="#make-regen-all" title="Link to this heading"></a></h4>
<p>Regenerate (almost) all generated files. These include (but are not
limited to) bytecode cases, and parser generator file.
<code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">regen-stdlib-module-names</span></code> and <code class="docutils literal notranslate"><span class="pre">autoconf</span></code> must be run
separately for the remaining <a class="reference external" href="#generated-files">generated files</a>.</p>
</section>
</section>
<section id="c-extensions">
<h3><span class="section-number">3.4.4. </span>C extensions<a class="headerlink" href="#c-extensions" title="Link to this heading"></a></h3>
<p>Some C extensions are built as built-in modules, like the <code class="docutils literal notranslate"><span class="pre">sys</span></code> module.
They are built with the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_BUILTIN</span></code> macro defined.
Built-in modules have no <code class="docutils literal notranslate"><span class="pre">__file__</span></code> attribute:</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span><span class="w"> </span><span class="nn">sys</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">sys</span>
<span class="go">&lt;module &#39;sys&#39; (built-in)&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">sys</span><span class="o">.</span><span class="vm">__file__</span>
<span class="gt">Traceback (most recent call last):</span>
File <span class="nb">&quot;&lt;stdin&gt;&quot;</span>, line <span class="m">1</span>, in <span class="n">&lt;module&gt;</span>
<span class="gr">AttributeError</span>: <span class="n">module &#39;sys&#39; has no attribute &#39;__file__&#39;</span>
</pre></div>
</div>
<p>Other C extensions are built as dynamic libraries, like the <code class="docutils literal notranslate"><span class="pre">_asyncio</span></code> module.
They are built with the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_MODULE</span></code> macro defined.
Example on Linux x86-64:</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span><span class="w"> </span><span class="nn">_asyncio</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_asyncio</span>
<span class="go">&lt;module &#39;_asyncio&#39; from &#39;/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so&#39;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_asyncio</span><span class="o">.</span><span class="vm">__file__</span>
<span class="go">&#39;/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so&#39;</span>
</pre></div>
</div>
<p><code class="file docutils literal notranslate"><span class="pre">Modules/Setup</span></code> is used to generate Makefile targets to build C extensions.
At the beginning of the files, C extensions are built as built-in modules.
Extensions defined after the <code class="docutils literal notranslate"><span class="pre">*shared*</span></code> marker are built as dynamic libraries.</p>
<p>The <code class="xref c c-macro docutils literal notranslate"><span class="pre">PyAPI_FUNC()</span></code>, <code class="xref c c-macro docutils literal notranslate"><span class="pre">PyAPI_DATA()</span></code> and
<a class="reference internal" href="../c-api/intro.html#c.PyMODINIT_FUNC" title="PyMODINIT_FUNC"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PyMODINIT_FUNC</span></code></a> macros of <code class="file docutils literal notranslate"><span class="pre">Include/exports.h</span></code> are defined
differently depending if the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_MODULE</span></code> macro is defined:</p>
<ul class="simple">
<li><p>Use <code class="docutils literal notranslate"><span class="pre">Py_EXPORTED_SYMBOL</span></code> if the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_MODULE</span></code> is defined</p></li>
<li><p>Use <code class="docutils literal notranslate"><span class="pre">Py_IMPORTED_SYMBOL</span></code> otherwise.</p></li>
</ul>
<p>If the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_BUILTIN</span></code> macro is used by mistake on a C extension
built as a shared library, its <code class="samp docutils literal notranslate"><span class="pre">PyInit_</span><em><span class="pre">xxx</span></em><span class="pre">()</span></code> function is not exported,
causing an <a class="reference internal" href="../library/exceptions.html#ImportError" title="ImportError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ImportError</span></code></a> on import.</p>
</section>
</section>
<section id="compiler-and-linker-flags">
<h2><span class="section-number">3.5. </span>Compiler and linker flags<a class="headerlink" href="#compiler-and-linker-flags" title="Link to this heading"></a></h2>
<p>Options set by the <code class="docutils literal notranslate"><span class="pre">./configure</span></code> script and environment variables and used by
<code class="docutils literal notranslate"><span class="pre">Makefile</span></code>.</p>
<section id="preprocessor-flags">
<h3><span class="section-number">3.5.1. </span>Preprocessor flags<a class="headerlink" href="#preprocessor-flags" title="Link to this heading"></a></h3>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CONFIGURE_CPPFLAGS">
<span class="sig-name descname"><span class="pre">CONFIGURE_CPPFLAGS</span></span><a class="headerlink" href="#envvar-CONFIGURE_CPPFLAGS" title="Link to this definition"></a></dt>
<dd><p>Value of <span class="target" id="index-12"></span><a class="reference internal" href="#envvar-CPPFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CPPFLAGS</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code> script.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CPPFLAGS">
<span class="sig-name descname"><span class="pre">CPPFLAGS</span></span><a class="headerlink" href="#envvar-CPPFLAGS" title="Link to this definition"></a></dt>
<dd><p>(Objective) C/C++ preprocessor flags, e.g. <code class="samp docutils literal notranslate"><span class="pre">-I</span><em><span class="pre">include_dir</span></em></code> if you have
headers in a nonstandard directory <em>include_dir</em>.</p>
<p>Both <span class="target" id="index-13"></span><a class="reference internal" href="#envvar-CPPFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CPPFLAGS</span></code></a> and <span class="target" id="index-14"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> need to contain the shells
value to be able to build extension modules using the
directories specified in the environment variables.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-BASECPPFLAGS">
<span class="sig-name descname"><span class="pre">BASECPPFLAGS</span></span><a class="headerlink" href="#envvar-BASECPPFLAGS" title="Link to this definition"></a></dt>
<dd><div class="versionadded">
<p><span class="versionmodified added">Added in version 3.4.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PY_CPPFLAGS">
<span class="sig-name descname"><span class="pre">PY_CPPFLAGS</span></span><a class="headerlink" href="#envvar-PY_CPPFLAGS" title="Link to this definition"></a></dt>
<dd><p>Extra preprocessor flags added for building the interpreter object files.</p>
<p>Default: <code class="docutils literal notranslate"><span class="pre">$(BASECPPFLAGS)</span> <span class="pre">-I.</span> <span class="pre">-I$(srcdir)/Include</span> <span class="pre">$(CONFIGURE_CPPFLAGS)</span> <span class="pre">$(CPPFLAGS)</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.2.</span></p>
</div>
</dd></dl>
</section>
<section id="compiler-flags">
<h3><span class="section-number">3.5.2. </span>Compiler flags<a class="headerlink" href="#compiler-flags" title="Link to this heading"></a></h3>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CC">
<span class="sig-name descname"><span class="pre">CC</span></span><a class="headerlink" href="#envvar-CC" title="Link to this definition"></a></dt>
<dd><p>C compiler command.</p>
<p>Example: <code class="docutils literal notranslate"><span class="pre">gcc</span> <span class="pre">-pthread</span></code>.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CXX">
<span class="sig-name descname"><span class="pre">CXX</span></span><a class="headerlink" href="#envvar-CXX" title="Link to this definition"></a></dt>
<dd><p>C++ compiler command.</p>
<p>Example: <code class="docutils literal notranslate"><span class="pre">g++</span> <span class="pre">-pthread</span></code>.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CFLAGS">
<span class="sig-name descname"><span class="pre">CFLAGS</span></span><a class="headerlink" href="#envvar-CFLAGS" title="Link to this definition"></a></dt>
<dd><p>C compiler flags.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CFLAGS_NODIST">
<span class="sig-name descname"><span class="pre">CFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-CFLAGS_NODIST" title="Link to this definition"></a></dt>
<dd><p><span class="target" id="index-15"></span><a class="reference internal" href="#envvar-CFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS_NODIST</span></code></a> is used for building the interpreter and stdlib C
extensions. Use it when a compiler flag should <em>not</em> be part of
<span class="target" id="index-16"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a> once Python is installed (<a class="reference external" href="https://github.com/python/cpython/issues/65320">gh-65320</a>).</p>
<p>In particular, <span class="target" id="index-17"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a> should not contain:</p>
<ul class="simple">
<li><p>the compiler flag <code class="docutils literal notranslate"><span class="pre">-I</span></code> (for setting the search path for include files).
The <code class="docutils literal notranslate"><span class="pre">-I</span></code> flags are processed from left to right, and any flags in
<span class="target" id="index-18"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a> would take precedence over user- and package-supplied <code class="docutils literal notranslate"><span class="pre">-I</span></code>
flags.</p></li>
<li><p>hardening flags such as <code class="docutils literal notranslate"><span class="pre">-Werror</span></code> because distributions cannot control
whether packages installed by users conform to such heightened
standards.</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.5.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-COMPILEALL_OPTS">
<span class="sig-name descname"><span class="pre">COMPILEALL_OPTS</span></span><a class="headerlink" href="#envvar-COMPILEALL_OPTS" title="Link to this definition"></a></dt>
<dd><p>Options passed to the <a class="reference internal" href="../library/compileall.html#module-compileall" title="compileall: Tools for byte-compiling all Python source files in a directory tree."><code class="xref py py-mod docutils literal notranslate"><span class="pre">compileall</span></code></a> command line when building PYC files
in <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code>. Default: <code class="docutils literal notranslate"><span class="pre">-j0</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-EXTRA_CFLAGS">
<span class="sig-name descname"><span class="pre">EXTRA_CFLAGS</span></span><a class="headerlink" href="#envvar-EXTRA_CFLAGS" title="Link to this definition"></a></dt>
<dd><p>Extra C compiler flags.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CONFIGURE_CFLAGS">
<span class="sig-name descname"><span class="pre">CONFIGURE_CFLAGS</span></span><a class="headerlink" href="#envvar-CONFIGURE_CFLAGS" title="Link to this definition"></a></dt>
<dd><p>Value of <span class="target" id="index-19"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code>
script.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.2.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CONFIGURE_CFLAGS_NODIST">
<span class="sig-name descname"><span class="pre">CONFIGURE_CFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-CONFIGURE_CFLAGS_NODIST" title="Link to this definition"></a></dt>
<dd><p>Value of <span class="target" id="index-20"></span><a class="reference internal" href="#envvar-CFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS_NODIST</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code>
script.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.5.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-BASECFLAGS">
<span class="sig-name descname"><span class="pre">BASECFLAGS</span></span><a class="headerlink" href="#envvar-BASECFLAGS" title="Link to this definition"></a></dt>
<dd><p>Base compiler flags.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-OPT">
<span class="sig-name descname"><span class="pre">OPT</span></span><a class="headerlink" href="#envvar-OPT" title="Link to this definition"></a></dt>
<dd><p>Optimization flags.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CFLAGS_ALIASING">
<span class="sig-name descname"><span class="pre">CFLAGS_ALIASING</span></span><a class="headerlink" href="#envvar-CFLAGS_ALIASING" title="Link to this definition"></a></dt>
<dd><p>Strict or non-strict aliasing flags used to compile <code class="docutils literal notranslate"><span class="pre">Python/dtoa.c</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.7.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CCSHARED">
<span class="sig-name descname"><span class="pre">CCSHARED</span></span><a class="headerlink" href="#envvar-CCSHARED" title="Link to this definition"></a></dt>
<dd><p>Compiler flags used to build a shared library.</p>
<p>For example, <code class="docutils literal notranslate"><span class="pre">-fPIC</span></code> is used on Linux and on BSD.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CFLAGSFORSHARED">
<span class="sig-name descname"><span class="pre">CFLAGSFORSHARED</span></span><a class="headerlink" href="#envvar-CFLAGSFORSHARED" title="Link to this definition"></a></dt>
<dd><p>Extra C flags added for building the interpreter object files.</p>
<p>Default: <code class="docutils literal notranslate"><span class="pre">$(CCSHARED)</span></code> when <a class="reference internal" href="#cmdoption-enable-shared"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-shared</span></code></a> is used, or an empty
string otherwise.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PY_CFLAGS">
<span class="sig-name descname"><span class="pre">PY_CFLAGS</span></span><a class="headerlink" href="#envvar-PY_CFLAGS" title="Link to this definition"></a></dt>
<dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(BASECFLAGS)</span> <span class="pre">$(OPT)</span> <span class="pre">$(CONFIGURE_CFLAGS)</span> <span class="pre">$(CFLAGS)</span> <span class="pre">$(EXTRA_CFLAGS)</span></code>.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PY_CFLAGS_NODIST">
<span class="sig-name descname"><span class="pre">PY_CFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-PY_CFLAGS_NODIST" title="Link to this definition"></a></dt>
<dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(CONFIGURE_CFLAGS_NODIST)</span> <span class="pre">$(CFLAGS_NODIST)</span> <span class="pre">-I$(srcdir)/Include/internal</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.5.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PY_STDMODULE_CFLAGS">
<span class="sig-name descname"><span class="pre">PY_STDMODULE_CFLAGS</span></span><a class="headerlink" href="#envvar-PY_STDMODULE_CFLAGS" title="Link to this definition"></a></dt>
<dd><p>C flags used for building the interpreter object files.</p>
<p>Default: <code class="docutils literal notranslate"><span class="pre">$(PY_CFLAGS)</span> <span class="pre">$(PY_CFLAGS_NODIST)</span> <span class="pre">$(PY_CPPFLAGS)</span> <span class="pre">$(CFLAGSFORSHARED)</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.7.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PY_CORE_CFLAGS">
<span class="sig-name descname"><span class="pre">PY_CORE_CFLAGS</span></span><a class="headerlink" href="#envvar-PY_CORE_CFLAGS" title="Link to this definition"></a></dt>
<dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(PY_STDMODULE_CFLAGS)</span> <span class="pre">-DPy_BUILD_CORE</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.2.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PY_BUILTIN_MODULE_CFLAGS">
<span class="sig-name descname"><span class="pre">PY_BUILTIN_MODULE_CFLAGS</span></span><a class="headerlink" href="#envvar-PY_BUILTIN_MODULE_CFLAGS" title="Link to this definition"></a></dt>
<dd><p>Compiler flags to build a standard library extension module as a built-in
module, like the <a class="reference internal" href="../library/posix.html#module-posix" title="posix: The most common POSIX system calls (normally used via module os). (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">posix</span></code></a> module.</p>
<p>Default: <code class="docutils literal notranslate"><span class="pre">$(PY_STDMODULE_CFLAGS)</span> <span class="pre">-DPy_BUILD_CORE_BUILTIN</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.8.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PURIFY">
<span class="sig-name descname"><span class="pre">PURIFY</span></span><a class="headerlink" href="#envvar-PURIFY" title="Link to this definition"></a></dt>
<dd><p>Purify command. Purify is a memory debugger program.</p>
<p>Default: empty string (not used).</p>
</dd></dl>
</section>
<section id="linker-flags">
<h3><span class="section-number">3.5.3. </span>Linker flags<a class="headerlink" href="#linker-flags" title="Link to this heading"></a></h3>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-LINKCC">
<span class="sig-name descname"><span class="pre">LINKCC</span></span><a class="headerlink" href="#envvar-LINKCC" title="Link to this definition"></a></dt>
<dd><p>Linker command used to build programs like <code class="docutils literal notranslate"><span class="pre">python</span></code> and <code class="docutils literal notranslate"><span class="pre">_testembed</span></code>.</p>
<p>Default: <code class="docutils literal notranslate"><span class="pre">$(PURIFY)</span> <span class="pre">$(CC)</span></code>.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CONFIGURE_LDFLAGS">
<span class="sig-name descname"><span class="pre">CONFIGURE_LDFLAGS</span></span><a class="headerlink" href="#envvar-CONFIGURE_LDFLAGS" title="Link to this definition"></a></dt>
<dd><p>Value of <span class="target" id="index-21"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code> script.</p>
<p>Avoid assigning <span class="target" id="index-22"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a>, <span class="target" id="index-23"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a>, etc. so users can use
them on the command line to append to these values without stomping the
pre-set values.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.2.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-LDFLAGS_NODIST">
<span class="sig-name descname"><span class="pre">LDFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-LDFLAGS_NODIST" title="Link to this definition"></a></dt>
<dd><p><span class="target" id="index-24"></span><a class="reference internal" href="#envvar-LDFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS_NODIST</span></code></a> is used in the same manner as
<span class="target" id="index-25"></span><a class="reference internal" href="#envvar-CFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS_NODIST</span></code></a>. Use it when a linker flag should <em>not</em> be part of
<span class="target" id="index-26"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> once Python is installed (<a class="reference external" href="https://github.com/python/cpython/issues/65320">gh-65320</a>).</p>
<p>In particular, <span class="target" id="index-27"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> should not contain:</p>
<ul class="simple">
<li><p>the compiler flag <code class="docutils literal notranslate"><span class="pre">-L</span></code> (for setting the search path for libraries).
The <code class="docutils literal notranslate"><span class="pre">-L</span></code> flags are processed from left to right, and any flags in
<span class="target" id="index-28"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> would take precedence over user- and package-supplied <code class="docutils literal notranslate"><span class="pre">-L</span></code>
flags.</p></li>
</ul>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-CONFIGURE_LDFLAGS_NODIST">
<span class="sig-name descname"><span class="pre">CONFIGURE_LDFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-CONFIGURE_LDFLAGS_NODIST" title="Link to this definition"></a></dt>
<dd><p>Value of <span class="target" id="index-29"></span><a class="reference internal" href="#envvar-LDFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS_NODIST</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code>
script.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.8.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-LDFLAGS">
<span class="sig-name descname"><span class="pre">LDFLAGS</span></span><a class="headerlink" href="#envvar-LDFLAGS" title="Link to this definition"></a></dt>
<dd><p>Linker flags, e.g. <code class="samp docutils literal notranslate"><span class="pre">-L</span><em><span class="pre">lib_dir</span></em></code> if you have libraries in a nonstandard
directory <em>lib_dir</em>.</p>
<p>Both <span class="target" id="index-30"></span><a class="reference internal" href="#envvar-CPPFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CPPFLAGS</span></code></a> and <span class="target" id="index-31"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> need to contain the shells
value to be able to build extension modules using the
directories specified in the environment variables.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-LIBS">
<span class="sig-name descname"><span class="pre">LIBS</span></span><a class="headerlink" href="#envvar-LIBS" title="Link to this definition"></a></dt>
<dd><p>Linker flags to pass libraries to the linker when linking the Python
executable.</p>
<p>Example: <code class="docutils literal notranslate"><span class="pre">-lrt</span></code>.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-LDSHARED">
<span class="sig-name descname"><span class="pre">LDSHARED</span></span><a class="headerlink" href="#envvar-LDSHARED" title="Link to this definition"></a></dt>
<dd><p>Command to build a shared library.</p>
<p>Default: <code class="docutils literal notranslate"><span class="pre">&#64;LDSHARED&#64;</span> <span class="pre">$(PY_LDFLAGS)</span></code>.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-BLDSHARED">
<span class="sig-name descname"><span class="pre">BLDSHARED</span></span><a class="headerlink" href="#envvar-BLDSHARED" title="Link to this definition"></a></dt>
<dd><p>Command to build <code class="docutils literal notranslate"><span class="pre">libpython</span></code> shared library.</p>
<p>Default: <code class="docutils literal notranslate"><span class="pre">&#64;BLDSHARED&#64;</span> <span class="pre">$(PY_CORE_LDFLAGS)</span></code>.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PY_LDFLAGS">
<span class="sig-name descname"><span class="pre">PY_LDFLAGS</span></span><a class="headerlink" href="#envvar-PY_LDFLAGS" title="Link to this definition"></a></dt>
<dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(CONFIGURE_LDFLAGS)</span> <span class="pre">$(LDFLAGS)</span></code>.</p>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PY_LDFLAGS_NODIST">
<span class="sig-name descname"><span class="pre">PY_LDFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-PY_LDFLAGS_NODIST" title="Link to this definition"></a></dt>
<dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(CONFIGURE_LDFLAGS_NODIST)</span> <span class="pre">$(LDFLAGS_NODIST)</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.8.</span></p>
</div>
</dd></dl>
<dl class="std envvar">
<dt class="sig sig-object std" id="envvar-PY_CORE_LDFLAGS">
<span class="sig-name descname"><span class="pre">PY_CORE_LDFLAGS</span></span><a class="headerlink" href="#envvar-PY_CORE_LDFLAGS" title="Link to this definition"></a></dt>
<dd><p>Linker flags used for building the interpreter object files.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.8.</span></p>
</div>
</dd></dl>
<p class="rubric">Footnotes</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="id5" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id3">1</a><span class="fn-bracket">]</span></span>
<p><code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">clean</span> <span class="pre">-fdx</span></code> is an even more extreme way to “clean” your
checkout. It removes all files not known to Git.
When bug hunting using <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">bisect</span></code>, this is
<a class="reference external" href="https://github.com/python/cpython/issues/114505#issuecomment-1907021718">recommended between probes</a>
to guarantee a completely clean build. <strong>Use with care</strong>, as it
will delete all files not checked into Git, including your
new, uncommitted work.</p>
</aside>
</aside>
</section>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<div>
<h3><a href="../contents.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">3. Configure Python</a><ul>
<li><a class="reference internal" href="#build-requirements">3.1. Build Requirements</a></li>
<li><a class="reference internal" href="#generated-files">3.2. Generated files</a><ul>
<li><a class="reference internal" href="#configure-script">3.2.1. configure script</a></li>
</ul>
</li>
<li><a class="reference internal" href="#configure-options">3.3. Configure Options</a><ul>
<li><a class="reference internal" href="#general-options">3.3.1. General Options</a></li>
<li><a class="reference internal" href="#c-compiler-options">3.3.2. C compiler options</a></li>
<li><a class="reference internal" href="#linker-options">3.3.3. Linker options</a></li>
<li><a class="reference internal" href="#options-for-third-party-dependencies">3.3.4. Options for third-party dependencies</a></li>
<li><a class="reference internal" href="#webassembly-options">3.3.5. WebAssembly Options</a></li>
<li><a class="reference internal" href="#install-options">3.3.6. Install Options</a></li>
<li><a class="reference internal" href="#performance-options">3.3.7. Performance options</a></li>
<li><a class="reference internal" href="#python-debug-build">3.3.8. Python Debug Build</a></li>
<li><a class="reference internal" href="#debug-options">3.3.9. Debug options</a></li>
<li><a class="reference internal" href="#id2">3.3.10. Linker options</a></li>
<li><a class="reference internal" href="#libraries-options">3.3.11. Libraries options</a></li>
<li><a class="reference internal" href="#security-options">3.3.12. Security Options</a></li>
<li><a class="reference internal" href="#macos-options">3.3.13. macOS Options</a></li>
<li><a class="reference internal" href="#ios-options">3.3.14. iOS Options</a></li>
<li><a class="reference internal" href="#cross-compiling-options">3.3.15. Cross Compiling Options</a></li>
</ul>
</li>
<li><a class="reference internal" href="#python-build-system">3.4. Python Build System</a><ul>
<li><a class="reference internal" href="#main-files-of-the-build-system">3.4.1. Main files of the build system</a></li>
<li><a class="reference internal" href="#main-build-steps">3.4.2. Main build steps</a></li>
<li><a class="reference internal" href="#main-makefile-targets">3.4.3. Main Makefile targets</a><ul>
<li><a class="reference internal" href="#make">3.4.3.1. make</a></li>
<li><a class="reference internal" href="#make-platform">3.4.3.2. make platform</a></li>
<li><a class="reference internal" href="#make-profile-opt">3.4.3.3. make profile-opt</a></li>
<li><a class="reference internal" href="#make-clean">3.4.3.4. make clean</a></li>
<li><a class="reference internal" href="#make-distclean">3.4.3.5. make distclean</a></li>
<li><a class="reference internal" href="#make-install">3.4.3.6. make install</a></li>
<li><a class="reference internal" href="#make-test">3.4.3.7. make test</a></li>
<li><a class="reference internal" href="#make-buildbottest">3.4.3.8. make buildbottest</a></li>
<li><a class="reference internal" href="#make-regen-all">3.4.3.9. make regen-all</a></li>
</ul>
</li>
<li><a class="reference internal" href="#c-extensions">3.4.4. C extensions</a></li>
</ul>
</li>
<li><a class="reference internal" href="#compiler-and-linker-flags">3.5. Compiler and linker flags</a><ul>
<li><a class="reference internal" href="#preprocessor-flags">3.5.1. Preprocessor flags</a></li>
<li><a class="reference internal" href="#compiler-flags">3.5.2. Compiler flags</a></li>
<li><a class="reference internal" href="#linker-flags">3.5.3. Linker flags</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="unix.html"
title="previous chapter"><span class="section-number">2. </span>Using Python on Unix platforms</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="windows.html"
title="next chapter"><span class="section-number">4. </span>Using Python on Windows</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../bugs.html">Report a Bug</a></li>
<li>
<a href="https://github.com/python/cpython/blob/main/Doc/using/configure.rst"
rel="nofollow">Show Source
</a>
</li>
</ul>
</div>
</div>
<div id="sidebarbutton" title="Collapse sidebar">
<span>«</span>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="windows.html" title="4. Using Python on Windows"
>next</a> |</li>
<li class="right" >
<a href="unix.html" title="2. Using Python on Unix platforms"
>previous</a> |</li>
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> &#187;</li>
<li class="switchers">
<div class="language_switcher_placeholder"></div>
<div class="version_switcher_placeholder"></div>
</li>
<li>
</li>
<li id="cpython-language-and-version">
<a href="../index.html">3.13.3 Documentation</a> &#187;
</li>
<li class="nav-item nav-item-1"><a href="index.html" >Python Setup and Usage</a> &#187;</li>
<li class="nav-item nav-item-this"><a href=""><span class="section-number">3. </span>Configure Python</a></li>
<li class="right">
<div class="inline-search" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
<input type="submit" value="Go" />
</form>
</div>
|
</li>
<li class="right">
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label> |</li>
</ul>
</div>
<div class="footer">
&copy;
<a href="../copyright.html">
Copyright
</a>
2001-2025, Python Software Foundation.
<br />
This page is licensed under the Python Software Foundation License Version 2.
<br />
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
<br />
See <a href="/license.html">History and License</a> for more information.<br />
<br />
The Python Software Foundation is a non-profit corporation.
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
Last updated on Apr 08, 2025 (14:33 UTC).
<a href="/bugs.html">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
</div>
</body>
</html>