]> arthur.barton.de Git - netdata.git/commitdiff
allow -flto to be set when cross compiling
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 11 Mar 2017 23:28:46 +0000 (01:28 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 11 Mar 2017 23:28:46 +0000 (01:28 +0200)
configure.ac
m4/ax_c_lto.m4

index 3eeedc4a1c2b01708e22a0ddd37d01a323b6b4f7..ddbc28e44fa2736d94eaa473a44fd12f8c9773c4 100644 (file)
@@ -405,9 +405,11 @@ fi
 if test "${have_lto}" = "yes"; then
     oCFLAGS="${CFLAGS}"
     CFLAGS="${CFLAGS} -flto ${OPTIONAL_MATH_CLFAGS} ${OPTIONAL_NFACCT_CLFAGS} ${OPTIONAL_ZLIB_CLFAGS} ${OPTIONAL_UUID_CLFAGS} ${OPTIONAL_LIBCAP_CFLAGS} ${OPTIONAL_IPMIMONITORING_CFLAGS}"
+    ac_cv_c_lto_cross_compile="${enable_lto}"
+    test "${ac_cv_c_lto_cross_compile}" != "yes" && ac_cv_c_lto_cross_compile="no"
     AC_C_LTO
     CFLAGS="${oCFLAGS}"
-    test "${ac_cv_c_lto}" = "no" && have_lto="no"
+    test "${ac_cv_c_lto}" != "yes" && have_lto="no"
 fi
 test "${enable_lto}" = "yes" -a "${have_lto}" != "yes" && \
     AC_MSG_ERROR([LTO is required but is not available.])
index 945527733ec3b7f4941abbfb75f9d79d63655e2e..7e6bc0119f8435af42a3da31a87f9f637ca4a21e 100644 (file)
@@ -13,8 +13,8 @@ AC_DEFUN([AC_C_LTO],
       ]])],
    [ac_cv_c_lto=yes],
    [ac_cv_c_lto=no],
-   [ac_cv_c_lto=no])])
-if test $ac_cv_c_lto = yes; then
+   [ac_cv_c_lto=${ac_cv_c_lto_cross_compile}])])
+if test "${ac_cv_c_lto}" = "yes"; then
   AC_DEFINE([HAVE_LTO], 1,
            [Define to 1 if -flto works.])
 fi