diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-03-12 00:57:51 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-03-12 00:57:51 +0200 |
commit | a2b6ad6782b46f97a092addfa082e19e11053a9b (patch) | |
tree | d34d773949a47c5629485ccbfd5c8b38cda34b05 /m4 | |
parent | 7b74c9aad41793211f2aefd0e33bdaaa5ac1bcf3 (diff) |
check if -flto can build executables before enabling it
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ax_c_lto.m4 | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/m4/ax_c_lto.m4 b/m4/ax_c_lto.m4 new file mode 100644 index 0000000000..945527733e --- /dev/null +++ b/m4/ax_c_lto.m4 @@ -0,0 +1,21 @@ +# AC_C_LTO +# ------------- +# Define HAVE_LTO if -flto works. +AN_IDENTIFIER([lto], [AC_C_LTO]) +AC_DEFUN([AC_C_LTO], +[AC_CACHE_CHECK([if -flto builds executables], ac_cv_c_lto, +[AC_RUN_IFELSE( + [AC_LANG_SOURCE( + [[#include <stdio.h> + int main(int argc, char **argv) { + return 0; + } + ]])], + [ac_cv_c_lto=yes], + [ac_cv_c_lto=no], + [ac_cv_c_lto=no])]) +if test $ac_cv_c_lto = yes; then + AC_DEFINE([HAVE_LTO], 1, + [Define to 1 if -flto works.]) +fi +])# AC_C_LTO |