summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2016-09-07 00:15:21 (GMT)
committerBrett Cannon <brett@python.org>2016-09-07 00:15:21 (GMT)
commit8c94f9746578fd9294f606d9d81e7fb466b34bdb (patch)
tree9d521dc5882938d283a974cbd7212fa40dc5b65e /configure.ac
parent653c8509191623951ca7d0091f470d3632034d84 (diff)
downloadcpython-8c94f9746578fd9294f606d9d81e7fb466b34bdb.zip
cpython-8c94f9746578fd9294f606d9d81e7fb466b34bdb.tar.gz
cpython-8c94f9746578fd9294f606d9d81e7fb466b34bdb.tar.bz2
Issue #26359: Add the --with-optimizations flag.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac41
1 files changed, 41 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index fb2ae67..fce8147 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1230,6 +1230,37 @@ else AC_MSG_RESULT(no); Py_DEBUG='false'
fi],
[AC_MSG_RESULT(no)])
+# Enable optimization flags
+AC_SUBST(DEF_MAKE_ALL_RULE)
+AC_SUBST(DEF_MAKE_RULE)
+Py_OPT='false'
+AC_MSG_CHECKING(for --with-optimizations)
+AC_ARG_WITH(optimizations, AS_HELP_STRING([--with-optimizations], [Enable all optimizations when available (LTO, PGO, etc). Disabled by default.]),
+[
+if test "$withval" != no
+then
+ Py_OPT='true'
+ AC_MSG_RESULT(yes);
+else
+ Py_OPT='false'
+ AC_MSG_RESULT(no);
+fi],
+[AC_MSG_RESULT(no)])
+if test "$Py_OPT" = 'true' ; then
+ Py_LTO='true'
+ case $ac_sys_system in
+ Darwin*)
+ # At least on macOS El Capitan, LTO does not work with PGO.
+ Py_LTO='false'
+ ;;
+ esac
+ DEF_MAKE_ALL_RULE="profile-opt"
+ DEF_MAKE_RULE="build_all"
+else
+ DEF_MAKE_ALL_RULE="build_all"
+ DEF_MAKE_RULE="all"
+fi
+
# Enable LTO flags
AC_SUBST(LTOFLAGS)
AC_MSG_CHECKING(for --with-lto)
@@ -5299,3 +5330,13 @@ $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
-s Modules Modules/Setup.config \
Modules/Setup.local Modules/Setup
mv config.c Modules
+
+if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then
+ echo "" >&AS_MESSAGE_FD
+ echo "" >&AS_MESSAGE_FD
+ echo "If you want a release build with all optimizations active (LTO, PGO, etc),"
+ echo "please run ./configure --with-optimizations" >&AS_MESSAGE_FD
+ echo "" >&AS_MESSAGE_FD
+ echo "" >&AS_MESSAGE_FD
+fi
+