Skip to content

Commit 09205a0

Browse files
Support older compilers
1 parent 23568cd commit 09205a0

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

configure

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,19 @@ then
19141914
fi
19151915
fi
19161916

1917+
# Look for parallel LTO support in GCC to speed up builds.
1918+
AC_CACHE_CHECK([If GCC version supports parallel LTO],
1919+
[ac_cv_gcc_parallel_lto],
1920+
[AC_PREPROC_IFELSE([AC_LANG_SOURCE([
1921+
#if defined(__GNUC__) && (__GNUC__ >= 8)
1922+
/* GCC parallel LTO supported! */
1923+
#else
1924+
#error "GCC parallel lto unsupported"
1925+
#endif
1926+
], [])],
1927+
[ac_cv_gcc_parallel_lto=yes],
1928+
[ac_cv_gcc_parallel_lto=no])])
1929+
19171930
# Enable LTO flags
19181931
AC_MSG_CHECKING([for --with-lto])
19191932
AC_ARG_WITH([lto],
@@ -2031,7 +2044,12 @@ if test "$Py_LTO" = 'true' ; then
20312044
LTOCFLAGS="-flto"
20322045
;;
20332046
*)
2047+
if test $ac_cv_gcc_parallel_lto = yes
2048+
then
20342049
LTOFLAGS="-flto=auto -fuse-linker-plugin -ffat-lto-objects"
2050+
else
2051+
LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects"
2052+
fi
20352053
;;
20362054
esac
20372055
;;

0 commit comments

Comments
 (0)