summaryrefslogtreecommitdiff
path: root/devdocs/python~3.12/using%2Fconfigure.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/python~3.12/using%2Fconfigure.html
new repository
Diffstat (limited to 'devdocs/python~3.12/using%2Fconfigure.html')
-rw-r--r--devdocs/python~3.12/using%2Fconfigure.html388
1 files changed, 388 insertions, 0 deletions
diff --git a/devdocs/python~3.12/using%2Fconfigure.html b/devdocs/python~3.12/using%2Fconfigure.html
new file mode 100644
index 00000000..32f8be70
--- /dev/null
+++ b/devdocs/python~3.12/using%2Fconfigure.html
@@ -0,0 +1,388 @@
+ <h1> Configure Python</h1> <section id="build-requirements"> <h2>
+<span class="section-number">3.1. </span>Build Requirements</h2> <p>Features required to build CPython:</p> <ul class="simple"> <li>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.</li> <li>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>.</li> <li>Support for threads.</li> <li>OpenSSL 1.1.1 or newer for the <a class="reference internal" href="../library/ssl#module-ssl" title="ssl: TLS/SSL wrapper for socket objects"><code>ssl</code></a> and <a class="reference internal" href="../library/hashlib#module-hashlib" title="hashlib: Secure hash and message digest algorithms."><code>hashlib</code></a> modules.</li> <li>On Windows, Microsoft Visual Studio 2017 or later is required.</li> </ul> <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.</p> </div> <div class="versionchanged"> <p><span class="versionmodified changed">Changed in version 3.10: </span>OpenSSL 1.1.1 is now required.</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.6: </span>Selected C99 features are now required, like <code>&lt;stdint.h&gt;</code> and <code>static
+inline</code> functions.</p> </div> <div class="versionchanged"> <p><span class="versionmodified changed">Changed in version 3.5: </span>On Windows, Visual Studio 2015 or later is 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</h2> <p>To reduce build dependencies, Python source code contains multiple generated files. Commands to regenerate all generated files:</p> <pre data-language="python">make regen-all
+make regen-stdlib-module-names
+make regen-limited-abi
+make regen-configure
+</pre> <p>The <code>Makefile.pre.in</code> file documents generated files, their inputs, and tools used to regenerate them. Search for <code>regen-*</code> make targets.</p> <section id="configure-script"> <h3>
+<span class="section-number">3.2.1. </span>configure script</h3> <p>The <code>make regen-configure</code> command regenerates the <code>aclocal.m4</code> file and the <code>configure</code> script using the <code>Tools/build/regen-configure.sh</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> <pre data-language="python">autoreconf -ivf -Werror
+</pre> <p>The generated files can change depending on the exact <code>autoconf-archive</code>, <code>aclocal</code> and <code>pkg-config</code> versions.</p> </section> </section> <section id="configure-options"> <span id="id1"></span><h2>
+<span class="section-number">3.3. </span>Configure Options</h2> <p>List all <code>./configure</code> script options using:</p> <pre data-language="python">./configure --help
+</pre> <p>See also the <code>Misc/SpecialBuilds.txt</code> in the Python source distribution.</p> <section id="general-options"> <h3>
+<span class="section-number">3.3.1. </span>General Options</h3> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-enable-loadable-sqlite-extensions">
+<code>--enable-loadable-sqlite-extensions</code> </dt> <dd>
+<p>Support loadable extensions in the <code>_sqlite</code> extension module (default is no) of the <a class="reference internal" href="../library/sqlite3#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code>sqlite3</code></a> module.</p> <p>See the <a class="reference internal" href="../library/sqlite3#sqlite3.Connection.enable_load_extension" title="sqlite3.Connection.enable_load_extension"><code>sqlite3.Connection.enable_load_extension()</code></a> method of the <a class="reference internal" href="../library/sqlite3#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code>sqlite3</code></a> module.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.6.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-disable-ipv6">
+<code>--disable-ipv6</code> </dt> <dd>
+<p>Disable IPv6 support (enabled by default if supported), see the <a class="reference internal" href="../library/socket#module-socket" title="socket: Low-level networking interface."><code>socket</code></a> module.</p> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-enable-big-digits">
+<code>--enable-big-digits=[15|30]</code> </dt> <dd>
+<p>Define the size in bits of Python <a class="reference internal" href="../library/functions#int" title="int"><code>int</code></a> digits: 15 or 30 bits.</p> <p>By default, the digit size is 30.</p> <p>Define the <code>PYLONG_BITS_IN_DIGIT</code> to <code>15</code> or <code>30</code>.</p> <p>See <a class="reference internal" href="../library/sys#sys.int_info" title="sys.int_info"><code>sys.int_info.bits_per_digit</code></a>.</p> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-suffix">
+<code>--with-suffix=SUFFIX</code> </dt> <dd>
+<p>Set the Python executable suffix to <em>SUFFIX</em>.</p> <p>The default suffix is <code>.exe</code> on Windows and macOS (<code>python.exe</code> executable), <code>.js</code> on Emscripten node, <code>.html</code> on Emscripten browser, <code>.wasm</code> on WASI, and an empty string on other platforms (<code>python</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>.js</code>, <code>.html</code> or <code>.wasm</code>.</p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-tzpath">
+<code>--with-tzpath=&lt;list of absolute paths separated by pathsep&gt;</code> </dt> <dd>
+<p>Select the default time zone search path for <a class="reference internal" href="../library/zoneinfo#zoneinfo.TZPATH" title="zoneinfo.TZPATH"><code>zoneinfo.TZPATH</code></a>. See the <a class="reference internal" href="../library/zoneinfo#zoneinfo-data-compile-time-config"><span class="std std-ref">Compile-time configuration</span></a> of the <a class="reference internal" href="../library/zoneinfo#module-zoneinfo" title="zoneinfo: IANA time zone support"><code>zoneinfo</code></a> module.</p> <p>Default: <code>/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo</code>.</p> <p>See <a class="reference internal" href="../library/os#os.pathsep" title="os.pathsep"><code>os.pathsep</code></a> path separator.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.9.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-without-decimal-contextvar">
+<code>--without-decimal-contextvar</code> </dt> <dd>
+<p>Build the <code>_decimal</code> extension module using a thread-local context rather than a coroutine-local context (default), see the <a class="reference internal" href="../library/decimal#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code>decimal</code></a> module.</p> <p>See <a class="reference internal" href="../library/decimal#decimal.HAVE_CONTEXTVAR" title="decimal.HAVE_CONTEXTVAR"><code>decimal.HAVE_CONTEXTVAR</code></a> and the <a class="reference internal" href="../library/contextvars#module-contextvars" title="contextvars: Context Variables"><code>contextvars</code></a> module.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.9.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-dbmliborder">
+<code>--with-dbmliborder=&lt;list of backend names&gt;</code> </dt> <dd>
+<p>Override order to check db backends for the <a class="reference internal" href="../library/dbm#module-dbm" title='dbm: Interfaces to various Unix "database" formats.'><code>dbm</code></a> module</p> <p>A valid value is a colon (<code>:</code>) separated string with the backend names:</p> <ul class="simple"> <li>
+<code>ndbm</code>;</li> <li>
+<code>gdbm</code>;</li> <li>
+<code>bdb</code>.</li> </ul> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-without-c-locale-coercion">
+<code>--without-c-locale-coercion</code> </dt> <dd>
+<p>Disable C locale coercion to a UTF-8 based locale (enabled by default).</p> <p>Don’t define the <code>PY_COERCE_C_LOCALE</code> macro.</p> <p>See <span class="target" id="index-2"></span><a class="reference internal" href="cmdline#envvar-PYTHONCOERCECLOCALE"><code>PYTHONCOERCECLOCALE</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">
+<code>--without-freelists</code> </dt> <dd>
+<p>Disable all freelists except the empty tuple singleton.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.11.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-platlibdir">
+<code>--with-platlibdir=DIRNAME</code> </dt> <dd>
+<p>Python library directory name (default is <code>lib</code>).</p> <p>Fedora and SuSE use <code>lib64</code> on 64-bit platforms.</p> <p>See <a class="reference internal" href="../library/sys#sys.platlibdir" title="sys.platlibdir"><code>sys.platlibdir</code></a>.</p> <div class="versionadded"> <p><span class="versionmodified added">New 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">
+<code>--with-wheel-pkg-dir=PATH</code> </dt> <dd>
+<p>Directory of wheel packages used by the <a class="reference internal" href="../library/ensurepip#module-ensurepip" title='ensurepip: Bootstrapping the "pip" installer into an existing Python installation or virtual environment.'><code>ensurepip</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>/usr/share/python-wheels/</code> directory and don’t install the <code>ensurepip._bundled</code> package.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.10.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-pkg-config">
+<code>--with-pkg-config=[check|yes|no]</code> </dt> <dd>
+<p>Whether configure should use <strong class="program">pkg-config</strong> to detect build dependencies.</p> <ul class="simple"> <li>
+<code>check</code> (default): <strong class="program">pkg-config</strong> is optional</li> <li>
+<code>yes</code>: <strong class="program">pkg-config</strong> is mandatory</li> <li>
+<code>no</code>: configure does not use <strong class="program">pkg-config</strong> even when present</li> </ul> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.11.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-enable-pystats">
+<code>--enable-pystats</code> </dt> <dd>
+<p>Turn on internal statistics gathering.</p> <p>The statistics will be dumped to a arbitrary (probably unique) file in <code>/tmp/py_stats/</code>, or <code>C:\temp\py_stats\</code> on Windows. If that directory does not exist, results will be printed on stdout.</p> <p>Use <code>Tools/scripts/summarize_stats.py</code> to read the stats.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.11.</span></p> </div> </dd>
+</dl> </section> <section id="webassembly-options"> <h3>
+<span class="section-number">3.3.2. </span>WebAssembly Options</h3> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-emscripten-target">
+<code>--with-emscripten-target=[browser|node]</code> </dt> <dd>
+<p>Set build flavor for <code>wasm32-emscripten</code>.</p> <ul class="simple"> <li>
+<code>browser</code> (default): preload minimal stdlib, default MEMFS.</li> <li>
+<code>node</code>: NODERAWFS and pthread support.</li> </ul> <div class="versionadded"> <p><span class="versionmodified added">New 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">
+<code>--enable-wasm-dynamic-linking</code> </dt> <dd>
+<p>Turn on dynamic linking support for WASM.</p> <p>Dynamic linking enables <code>dlopen</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">New in version 3.11.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-enable-wasm-pthreads">
+<code>--enable-wasm-pthreads</code> </dt> <dd>
+<p>Turn on pthreads support for WASM.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.11.</span></p> </div> </dd>
+</dl> </section> <section id="install-options"> <h3>
+<span class="section-number">3.3.3. </span>Install Options</h3> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-prefix">
+<code>--prefix=PREFIX</code> </dt> <dd>
+<p>Install architecture-independent files in PREFIX. On Unix, it defaults to <code>/usr/local</code>.</p> <p>This value can be retrieved at runtime using <a class="reference internal" href="../library/sys#sys.prefix" title="sys.prefix"><code>sys.prefix</code></a>.</p> <p>As an example, one can use <code>--prefix="$HOME/.local/"</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">
+<code>--exec-prefix=EPREFIX</code> </dt> <dd>
+<p>Install architecture-dependent files in EPREFIX, defaults to <a class="reference internal" href="#cmdoption-prefix"><code>--prefix</code></a>.</p> <p>This value can be retrieved at runtime using <a class="reference internal" href="../library/sys#sys.exec_prefix" title="sys.exec_prefix"><code>sys.exec_prefix</code></a>.</p> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-disable-test-modules">
+<code>--disable-test-modules</code> </dt> <dd>
+<p>Don’t build nor install test modules, like the <a class="reference internal" href="../library/test#module-test" title="test: Regression tests package containing the testing suite for Python."><code>test</code></a> package or the <code>_testcapi</code> extension module (built and installed by default).</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.10.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-ensurepip">
+<code>--with-ensurepip=[upgrade|install|no]</code> </dt> <dd>
+<p>Select the <a class="reference internal" href="../library/ensurepip#module-ensurepip" title='ensurepip: Bootstrapping the "pip" installer into an existing Python installation or virtual environment.'><code>ensurepip</code></a> command run on Python installation:</p> <ul class="simple"> <li>
+<code>upgrade</code> (default): run <code>python -m ensurepip --altinstall --upgrade</code> command.</li> <li>
+<code>install</code>: run <code>python -m ensurepip --altinstall</code> command;</li> <li>
+<code>no</code>: don’t run ensurepip;</li> </ul> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.6.</span></p> </div> </dd>
+</dl> </section> <section id="performance-options"> <h3>
+<span class="section-number">3.3.4. </span>Performance options</h3> <p>Configuring Python using <code>--enable-optimizations --with-lto</code> (PGO + LTO) is recommended for best performance. The experimental <code>--enable-bolt</code> flag can also be used to improve performance.</p> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-enable-optimizations">
+<code>--enable-optimizations</code> </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>PROFILE_TASK</code></a> (disabled by default).</p> <p>The C compiler Clang requires <code>llvm-profdata</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>--enable-shared</code> and GCC is used: add <code>-fno-semantic-interposition</code> to the compiler and linker flags.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.6.</span></p> </div> <div class="versionchanged"> <p><span class="versionmodified changed">Changed in version 3.10: </span>Use <code>-fno-semantic-interposition</code> on GCC.</p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-PROFILE_TASK">
+<code>PROFILE_TASK</code> </dt> <dd>
+<p>Environment variable used in the Makefile: Python command line arguments for the PGO generation task.</p> <p>Default: <code>-m test --pgo --timeout=$(TESTTIMEOUT)</code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.8.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-lto">
+<code>--with-lto=[full|thin|no|yes]</code> </dt> <dd>
+<p>Enable Link Time Optimization (LTO) in any build (disabled by default).</p> <p>The C compiler Clang requires <code>llvm-ar</code> for LTO (<code>ar</code> on macOS), as well as an LTO-aware linker (<code>ld.gold</code> or <code>lld</code>).</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.6.</span></p> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.11: </span>To use ThinLTO feature, use <code>--with-lto=thin</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">
+<code>--enable-bolt</code> </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>llvm-bolt</code> and <code>merge-fdata</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>BOLT_INSTRUMENT_FLAGS</code> and <code>BOLT_APPLY_FLAGS</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">New in version 3.12.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-computed-gotos">
+<code>--with-computed-gotos</code> </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-pymalloc">
+<code>--without-pymalloc</code> </dt> <dd>
+<p>Disable the specialized Python memory allocator <a class="reference internal" href="../c-api/memory#pymalloc"><span class="std std-ref">pymalloc</span></a> (enabled by default).</p> <p>See also <span class="target" id="index-5"></span><a class="reference internal" href="cmdline#envvar-PYTHONMALLOC"><code>PYTHONMALLOC</code></a> environment variable.</p> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-without-doc-strings">
+<code>--without-doc-strings</code> </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>Don’t define the <code>WITH_DOC_STRINGS</code> macro.</p> <p>See the <code>PyDoc_STRVAR()</code> macro.</p> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-enable-profiling">
+<code>--enable-profiling</code> </dt> <dd>
+<p>Enable C-level code profiling with <code>gprof</code> (disabled by default).</p> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-strict-overflow">
+<code>--with-strict-overflow</code> </dt> <dd>
+<p>Add <code>-fstrict-overflow</code> to the C compiler flags (by default we add <code>-fno-strict-overflow</code> instead).</p> </dd>
+</dl> </section> <section id="python-debug-build"> <span id="debug-build"></span><h3>
+<span class="section-number">3.3.5. </span>Python Debug Build</h3> <p>A debug build is Python built with the <a class="reference internal" href="#cmdoption-with-pydebug"><code>--with-pydebug</code></a> configure option.</p> <p>Effects of a debug build:</p> <ul class="simple"> <li>Display all warnings by default: the list of default warning filters is empty in the <a class="reference internal" href="../library/warnings#module-warnings" title="warnings: Issue warning messages and control their disposition."><code>warnings</code></a> module.</li> <li>Add <code>d</code> to <a class="reference internal" href="../library/sys#sys.abiflags" title="sys.abiflags"><code>sys.abiflags</code></a>.</li> <li>Add <code>sys.gettotalrefcount()</code> function.</li> <li>Add <a class="reference internal" href="cmdline#cmdoption-X"><code>-X showrefcount</code></a> command line option.</li> <li>Add <a class="reference internal" href="cmdline#cmdoption-d"><code>-d</code></a> command line option and <span class="target" id="index-6"></span><a class="reference internal" href="cmdline#envvar-PYTHONDEBUG"><code>PYTHONDEBUG</code></a> environment variable to debug the parser.</li> <li>Add support for the <code>__lltrace__</code> variable: enable low-level tracing in the bytecode evaluation loop if the variable is defined.</li> <li>Install <a class="reference internal" href="../c-api/memory#default-memory-allocators"><span class="std std-ref">debug hooks on memory allocators</span></a> to detect buffer overflow and other memory errors.</li> <li>Define <code>Py_DEBUG</code> and <code>Py_REF_DEBUG</code> macros.</li> <li>
+<p>Add runtime checks: code surrounded by <code>#ifdef Py_DEBUG</code> and <code>#endif</code>. Enable <code>assert(...)</code> and <code>_PyObject_ASSERT(...)</code> assertions: don’t set the <code>NDEBUG</code> macro (see also the <a class="reference internal" href="#cmdoption-with-assertions"><code>--with-assertions</code></a> configure option). Main runtime checks:</p> <ul> <li>Add sanity checks on the function arguments.</li> <li>Unicode and int objects are created with their memory filled with a pattern to detect usage of uninitialized objects.</li> <li>Ensure that functions which can clear or replace the current exception are not called with an exception raised.</li> <li>Check that deallocator functions don’t change the current exception.</li> <li>The garbage collector (<a class="reference internal" href="../library/gc#gc.collect" title="gc.collect"><code>gc.collect()</code></a> function) runs some basic checks on objects consistency.</li> <li>The <code>Py_SAFE_DOWNCAST()</code> macro checks for integer underflow and overflow when downcasting from wide types to narrow types.</li> </ul> </li> </ul> <p>See also the <a class="reference internal" href="../library/devmode#devmode"><span class="std std-ref">Python Development Mode</span></a> and the <a class="reference internal" href="#cmdoption-with-trace-refs"><code>--with-trace-refs</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>Py_DEBUG</code> macro no longer implies the <code>Py_TRACE_REFS</code> macro (see the <a class="reference internal" href="#cmdoption-with-trace-refs"><code>--with-trace-refs</code></a> option), which introduces the only ABI incompatibility.</p> </div> </section> <section id="debug-options"> <h3>
+<span class="section-number">3.3.6. </span>Debug options</h3> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-pydebug">
+<code>--with-pydebug</code> </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>Py_DEBUG</code> macro (disabled by default).</p> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-trace-refs">
+<code>--with-trace-refs</code> </dt> <dd>
+<p>Enable tracing references for debugging purpose (disabled by default).</p> <p>Effects:</p> <ul class="simple"> <li>Define the <code>Py_TRACE_REFS</code> macro.</li> <li>Add <code>sys.getobjects()</code> function.</li> <li>Add <span class="target" id="index-7"></span><a class="reference internal" href="cmdline#envvar-PYTHONDUMPREFS"><code>PYTHONDUMPREFS</code></a> environment variable.</li> </ul> <p>This build is not ABI compatible with release build (default build) or debug build (<code>Py_DEBUG</code> and <code>Py_REF_DEBUG</code> macros).</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.8.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-assertions">
+<code>--with-assertions</code> </dt> <dd>
+<p>Build with C assertions enabled (default is no): <code>assert(...);</code> and <code>_PyObject_ASSERT(...);</code>.</p> <p>If set, the <code>NDEBUG</code> macro is not defined in the <span class="target" id="index-8"></span><a class="reference internal" href="#envvar-OPT"><code>OPT</code></a> compiler variable.</p> <p>See also the <a class="reference internal" href="#cmdoption-with-pydebug"><code>--with-pydebug</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">New in version 3.6.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-valgrind">
+<code>--with-valgrind</code> </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">
+<code>--with-dtrace</code> </dt> <dd>
+<p>Enable DTrace support (default is no).</p> <p>See <a class="reference internal" href="../howto/instrumentation#instrumentation"><span class="std std-ref">Instrumenting CPython with DTrace and SystemTap</span></a>.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.6.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-address-sanitizer">
+<code>--with-address-sanitizer</code> </dt> <dd>
+<p>Enable AddressSanitizer memory error detector, <code>asan</code> (default is no).</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.6.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-memory-sanitizer">
+<code>--with-memory-sanitizer</code> </dt> <dd>
+<p>Enable MemorySanitizer allocation error detector, <code>msan</code> (default is no).</p> <div class="versionadded"> <p><span class="versionmodified added">New 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">
+<code>--with-undefined-behavior-sanitizer</code> </dt> <dd>
+<p>Enable UndefinedBehaviorSanitizer undefined behaviour detector, <code>ubsan</code> (default is no).</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.6.</span></p> </div> </dd>
+</dl> </section> <section id="linker-options"> <h3>
+<span class="section-number">3.3.7. </span>Linker options</h3> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-enable-shared">
+<code>--enable-shared</code> </dt> <dd>
+<p>Enable building a shared Python library: <code>libpython</code> (default is no).</p> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-without-static-libpython">
+<code>--without-static-libpython</code> </dt> <dd>
+<p>Do not build <code>libpythonMAJOR.MINOR.a</code> and do not install <code>python.o</code> (built and enabled by default).</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.10.</span></p> </div> </dd>
+</dl> </section> <section id="libraries-options"> <h3>
+<span class="section-number">3.3.8. </span>Libraries options</h3> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-libs">
+<code>--with-libs='lib1 ...'</code> </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">
+<code>--with-system-expat</code> </dt> <dd>
+<p>Build the <code>pyexpat</code> module using an installed <code>expat</code> library (default is no).</p> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-system-libmpdec">
+<code>--with-system-libmpdec</code> </dt> <dd>
+<p>Build the <code>_decimal</code> extension module using an installed <code>mpdec</code> library, see the <a class="reference internal" href="../library/decimal#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code>decimal</code></a> module (default is no).</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.3.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-readline">
+<code>--with-readline=editline</code> </dt> <dd>
+<p>Use <code>editline</code> library for backend of the <a class="reference internal" href="../library/readline#module-readline" title="readline: GNU readline support for Python. (Unix)"><code>readline</code></a> module.</p> <p>Define the <code>WITH_EDITLINE</code> macro.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.10.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-without-readline">
+<code>--without-readline</code> </dt> <dd>
+<p>Don’t build the <a class="reference internal" href="../library/readline#module-readline" title="readline: GNU readline support for Python. (Unix)"><code>readline</code></a> module (built by default).</p> <p>Don’t define the <code>HAVE_LIBREADLINE</code> macro.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.10.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-libm">
+<code>--with-libm=STRING</code> </dt> <dd>
+<p>Override <code>libm</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">
+<code>--with-libc=STRING</code> </dt> <dd>
+<p>Override <code>libc</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">
+<code>--with-openssl=DIR</code> </dt> <dd>
+<p>Root of the OpenSSL directory.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.7.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-openssl-rpath">
+<code>--with-openssl-rpath=[no|auto|DIR]</code> </dt> <dd>
+<p>Set runtime library directory (rpath) for OpenSSL libraries:</p> <ul class="simple"> <li>
+<code>no</code> (default): don’t set rpath;</li> <li>
+<code>auto</code>: auto-detect rpath from <a class="reference internal" href="#cmdoption-with-openssl"><code>--with-openssl</code></a> and <code>pkg-config</code>;</li> <li>
+<em>DIR</em>: set an explicit rpath.</li> </ul> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.10.</span></p> </div> </dd>
+</dl> </section> <section id="security-options"> <h3>
+<span class="section-number">3.3.9. </span>Security Options</h3> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-hash-algorithm">
+<code>--with-hash-algorithm=[fnv|siphash13|siphash24]</code> </dt> <dd>
+<p>Select hash algorithm for use in <code>Python/pyhash.c</code>:</p> <ul class="simple"> <li>
+<code>siphash13</code> (default);</li> <li>
+<code>siphash24</code>;</li> <li>
+<code>fnv</code>.</li> </ul> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.4.</span></p> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.11: </span><code>siphash13</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">
+<code>--with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2</code> </dt> <dd>
+<p>Built-in hash modules:</p> <ul class="simple"> <li>
+<code>md5</code>;</li> <li>
+<code>sha1</code>;</li> <li>
+<code>sha256</code>;</li> <li>
+<code>sha512</code>;</li> <li>
+<code>sha3</code> (with shake);</li> <li>
+<code>blake2</code>.</li> </ul> <div class="versionadded"> <p><span class="versionmodified added">New 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">
+<code>--with-ssl-default-suites=[python|openssl|STRING]</code> </dt> <dd>
+<p>Override the OpenSSL default cipher suites string:</p> <ul class="simple"> <li>
+<code>python</code> (default): use Python’s preferred selection;</li> <li>
+<code>openssl</code>: leave OpenSSL’s defaults untouched;</li> <li>
+<em>STRING</em>: use a custom string</li> </ul> <p>See the <a class="reference internal" href="../library/ssl#module-ssl" title="ssl: TLS/SSL wrapper for socket objects"><code>ssl</code></a> module.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.7.</span></p> </div> <div class="versionchanged"> <p><span class="versionmodified changed">Changed in version 3.10: </span>The settings <code>python</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.10. </span>macOS Options</h3> <p>See <code>Mac/README.rst</code>.</p> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-enable-universalsdk">
+<code>--enable-universalsdk</code> </dt> <dd></dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-0">
+<code>--enable-universalsdk=SDKDIR</code> </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">
+<code>--enable-framework</code> </dt> <dd></dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-1">
+<code>--enable-framework=INSTALLDIR</code> </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">
+<code>--with-universal-archs=ARCH</code> </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-0"><code>--enable-universalsdk</code></a> is set.</p> <p>Options:</p> <ul class="simple"> <li>
+<code>universal2</code>;</li> <li>
+<code>32-bit</code>;</li> <li>
+<code>64-bit</code>;</li> <li>
+<code>3-way</code>;</li> <li>
+<code>intel</code>;</li> <li>
+<code>intel-32</code>;</li> <li>
+<code>intel-64</code>;</li> <li>
+<code>all</code>.</li> </ul> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-with-framework-name">
+<code>--with-framework-name=FRAMEWORK</code> </dt> <dd>
+<p>Specify the name for the python framework on macOS only valid when <a class="reference internal" href="#cmdoption-1"><code>--enable-framework</code></a> is set (default: <code>Python</code>).</p> </dd>
+</dl> </section> <section id="cross-compiling-options"> <h3>
+<span class="section-number">3.3.11. </span>Cross Compiling Options</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">
+<code>--build=BUILD</code> </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">
+<code>--host=HOST</code> </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">
+<code>--with-build-python=path/to/python</code> </dt> <dd>
+<p>path to build <code>python</code> binary for cross compiling</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.11.</span></p> </div> </dd>
+</dl> <dl class="std option"> <dt class="sig sig-object std" id="cmdoption-arg-CONFIG_SITE">
+<code>CONFIG_SITE=file</code> </dt> <dd>
+<p>An environment variable that points to a file with configure overrides.</p> <p>Example <em>config.site</em> file:</p> <pre data-language="python"># config.site-aarch64
+ac_cv_buggy_getaddrinfo=no
+ac_cv_file__dev_ptmx=yes
+ac_cv_file__dev_ptc=no
+</pre> </dd>
+</dl> <p>Cross compiling example:</p> <pre data-language="python">CONFIG_SITE=config.site-aarch64 ../configure \
+ --build=x86_64-pc-linux-gnu \
+ --host=aarch64-unknown-linux-gnu \
+ --with-build-python=../x86_64/python
+</pre> </section> </section> <section id="python-build-system"> <h2>
+<span class="section-number">3.4. </span>Python Build System</h2> <section id="main-files-of-the-build-system"> <h3>
+<span class="section-number">3.4.1. </span>Main files of the build system</h3> <ul class="simple"> <li>
+<code>configure.ac</code> =&gt; <code>configure</code>;</li> <li>
+<code>Makefile.pre.in</code> =&gt; <code>Makefile</code> (created by <code>configure</code>);</li> <li>
+<code>pyconfig.h</code> (created by <code>configure</code>);</li> <li>
+<code>Modules/Setup</code>: C extensions built by the Makefile using <code>Module/makesetup</code> shell script;</li> </ul> </section> <section id="main-build-steps"> <h3>
+<span class="section-number">3.4.2. </span>Main build steps</h3> <ul class="simple"> <li>C files (<code>.c</code>) are built as object files (<code>.o</code>).</li> <li>A static <code>libpython</code> library (<code>.a</code>) is created from objects files.</li> <li>
+<code>python.o</code> and the static <code>libpython</code> library are linked into the final <code>python</code> program.</li> <li>C extensions are built by the Makefile (see <code>Modules/Setup</code>).</li> </ul> </section> <section id="main-makefile-targets"> <h3>
+<span class="section-number">3.4.3. </span>Main Makefile targets</h3> <ul class="simple"> <li>
+<code>make</code>: Build Python with the standard library.</li> <li>
+<code>make platform:</code>: build the <code>python</code> program, but don’t build the standard library extension modules.</li> <li>
+<code>make profile-opt</code>: build Python using Profile Guided Optimization (PGO). You can use the configure <a class="reference internal" href="#cmdoption-enable-optimizations"><code>--enable-optimizations</code></a> option to make this the default target of the <code>make</code> command (<code>make all</code> or just <code>make</code>).</li> <li>
+<code>make buildbottest</code>: Build Python and run the Python test suite, the same way than buildbots test Python. Set <code>TESTTIMEOUT</code> variable (in seconds) to change the test timeout (1200 by default: 20 minutes).</li> <li>
+<code>make install</code>: Build and install Python.</li> <li>
+<code>make regen-all</code>: Regenerate (almost) all generated files; <code>make regen-stdlib-module-names</code> and <code>autoconf</code> must be run separately for the remaining generated files.</li> <li>
+<code>make clean</code>: Remove built files.</li> <li>
+<code>make distclean</code>: Same than <code>make clean</code>, but remove also files created by the configure script.</li> </ul> </section> <section id="c-extensions"> <h3>
+<span class="section-number">3.4.4. </span>C extensions</h3> <p>Some C extensions are built as built-in modules, like the <code>sys</code> module. They are built with the <code>Py_BUILD_CORE_BUILTIN</code> macro defined. Built-in modules have no <code>__file__</code> attribute:</p> <pre data-language="python">&gt;&gt;&gt; import sys
+&gt;&gt;&gt; sys
+&lt;module 'sys' (built-in)&gt;
+&gt;&gt;&gt; sys.__file__
+Traceback (most recent call last):
+ File "&lt;stdin&gt;", line 1, in &lt;module&gt;
+AttributeError: module 'sys' has no attribute '__file__'
+</pre> <p>Other C extensions are built as dynamic libraries, like the <code>_asyncio</code> module. They are built with the <code>Py_BUILD_CORE_MODULE</code> macro defined. Example on Linux x86-64:</p> <pre data-language="python">&gt;&gt;&gt; import _asyncio
+&gt;&gt;&gt; _asyncio
+&lt;module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'&gt;
+&gt;&gt;&gt; _asyncio.__file__
+'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'
+</pre> <p><code>Modules/Setup</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>*shared*</code> marker are built as dynamic libraries.</p> <p>The <code>PyAPI_FUNC()</code>, <code>PyAPI_DATA()</code> and <a class="reference internal" href="../c-api/intro#c.PyMODINIT_FUNC" title="PyMODINIT_FUNC"><code>PyMODINIT_FUNC</code></a> macros of <code>Include/exports.h</code> are defined differently depending if the <code>Py_BUILD_CORE_MODULE</code> macro is defined:</p> <ul class="simple"> <li>Use <code>Py_EXPORTED_SYMBOL</code> if the <code>Py_BUILD_CORE_MODULE</code> is defined</li> <li>Use <code>Py_IMPORTED_SYMBOL</code> otherwise.</li> </ul> <p>If the <code>Py_BUILD_CORE_BUILTIN</code> macro is used by mistake on a C extension built as a shared library, its <code>PyInit_<em>xxx</em>()</code> function is not exported, causing an <a class="reference internal" href="../library/exceptions#ImportError" title="ImportError"><code>ImportError</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</h2> <p>Options set by the <code>./configure</code> script and environment variables and used by <code>Makefile</code>.</p> <section id="preprocessor-flags"> <h3>
+<span class="section-number">3.5.1. </span>Preprocessor flags</h3> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CONFIGURE_CPPFLAGS">
+<code>CONFIGURE_CPPFLAGS</code> </dt> <dd>
+<p>Value of <span class="target" id="index-9"></span><a class="reference internal" href="#envvar-CPPFLAGS"><code>CPPFLAGS</code></a> variable passed to the <code>./configure</code> script.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.6.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CPPFLAGS">
+<code>CPPFLAGS</code> </dt> <dd>
+<p>(Objective) C/C++ preprocessor flags, e.g. <code>-I<em>include_dir</em></code> if you have headers in a nonstandard directory <em>include_dir</em>.</p> <p>Both <span class="target" id="index-10"></span><a class="reference internal" href="#envvar-CPPFLAGS"><code>CPPFLAGS</code></a> and <span class="target" id="index-11"></span><a class="reference internal" href="#envvar-LDFLAGS"><code>LDFLAGS</code></a> need to contain the shell’s 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">
+<code>BASECPPFLAGS</code> </dt> <dd>
+<div class="versionadded"> <p><span class="versionmodified added">New in version 3.4.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-PY_CPPFLAGS">
+<code>PY_CPPFLAGS</code> </dt> <dd>
+<p>Extra preprocessor flags added for building the interpreter object files.</p> <p>Default: <code>$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)</code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New 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</h3> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CC">
+<code>CC</code> </dt> <dd>
+<p>C compiler command.</p> <p>Example: <code>gcc -pthread</code>.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CXX">
+<code>CXX</code> </dt> <dd>
+<p>C++ compiler command.</p> <p>Example: <code>g++ -pthread</code>.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CFLAGS">
+<code>CFLAGS</code> </dt> <dd>
+<p>C compiler flags.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CFLAGS_NODIST">
+<code>CFLAGS_NODIST</code> </dt> <dd>
+<p><span class="target" id="index-12"></span><a class="reference internal" href="#envvar-CFLAGS_NODIST"><code>CFLAGS_NODIST</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-13"></span><a class="reference internal" href="#envvar-CFLAGS"><code>CFLAGS</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-14"></span><a class="reference internal" href="#envvar-CFLAGS"><code>CFLAGS</code></a> should not contain:</p> <ul class="simple"> <li>the compiler flag <code>-I</code> (for setting the search path for include files). The <code>-I</code> flags are processed from left to right, and any flags in <span class="target" id="index-15"></span><a class="reference internal" href="#envvar-CFLAGS"><code>CFLAGS</code></a> would take precedence over user- and package-supplied <code>-I</code> flags.</li> <li>hardening flags such as <code>-Werror</code> because distributions cannot control whether packages installed by users conform to such heightened standards.</li> </ul> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.5.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-COMPILEALL_OPTS">
+<code>COMPILEALL_OPTS</code> </dt> <dd>
+<p>Options passed to the <a class="reference internal" href="../library/compileall#module-compileall" title="compileall: Tools for byte-compiling all Python source files in a directory tree."><code>compileall</code></a> command line when building PYC files in <code>make install</code>. Default: <code>-j0</code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.12.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-EXTRA_CFLAGS">
+<code>EXTRA_CFLAGS</code> </dt> <dd>
+<p>Extra C compiler flags.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CONFIGURE_CFLAGS">
+<code>CONFIGURE_CFLAGS</code> </dt> <dd>
+<p>Value of <span class="target" id="index-16"></span><a class="reference internal" href="#envvar-CFLAGS"><code>CFLAGS</code></a> variable passed to the <code>./configure</code> script.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.2.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CONFIGURE_CFLAGS_NODIST">
+<code>CONFIGURE_CFLAGS_NODIST</code> </dt> <dd>
+<p>Value of <span class="target" id="index-17"></span><a class="reference internal" href="#envvar-CFLAGS_NODIST"><code>CFLAGS_NODIST</code></a> variable passed to the <code>./configure</code> script.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.5.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-BASECFLAGS">
+<code>BASECFLAGS</code> </dt> <dd>
+<p>Base compiler flags.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-OPT">
+<code>OPT</code> </dt> <dd>
+<p>Optimization flags.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CFLAGS_ALIASING">
+<code>CFLAGS_ALIASING</code> </dt> <dd>
+<p>Strict or non-strict aliasing flags used to compile <code>Python/dtoa.c</code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.7.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CCSHARED">
+<code>CCSHARED</code> </dt> <dd>
+<p>Compiler flags used to build a shared library.</p> <p>For example, <code>-fPIC</code> is used on Linux and on BSD.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CFLAGSFORSHARED">
+<code>CFLAGSFORSHARED</code> </dt> <dd>
+<p>Extra C flags added for building the interpreter object files.</p> <p>Default: <code>$(CCSHARED)</code> when <a class="reference internal" href="#cmdoption-enable-shared"><code>--enable-shared</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">
+<code>PY_CFLAGS</code> </dt> <dd>
+<p>Default: <code>$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)</code>.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-PY_CFLAGS_NODIST">
+<code>PY_CFLAGS_NODIST</code> </dt> <dd>
+<p>Default: <code>$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/internal</code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.5.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-PY_STDMODULE_CFLAGS">
+<code>PY_STDMODULE_CFLAGS</code> </dt> <dd>
+<p>C flags used for building the interpreter object files.</p> <p>Default: <code>$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED)</code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.7.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-PY_CORE_CFLAGS">
+<code>PY_CORE_CFLAGS</code> </dt> <dd>
+<p>Default: <code>$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE</code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New 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">
+<code>PY_BUILTIN_MODULE_CFLAGS</code> </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#module-posix" title="posix: The most common POSIX system calls (normally used via module os). (Unix)"><code>posix</code></a> module.</p> <p>Default: <code>$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN</code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.8.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-PURIFY">
+<code>PURIFY</code> </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</h3> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-LINKCC">
+<code>LINKCC</code> </dt> <dd>
+<p>Linker command used to build programs like <code>python</code> and <code>_testembed</code>.</p> <p>Default: <code>$(PURIFY) $(CC)</code>.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CONFIGURE_LDFLAGS">
+<code>CONFIGURE_LDFLAGS</code> </dt> <dd>
+<p>Value of <span class="target" id="index-18"></span><a class="reference internal" href="#envvar-LDFLAGS"><code>LDFLAGS</code></a> variable passed to the <code>./configure</code> script.</p> <p>Avoid assigning <span class="target" id="index-19"></span><a class="reference internal" href="#envvar-CFLAGS"><code>CFLAGS</code></a>, <span class="target" id="index-20"></span><a class="reference internal" href="#envvar-LDFLAGS"><code>LDFLAGS</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">New in version 3.2.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-LDFLAGS_NODIST">
+<code>LDFLAGS_NODIST</code> </dt> <dd>
+<p><span class="target" id="index-21"></span><a class="reference internal" href="#envvar-LDFLAGS_NODIST"><code>LDFLAGS_NODIST</code></a> is used in the same manner as <span class="target" id="index-22"></span><a class="reference internal" href="#envvar-CFLAGS_NODIST"><code>CFLAGS_NODIST</code></a>. Use it when a linker flag should <em>not</em> be part of <span class="target" id="index-23"></span><a class="reference internal" href="#envvar-LDFLAGS"><code>LDFLAGS</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-24"></span><a class="reference internal" href="#envvar-LDFLAGS"><code>LDFLAGS</code></a> should not contain:</p> <ul class="simple"> <li>the compiler flag <code>-L</code> (for setting the search path for libraries). The <code>-L</code> flags are processed from left to right, and any flags in <span class="target" id="index-25"></span><a class="reference internal" href="#envvar-LDFLAGS"><code>LDFLAGS</code></a> would take precedence over user- and package-supplied <code>-L</code> flags.</li> </ul> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-CONFIGURE_LDFLAGS_NODIST">
+<code>CONFIGURE_LDFLAGS_NODIST</code> </dt> <dd>
+<p>Value of <span class="target" id="index-26"></span><a class="reference internal" href="#envvar-LDFLAGS_NODIST"><code>LDFLAGS_NODIST</code></a> variable passed to the <code>./configure</code> script.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.8.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-LDFLAGS">
+<code>LDFLAGS</code> </dt> <dd>
+<p>Linker flags, e.g. <code>-L<em>lib_dir</em></code> if you have libraries in a nonstandard directory <em>lib_dir</em>.</p> <p>Both <span class="target" id="index-27"></span><a class="reference internal" href="#envvar-CPPFLAGS"><code>CPPFLAGS</code></a> and <span class="target" id="index-28"></span><a class="reference internal" href="#envvar-LDFLAGS"><code>LDFLAGS</code></a> need to contain the shell’s 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">
+<code>LIBS</code> </dt> <dd>
+<p>Linker flags to pass libraries to the linker when linking the Python executable.</p> <p>Example: <code>-lrt</code>.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-LDSHARED">
+<code>LDSHARED</code> </dt> <dd>
+<p>Command to build a shared library.</p> <p>Default: <code>@LDSHARED@ $(PY_LDFLAGS)</code>.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-BLDSHARED">
+<code>BLDSHARED</code> </dt> <dd>
+<p>Command to build <code>libpython</code> shared library.</p> <p>Default: <code>@BLDSHARED@ $(PY_CORE_LDFLAGS)</code>.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-PY_LDFLAGS">
+<code>PY_LDFLAGS</code> </dt> <dd>
+<p>Default: <code>$(CONFIGURE_LDFLAGS) $(LDFLAGS)</code>.</p> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-PY_LDFLAGS_NODIST">
+<code>PY_LDFLAGS_NODIST</code> </dt> <dd>
+<p>Default: <code>$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)</code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.8.</span></p> </div> </dd>
+</dl> <dl class="std envvar"> <dt class="sig sig-object std" id="envvar-PY_CORE_LDFLAGS">
+<code>PY_CORE_LDFLAGS</code> </dt> <dd>
+<p>Linker flags used for building the interpreter object files.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.8.</span></p> </div> </dd>
+</dl> </section> </section> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2001&ndash;2023 Python Software Foundation<br>Licensed under the PSF License.<br>
+ <a href="https://docs.python.org/3.12/using/configure.html" class="_attribution-link">https://docs.python.org/3.12/using/configure.html</a>
+ </p>
+</div>