From 275fe38f56cf07eb3e3c46e41d18402a94e66a5e Mon Sep 17 00:00:00 2001 From: Ryan Boland Date: Mar 04 2020 13:11:47 +0000 Subject: Merge pull request #166 from michaelglass/patch-1 disable lto flag for darwin + nix --- diff --git a/ext/extconf.rb b/ext/extconf.rb index 259bdcf..36652f3 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -24,7 +24,12 @@ if enable_config('march-tune-native', false) $CXXFLAGS << ' -march=native -mtune=native' end -if enable_config('lto', true) +# darwin nix clang doesn't support lto +# disable -lto flag for darwin + nix +# see: https://github.com/sass/sassc-ruby/issues/148 +enable_lto_by_default = (Gem::Platform.local.os == "darwin" && !ENV['NIX_CC'].nil?) + +if enable_config('lto', enable_lto_by_default) $CFLAGS << ' -flto' $CXXFLAGS << ' -flto' $LDFLAGS << ' -flto'