Enable optimizations in Python build and set exec_prefix
Turn on build optimizations with --enable-optimizations
and --with-lto
which enables Profile guided optimization (PGO) and Link Time Optimization (LTO). Both are needed, despite what some documentation might state.
Additionally, explicitly set the exec_prefix
to be the same as prefix
https://docs.python.org/3/using/unix.html#python-related-paths-and-files