• Home
  • Raw
  • Download

Lines Matching +full:cxx +full:- +full:test +full:- +full:suite

2 dnl * Please run autoreconf -if to test your changes! *
5 dnl Python's configure.ac file requires autoconf 2.69 and autoconf-archive.
18 [AC_MSG_ERROR([Please install autoconf-archive package and re-run autoreconf])]
23 [AC_MSG_ERROR([Please install pkgconf's m4 macro package and re-run autoreconf])]
27 dnl - _SAVE_VAR([VAR]) Helper for SAVE_ENV; stores VAR as save_VAR
28 dnl - _RESTORE_VAR([VAR]) Helper for RESTORE_ENV; restores VAR from save_VAR
29 dnl - SAVE_ENV Saves CFLAGS, LDFLAGS, LIBS, and CPPFLAGS
30 dnl - RESTORE_ENV Restores CFLAGS, LDFLAGS, LIBS, and CPPFLAGS
31 dnl - WITH_SAVE_ENV([SCRIPT]) Runs SCRIPT wrapped with SAVE_ENV/RESTORE_ENV
52 dnl PY_CHECK_FUNC(FUNCTION, [INCLUDES], [AC_DEFINE-VAR])
72 dnl PY_CHECK_LIB(LIBRARY, FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES])
86 AS_IF([test "$ac_sys_system" = "Emscripten" -a -z "$py_cflags" -a -z "$py_libs"], [
95 if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
96 # If we're building out-of-tree, we need to make sure the following
98 # Objects/ -> typeslots.inc
99 # Include/ -> Python.h
100 # Python/ -> importlib.h
102 # regenerated when building out-of-tree, regardless of whether or not
103 # the $srcdir counterpart is up-to-date. This is an acceptable trade
105 BASECPPFLAGS="-IObjects -IInclude -IPython"
114 if test -e $srcdir/.git
116 AC_CHECK_PROG(HAS_GIT, git, found, not-found)
118 HAS_GIT=no-repository
120 if test $HAS_GIT = found
122 GITVERSION="git --git-dir \$(srcdir)/.git rev-parse --short HEAD"
123 GITTAG="git --git-dir \$(srcdir)/.git describe --all --always --dirty"
124 GITBRANCH="git --git-dir \$(srcdir)/.git name-rev --name-only HEAD"
139 [AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])]
142 # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
143 rm -f pybuilddir.txt
146 [build-python],
147 [AS_HELP_STRING([--with-build-python=python]PYTHON_VERSION,
150 AC_MSG_CHECKING([for --with-build-python])
153 …AS_VAR_IF([with_build_python], [no], [AC_MSG_ERROR([invalid --with-build-python option: expected p…
155 if ! $(command -v "$with_build_python" >/dev/null 2>&1); then
158 …build_python_ver=$($with_build_python -c "import sys; print(f'{sys.version_info.major}.{sys.versio…
159 if test "$build_python_ver" != "$PACKAGE_VERSION"; then
165 …lddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt &&…
169 [AC_MSG_ERROR([Cross compiling requires --with-build-python])]
171 PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
211 if command -v "$PYTHON_FOR_REGEN" >/dev/null 2>&1; then
212 AC_MSG_RESULT([$($PYTHON_FOR_REGEN -V 2>/dev/null)])
222 if test "$prefix" != "/"; then
223 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
242 # with other autoconf-based packages that include Python.h
243 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
255 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
260 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
265 # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
276 dnl Allow users to disable pkg-config or require pkg-config
278 [pkg-config],
279 [AS_HELP_STRING([[--with-pkg-config=[yes|no|check]]],
280 [use pkg-config to detect build options (default is check)])],
286 if test -z "$PKG_CONFIG"; then
296 dnl force AX_CHECK_OPENSSL to ignore pkg-config
300 [AC_MSG_ERROR([invalid argument --with-pkg-config=$with_pkg_config])]
302 if test "$with_pkg_config" = yes -a -z "$PKG_CONFIG"; then
303 AC_MSG_ERROR([pkg-config is required])]
306 AC_MSG_CHECKING([for --enable-universalsdk])
308 AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@],
317 enableval="`/usr/bin/xcodebuild -version -sdk macosx Path 2>/dev/null`"
318 if ! ( echo $enableval | grep -E '\.sdk' 1>/dev/null )
321 if test ! -d "${enableval}"
335 if test ! -d "${UNIVERSALSDK}"
337 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
346 if test -n "${UNIVERSALSDK}"
357 # For backward compatibility reasons we prefer to select '32-bit' if available,
359 UNIVERSAL_ARCHS="32-bit"
360 if test "`uname -s`" = "Darwin"
362 if test -n "${UNIVERSALSDK}"
364 if test -z "`/usr/bin/file -L "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`"
373 AC_MSG_CHECKING(for --with-universal-archs)
374 AC_ARG_WITH(universal-archs,
375 AS_HELP_STRING([--with-universal-archs=ARCH],
377 This option is only valid when --enable-universalsdk is set; options are:
378 ("universal2", "intel-64", "intel-32", "intel", "32-bit",
379 "64-bit", "3-way", or "all")
385 if test -n "${UNIVERSALSDK}"
392 AC_ARG_WITH(framework-name,
393 AS_HELP_STRING([--with-framework-name=FRAMEWORK],
395 only valid when --enable-framework is set. see Mac/README.rst
400 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
408 AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@],
420 PYTHONFRAMEWORKDIR=no-framework
428 if test "x${prefix}" = "xNONE"; then
445 if test "x${prefix}" = "xNONE" ; then
455 if test "${prefix}" = "NONE" ; then
470 if test "${prefix}" = "NONE"; then
472 # --prefix option, but wants to install
473 # the framework in a non-default location,
497 PYTHONFRAMEWORKDIR=no-framework
505 if test "x${prefix}" = "xNONE" ; then
528 # Set name for machine-dependent library files
529 AC_ARG_VAR([MACHDEP], [name for machine-dependent library files])
531 if test -z "$MACHDEP"
534 if test "$cross_compiling" = yes; then
539 *-*-linux-android*)
540 ac_sys_system=Linux-android
542 *-*-linux*)
545 *-*-cygwin*)
548 *-*-vxworks*)
551 *-*-emscripten)
554 *-*-wasi)
564 ac_sys_system=`uname -s`
565 if test "$ac_sys_system" = "AIX" \
566 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
567 ac_sys_release=`uname -v`
569 ac_sys_release=`uname -r`
573 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
575 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
589 if test "$cross_compiling" = yes; then
591 *-*-linux*)
600 *-*-cygwin*)
603 *-*-vxworks*)
606 wasm32-*-* | wasm64-*-*)
614 _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
649 NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
661 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
676 Darwin/@<:@[12]@:>@@<:@0-9@:>@.*)
689 # On HP-UX, defining _XOPEN_SOURCE to 600 or greater hides
697 if test $define_xopen_source = yes
699 # X/Open 7, incorporating POSIX.1-2008
706 # cases for HP-UX, we define it globally.
708 Define to activate Unix95-and-earlier features)
710 AC_DEFINE(_POSIX_C_SOURCE, 200809L, Define to activate features from IEEE Stds 1003.1-2008)
713 # On HP-UX mbstate_t requires _INCLUDE__STDC_A1_SOURCE
721 if test $define_stdc_a1 = yes
726 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
743 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
745 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
749 # Don't let AC_PROG_CC set the default CFLAGS. It normally sets -g -O2
750 # when the compiler supports them, but we don't always want -O2, and
751 # we set -g later.
752 if test -z "$CFLAGS"; then
757 dnl On Emscripten use MEMORY64 setting to build target wasm64-emscripten.
760 [wasm64-*-emscripten], [
761 AS_VAR_APPEND([CFLAGS], [" -sMEMORY64=1"])
762 AS_VAR_APPEND([LDFLAGS], [" -sMEMORY64=1"])
766 if test "$ac_sys_system" = "Darwin"
771 if test -z "${CC}"
779 if test -x "${as_dir}/gcc"; then
780 if test -z "${found_gcc}"; then
784 if test -x "${as_dir}/clang"; then
785 if test -z "${found_clang}"; then
792 if test -n "$found_gcc" -a -n "$found_clang"
794 if test -n "`"$found_gcc" --version | grep llvm-gcc`"
796 AC_MSG_NOTICE([Detected llvm-gcc, falling back to clang])
798 CXX="$found_clang++"
802 elif test -z "$found_gcc" -a -n "$found_clang"
806 CXX="$found_clang++"
808 elif test -z "$found_gcc" -a -z "$found_clang"
810 found_clang=`/usr/bin/xcrun -find clang 2>/dev/null`
811 if test -n "${found_clang}"
815 CXX="`/usr/bin/xcrun -find clang++`"
850 ac_cv_cc_name=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
854 rm -f conftest.c conftest.out
862 AC_SUBST(CXX) subst
864 AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
866 AS_HELP_STRING([--with-cxx-main@<:@=COMPILER@:>@],
867 …pile main() and link Python executable with C++ compiler specified in COMPILER (default is $CXX)]),
874 MAINCC='$(CXX)';;
877 if test -z "$CXX"
879 CXX=$withval
887 preset_cxx="$CXX"
888 if test -z "$CXX"
891 gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
892 cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
893 clang|*/clang) AC_PATH_TOOL(CXX, [clang++], [clang++], [notfound]) ;;
894 icc|*/icc) AC_PATH_TOOL(CXX, [icpc], [icpc], [notfound]) ;;
896 if test "$CXX" = "notfound"
898 CXX=""
901 if test -z "$CXX"
903 AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
904 if test "$CXX" = "notfound"
906 CXX=""
909 if test "$preset_cxx" != "$CXX"
913 By default, distutils will build C++ extension modules with "$CXX".
914 If this is not intended, then set CXX on the configure command line.
936 x86_64-linux-gnu
938 x86_64-linux-gnux32
940 i386-linux-gnu
943 aarch64_ilp32-linux-gnu
945 aarch64-linux-gnu
949 aarch64_be_ilp32-linux-gnu
951 aarch64_be-linux-gnu
954 alpha-linux-gnu
957 arm-linux-gnueabihf
959 armeb-linux-gnueabihf
963 arm-linux-gnueabi
965 armeb-linux-gnueabi
968 hppa-linux-gnu
970 ia64-linux-gnu
972 m68k-linux-gnu
975 mipsisa32r6el-linux-gnu
977 mipsisa64r6el-linux-gnuabin32
979 mipsisa64r6el-linux-gnuabi64
985 mipsisa32r6-linux-gnu
987 mipsisa64r6-linux-gnuabin32
989 mipsisa64r6-linux-gnuabi64
995 mipsel-linux-gnu
997 mips64el-linux-gnuabin32
999 mips64el-linux-gnuabi64
1005 mips-linux-gnu
1007 mips64-linux-gnuabin32
1009 mips64-linux-gnuabi64
1014 or1k-linux-gnu
1016 powerpc-linux-gnuspe
1019 powerpc64le-linux-gnu
1021 powerpc64-linux-gnu
1024 powerpc-linux-gnu
1026 s390x-linux-gnu
1028 s390-linux-gnu
1030 sh4-linux-gnu
1032 sparc64-linux-gnu
1034 sparc-linux-gnu
1037 riscv32-linux-gnu
1039 riscv64-linux-gnu
1048 x86_64-kfreebsd-gnu
1050 i386-kfreebsd-gnu
1055 i386-gnu
1062 wasm32-emscripten
1064 wasm32-wasi
1070 wasm64-emscripten
1072 wasm64-wasi
1083 PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
1085 linux-musl*)
1086 PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'`
1093 rm -f conftest.c conftest.out
1099 [MULTIARCH=$($CC --print-multiarch 2>/dev/null)]
1104 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
1105 if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
1108 elif test x$PLATFORM_TRIPLET != x && test x$MULTIARCH = x; then
1113 if test x$MULTIARCH != x; then
1114 MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
1118 dnl Support tiers according to https://peps.python.org/pep-0011/
1124 [x86_64-*-linux-gnu/gcc], [PY_SUPPORT_TIER=1], dnl Linux on AMD64, any vendor, glibc, gcc
1125 [x86_64-apple-darwin*/clang], [PY_SUPPORT_TIER=1], dnl macOS on Intel, any version
1126 [i686-pc-windows-msvc/msvc], [PY_SUPPORT_TIER=1], dnl 32bit Windows on Intel, MSVC
1127 [x86_64-pc-windows-msvc/msvc], [PY_SUPPORT_TIER=1], dnl 64bit Windows on AMD64, MSVC
1129 [aarch64-apple-darwin*/clang], [PY_SUPPORT_TIER=2], dnl macOS on M1, any version
1130 [aarch64-*-linux-gnu/gcc], [PY_SUPPORT_TIER=2], dnl Linux ARM64, glibc, gcc+clang
1131 [aarch64-*-linux-gnu/clang], [PY_SUPPORT_TIER=2],
1132 …[powerpc64le-*-linux-gnu/gcc], [PY_SUPPORT_TIER=2], dnl Linux on PPC64 little endian, glibc, g…
1133 …[x86_64-*-linux-gnu/clang], [PY_SUPPORT_TIER=2], dnl Linux on AMD64, any vendor, glibc, cla…
1135 [aarch64-pc-windows-msvc/msvc], [PY_SUPPORT_TIER=3], dnl Windows ARM64, MSVC
1136 …[armv7l-*-linux-gnueabihf/gcc], [PY_SUPPORT_TIER=3], dnl ARMv7 LE with hardware floats, any ven…
1137 …[powerpc64le-*-linux-gnu/clang], [PY_SUPPORT_TIER=3], dnl Linux on PPC64 little endian, glibc, c…
1138 …[s390x-*-linux-gnu/gcc], [PY_SUPPORT_TIER=3], dnl Linux on 64bit s390x (big endian), gli…
1139 [wasm32-unknown-emscripten/clang], [PY_SUPPORT_TIER=3], dnl WebAssembly Emscripten
1140 [wasm32-unknown-wasi/clang], [PY_SUPPORT_TIER=3], dnl WebAssembly System Interface
1141 [x86_64-*-freebsd*/clang], [PY_SUPPORT_TIER=3], dnl FreeBSD on AMD64
1154 AC_CACHE_CHECK([for -Wl,--no-as-needed], [ac_cv_wl_no_as_needed], [
1156 AS_VAR_APPEND([LDFLAGS], [-Wl,--no-as-needed])
1158 [NO_AS_NEEDED="-Wl,--no-as-needed"
1177 ANDROID_API_LEVEL=`sed -n -e '/__ANDROID_API__/d' -e 's/^android_api = //p' conftest.out`
1178 _arm_arch=`sed -n -e '/__ARM_ARCH/d' -e 's/^arm_arch = //p' conftest.out`
1180 if test -z "$ANDROID_API_LEVEL"; then
1187 if test "$_arm_arch" = 7; then
1188 BASECFLAGS="${BASECFLAGS} -mfloat-abi=softfp -mfpu=vfpv3-d16"
1189 LDFLAGS="${LDFLAGS} -march=armv7-a -Wl,--fix-cortex-a8"
1194 rm -f conftest.c conftest.out
1206 AC_MSG_CHECKING([for --with-emscripten-target])
1207 AC_ARG_WITH([emscripten-target],
1208 [AS_HELP_STRING([--with-emscripten-target=@<:@browser|node@:>@], [Emscripten platform])],
1218 [browser-debug], [ac_sys_emscripten_target=browser-debug],
1219 [node-debug], [ac_sys_emscripten_target=node-debug],
1220 [AC_MSG_ERROR([Invalid argument: --with-emscripten-target=browser|node])]
1223 AC_MSG_ERROR([--with-emscripten-target only applies to Emscripten])
1230 dnl On Emscripten dlopen() requires -s MAIN_MODULE and -fPIC. The flags
1233 dnl See https://emscripten.org/docs/compiling/Dynamic-Linking.html
1234 AC_MSG_CHECKING([for --enable-wasm-dynamic-linking])
1235 AC_ARG_ENABLE([wasm-dynamic-linking],
1236 [AS_HELP_STRING([--enable-wasm-dynamic-linking],
1242 [AC_MSG_ERROR([--enable-wasm-dynamic-linking only applies to Emscripten and WASI])]
1249 AC_MSG_CHECKING([for --enable-wasm-pthreads])
1250 AC_ARG_ENABLE([wasm-pthreads],
1251 [AS_HELP_STRING([--enable-wasm-pthreads],
1257 [AC_MSG_ERROR([--enable-wasm-pthreads only applies to Emscripten and WASI])]
1264 AC_MSG_CHECKING([for --with-suffix])
1266 …[AS_HELP_STRING([--with-suffix=SUFFIX], [set executable suffix to SUFFIX (default is empty, yes is…
1283 # Test whether we're running on a non-case-sensitive system, in which
1286 AC_MSG_CHECKING(for case-insensitive build directory)
1287 if test ! -d CaseSensitiveTestDir; then
1291 if test -d casesensitivetestdir && test -z "$EXEEXT"
1304 cc|*/cc) CC="$CC -Ae";;
1310 if test -z "$LIBRARY"
1328 # on the system - some systems like version suffix, others don't
1348 # LINKCC is the command that links the python executable -- default is $(CC).
1349 # If CXX is set, and if it is needed to link a main function that was
1350 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
1354 if test -z "$LINKCC"
1360 # support -N.
1383 # distutils.unixccompiler to know if it should add --enable-new-dtags
1389 if test "$GCC" = yes; then
1390 ac_prog=`$CC -print-prog-name=ld`
1392 case `"$ac_prog" -V 2>&1 < /dev/null` in
1400 AC_MSG_CHECKING(for --enable-shared)
1402 … AS_HELP_STRING([--enable-shared], [enable building a shared Python library (default is no)]))
1404 if test -z "$enable_shared"
1415 # --with-static-libpython
1417 AC_MSG_CHECKING(for --with-static-libpython)
1418 AC_ARG_WITH(static-libpython,
1419 AS_HELP_STRING([--without-static-libpython],
1422 if test "$withval" = no
1432 AC_MSG_CHECKING(for --enable-profiling)
1434 … AS_HELP_STRING([--enable-profiling], [enable C-level code profiling with gprof (default is no)]))
1435 if test "x$enable_profiling" = xyes; then
1437 CC="$CC -pg"
1447 if test "x$enable_profiling" = xyes; then
1448 BASECFLAGS="-pg $BASECFLAGS"
1449 LDFLAGS="-pg $LDFLAGS"
1456 # will find it with a -framework option). For this reason there is an
1460 if test "$enable_framework"
1470 if test $enable_shared = "yes"; then
1480 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(LDVERSION)'
1483 if test "$with_pydebug" != yes
1490 BLDLIBRARY='-L. -lpython$(LDVERSION)'
1493 if test "$with_pydebug" != yes
1499 case `uname -m` in
1507 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(LDVERSION)'
1512 BLDLIBRARY='-L. -lpython$(LDVERSION)'
1531 if test "$cross_compiling" = yes; then
1536 if test -z "$HOSTRUNNER"
1544 AC_CACHE_CHECK([for node --experimental-wasm-bigint], [ac_cv_tool_node_wasm_bigint], [
1545 if $NODE -v --experimental-wasm-bigint > /dev/null 2>&1; then
1552 AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-bigint"])
1556 AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-threads"])
1558 … AC_CACHE_CHECK([for node --experimental-wasm-bulk-memory], [ac_cv_tool_node_wasm_bulk_memory], [
1559 if $NODE -v --experimental-wasm-bulk-memory > /dev/null 2>&1; then
1566 AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-bulk-memory"])
1570 … AS_VAR_IF([host_cpu], [wasm64], [AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-memory64"])])
1575 …mtime run --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell …
1583 if test -n "$HOSTRUNNER"; then
1596 if test "$PY_ENABLE_SHARED" = 1 || test "$enable_framework" ; then
1598 if test "$STATIC_LIBPYTHON" = 1; then
1604 if test "$STATIC_LIBPYTHON" = 0; then
1623 if test -z "$ARFLAGS"
1629 if test "$cross_compiling" = yes; then
1641 # install -d does not work on HP-UX
1642 if test -z "$INSTALL"
1644 INSTALL="${srcdir}/install-sh -c"
1652 if test -z "$LN" ; then
1654 CYGWIN*) LN="ln -s";;
1663 # Check for --with-pydebug
1664 AC_MSG_CHECKING(for --with-pydebug)
1666 AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined (default is no)]),
1668 if test "$withval" != no
1671 [Define if you want to build an interpreter with many run-time checks.])
1679 # Check for --with-trace-refs
1680 # --with-trace-refs
1681 AC_MSG_CHECKING(for --with-trace-refs)
1682 AC_ARG_WITH(trace-refs,
1684 [--with-trace-refs],
1689 if test "$with_trace_refs" = "yes"
1695 # Check for --enable-pystats
1696 AC_MSG_CHECKING([for --enable-pystats])
1699 [--enable-pystats],
1709 # Check for --with-assertions.
1712 AC_MSG_CHECKING(for --with-assertions)
1714 AS_HELP_STRING([--with-assertions],[build with C assertions enabled (default is no)]),
1716 if test "$withval" != no
1721 if test "$assertions" = 'true'; then
1723 elif test "$Py_DEBUG" = 'true'; then
1725 AC_MSG_RESULT(implied by --with-pydebug)
1734 AC_MSG_CHECKING(for --enable-optimizations)
1736 [--enable-optimizations],
1739 if test "$enableval" != no
1749 if test "$Py_OPT" = 'true' ; then
1753 # who want LTO need to use --with-lto themselves.
1754 DEF_MAKE_ALL_RULE="profile-opt"
1759 AX_CHECK_COMPILE_FLAG([-fno-semantic-interposition],[
1760 CFLAGS_NODIST="$CFLAGS_NODIST -fno-semantic-interposition"
1761 LDFLAGS_NODIST="$LDFLAGS_NODIST -fno-semantic-interposition"
1765 elif test "$ac_sys_system" = "Emscripten" -o "$ac_sys_system" = "WASI"; then
1779 if test -z "$PROFILE_TASK"
1781 PROFILE_TASK='-m test --pgo --timeout=$(TESTTIMEOUT)'
1785 # Make llvm-related checks work on systems where llvm tools are not installed with their
1787 # non-suffixed name in their versioned llvm directory.
1791 if test "${CC}" = "clang"
1796 if test -L "${clang_bin}"
1806 AC_MSG_CHECKING(for --with-lto)
1807 AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto=@<:@full|thin|no|yes@:>@], [enable Link-Time-Optimizati…
1836 if test "$Py_LTO" = 'true' ; then
1839 LDFLAGS_NOLTO="-fno-lto"
1840 dnl Clang linker requires -flto in order to link objects with LTO information.
1842 AX_CHECK_COMPILE_FLAG([-flto=thin],[LDFLAGS_NOLTO="-flto=thin"],[LDFLAGS_NOLTO="-flto"])
1844 AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
1846 if test -n "${LLVM_AR}" -a -x "${LLVM_AR}"
1850 LLVM_AR_FOUND="not-found"
1852 if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
1854 # The Apple-supplied ar in Xcode or the Command Line Tools is apparently sufficient
1855 found_llvm_ar=`/usr/bin/xcrun -find ar 2>/dev/null`
1856 if test -n "${found_llvm_ar}"
1860 AC_MSG_NOTICE([llvm-ar found via xcrun: ${LLVM_AR}])
1863 if test $LLVM_AR_FOUND = not-found
1866 … AC_MSG_ERROR([llvm-ar is required for a --with-lto build with clang but could not be found.])
1874 if test $Py_LTO_POLICY = default
1876 LTOFLAGS="-flto -Wl,-export_dynamic"
1877 LTOCFLAGS="-flto"
1879 LTOFLAGS="-flto=${Py_LTO_POLICY} -Wl,-export_dynamic"
1880 LTOCFLAGS="-flto=${Py_LTO_POLICY}"
1884 if test $Py_LTO_POLICY = default
1886 LTOFLAGS="-flto"
1888 LTOFLAGS="-flto=${Py_LTO_POLICY}"
1894 if test "$Py_LTO_POLICY" != "default"; then
1897 LTOFLAGS="-flto"
1898 LTOCFLAGS="-flto"
1901 if test $Py_LTO_POLICY = thin
1906 LDFLAGS_NOLTO="-fno-lto"
1909 LTOFLAGS="-flto -Wl,-export_dynamic"
1910 LTOCFLAGS="-flto"
1913 LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
1919 if test "$ac_cv_prog_cc_g" = "yes"
1921 # bpo-30345: Add -g to LDFLAGS when compiling with LTO
1923 LTOFLAGS="$LTOFLAGS -g"
1926 CFLAGS_NODIST="$CFLAGS_NODIST ${LTOCFLAGS-$LTOFLAGS}"
1937 AC_PATH_TOOL(LLVM_PROFDATA, llvm-profdata, '', ${llvm_path})
1939 if test -n "${LLVM_PROFDATA}" -a -x "${LLVM_PROFDATA}"
1943 LLVM_PROF_FOUND="not-found"
1945 if test "$ac_sys_system" = "Darwin" -a "${LLVM_PROF_FOUND}" = "not-found"
1947 found_llvm_profdata=`/usr/bin/xcrun -find llvm-profdata 2>/dev/null`
1948 if test -n "${found_llvm_profdata}"
1950 # llvm-profdata isn't directly in $PATH in some cases.
1952 LLVM_PROFDATA='/usr/bin/xcrun llvm-profdata'
1954 AC_MSG_NOTICE([llvm-profdata found via xcrun: ${LLVM_PROFDATA}])
1961 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
1962 PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
1963 LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr"
1964 LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
1965 if test $LLVM_PROF_FOUND = not-found
1968 if test "${REQUIRE_PGO}" = "yes"
1970 …AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.…
1977 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
1978 PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
1979 LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr"
1980 LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
1981 if test "${LLVM_PROF_FOUND}" = "not-found"
1984 if test "${REQUIRE_PGO}" = "yes"
1986 …AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.…
1991 PGO_PROF_GEN_FLAG="-fprofile-generate"
1992 PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
1999 PGO_PROF_GEN_FLAG="-prof-gen"
2000 PGO_PROF_USE_FLAG="-prof-use"
2010 # ------------------------
2011 # (The following bit of code is complicated enough - please keep things
2012 # indented properly. Just pretend you're editing Python code. ;-)
2024 if $CC --version 2>&1 | grep -q clang
2032 # Check if CC supports -Og optimization level
2034 CFLAGS="-Og"
2035 AC_CACHE_CHECK([if $CC supports -Og optimization level],
2050 PYDEBUG_CFLAGS="-O0"
2052 [PYDEBUG_CFLAGS="-Og"])
2058 if test "${OPT-unset}" = "unset"
2062 # For gcc 4.x we need to use -fwrapv so lets check if its supported
2063 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
2064 WRAP="-fwrapv"
2067 if test -n "${cc_is_clang}"
2069 # Clang also needs -fwrapv
2070 WRAP="-fwrapv"
2071 # bpo-30104: disable strict aliasing to compile correctly dtoa.c,
2073 CFLAGS_ALIASING="-fno-strict-aliasing"
2078 if test "$Py_DEBUG" = 'true' ; then
2079 OPT="-g $PYDEBUG_CFLAGS -Wall"
2081 OPT="-g $WRAP -O3 -Wall"
2085 OPT="-O3 -Wall"
2090 SCO_SV*) OPT="$OPT -m486 -DSCO5"
2096 OPT="-O"
2105 dnl node-debug or browser-debug.
2109 AS_VAR_APPEND([LDFLAGS_NODIST], [" -sALLOW_MEMORY_GROWTH -sTOTAL_MEMORY=20971520"])
2112 AS_VAR_APPEND([LDFLAGS_NODIST], [" -sWASM_BIGINT"])
2115 …AS_VAR_APPEND([LDFLAGS_NODIST], [" -sFORCE_FILESYSTEM -lidbfs.js -lnodefs.js -lproxyfs.js -lworker…
2118 AS_VAR_APPEND([LINKFORSHARED], [" -sMAIN_MODULE"])
2122 AS_VAR_APPEND([CFLAGS_NODIST], [" -pthread"])
2123 AS_VAR_APPEND([LDFLAGS_NODIST], [" -sUSE_PTHREADS"])
2124 AS_VAR_APPEND([LINKFORSHARED], [" -sPROXY_TO_PTHREAD"])
2129 AS_VAR_IF([ac_sys_emscripten_target], [browser-debug], [wasm_debug=yes])
2130 AS_VAR_APPEND([LINKFORSHARED], [" --preload-file=\$(WASM_ASSETS_DIR)"])
2133 dnl separate-dwarf does not seem to work in Chrome DevTools Support.
2134 WASM_LINKFORSHARED_DEBUG="-gsource-map --emit-symbol-map"
2137 AS_VAR_IF([ac_sys_emscripten_target], [node-debug], [wasm_debug=yes])
2138 AS_VAR_APPEND([LDFLAGS_NODIST], [" -sALLOW_MEMORY_GROWTH -sNODERAWFS"])
2139 AS_VAR_APPEND([LINKFORSHARED], [" -sEXIT_RUNTIME"])
2140 WASM_LINKFORSHARED_DEBUG="-gseparate-dwarf --emit-symbol-map"
2145 AS_VAR_APPEND([LDFLAGS_NODIST], [" -sASSERTIONS"])
2148 AS_VAR_APPEND([LINKFORSHARED], [" -O2 -g0"])
2155 LIBS="$LIBS -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks"
2159 dnl https://github.com/WebAssembly/wasi-libc/issues/233
2160 …AS_VAR_APPEND([LDFLAGS_NODIST], [" -z stack-size=524288 -Wl,--stack-first -Wl,--initial-memory=104…
2177 # The -arch flags for universal builds on macOS
2186 AS_VAR_APPEND([CFLAGS], ["-W$2 -Werror"])
2198 CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
2200 PY_CHECK_CC_WARNING([enable], [extra], [if we can add -Wextra])
2202 [CFLAGS_NODIST="$CFLAGS_NODIST -Wextra"])
2206 # -fno-strict-aliasing on versions of GCC that support but produce
2209 CC="$CC -fno-strict-aliasing"
2211 AC_CACHE_CHECK([whether $CC accepts and needs -fno-strict-aliasing],
2217 CC="$ac_save_cc -fstrict-aliasing"
2218 CFLAGS="$CFLAGS -Werror -Wstrict-aliasing"
2234 [BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"])
2240 [PY_CHECK_CC_WARNING([disable], [unused-result])])
2242 [BASECFLAGS="$BASECFLAGS -Wno-unused-result"
2243 CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-result"])
2245 PY_CHECK_CC_WARNING([disable], [unused-parameter])
2247 [CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter"])
2249 PY_CHECK_CC_WARNING([disable], [missing-field-initializers])
2251 [CFLAGS_NODIST="$CFLAGS_NODIST -Wno-missing-field-initializers"])
2253 PY_CHECK_CC_WARNING([enable], [sign-compare])
2255 [BASECFLAGS="$BASECFLAGS -Wsign-compare"])
2257 PY_CHECK_CC_WARNING([enable], [unreachable-code])
2259 # results in non-standard code paths.
2265 if test $ac_cv_enable_unreachable_code_warning = yes && \
2266 test "$Py_DEBUG" != "true" && \
2267 test -z "`$CC --version 2>/dev/null | grep 'Free Software Foundation'`"
2269 BASECFLAGS="$BASECFLAGS -Wunreachable-code"
2274 PY_CHECK_CC_WARNING([enable], [strict-prototypes])
2276 [CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"])
2279 CC="$CC -Werror=implicit-function-declaration"
2293 [CFLAGS_NODIST="$CFLAGS_NODIST -Werror=implicit-function-declaration"])
2296 CC="$CC -fvisibility=hidden"
2309 [CFLAGS_NODIST="$CFLAGS_NODIST -fvisibility=hidden"])
2311 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
2316 BASECFLAGS="$BASECFLAGS -mieee"
2322 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
2326 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
2327 # used to be here, but non-Apple gcc doesn't accept them.
2328 if test "${CC}" = gcc
2336 CC=gcc-4.0
2337 CPP=cpp-4.0
2344 if test "${enable_universalsdk}"
2347 32-bit)
2348 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
2352 64-bit)
2353 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
2358 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
2359 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
2360 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
2363 UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
2365 LIPO_INTEL64_FLAGS="-extract x86_64"
2369 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
2370 LIPO_32BIT_FLAGS="-extract i386"
2371 ARCH_RUN_32BIT="/usr/bin/arch -i386"
2373 intel-32)
2374 UNIVERSAL_ARCH_FLAGS="-arch i386"
2378 intel-64)
2379 UNIVERSAL_ARCH_FLAGS="-arch x86_64"
2383 3-way)
2384 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
2385 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
2386 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
2389 … AC_MSG_ERROR([proper usage is --with-universal-arch=universal2|32-bit|64-bit|all|intel|3-way])
2393 if test "${UNIVERSALSDK}" != "/"
2395 CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
2396 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
2397 CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
2418 cur_target_major=`sw_vers -productVersion | \
2419 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
2420 cur_target_minor=`sw_vers -productVersion | \
2421 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
2423 if test ${cur_target_major} -eq 10 && \
2424 test ${cur_target_minor} -ge 3 && \
2425 test ${cur_target_minor} -le 5
2429 if test ${enable_universalsdk}
2432 all|3-way|intel|64-bit)
2438 if test `/usr/bin/arch` = "i386"
2445 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
2460 AC_MSG_ERROR(check config.log and use the '--with-universal-archs' option)
2471 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
2474 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
2482 # ICC needs -fp-model strict or floats behave badly
2483 CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict"
2486 CFLAGS_NODIST="$CFLAGS_NODIST -qalias=noansi -qmaxmem=-1"
2490 if test "$assertions" = 'true'; then
2493 OPT="-DNDEBUG $OPT"
2496 if test "$ac_arch_flags"
2505 # options before we can check whether -Kpthread improves anything.
2529 if test $ac_cv_pthread_is_default = yes
2533 # -Kpthread, if available, provides the right #defines
2535 # Some compilers won't report that they do not support -Kpthread,
2538 AC_CACHE_CHECK([whether $CC accepts -Kpthread], [ac_cv_kpthread],
2540 CC="$CC -Kpthread"
2558 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
2560 # -Kthread, if available, provides the right #defines
2562 # Some compilers won't report that they do not support -Kthread,
2565 AC_CACHE_CHECK([whether $CC accepts -Kthread], [ac_cv_kthread],
2567 CC="$CC -Kthread"
2585 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
2587 # -pthread, if available, provides the right #defines
2589 # Some compilers won't report that they do not support -pthread,
2592 AC_CACHE_CHECK([whether $CC accepts -pthread], [ac_cv_pthread],
2594 CC="$CC -pthread"
2613 # check if it works for CXX, too.
2615 if test ! -z "$CXX"
2617 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
2618 ac_save_cxx="$CXX"
2620 if test "$ac_cv_kpthread" = "yes"
2622 CXX="$CXX -Kpthread"
2624 elif test "$ac_cv_kthread" = "yes"
2626 CXX="$CXX -Kthread"
2628 elif test "$ac_cv_pthread" = "yes"
2630 CXX="$CXX -pthread"
2634 if test $ac_cv_cxx_thread = yes
2637 $CXX -c conftest.$ac_ext 2>&5
2638 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
2639 && test -s conftest$ac_exeext && ./conftest$ac_exeext
2645 rm -fr conftest*
2649 CXX="$ac_save_cxx"
2654 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
2681 # bluetooth/bluetooth.h has been known to not compile with -std=c99.
2684 CFLAGS="-std=c99 $CFLAGS"
2782 if test "$use_lfs" = "yes"; then
2797 # Add some code to confdefs.h so that the test for off_t works on SCO
2845 if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
2846 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
2877 if test "$ac_cv_kpthread" = "yes"
2878 then CC="$CC -Kpthread"
2879 elif test "$ac_cv_kthread" = "yes"
2880 then CC="$CC -Kthread"
2881 elif test "$ac_cv_pthread" = "yes"
2882 then CC="$CC -pthread"
2902 if test "$ac_cv_sizeof_pthread_key_t" -eq "$ac_cv_sizeof_int" ; then
2922 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
2933 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
2934 if test "${enable_universalsdk}"; then
2937 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
2939 …LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYT…
2940 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
2942 gcc_version=`gcc -dumpversion`
2943 if test ${gcc_version} '<' 4.0
2945 LIBTOOL_CRUFT="-lcc_dynamic"
2961 if test "${ac_osx_32bit}" = "yes"; then
2991 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
2992 …LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYT…
2993 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
2995 AC_MSG_CHECKING(for --enable-framework)
2996 if test "$enable_framework"
2998 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
2999 # -F. is needed to allow linking to the framework while
3005 if test $enable_shared = "yes"
3007 …AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --
3017 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
3018 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
3027 AC_MSG_CHECKING(for --with-address-sanitizer)
3029 AS_HELP_STRING([--with-address-sanitizer],
3033 BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
3034 LDFLAGS="-fsanitize=address $LDFLAGS"
3040 AC_MSG_CHECKING(for --with-memory-sanitizer)
3042 AS_HELP_STRING([--with-memory-sanitizer],
3046 AX_CHECK_COMPILE_FLAG([-fsanitize=memory],[
3047 BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS"
3048 LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS"
3055 AC_MSG_CHECKING(for --with-undefined-behavior-sanitizer)
3057 AS_HELP_STRING([--with-undefined-behavior-sanitizer],
3061 BASECFLAGS="-fsanitize=undefined $BASECFLAGS"
3062 LDFLAGS="-fsanitize=undefined $LDFLAGS"
3079 # -- usually .so, .sl on HP-UX, .dll on Cygwin
3081 if test -z "$SHLIB_SUFFIX"; then
3084 case `uname -m` in
3096 # -- "cc -G" on SunOS 5.x.
3100 if test -z "$LDSHARED"
3104 BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
3105 LDSHARED="\$(LIBPL)/ld_so_aix \$(CC) -bI:\$(LIBPL)/python.exp"
3108 if test "$GCC" = "yes" ; then
3109 LDSHARED='$(CC) -shared'
3110 LDCXXSHARED='$(CXX) -shared'
3112 LDSHARED='$(CC) -G'
3113 LDCXXSHARED='$(CXX) -G'
3116 if test "$GCC" = "yes" ; then
3117 LDSHARED='$(CC) -shared'
3118 LDCXXSHARED='$(CXX) -shared'
3120 LDSHARED='$(CC) -b'
3121 LDCXXSHARED='$(CXX) -b'
3124 LDSHARED='$(CC) -bundle'
3125 LDCXXSHARED='$(CXX) -bundle'
3126 if test "$enable_framework" ; then
3133 LDSHARED="$LDSHARED -undefined suppress"
3134 LDCXXSHARED="$LDCXXSHARED -undefined suppress"
3137 LDSHARED='$(CC) -bundle'
3138 LDCXXSHARED='$(CXX) -bundle'
3139 if test "$enable_framework" ; then
3145 # No framework, use the Python app as bundle-loader
3146 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
3147 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
3148 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
3151 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
3155 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
3157 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
3158 if test ${dep_target_major} -eq 10 && \
3159 test ${dep_target_minor} -le 2
3165 LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
3166 LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
3171 LDSHARED='$(CC) -shared'
3172 LDCXXSHARED='$(CXX) -shared';;
3174 LDSHARED='$(CC) -shared'
3175 LDCXXSHARED='$(CXX) -shared';;
3177 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
3179 LDSHARED='$(CC) -shared'
3180 LDCXXSHARED='$(CXX) -shared'
3182 LDSHARED="ld -Bshareable"
3185 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
3187 LDSHARED='$(CC) -shared $(CCSHARED)'
3188 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
3190 case `uname -r` in
3191 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
3192 LDSHARED="ld -Bshareable ${LDFLAGS}"
3195 LDSHARED='$(CC) -shared $(CCSHARED)'
3196 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
3201 LDSHARED='$(CC) -shared'
3202 LDCXXSHARED='$(CXX) -shared';;
3204 if test "$GCC" = "yes" ; then
3205 LDSHARED='$(CC) -shared'
3206 LDCXXSHARED='$(CXX) -shared'
3208 LDSHARED='$(CC) -G'
3209 LDCXXSHARED='$(CXX) -G'
3212 LDSHARED='$(CC) -Wl,-G,-Bexport'
3213 LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
3219 LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
3220 LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
3226 dnl test -z $LDSHARED block to configure BLDSHARED for side module support.
3227 if test "$enable_wasm_dynamic_linking" = "yes" -a "$ac_sys_system" = "Emscripten"; then
3228 BLDSHARED='$(CC) -shared -sSIDE_MODULE=1'
3232 LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
3235 BLDSHARED=${BLDSHARED-$LDSHARED}
3239 # library (module) -- this is only needed for a few systems
3241 if test -z "$CCSHARED"
3244 SunOS*) if test "$GCC" = yes;
3245 then CCSHARED="-fPIC";
3246 elif test `uname -p` = sparc;
3247 then CCSHARED="-xcode=pic32";
3248 else CCSHARED="-Kpic";
3250 hp*|HP*) if test "$GCC" = yes;
3251 then CCSHARED="-fPIC";
3254 Linux-android*) ;;
3255 Linux*|GNU*) CCSHARED="-fPIC";;
3258 CCSHARED="-fPIC"
3260 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
3261 Haiku*) CCSHARED="-fPIC";;
3263 if test "$GCC" = "yes"
3264 then CCSHARED="-fPIC"
3265 else CCSHARED="-KPIC"
3268 if test "$GCC" = "yes"
3269 then CCSHARED="-fPIC"
3270 else CCSHARED="-Kpic -belf"
3273 CCSHARED="-fpic -D__SO_PICABILINUX__ -ftls-model=global-dynamic"
3278 # the python executable -- this is only needed for a few systems
3280 if test -z "$LINKFORSHARED"
3283 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
3285 LINKFORSHARED="-Wl,-E -Wl,+s";;
3286 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
3287 Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
3288 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
3289 # -u libsys_s pulls in all symbols in libsys
3291 LINKFORSHARED="$extra_undefs -framework CoreFoundation"
3297 if test "$with_ubsan" = "yes"
3303 LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED"
3309 if test "$enable_framework"
3314 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
3315 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
3316 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
3318 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
3320 LINKFORSHARED="-Wl,--export-dynamic"
3324 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
3326 LINKFORSHARED="-Xlinker --export-dynamic"
3330 if test $enable_shared = "no"
3332 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
3335 # -Wl,-E causes the symbols to be added to the dynamic
3337 # is loaded. -N 2048K causes the stack size to be set
3340 LINKFORSHARED='-Wl,-E -N 2048K';;
3342 LINKFORSHARED='-Wl,-export-dynamic';;
3350 if test ! "$LIBRARY" = "$LDLIBRARY"
3362 dnl WASM dynamic linking requires -fPIC.
3369 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
3370 # library (with --enable-shared).
3389 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
3400 dnl Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet
3401 dnl stream in big-endian byte-order
3405 LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
3406 LIBUUID_LIBS=${LIBUUID_LIBS-""}
3413 dnl linux-util's libuuid has uuid_generate_time_safe() since v2.20 (2011)
3430 LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
3431 LIBUUID_LIBS=${LIBUUID_LIBS-"-luuid"}
3443 LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
3444 LIBUUID_LIBS=${LIBUUID_LIBS-""}
3460 LIBS="-lintl $LIBS"])
3476 dnl The AIX_BUILDDATE is obtained from the kernel fileset - bos.mp64
3481 AIX_BUILDDATE=$(lslpp -Lcq bos.mp64 | awk -F: '{ print $NF }')
3508 if test "$ac_cv_aligned_required" = yes ; then
3518 AC_MSG_CHECKING(for --with-hash-algorithm)
3521 AS_HELP_STRING([--with-hash-algorithm=@<:@fnv|siphash13|siphash24@:>@],
3544 if test -z "$1"; then
3552 AC_MSG_ERROR([--with-tzpath must contain only absolute paths, not $1])
3558 AC_MSG_CHECKING(for --with-tzpath)
3560 AS_HELP_STRING([--with-tzpath=<list of absolute paths separated by pathsep>]
3565 AC_MSG_ERROR([--with-tzpath requires a value])
3578 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
3579 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
3580 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
3584 AC_CHECK_LIB(network, socket, [LIBS="-lnetwork $LIBS"], [], $LIBS)
3588 AC_MSG_CHECKING(for --with-libs)
3590 … AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs (default is no)]),
3598 AC_MSG_CHECKING(for --with-system-expat)
3600 …AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library, see …
3607 LIBEXPAT_CFLAGS=${LIBEXPAT_CFLAGS-""}
3608 LIBEXPAT_LDFLAGS=${LIBEXPAT_LDFLAGS-"-lexpat"}
3611 LIBEXPAT_CFLAGS="-I\$(srcdir)/Modules/expat"
3612 LIBEXPAT_LDFLAGS="-lm \$(LIBEXPAT_A)"
3621 AC_MSG_CHECKING(for --with-system-ffi)
3623 …AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library, see Doc/…
3625 if test "$ac_sys_system" = "Darwin"
3634 AC_MSG_ERROR([--with-system-ffi accepts no arguments])
3640 if test "$with_system_ffi" != ""
3642 AC_MSG_WARN([--with(out)-system-ffi is ignored on this platform])
3647 if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
3648 … LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
3655 AC_MSG_CHECKING(for --with-system-libmpdec)
3657 …AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec librar…
3663 LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""}
3664 LIBMPDEC_LDFLAGS=${LIBMPDEC_LDFLAGS-"-lmpdec"}
3667 LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
3668 LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)"
3671 dnl Disable forced inlining in debug builds, see GH-94847
3673 AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DTEST_COVERAGE"])
3681 # Check whether _decimal should use a coroutine-local or thread-local context
3682 AC_MSG_CHECKING(for --with-decimal-contextvar)
3684 …AS_HELP_STRING([--with-decimal-contextvar], [build _decimal module using a coroutine-local rather …
3688 if test "$with_decimal_contextvar" != "no"
3691 …[Define if you want build the _decimal module using a coroutine-local rather than a thread-local c…
3705 if test "$libmpdec_system" = Darwin; then
3709 elif test $ac_cv_sizeof_size_t -eq 8; then
3710 if test "$ac_cv_gcc_asm_for_x64" = yes; then
3712 elif test "$ac_cv_type___uint128_t" = yes; then
3717 elif test $ac_cv_sizeof_size_t -eq 4; then
3718 if test "$ac_cv_gcc_asm_for_x87" = yes -a "$libmpdec_system" != sunos; then
3731 [x64], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_64=1 -DASM=1"])],
3732 [uint128], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_64=1 -DANSI=1 -DHAVE_UINT128_T=1"])],
3733 [ansi64], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_64=1 -DANSI=1"])],
3734 …[ppro], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_32=1 -DANSI=1 -DASM=1 -Wno-unknown-pr…
3735 [ansi32], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_32=1 -DANSI=1"])],
3736 …[ansi-legacy], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_32=1 -DANSI=1 -DLEGACY_COMPILER=1"])],
3737 [universal], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DUNIVERSAL=1"])],
3741 if test "$have_ipa_pure_const_bug" = yes; then
3744 # https://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
3745 AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -fno-ipa-pure-const"])
3748 if test "$have_glibc_memmove_bug" = yes; then
3750 # https://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
3751 AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -U_FORTIFY_SOURCE"])
3758 LIBNSL_CFLAGS=${LIBNSL_CFLAGS-""}
3767 LIBNSL_LIBS=${LIBNSL_LIBS-$libnsl}
3779 [NetBSD*], [OSSAUDIODEV_LIBS="-lossaudio"],
3784 PY_CHECK_EMSCRIPTEN_PORT([LIBSQLITE3], [-sUSE_SQLITE3])
3786 dnl Check for SQLite library. Use pkg-config if available.
3789 LIBSQLITE3_CFLAGS=${LIBSQLITE3_CFLAGS-""}
3790 LIBSQLITE3_LIBS=${LIBSQLITE3_LIBS-"-lsqlite3"}
3793 AS_VAR_APPEND([LIBSQLITE3_CFLAGS], [' -I$(srcdir)/Modules/_sqlite'])
3795 dnl PY_CHECK_SQLITE_FUNC(FUNCTION, IF-FOUND, IF-NOT-FOUND)
3803 dnl bpo-45774/GH-29507: The CPP check in AC_CHECK_HEADER can fail on FreeBSD,
3851 AC_MSG_CHECKING([for --enable-loadable-sqlite-extensions])
3852 AC_ARG_ENABLE([loadable-sqlite-extensions],
3854 [--enable-loadable-sqlite-extensions], [
3875 dnl Detect Tcl/Tk. Use pkg-config if available.
3892 TCLTK_CFLAGS=${TCLTK_CFLAGS-""}
3893 TCLTK_LIBS=${TCLTK_LIBS-""}
3940 AS_VAR_APPEND([TCLTK_CFLAGS], [" -Wno-strict-prototypes -DWITH_APPINIT=1"])
3956 GDBM_LIBS=${GDBM_LIBS-"-lgdbm"}
3970 # "gdbm-ndbm.h" and "gdbm/ndbm.h" are both normalized to "gdbm_ndbm_h"
3986 [gdbm-ndbm.h],
3991 AC_DEFINE([HAVE_GDBM_DASH_NDBM_H], [1], [Define to 1 if you have the <gdbm-ndbm.h> header file.])
3995 if test "$ac_cv_header_gdbm_slash_ndbm_h" = yes -o "$ac_cv_header_gdbm_dash_ndbm_h" = yes; then
4002 # db.h re-defines the name of the function
4006 LIBS="$LIBS -ldb"
4018 AC_DEFINE([HAVE_LIBDB], [1], [Define to 1 if you have the `db' library (-ldb).])
4022 # Check for --with-dbmliborder
4023 AC_MSG_CHECKING(for --with-dbmliborder)
4025 …AS_HELP_STRING([--with-dbmliborder=db1:db2:...], [override order to check db backends for dbm; a v…
4041 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:... (gdbm:ndbm:bdb)])
4048 [Define to force use of thread-safe errno, h_errno, and other functions])
4050 if test "$ac_cv_pthread_is_default" = yes
4055 if test "$ac_sys_system" = "SunOS"; then
4056 CFLAGS="$CFLAGS -D_REENTRANT"
4058 elif test "$ac_cv_kpthread" = "yes"
4060 CC="$CC -Kpthread"
4061 if test "$ac_cv_cxx_thread" = "yes"; then
4062 CXX="$CXX -Kpthread"
4065 elif test "$ac_cv_kthread" = "yes"
4067 CC="$CC -Kthread"
4068 if test "$ac_cv_cxx_thread" = "yes"; then
4069 CXX="$CXX -Kthread"
4072 elif test "$ac_cv_pthread" = "yes"
4074 CC="$CC -pthread"
4075 if test "$ac_cv_cxx_thread" = "yes"; then
4076 CXX="$CXX -pthread"
4080 if test ! -z "$withval" -a -d "$withval"
4081 then LDFLAGS="$LDFLAGS -L$withval"
4102 LIBS="$LIBS -lpthread"
4103 AC_MSG_CHECKING([for pthread_create in -lpthread])
4120 LIBS="$LIBS -lpthreads"
4124 LIBS="$LIBS -lc_r"
4128 LIBS="$LIBS -lpthread"
4132 LIBS="$LIBS -lcma"
4141 LIBS="$LIBS -lmpc"
4146 if test "$posix_threads" = "yes"; then
4147 if test "$unistd_defines_pthreads" = "no"; then
4179 if (pthread_attr_init(&attr)) return (-1);
4180 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
4181 if (pthread_create(&id, &attr, foo, NULL)) return (-1);
4188 if test "$ac_cv_pthread_system_supported" = "yes"; then
4205 # Check for enable-ipv6
4206 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
4207 AC_MSG_CHECKING([if --enable-ipv6 is specified])
4209 AS_HELP_STRING([--enable-ipv6],
4239 if test "$ipv6" = "yes"; then
4255 if test "$ipv6" = "yes"; then
4264 if test "$ipv6" = "yes"; then
4266 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
4290 linux-glibc)
4300 linux-inet6)
4302 if test -d /usr/inet6; then
4306 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
4310 if test -f /etc/netconfig; then
4311 if $GREP -q tcp6 /etc/netconfig; then
4336 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
4349 if test "$ipv6type" != "unknown"; then
4356 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
4357 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
4358 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
4396 # Check for --with-doc-strings
4397 AC_MSG_CHECKING(for --with-doc-strings)
4398 AC_ARG_WITH(doc-strings,
4399 AS_HELP_STRING([--with-doc-strings], [enable documentation strings (default is yes)]))
4401 if test -z "$with_doc_strings"
4404 if test "$with_doc_strings" != "no"
4411 # Check for Python-specific malloc support
4412 AC_MSG_CHECKING(for --with-pymalloc)
4414 AS_HELP_STRING([--with-pymalloc], [enable specialized mallocs (default is yes)]))
4416 if test -z "$with_pymalloc"
4418 dnl default to yes except for wasm32-emscripten and wasm32-wasi.
4425 if test "$with_pymalloc" != "no"
4428 [Define if you want to compile in Python-specific mallocs])
4434 AC_MSG_CHECKING(for --with-freelists)
4436 AS_HELP_STRING([--with-freelists], [enable object freelists (default is yes)]))
4438 if test -z "$with_freelists"
4442 if test "$with_freelists" != "no"
4449 # Check for --with-c-locale-coercion
4450 AC_MSG_CHECKING(for --with-c-locale-coercion)
4451 AC_ARG_WITH(c-locale-coercion,
4452 AS_HELP_STRING([--with-c-locale-coercion],
4453 [enable C locale coercion to a UTF-8 based locale (default is yes)]))
4455 if test -z "$with_c_locale_coercion"
4459 if test "$with_c_locale_coercion" != "no"
4462 [Define if you want to coerce the C locale to a UTF-8 based locale])
4467 AC_MSG_CHECKING([for --with-valgrind])
4469 AS_HELP_STRING([--with-valgrind], [enable Valgrind support (default is no)]),,
4472 if test "$with_valgrind" != no; then
4477 OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
4481 AC_MSG_CHECKING(for --with-dtrace)
4483 AS_HELP_STRING([--with-dtrace],[enable DTrace support (default is no)]),,
4495 if test "$with_dtrace" = "yes"
4498 if test "$DTRACE" = "not found"; then
4506 # generation flag '-G'. We check for presence of this flag, rather than
4512 "$DTRACE" $DFLAGS -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \
4515 if test "$ac_cv_dtrace_link" = "yes"; then
4520 dnl Platform-specific C and header files.
4533 # -I${DLINCLDIR} is added to the compile rule for importdl.o
4545 if test -z "$DYNLOADFILE"
4552 if test "$ac_cv_func_dlopen" = yes
4560 if test "$DYNLOADFILE" != "dynload_stub.o"
4566 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
4570 if test -z "$MACHDEP_OBJS"
4576 if test -z "$MACHDEP_OBJS"; then
4613 if test "$MACHDEP" != linux; then
4623 dnl PY_CHECK_FUNC(FUNCTION, [INCLUDES], [AC_DEFINE-VAR])
4662 PY_CHECK_FUNC([_dyld_shared_cache_contains_path], [#include <mach-o/dyld.h>], [HAVE_DYLD_SHARED_CAC…
4700 [AC_CHECK_LIB([bsd], [flock], [FCNTL_LIBS="-lbsd"])])])
4720 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
4743 if test "$ac_cv_have_chflags" = cross ; then
4746 if test "$ac_cv_have_chflags" = yes ; then
4762 if test "$ac_cv_have_lchflags" = cross ; then
4765 if test "$ac_cv_have_lchflags" = yes ; then
4773 PY_CHECK_EMSCRIPTEN_PORT([ZLIB], [-sUSE_ZLIB])
4787 ZLIB_CFLAGS=${ZLIB_CFLAGS-""}
4788 ZLIB_LIBS=${ZLIB_LIBS-"-lz"}
4796 BINASCII_CFLAGS="-DUSE_ZLIB_CRC32 $ZLIB_CFLAGS"
4801 PY_CHECK_EMSCRIPTEN_PORT([BZIP2], [-sUSE_BZIP2])
4811 BZIP2_CFLAGS=${BZIP2_CFLAGS-""}
4812 BZIP2_LIBS=${BZIP2_LIBS-"-lbz2"}
4825 LIBLZMA_CFLAGS=${LIBLZMA_CFLAGS-""}
4826 LIBLZMA_LIBS=${LIBLZMA_LIBS-"-llzma"}
4877 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
4878 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
4886 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
4887 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
4918 if test "$ac_cv_search_crypt_r" = "none required"; then
4923 LIBCRYPT_LIBS=${LIBCRYPT_LIBS-$libcrypt}
4950 LIBS="$LIBS -lrt"
5043 for (ai = aitop; ai; ai = ai->ai_next) {
5044 if (ai->ai_addr == NULL ||
5045 ai->ai_addrlen == 0 ||
5046 getnameinfo(ai->ai_addr, ai->ai_addrlen,
5051 switch (ai->ai_family) {
5112 if test "${enable_ipv6+set}" = set; then
5113 ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6"
5121 if test "$ac_cv_func_getaddrinfo" = no -o "$ac_cv_buggy_getaddrinfo" = yes
5126 or pass the "--disable-ipv6" option to configure.
5162 if test $ac_cv_header_time_altzone = yes; then
5170 if test $ac_cv_struct_addrinfo = yes; then
5180 if test $ac_cv_struct_sockaddr_storage = yes; then
5191 if test $ac_cv_struct_sockaddr_alg = yes; then
5255 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
5277 [Define this if you have the 6-arg version of gethostbyname_r().])
5296 [Define this if you have the 5-arg version of gethostbyname_r().])
5313 [Define this if you have the 3-arg version of gethostbyname_r().])
5339 # check for --with-libm=...
5343 *) LIBM=-lm
5345 AC_MSG_CHECKING(for --with-libm=STRING)
5347 …AS_HELP_STRING([--with-libm=STRING], [override libm math library to STRING (default is system-depe…
5349 if test "$withval" = no
5352 elif test "$withval" != yes
5355 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
5359 # check for --with-libc=...
5361 AC_MSG_CHECKING(for --with-libc=STRING)
5363 …AS_HELP_STRING([--with-libc=STRING], [override libc C library to STRING (default is system-depende…
5365 if test "$withval" = no
5368 elif test "$withval" != yes
5371 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
5396 if test "$ax_cv_c_float_words_bigendian" = "yes"
5399 [Define if C doubles are 64-bit IEEE 754 binary format, stored
5401 elif test "$ax_cv_c_float_words_bigendian" = "no"
5404 [Define if C doubles are 64-bit IEEE 754 binary format, stored
5407 # Some ARM platforms use a mixed-endian representation for doubles.
5409 # (see e.g., issue 1762561), we can at least make sure that float <-> string
5414 [Define if C doubles are 64-bit IEEE 754 binary format, stored
5415 in ARM mixed-endian order (byte order 45670123)])
5419 # correctly-rounded string <-> double conversion functions from
5420 # Python/dtoa.c, which in turn require that the FPU uses 53-bit
5452 # Detect whether system arithmetic is subject to x87-style double
5453 # rounding issues. The result of this test has little meaning on non
5454 # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
5455 # mode is round-to-nearest and double rounding issues are present, and
5457 AC_CACHE_CHECK([for x87-style double rounding], [ac_cv_x87_double_rounding], [
5466 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
5467 x = 0.99999999999999989; /* 1-2**-53 */
5471 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
5489 [Define if arithmetic is subject to x87-style double rounding issue])
5565 return res==-1 ? 1 : 0;
5584 AC_ARG_ENABLE(big-digits,
5585 AS_HELP_STRING([--enable-big-digits@<:@=15|30@:>@],[use big digits (30 or 15 bits) for Python longs…
5594 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
5611 if test "$wchar_h" = yes
5617 if test "$wchar_h" = yes
5626 return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
5636 if test "$ac_cv_sizeof_wchar_t" -ge 2 \
5637 -a "$ac_cv_wchar_t_signed" = "no"
5650 if test -f /etc/os-release; then
5651 OS_NAME=$(awk -F= '/^NAME=/ {print substr($2,2,length($2)-2)}' /etc/os-release)
5652 if test "x$OS_NAME" = "xOracle Solaris"; then
5653 # bpo-43667: In Oracle Solaris, the internal form of wchar_t in
5654 # non-Unicode locales is not Unicode and hence cannot be used directly.
5657 [Define if the internal form of wchar_t in non-Unicode locales
5672 # * The Python implementation (always 'cpython-' for us)
5674 # * --with-pydebug (adds a 'd')
5677 # would get a shared library ABI version tag of 'cpython-32dmu' and shared
5678 # libraries would be named 'foo.cpython-32dmu.so'.
5680 # In Python 3.2 and older, --with-wide-unicode added a 'u' flag.
5681 # In Python 3.7 and older, --with-pymalloc added a 'm' flag.
5686 SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
5690 if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then
5693 …ALT_SOABI='cpython-'`echo $VERSION | tr -d .``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATF…
5707 if test -n "$ANDROID_API_LEVEL" -o "$MACHDEP" = "cygwin"; then
5708 LIBPYTHON="-lpython${VERSION}${ABIFLAGS}"
5718 # Check for --with-platlibdir
5722 AC_MSG_CHECKING(for --with-platlibdir)
5724 AS_HELP_STRING([--with-platlibdir=DIRNAME],
5728 # --with-platlibdir
5729 # --with-platlibdir=
5730 # --without-platlibdir
5731 if test -n "$withval" -a "$withval" != yes -a "$withval" != no
5744 if test x$PLATFORM_TRIPLET = x; then
5745 LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}"
5747 LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
5751 # Check for --with-wheel-pkg-dir=PATH
5754 AC_MSG_CHECKING(for --with-wheel-pkg-dir)
5755 AC_ARG_WITH(wheel-pkg-dir,
5756 AS_HELP_STRING([--with-wheel-pkg-dir=PATH],
5759 if test -n "$withval"; then
5773 return (((-1)>>3 == -1) ? 0 : 1);
5779 if test "$ac_cv_rshift_extends_sign" = no
5794 if test "$ac_cv_have_getc_unlocked" = yes
5801 [AS_HELP_STRING([--with(out)-readline@<:@=editline@:>@],
5811 if test "$with_readline" != no; then
5822 AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline@:>@])
5831 if test -z "$py_libtermcap"; then
5832 READLINE_LIBS="-l$LIBREADLINE"
5834 READLINE_LIBS="-l$LIBREADLINE -l$py_libtermcap"
5840 if test $py_cv_lib_readline = yes; then
5847 if test $py_cv_lib_readline = no; then
5856 if test "$py_cv_lib_readline" = yes; then
5929 if (val1 != -1 && val1 == nice(2))
5937 if test "$ac_cv_broken_nice" = yes
5967 if test "$ac_cv_broken_poll" = yes
5988 in the library reference and as expected by the test suite.
5990 tm->tm_zone does not exist since it is the alternative way
5997 time_t groundhogday = 1044144000; /* GMT-based */
6002 if (localtime(&groundhogday)->tm_hour != 0)
6013 if (localtime(&groundhogday)->tm_hour != 19)
6020 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
6022 if (localtime(&groundhogday)->tm_hour != 11)
6030 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
6032 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
6042 if test "$ac_cv_working_tzset" = yes
6056 if test "$ac_cv_stat_tv_nsec" = yes
6070 if test "$ac_cv_stat_tv_nsec2" = yes
6078 if test "$cross_compiling" = no; then
6079 CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
6100 if test "$ac_cv_mvwdelch_is_expression" = yes
6116 w->_flags = 0;
6122 if test "$ac_cv_window_has_flags" = yes
6169 if test "x$cross_compiling" = xyes; then
6170 if test "${ac_cv_file__dev_ptmx+set}" != set; then
6175 if test "${ac_cv_file__dev_ptc+set}" != set; then
6183 if test "x$ac_cv_file__dev_ptmx" = xyes; then
6188 if test "x$ac_cv_file__dev_ptc" = xyes; then
6193 if test $ac_sys_system = Darwin
6195 LIBS="$LIBS -framework CoreFoundation"
6226 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
6229 if (strcmp(buffer, "-123"))
6237 [ac_cv_have_size_t_format="cross -- assuming yes"
6239 if test "$ac_cv_have_size_t_format" != no ; then
6261 size_t len = -1;
6270 if test "$ac_cv_broken_mbstowcs" = yes
6277 # Check for --with-computed-gotos
6278 AC_MSG_CHECKING(for --with-computed-gotos)
6279 AC_ARG_WITH(computed-gotos,
6280 AS_HELP_STRING([--with-computed-gotos],
6283 if test "$withval" = yes
6289 if test "$withval" = no
6313 [if test "${with_computed_gotos+set}" = set; then
6314 ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos"
6359 if test ! -d $dir; then
6365 # Availability of -O2:
6366 AC_CACHE_CHECK([for -O2], [ac_cv_compile_o2], [
6368 CFLAGS="-O2"
6374 # http://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
6377 CFLAGS="-O2 -D_FORTIFY_SOURCE=2"
6378 if test "$ac_cv_compile_o2" = no; then
6402 if test "$have_glibc_memmove_bug" = yes; then
6408 if test "$ac_cv_gcc_asm_for_x87" = yes; then
6411 # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
6414 AC_MSG_CHECKING(for gcc ipa-pure-const bug)
6416 CFLAGS="-O2"
6439 if test "$have_ipa_pure_const_bug" = yes; then
6441 [Define if gcc has the ipa-pure-const bug.])
6492 [AS_HELP_STRING([--with-ensurepip@<:@=install|upgrade|no@:>@],
6506 [AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])])
6558 # the test was written for the Solaris function of <sys/random.h>
6585 POSIXSHMEM_CFLAGS='-I$(srcdir)/Modules/_multiprocessing'
6588 AS_VAR_IF([ac_cv_search_shm_open], [-lrt], [POSIXSHMEM_LIBS="-lrt"])
6609 rpath_arg="-Wl,--enable-new-dtags,-rpath="
6611 rpath_arg="-Wl,-rpath="
6614 AC_MSG_CHECKING(for --with-openssl-rpath)
6615 AC_ARG_WITH(openssl-rpath,
6616 AS_HELP_STRING([--with-openssl-rpath=@<:@DIR|auto|no@:>@],
6619 auto: auto-detect rpath from --with-openssl and pkg-config,
6631 … [-L*], [OPENSSL_LDFLAGS_RPATH="$OPENSSL_LDFLAGS_RPATH ${rpath_arg}$(echo $arg | cut -c3-)"]
6637 [test -d "$with_openssl_rpath"],
6642 AC_MSG_ERROR([--with-openssl-rpath "$with_openssl_rpath" is not a directory]))
6649 # Requires static OpenSSL build with position-independent code. Some features
6657 [-l*], [
6658 libname=$(echo $arg | cut -c3-)
6659 new_OPENSSL_LIBS="$new_OPENSSL_LIBS -l:lib${libname}.a -Wl,--exclude-libs,lib${libname}.a"
6669 dnl AX_CHECK_OPENSSL does not export libcrypto-only libs
6673 [-l*ssl*|-Wl*ssl*], [],
6726 # ssl module default cipher suite string
6731 [Cipher suite string for PY_SSL_DEFAULT_CIPHERS=0]
6734 AC_MSG_CHECKING(for --with-ssl-default-suites)
6735 AC_ARG_WITH(ssl-default-suites,
6736 AS_HELP_STRING([--with-ssl-default-suites=@<:@python|openssl|STRING@:>@],
6766 AC_MSG_CHECKING(for --with-builtin-hashlib-hashes)
6767 AC_ARG_WITH(builtin-hashlib-hashes,
6768 AS_HELP_STRING([--with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2],
6804 # Check whether to disable test modules. Once set, setup.py will not build
6805 # test extension modules and "make install" will not install test suites.
6806 AC_MSG_CHECKING([for --disable-test-modules])
6807 AC_ARG_ENABLE([test-modules],
6808 [AS_HELP_STRING([--disable-test-modules], [don't build nor install test modules])], [
6889 [MODULE_BUILDTYPE=${MODULE_BUILDTYPE:-shared}]
6910 dnl PY_STDLIB_MOD([NAME], [ENABLED-TEST], [SUPPORTED-TEST], [CFLAGS], [LDFLAGS])
6911 dnl sets MODULE_$NAME_STATE based on PY_STDLIB_MOD_SET_NA(), ENABLED-TEST,
6912 dnl and SUPPORTED_TEST. ENABLED-TEST and SUPPORTED-TEST default to true if
6924 AS_IF([test "$modstate" != "n/a"], [
6934 AM_CONDITIONAL(modcond, [test "$modstate" = yes])
6948 AS_IF([test "$modstate" != "n/a"], [modstate=yes])
6949 AM_CONDITIONAL(modcond, [test "$modstate" = yes])
6960 PY_STDLIB_MOD_SIMPLE([_io], [-I\$(srcdir)/Modules/_io], [])
6985 [], [test "$ac_cv_func_sem_unlink" = "yes"],
6986 [-I\$(srcdir)/Modules/_multiprocessing])
6988 [], [test "$have_posix_shmem" = "yes"],
7002 [], [test "$ac_cv_header_sys_ioctl_h" = "yes" -a "$ac_cv_header_fcntl_h" = "yes"],
7005 [], [test "$ac_cv_header_sys_mman_h" = "yes" -a "$ac_cv_header_sys_stat_h" = "yes"])
7007 [], m4_flatten([test "$ac_cv_header_sys_socket_h" = "yes"
7008 -a "$ac_cv_header_sys_types_h" = "yes"
7009 -a "$ac_cv_header_netinet_in_h" = "yes"]))
7012 PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes])
7014 [], [test "$ac_cv_header_linux_soundcard_h" = yes -o "$ac_cv_header_sys_soundcard_h" = yes],
7016 PY_STDLIB_MOD([pwd], [], [test "$ac_cv_func_getpwuid" = yes -o "$ac_cv_func_getpwuid_r" = yes])
7017 PY_STDLIB_MOD([resource], [], [test "$ac_cv_header_sys_resource_h" = yes])
7019 [test "$ac_sys_system" = "Darwin"], [],
7020 [], [-framework SystemConfiguration -framework CoreFoundation])
7021 PY_STDLIB_MOD([spwd], [], [test "$ac_cv_func_getspent" = yes -o "$ac_cv_func_getspnam" = yes])
7022 PY_STDLIB_MOD([syslog], [], [test "$ac_cv_header_syslog_h" = yes])
7023 PY_STDLIB_MOD([termios], [], [test "$ac_cv_header_termios_h" = yes])
7039 PY_STDLIB_MOD([_md5], [test "$with_builtin_md5" = yes])
7040 PY_STDLIB_MOD([_sha1], [test "$with_builtin_sha1" = yes])
7041 PY_STDLIB_MOD([_sha256], [test "$with_builtin_sha256" = yes])
7042 PY_STDLIB_MOD([_sha512], [test "$with_builtin_sha512" = yes])
7043 PY_STDLIB_MOD([_sha3], [test "$with_builtin_sha3" = yes])
7045 [test "$with_builtin_blake2" = yes], [],
7049 [], [test "$ac_cv_crypt_crypt" = yes],
7057 [test "$have_gdbm_dbmliborder" = yes], [test "$have_gdbm" = yes],
7060 [], [test "$have_nis" = yes -a "$ac_cv_header_rpc_rpc_h" = yes],
7064 [test "$have_sqlite3" = "yes"],
7065 [test "$have_supported_sqlite3" = "yes"],
7068 [], [test "$have_tcltk" = "yes"],
7071 [], [test "$have_uuid" = "yes"],
7075 PY_STDLIB_MOD([zlib], [], [test "$have_zlib" = yes],
7079 PY_STDLIB_MOD([_bz2], [], [test "$have_bzip2" = yes],
7081 PY_STDLIB_MOD([_lzma], [], [test "$have_liblzma" = yes],
7085 PY_STDLIB_MOD([_ssl], [], [test "$ac_cv_working_openssl_ssl" = yes],
7087 PY_STDLIB_MOD([_hashlib], [], [test "$ac_cv_working_openssl_hashlib" = yes],
7090 dnl test modules
7091 PY_STDLIB_MOD([_testcapi], [test "$TEST_MODULES" = yes])
7092 PY_STDLIB_MOD([_testclinic], [test "$TEST_MODULES" = yes])
7093 PY_STDLIB_MOD([_testinternalcapi], [test "$TEST_MODULES" = yes])
7094 PY_STDLIB_MOD([_testbuffer], [test "$TEST_MODULES" = yes])
7095 PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes…
7096 PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
7097 PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
7098 PY_STDLIB_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes], [], …
7103 PY_STDLIB_MOD([xxlimited], [test "$with_trace_refs" = "no"], [test "$ac_cv_func_dlopen" = yes])
7104 PY_STDLIB_MOD([xxlimited_35], [test "$with_trace_refs" = "no"], [test "$ac_cv_func_dlopen" = yes])
7110 AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh)
7116 if test ! -f Modules/Setup.local
7122 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
7123 -s Modules \
7127 if test -z "$PKG_CONFIG"; then
7128 AC_MSG_WARN([pkg-config is missing. Some dependencies may not be detected correctly.])
7131 if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then
7135 please run ./configure --enable-optimizations
7142 CPython core team, see https://peps.python.org/pep-0011/ for more information.