Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

39 wiersze
1.2 KiB

  1. % This file is part of Jiffy released under the MIT license.
  2. % See the LICENSE file for more information.
  3. %
  4. % Only run the EQC checks when EQC is present.
  5. HaveEQC = code:which(eqc) =/= non_existing,
  6. ErlOpts = if not HaveEQC -> []; true ->
  7. [{d, 'HAVE_EQC'}]
  8. end,
  9. Config1 = case lists:keyfind(erl_opts, 1, CONFIG) of
  10. {erl_opts, Opts} ->
  11. NewOpts = {erl_opts, Opts ++ ErlOpts},
  12. lists:keyreplace(erl_opts, 1, CONFIG, NewOpts);
  13. false ->
  14. CONFIG ++ [{erl_opts, ErlOpts}]
  15. end,
  16. case os:type() of
  17. {unix, _} ->
  18. CC = case os:getenv("CC") of
  19. false -> "cc";
  20. Else -> Else
  21. end,
  22. FLTO_CHECK = "echo 'int main(int argc, char *argv[]) {return 0;}' | "
  23. ++ CC ++ " -c -x c -o /dev/null -flto -",
  24. case os:cmd(FLTO_CHECK) of
  25. [] ->
  26. {port_env, PortEnv} = lists:keyfind(port_env, 1, Config1),
  27. NewFlag = {".*", "FLTO_FLAG", "-flto"},
  28. NewPortEnv = lists:keyreplace("FLTO_FLAG", 2, PortEnv, NewFlag),
  29. lists:keyreplace(port_env, 1, Config1, {port_env, NewPortEnv});
  30. _ ->
  31. Config1
  32. end;
  33. _ ->
  34. Config1
  35. end.