diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2011-10-26 11:41:06 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2011-10-26 11:41:06 +0100 |
| commit | e15c0f2325f449f25c2dc69b34a2fdf6808a6610 (patch) | |
| tree | f79871c20bcfa7315009349c111630a4807e6b9c /src | |
| parent | 8ef7d5466098cb7b617367850deec4df8d3ced77 (diff) | |
| download | rabbitmq-server-git-e15c0f2325f449f25c2dc69b34a2fdf6808a6610.tar.gz | |
If HiPE is not available, print an error message and continue.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit.erl | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 2b44ad8a03..4317a8f8b2 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -234,19 +234,25 @@ %%---------------------------------------------------------------------------- maybe_hipe_compile() -> - {ok, Compile} = application:get_env(rabbit, hipe_compile), - case Compile of - true -> Count = length(?HIPE_WORTHY), - io:format("HiPE compiling: |~s|~n ", - [string:copies("-", Count - 2)]), - T1 = erlang:now(), - [hipe_compile(M) || M <- ?HIPE_WORTHY], - T2 = erlang:now(), - io:format("~n~nCompiled ~B modules in ~Bs~n", - [Count, trunc(timer:now_diff(T2, T1) / 1000000)]); - false -> ok + {ok, Want} = application:get_env(rabbit, hipe_compile), + Can = code:which(hipe) =/= non_existing, + case {Want, Can} of + {true, true} -> hipe_compile(); + {true, false} -> io:format("Not HiPE compiling: HiPE not found in " + "this Erlang installation.~n"); + {false, _} -> ok end. +hipe_compile() -> + Count = length(?HIPE_WORTHY), + io:format("HiPE compiling: |~s|~n ", + [string:copies("-", Count - 2)]), + T1 = erlang:now(), + [hipe_compile(M) || M <- ?HIPE_WORTHY], + T2 = erlang:now(), + T = trunc(timer:now_diff(T2, T1) / 1000000), + io:format("~n~nCompiled ~B modules in ~Bs~n", [Count, T]). + hipe_compile(M) -> io:format("#"), {ok, M} = hipe:c(M, [o3]). |
