Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2017-11-06 13:29:42 +0300
committerPaweł Chmielowski <pchmielowski@process-one.net>2017-11-06 14:40:00 +0300
commit7121a9542801702a63bf6a7ccb92a9bd27ffc6e4 (patch)
tree8d78fb461d0d312b9bfbc4c6c6a4d376c1c56a72 /mix.exs
parent41c393466c9e57b6ed1a3f3d91ab4609e76d7e17 (diff)
Define flags that depend on erlang version in mix.exs
Diffstat (limited to 'mix.exs')
-rw-r--r--mix.exs15
1 files changed, 14 insertions, 1 deletions
diff --git a/mix.exs b/mix.exs
index 2ac1992cf..d5dc7175e 100644
--- a/mix.exs
+++ b/mix.exs
@@ -32,10 +32,23 @@ defmodule Ejabberd.Mixfile do
++ cond_apps()]
end
+ defp if_function_exported(mod, fun, arity, okResult) do
+ :code.ensure_loaded(mod)
+ if :erlang.function_exported(mod, fun, arity) do
+ okResult
+ else
+ []
+ end
+ end
+
defp erlc_options do
# Use our own includes + includes from all dependencies
includes = ["include"] ++ deps_include(["fast_xml", "xmpp", "p1_utils"])
- [:debug_info, {:d, :ELIXIR_ENABLED}] ++ cond_options() ++ Enum.map(includes, fn(path) -> {:i, path} end)
+ [:debug_info, {:d, :ELIXIR_ENABLED}] ++ cond_options() ++ Enum.map(includes, fn(path) -> {:i, path} end) ++
+ if_function_exported(:crypto, :strong_rand_bytes, 1, [{:d, :STRONG_RAND_BYTES}]) ++
+ if_function_exported(:rand, :uniform, 1, [{:d, :RAND_UNIFORM}]) ++
+ if_function_exported(:gb_sets, :iterator_from, 2, [{:d, :GB_SETS_ITERATOR_FROM}]) ++
+ if_function_exported(:public_key, :short_name_hash, 1, [{:d, :SHORT_NAME_HASH}])
end
defp cond_options do