@@ -674,6 +674,8 @@ LLVM_PROF_MERGER
674674PGO_PROF_USE_FLAG
675675PGO_PROF_GEN_FLAG
676676LTOFLAGS
677+ DEF_MAKE_RULE
678+ DEF_MAKE_ALL_RULE
677679ABIFLAGS
678680LN
679681MKDIR_P
@@ -774,7 +776,6 @@ infodir
774776docdir
775777oldincludedir
776778includedir
777- runstatedir
778779localstatedir
779780sharedstatedir
780781sysconfdir
@@ -808,6 +809,7 @@ with_suffix
808809enable_shared
809810enable_profiling
810811with_pydebug
812+ with_optimizations
811813with_lto
812814with_hash_algorithm
813815with_address_sanitizer
@@ -885,7 +887,6 @@ datadir='${datarootdir}'
885887sysconfdir=' ${prefix}/etc'
886888sharedstatedir=' ${prefix}/com'
887889localstatedir=' ${prefix}/var'
888- runstatedir=' ${localstatedir}/run'
889890includedir=' ${prefix}/include'
890891oldincludedir=' /usr/include'
891892docdir=' ${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1138,15 +1139,6 @@ do
11381139 | -silent | --silent | --silen | --sile | --sil)
11391140 silent=yes ;;
11401141
1141- -runstatedir | --runstatedir | --runstatedi | --runstated \
1142- | --runstate | --runstat | --runsta | --runst | --runs \
1143- | --run | --ru | --r)
1144- ac_prev=runstatedir ;;
1145- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1146- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1147- | --run=* | --ru=* | --r=* )
1148- runstatedir=$ac_optarg ;;
1149-
11501142 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
11511143 ac_prev=sbindir ;;
11521144 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
12841276for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12851277 datadir sysconfdir sharedstatedir localstatedir includedir \
12861278 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1287- libdir localedir mandir runstatedir
1279+ libdir localedir mandir
12881280do
12891281 eval ac_val=\$ $ac_var
12901282 # Remove trailing slashes.
@@ -1437,7 +1429,6 @@ Fine tuning of the installation directories:
14371429 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
14381430 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
14391431 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
1440- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
14411432 --libdir=DIR object code libraries [EPREFIX/lib]
14421433 --includedir=DIR C header files [PREFIX/include]
14431434 --oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1500,6 +1491,8 @@ Optional Packages:
15001491 compiler
15011492 --with-suffix=.exe set executable suffix
15021493 --with-pydebug build with Py_DEBUG defined
1494+ --with-optimizations Enable all optimizations when available (LTO, PGO,
1495+ etc). Disabled by default.
15031496 --with-lto Enable Link Time Optimization in PGO builds.
15041497 Disabled by default.
15051498 --with-hash-algorithm=[fnv|siphash24]
@@ -6528,6 +6521,46 @@ $as_echo "no" >&6; }
65286521fi
65296522
65306523
6524+ # Enable optimization flags
6525+
6526+
6527+ Py_OPT=' false'
6528+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for --with-optimizations" >&5
6529+ $as_echo_n " checking for --with-optimizations... " >&6 ; }
6530+
6531+ # Check whether --with-optimizations was given.
6532+ if test " ${with_optimizations+set} " = set ; then :
6533+ withval=$with_optimizations ;
6534+ if test " $withval " ! = no
6535+ then
6536+ Py_OPT=' true'
6537+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: yes" >&5
6538+ $as_echo " yes" >&6 ; };
6539+ else
6540+ Py_OPT=' false'
6541+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
6542+ $as_echo " no" >&6 ; };
6543+ fi
6544+ else
6545+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
6546+ $as_echo " no" >&6 ; }
6547+ fi
6548+
6549+ if test " $Py_OPT " = ' true' ; then
6550+ Py_LTO=' true'
6551+ case $ac_sys_system in
6552+ Darwin* )
6553+ # At least on macOS El Capitan, LTO does not work with PGO.
6554+ Py_LTO=' false'
6555+ ;;
6556+ esac
6557+ DEF_MAKE_ALL_RULE=" profile-opt"
6558+ DEF_MAKE_RULE=" build_all"
6559+ else
6560+ DEF_MAKE_ALL_RULE=" build_all"
6561+ DEF_MAKE_RULE=" all"
6562+ fi
6563+
65316564# Enable LTO flags
65326565
65336566{ $as_echo " $as_me :${as_lineno-$LINENO } : checking for --with-lto" >&5
@@ -17636,3 +17669,13 @@ $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1763617669 -s Modules Modules/Setup.config \
1763717670 Modules/Setup.local Modules/Setup
1763817671mv config.c Modules
17672+
17673+ if test " $Py_OPT " = ' false' -a " $Py_DEBUG " ! = ' true' ; then
17674+ echo " " >&6
17675+ echo " " >&6
17676+ echo " If you want a release build with all optimizations active (LTO, PGO, etc),"
17677+ echo " please run ./configure --with-optimizations" >&6
17678+ echo " " >&6
17679+ echo " " >&6
17680+ fi
17681+
0 commit comments