summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2016-04-15 23:57:04 (GMT)
committerGregory P. Smith <greg@krypto.org>2016-04-15 23:57:04 (GMT)
commitd82da9f7f22cd0e81e4de3d7331668d3aa9b0811 (patch)
tree242d8b5a519af5157256e87d9514cbb82f7350dc /configure.ac
parent1ff6b6ab121bce00cb9395fce034d09665ec8d77 (diff)
downloadcpython-d82da9f7f22cd0e81e4de3d7331668d3aa9b0811.zip
cpython-d82da9f7f22cd0e81e4de3d7331668d3aa9b0811.tar.gz
cpython-d82da9f7f22cd0e81e4de3d7331668d3aa9b0811.tar.bz2
Issue #25702: A --with-lto configure option has been added that will
enable link time optimizations at build time during a make profile-opt.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac33
1 files changed, 33 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7149830..b13cf05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1235,6 +1235,39 @@ else AC_MSG_RESULT(no); Py_DEBUG='false'
fi],
[AC_MSG_RESULT(no)])
+# Enable LTO flags
+AC_SUBST(LTOFLAGS)
+AC_MSG_CHECKING(for --with-lto)
+AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in PGO builds. Disabled by default.]),
+[
+if test "$withval" != no
+then
+ Py_LTO='true'
+ AC_MSG_RESULT(yes);
+else
+ Py_LTO='false'
+ AC_MSG_RESULT(no);
+fi],
+[AC_MSG_RESULT(no)])
+if test "$Py_LTO" = 'true' ; then
+ case $CC in
+ *clang*)
+ # Any changes made here should be reflected in the GCC+Darwin case below
+ LTOFLAGS="-flto"
+ ;;
+ *gcc*)
+ case $ac_sys_system in
+ Darwin*)
+ LTOFLAGS="-flto"
+ ;;
+ *)
+ LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
+ ;;
+ esac
+ ;;
+ esac
+fi
+
# Enable PGO flags.
AC_SUBST(PGO_PROF_GEN_FLAG)
AC_SUBST(PGO_PROF_USE_FLAG)