Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 1 | **************** |
| 2 | Configure Python |
| 3 | **************** |
| 4 | |
| 5 | .. _configure-options: |
| 6 | |
| 7 | Configure Options |
| 8 | ================= |
| 9 | |
| 10 | List all ``./configure`` script options using:: |
| 11 | |
| 12 | ./configure --help |
| 13 | |
| 14 | See also the :file:`Misc/SpecialBuilds.txt` in the Python source distribution. |
| 15 | |
| 16 | General Options |
| 17 | --------------- |
| 18 | |
| 19 | .. cmdoption:: --enable-loadable-sqlite-extensions |
| 20 | |
| 21 | Support loadable extensions in the :mod:`_sqlite` extension module (default |
| 22 | is no), see the :mod:`sqlite3` module. |
| 23 | |
| 24 | .. versionadded:: 3.6 |
| 25 | |
| 26 | .. cmdoption:: --disable-ipv6 |
| 27 | |
| 28 | Disable IPv6 support (enabled by default if supported), see the |
| 29 | :mod:`socket` module. |
| 30 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 31 | .. cmdoption:: --enable-big-digits=[15|30] |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 32 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 33 | Define the size in bits of Python :class:`int` digits: 15 or 30 bits. |
| 34 | |
| 35 | By default, the number of bits is selected depending on ``sizeof(void*)``: |
| 36 | 30 bits if ``void*`` size is 64-bit or larger, 15 bits otherwise. |
| 37 | |
| 38 | Define the ``PYLONG_BITS_IN_DIGIT`` to ``15`` or ``30``. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 39 | |
| 40 | See :data:`sys.int_info.bits_per_digit <sys.int_info>`. |
| 41 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 42 | .. cmdoption:: --with-cxx-main |
| 43 | .. cmdoption:: --with-cxx-main=COMPILER |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 44 | |
| 45 | Compile the Python ``main()`` function and link Python executable with C++ |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 46 | compiler: ``$CXX``, or *COMPILER* if specified. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 47 | |
| 48 | .. cmdoption:: --with-suffix=SUFFIX |
| 49 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 50 | Set the Python executable suffix to *SUFFIX*. |
| 51 | |
| 52 | The default suffix is ``.exe`` on Windows and macOS (``python.exe`` |
| 53 | executable), and an empty string on other platforms (``python`` executable). |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 54 | |
| 55 | .. cmdoption:: --with-tzpath=<list of absolute paths separated by pathsep> |
| 56 | |
| 57 | Select the default time zone search path for :data:`zoneinfo.TZPATH`, |
| 58 | see the :mod:`zoneinfo` module. |
| 59 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 60 | Default: ``/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo``. |
| 61 | |
| 62 | See :data:`os.pathsep` path separator. |
| 63 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 64 | .. versionadded:: 3.9 |
| 65 | |
| 66 | .. cmdoption:: --without-decimal-contextvar |
| 67 | |
| 68 | Build the ``_decimal`` extension module using a thread-local context rather |
| 69 | than a coroutine-local context (default), see the :mod:`decimal` module. |
| 70 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 71 | See :data:`decimal.HAVE_CONTEXTVAR` and the :mod:`contextvars` module. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 72 | |
| 73 | .. versionadded:: 3.9 |
| 74 | |
| 75 | .. cmdoption:: --with-dbmliborder=db1:db2:... |
| 76 | |
| 77 | Override order to check db backends for the :mod:`dbm` module |
| 78 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 79 | A valid value is a colon (``:``) separated string with the backend names: |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 80 | |
| 81 | * ``ndbm``; |
| 82 | * ``gdbm``; |
| 83 | * ``bdb``. |
| 84 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 85 | .. cmdoption:: --without-c-locale-coercion |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 86 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 87 | Disable C locale coercion to a UTF-8 based locale (enabled by default). |
| 88 | |
| 89 | Don't define the ``PY_COERCE_C_LOCALE`` macro. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 90 | |
| 91 | See :envvar:`PYTHONCOERCECLOCALE` and the :pep:`538`. |
| 92 | |
| 93 | .. cmdoption:: --with-platlibdir=DIRNAME |
| 94 | |
| 95 | Python library directory name (default is ``lib``). |
| 96 | |
| 97 | Fedora and SuSE use ``lib64`` on 64-bit platforms. |
| 98 | |
| 99 | See :data:`sys.platlibdir`. |
| 100 | |
| 101 | .. versionadded:: 3.9 |
| 102 | |
| 103 | .. cmdoption:: --with-wheel-pkg-dir=PATH |
| 104 | |
| 105 | Directory of wheel packages used by the :mod:`ensurepip` module |
| 106 | (none by default). |
| 107 | |
| 108 | Some Linux distribution packaging policies recommend against bundling |
| 109 | dependencies. For example, Fedora installs wheel packages in the |
| 110 | ``/usr/share/python-wheels/`` directory and don't install the |
| 111 | :mod:`ensurepip._bundled` package. |
| 112 | |
| 113 | .. versionadded:: 3.10 |
| 114 | |
| 115 | |
| 116 | Install Options |
| 117 | --------------- |
| 118 | |
| 119 | .. cmdoption:: --disable-test-modules |
| 120 | |
| 121 | Don't build nor install test modules, like the :mod:`test` package or the |
| 122 | :mod:`_testcapi` extension module (built and installed by default). |
| 123 | |
| 124 | .. versionadded:: 3.10 |
| 125 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 126 | .. cmdoption:: --with-ensurepip=[upgrade|install|no] |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 127 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 128 | Select the :mod:`ensurepip` command run on Python installation: |
| 129 | |
| 130 | * ``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade`` |
| 131 | command. |
| 132 | * ``install``: run ``python -m ensurepip --altinstall`` command; |
| 133 | * ``no``: don't run ensurepip; |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 134 | |
| 135 | .. versionadded:: 3.6 |
| 136 | |
| 137 | |
| 138 | Performance options |
| 139 | ------------------- |
| 140 | |
| 141 | Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) is |
| 142 | recommended for best performance. |
| 143 | |
| 144 | .. cmdoption:: --enable-optimizations |
| 145 | |
| 146 | Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK` |
| 147 | (disabled by default). |
| 148 | |
| 149 | Disable also semantic interposition in libpython if ``--enable-shared`` and |
| 150 | GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker |
| 151 | flags. |
| 152 | |
| 153 | .. versionadded:: 3.6 |
| 154 | |
| 155 | .. versionchanged:: 3.10 |
| 156 | Use ``-fno-semantic-interposition`` on GCC. |
| 157 | |
| 158 | .. envvar:: PROFILE_TASK |
| 159 | |
| 160 | Environment variable used in the Makefile: Python command line arguments for |
| 161 | the PGO generation task. |
| 162 | |
| 163 | Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``. |
| 164 | |
| 165 | .. versionadded:: 3.8 |
| 166 | |
| 167 | .. cmdoption:: --with-lto |
| 168 | |
| 169 | Enable Link Time Optimization (LTO) in any build (disabled by default). |
| 170 | |
| 171 | .. versionadded:: 3.6 |
| 172 | |
| 173 | .. cmdoption:: --with-computed-gotos |
| 174 | |
| 175 | Enable computed gotos in evaluation loop (enabled by default on supported |
| 176 | compilers). |
| 177 | |
| 178 | .. cmdoption:: --without-pymalloc |
| 179 | |
| 180 | Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>` |
| 181 | (enabled by default). |
| 182 | |
| 183 | See also :envvar:`PYTHONMALLOC` environment variable. |
| 184 | |
| 185 | .. cmdoption:: --without-doc-strings |
| 186 | |
| 187 | Disable static documentation strings to reduce the memory footprint (enabled |
| 188 | by default). Documentation strings defined in Python are not affected. |
| 189 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 190 | Don't define the ``WITH_DOC_STRINGS`` macro. |
| 191 | |
| 192 | See the ``PyDoc_STRVAR()`` macro. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 193 | |
| 194 | .. cmdoption:: --enable-profiling |
| 195 | |
| 196 | Enable C-level code profiling with ``gprof`` (disabled by default). |
| 197 | |
| 198 | |
| 199 | .. _debug-build: |
| 200 | |
| 201 | Debug build |
| 202 | ----------- |
| 203 | |
| 204 | A debug build is Python built with the :option:`--with-pydebug` configure |
| 205 | option. |
| 206 | |
| 207 | Effects of a debug build: |
| 208 | |
| 209 | * Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros. |
| 210 | * Add ``d`` to :data:`sys.abiflags`. |
| 211 | * Add :func:`sys.gettotalrefcount` function. |
| 212 | * Add :option:`-X showrefcount <-X>` command line option. |
| 213 | * Add :envvar:`PYTHONTHREADDEBUG` environment variable. |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 214 | * Add support for the ``__ltrace__`` variable: enable low-level tracing in the |
| 215 | bytecode evaluation loop if the variable is defined. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 216 | * The list of default warning filters is empty in the :mod:`warnings` module. |
| 217 | * Install debug hooks on memory allocators to detect buffer overflow and other |
| 218 | memory errors: see :c:func:`PyMem_SetupDebugHooks`. |
| 219 | * Build Python with assertions (don't set ``NDEBUG`` macro): |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 220 | ``assert(...);`` and ``_PyObject_ASSERT(...);``. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 221 | See also the :option:`--with-assertions` configure option. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 222 | * Unicode and int objects are created with their memory filled with a pattern |
| 223 | to help detecting uninitialized bytes. |
| 224 | * Many functions ensure that are not called with an exception raised, since |
| 225 | they can clear or replace the current exception. |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 226 | * The garbage collector (:func:`gc.collect` function) runs some basic checks on |
| 227 | objects consistency. |
| 228 | * More generally, add runtime checks, code surroundeded by ``#ifdef Py_DEBUG`` |
| 229 | and ``#endif``. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 230 | |
| 231 | See also the :ref:`Python Development Mode <devmode>` and the |
| 232 | :option:`--with-trace-refs` configure option. |
| 233 | |
| 234 | .. versionchanged:: 3.8 |
| 235 | Release builds and debug builds are now ABI compatible: defining the |
| 236 | ``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro, which |
| 237 | introduces the only ABI incompatibility. |
| 238 | |
| 239 | |
| 240 | Debug options |
| 241 | ------------- |
| 242 | |
| 243 | .. cmdoption:: --with-pydebug |
| 244 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 245 | :ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG`` |
| 246 | macro (disabled by default). |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 247 | |
| 248 | .. cmdoption:: --with-trace-refs |
| 249 | |
| 250 | Enable tracing references for debugging purpose (disabled by default). |
| 251 | |
| 252 | Effects: |
| 253 | |
| 254 | * Define the ``Py_TRACE_REFS`` macro. |
| 255 | * Add :func:`sys.getobjects` function. |
| 256 | * Add :envvar:`PYTHONDUMPREFS` environment variable. |
| 257 | |
| 258 | This build is not ABI compatible with release build (default build) or debug |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 259 | build (``Py_DEBUG`` and ``Py_REF_DEBUG`` macros). |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 260 | |
| 261 | .. versionadded:: 3.8 |
| 262 | |
| 263 | .. cmdoption:: --with-assertions |
| 264 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 265 | Build with C assertions enabled (default is no): ``assert(...);`` and |
| 266 | ``_PyObject_ASSERT(...);``. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 267 | |
| 268 | If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler |
| 269 | variable. |
| 270 | |
| 271 | See also the :option:`--with-pydebug` option (:ref:`debug build |
| 272 | <debug-build>`) which also enables assertions. |
| 273 | |
| 274 | .. versionadded:: 3.6 |
| 275 | |
| 276 | .. cmdoption:: --with-valgrind |
| 277 | |
| 278 | Enable Valgrind support (default is no). |
| 279 | |
| 280 | .. cmdoption:: --with-dtrace |
| 281 | |
| 282 | Enable DTrace support (default is no). |
| 283 | |
| 284 | .. versionadded:: 3.6 |
| 285 | |
| 286 | .. cmdoption:: --with-address-sanitizer |
| 287 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 288 | Enable AddressSanitizer memory error detector, ``asan`` (default is no). |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 289 | |
| 290 | .. versionadded:: 3.6 |
| 291 | |
| 292 | .. cmdoption:: --with-memory-sanitizer |
| 293 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 294 | Enable MemorySanitizer allocation error detector, ``msan`` (default is no). |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 295 | |
| 296 | .. versionadded:: 3.6 |
| 297 | |
| 298 | .. cmdoption:: --with-undefined-behavior-sanitizer |
| 299 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 300 | Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 301 | (default is no). |
| 302 | |
| 303 | .. versionadded:: 3.6 |
| 304 | |
| 305 | |
| 306 | Linker options |
| 307 | -------------- |
| 308 | |
| 309 | .. cmdoption:: --enable-shared |
| 310 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 311 | Enable building a shared Python library: ``libpython`` (default is no). |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 312 | |
| 313 | .. cmdoption:: --without-static-libpython |
| 314 | |
| 315 | Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` |
| 316 | (built and enabled by default). |
| 317 | |
| 318 | .. versionadded:: 3.10 |
| 319 | |
| 320 | |
| 321 | Libraries options |
| 322 | ----------------- |
| 323 | |
| 324 | .. cmdoption:: --with-libs='lib1 ...' |
| 325 | |
| 326 | Link against additional libraries (default is no). |
| 327 | |
| 328 | .. cmdoption:: --with-system-expat |
| 329 | |
| 330 | Build the :mod:`pyexpat` module using an installed ``expat`` library |
| 331 | (default is no). |
| 332 | |
| 333 | .. cmdoption:: --with-system-ffi |
| 334 | |
| 335 | Build the :mod:`_ctypes` extension module using an installed ``ffi`` |
| 336 | library, see the :mod:`ctypes` module (default is system-dependent). |
| 337 | |
| 338 | .. cmdoption:: --with-system-libmpdec |
| 339 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 340 | Build the ``_decimal`` extension module using an installed ``mpdec`` |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 341 | library, see the :mod:`decimal` module (default is no). |
| 342 | |
| 343 | .. versionadded:: 3.3 |
| 344 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 345 | .. cmdoption:: --with-readline=editline |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 346 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 347 | Use ``editline`` library for backend of the :mod:`readline` module. |
| 348 | |
| 349 | Define the ``WITH_EDITLINE`` macro. |
| 350 | |
| 351 | .. versionadded:: 3.10 |
| 352 | |
| 353 | .. cmdoption:: --without-readline |
| 354 | |
| 355 | Don't build the :mod:`readline` module (built by default). |
| 356 | |
| 357 | Don't define the ``HAVE_LIBREADLINE`` macro. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 358 | |
| 359 | .. versionadded:: 3.10 |
| 360 | |
| 361 | .. cmdoption:: --with-tcltk-includes='-I...' |
| 362 | |
| 363 | Override search for Tcl and Tk include files. |
| 364 | |
| 365 | .. cmdoption:: --with-tcltk-libs='-L...' |
| 366 | |
| 367 | Override search for Tcl and Tk libraries. |
| 368 | |
| 369 | .. cmdoption:: --with-libm=STRING |
| 370 | |
| 371 | Override ``libm`` math library to *STRING* (default is system-dependent). |
| 372 | |
| 373 | .. cmdoption:: --with-libc=STRING |
| 374 | |
| 375 | Override ``libc`` C library to *STRING* (default is system-dependent). |
| 376 | |
| 377 | .. cmdoption:: --with-openssl=DIR |
| 378 | |
| 379 | Root of the OpenSSL directory. |
| 380 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 381 | .. versionadded:: 3.7 |
| 382 | |
| 383 | .. cmdoption:: --with-openssl-rpath=[no|auto|DIR] |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 384 | |
| 385 | Set runtime library directory (rpath) for OpenSSL libraries: |
| 386 | |
| 387 | * ``no`` (default): don't set rpath; |
| 388 | * ``auto``: auto-detect rpath from :option:`--with-openssl` and |
| 389 | ``pkg-config``; |
| 390 | * *DIR*: set an explicit rpath. |
| 391 | |
| 392 | .. versionadded:: 3.10 |
| 393 | |
| 394 | |
| 395 | Security Options |
| 396 | ---------------- |
| 397 | |
| 398 | .. cmdoption:: --with-hash-algorithm=[fnv|siphash24] |
| 399 | |
| 400 | Select hash algorithm for use in ``Python/pyhash.c``: |
| 401 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 402 | * ``siphash24`` (default). |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 403 | * ``fnv``; |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 404 | |
| 405 | .. versionadded:: 3.4 |
| 406 | |
| 407 | .. cmdoption:: --with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2 |
| 408 | |
| 409 | Built-in hash modules: |
| 410 | |
| 411 | * ``md5``; |
| 412 | * ``sha1``; |
| 413 | * ``sha256``; |
| 414 | * ``sha512``; |
| 415 | * ``sha3`` (with shake); |
| 416 | * ``blake2``. |
| 417 | |
| 418 | .. versionadded:: 3.9 |
| 419 | |
| 420 | .. cmdoption:: --with-ssl-default-suites=[python|openssl|STRING] |
| 421 | |
| 422 | Override the OpenSSL default cipher suites string: |
| 423 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 424 | * ``python`` (default): use Python's preferred selection; |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 425 | * ``openssl``: leave OpenSSL's defaults untouched; |
| 426 | * *STRING*: use a custom string, PROTOCOL_SSLv2 ignores the setting. |
| 427 | |
| 428 | See the :mod:`ssl` module. |
| 429 | |
| 430 | .. versionadded:: 3.7 |
| 431 | |
| 432 | |
| 433 | macOS Options |
| 434 | ------------- |
| 435 | |
| 436 | See ``Mac/README.rst``. |
| 437 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 438 | .. cmdoption:: --enable-universalsdk |
| 439 | .. cmdoption:: --enable-universalsdk=SDKDIR |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 440 | |
| 441 | Create a universal binary build. *SDKDIR* specifies which macOS SDK should |
| 442 | be used to perform the build (default is no). |
| 443 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 444 | .. cmdoption:: --enable-framework |
| 445 | .. cmdoption:: --enable-framework=INSTALLDIR |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 446 | |
| 447 | Create a Python.framework rather than a traditional Unix install. Optional |
| 448 | *INSTALLDIR* specifies the installation path (default is no). |
| 449 | |
| 450 | .. cmdoption:: --with-universal-archs=ARCH |
| 451 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 452 | Specify the kind of universal binary that should be created. This option is |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 453 | only valid when :option:`--enable-universalsdk` is set. |
| 454 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 455 | Options: |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 456 | |
| 457 | * ``universal2``; |
| 458 | * ``32-bit``; |
| 459 | * ``64-bit``; |
| 460 | * ``3-way``; |
| 461 | * ``intel``; |
| 462 | * ``intel-32``; |
| 463 | * ``intel-64``; |
| 464 | * ``all``. |
| 465 | |
| 466 | .. cmdoption:: --with-framework-name=FRAMEWORK |
| 467 | |
| 468 | Specify the name for the python framework on macOS only valid when |
| 469 | :option:`--enable-framework` is set (default: ``Python``). |
| 470 | |
| 471 | |
| 472 | Compiler and linker flags |
| 473 | ========================= |
| 474 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 475 | Options set by the ``./configure`` script and environment variables and used by |
| 476 | ``Makefile``. |
| 477 | |
| 478 | Main files of the Python build system: |
| 479 | |
| 480 | * :file:`configure.ac` => :file:`configure`; |
| 481 | * :file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`); |
| 482 | * :file:`pyconfig.h` (created by :file:`configure`); |
| 483 | * :file:`Modules/Setup`. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 484 | |
| 485 | Preprocessor flags |
| 486 | ------------------ |
| 487 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 488 | .. envvar:: CONFIGURE_CPPFLAGS |
| 489 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 490 | Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script. |
| 491 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 492 | .. versionadded:: 3.6 |
| 493 | |
| 494 | .. envvar:: CPPFLAGS |
| 495 | |
| 496 | (Objective) C/C++ preprocessor flags, e.g. ``-I<include dir>`` if you have |
| 497 | headers in a nonstandard directory ``<include dir>``. |
| 498 | |
| 499 | Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's |
| 500 | value for setup.py to be able to build extension modules using the |
| 501 | directories specified in the environment variables. |
| 502 | |
| 503 | .. envvar:: BASECPPFLAGS |
| 504 | |
| 505 | .. versionadded:: 3.4 |
| 506 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 507 | .. envvar:: PY_CPPFLAGS |
| 508 | |
| 509 | Extra preprocessor flags added for building the interpreter object files. |
| 510 | |
| 511 | Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)``. |
| 512 | |
| 513 | .. versionadded:: 3.2 |
| 514 | |
| 515 | Compiler flags |
| 516 | -------------- |
| 517 | |
| 518 | .. envvar:: CC |
| 519 | |
| 520 | C compiler command. |
| 521 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 522 | Example: ``gcc -pthread``. |
| 523 | |
| 524 | .. envvar:: CXX |
| 525 | |
| 526 | C++ compiler command. |
| 527 | |
| 528 | Used if the :option:`--with-cxx-main` option is used. |
| 529 | |
| 530 | Example: ``g++ -pthread``. |
| 531 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 532 | .. envvar:: CFLAGS |
| 533 | |
| 534 | C compiler flags. |
| 535 | |
| 536 | .. envvar:: CFLAGS_NODIST |
| 537 | |
| 538 | :envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C |
| 539 | extensions. Use it when a compiler flag should *not* be part of the |
| 540 | distutils :envvar:`CFLAGS` once Python is installed (:issue:`21121`). |
| 541 | |
| 542 | .. versionadded:: 3.5 |
| 543 | |
| 544 | .. envvar:: EXTRA_CFLAGS |
| 545 | |
| 546 | Extra C compiler flags. |
| 547 | |
| 548 | .. envvar:: CONFIGURE_CFLAGS |
| 549 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 550 | Value of :envvar:`CFLAGS` variable passed to the ``./configure`` |
| 551 | script. |
| 552 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 553 | .. versionadded:: 3.2 |
| 554 | |
| 555 | .. envvar:: CONFIGURE_CFLAGS_NODIST |
| 556 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 557 | Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` |
| 558 | script. |
| 559 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 560 | .. versionadded:: 3.5 |
| 561 | |
| 562 | .. envvar:: BASECFLAGS |
| 563 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 564 | Base compiler flags. |
| 565 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 566 | .. envvar:: OPT |
| 567 | |
| 568 | Optimization flags. |
| 569 | |
| 570 | .. envvar:: CFLAGS_ALIASING |
| 571 | |
| 572 | Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``. |
| 573 | |
| 574 | .. versionadded:: 3.7 |
| 575 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 576 | .. envvar:: CCSHARED |
| 577 | |
| 578 | Compiler flags used to build a shared library. |
| 579 | |
| 580 | For example, ``-fPIC`` is used on Linux and on BSD. |
| 581 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 582 | .. envvar:: CFLAGSFORSHARED |
| 583 | |
| 584 | Extra C flags added for building the interpreter object files. |
| 585 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 586 | Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty |
| 587 | string otherwise. |
| 588 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 589 | .. envvar:: PY_CFLAGS |
| 590 | |
| 591 | Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)``. |
| 592 | |
| 593 | .. envvar:: PY_CFLAGS_NODIST |
| 594 | |
| 595 | Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/internal``. |
| 596 | |
| 597 | .. versionadded:: 3.5 |
| 598 | |
| 599 | .. envvar:: PY_STDMODULE_CFLAGS |
| 600 | |
| 601 | C flags used for building the interpreter object files. |
| 602 | |
| 603 | Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED)``. |
| 604 | |
| 605 | .. versionadded:: 3.7 |
| 606 | |
| 607 | .. envvar:: PY_CORE_CFLAGS |
| 608 | |
| 609 | Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``. |
| 610 | |
| 611 | .. versionadded:: 3.2 |
| 612 | |
| 613 | .. envvar:: PY_BUILTIN_MODULE_CFLAGS |
| 614 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 615 | Compiler flags to build a standard library extension module as a built-in |
| 616 | module, like the :mod:`posix` module. |
| 617 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 618 | Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``. |
| 619 | |
| 620 | .. versionadded:: 3.8 |
| 621 | |
| 622 | |
| 623 | Linker flags |
| 624 | ------------ |
| 625 | |
| 626 | .. envvar:: CONFIGURE_LDFLAGS |
| 627 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 628 | Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script. |
| 629 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 630 | Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use |
| 631 | them on the command line to append to these values without stomping the |
| 632 | pre-set values. |
| 633 | |
| 634 | .. versionadded:: 3.2 |
| 635 | |
| 636 | .. envvar:: LDFLAGS_NODIST |
| 637 | |
| 638 | :envvar:`LDFLAGS_NODIST` is used in the same manner as |
| 639 | :envvar:`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of |
| 640 | the distutils :envvar:`LDFLAGS` once Python is installed (:issue:`35257`). |
| 641 | |
| 642 | .. envvar:: CONFIGURE_LDFLAGS_NODIST |
| 643 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 644 | Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` |
| 645 | script. |
| 646 | |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 647 | .. versionadded:: 3.8 |
| 648 | |
| 649 | .. envvar:: LDFLAGS |
| 650 | |
| 651 | Linker flags, e.g. ``-L<lib dir>`` if you have libraries in a nonstandard |
| 652 | directory ``<lib dir>``. |
| 653 | |
| 654 | Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's |
| 655 | value for setup.py to be able to build extension modules using the |
| 656 | directories specified in the environment variables. |
| 657 | |
| 658 | .. envvar:: LIBS |
| 659 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 660 | Linker flags to pass libraries to the linker when linking the Python |
| 661 | executable. |
| 662 | |
| 663 | Example: ``-lrt``. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 664 | |
| 665 | .. envvar:: LDSHARED |
| 666 | |
| 667 | Command to build a shared library. |
| 668 | |
| 669 | Default: ``@LDSHARED@ $(PY_LDFLAGS)``. |
| 670 | |
| 671 | .. envvar:: BLDSHARED |
| 672 | |
Victor Stinner | 5436695 | 2021-04-09 01:58:20 +0200 | [diff] [blame] | 673 | Command to build ``libpython`` shared library. |
Victor Stinner | a41782c | 2021-04-08 22:32:21 +0200 | [diff] [blame] | 674 | |
| 675 | Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``. |
| 676 | |
| 677 | .. envvar:: PY_LDFLAGS |
| 678 | |
| 679 | Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``. |
| 680 | |
| 681 | .. envvar:: PY_LDFLAGS_NODIST |
| 682 | |
| 683 | Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``. |
| 684 | |
| 685 | .. versionadded:: 3.8 |
| 686 | |
| 687 | .. envvar:: PY_CORE_LDFLAGS |
| 688 | |
| 689 | Linker flags used for building the interpreter object files. |
| 690 | |
| 691 | .. versionadded:: 3.8 |