summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2016-04-15 23:58:51 (GMT)
committerGregory P. Smith <greg@krypto.org>2016-04-15 23:58:51 (GMT)
commit79a12a2aa5087a840988a77a2e1c59c2febe182d (patch)
tree9e92dee3418aaa8cb2d39a7691ad8f782600b9c6 /configure.ac
parenta9dd804c36b2ab4bbb0e90e541224ee21ef92d73 (diff)
parentd82da9f7f22cd0e81e4de3d7331668d3aa9b0811 (diff)
downloadcpython-79a12a2aa5087a840988a77a2e1c59c2febe182d.zip
cpython-79a12a2aa5087a840988a77a2e1c59c2febe182d.tar.gz
cpython-79a12a2aa5087a840988a77a2e1c59c2febe182d.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 837b43a..326afbc 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)