mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
4d8f770624
Use dynamic Rebar configuration Make iconv dependency optional Disable transient_supervisors compile option Add hipe compilation support Only compile ibrowse and lhttpc when needed Make it possible to generate an OTP application release Add --enable-debug compile option Add --enable-all compiler option Add --enable-tools configure option Add --with-erlang configure option. Add --enable-erlang-version-check configure option. Add lager support Improve the test suite
83 lines
2.3 KiB
Plaintext
83 lines
2.3 KiB
Plaintext
dnl erlang-extra.m4
|
|
|
|
AC_DEFUN([ERLANG_SUBST_LIB_VER],
|
|
[AC_ERLANG_CHECK_LIB([$1])
|
|
ERLANG_LIB_VER_SUBST="$ERLANG_LIB_VER_SUBST -e 's,[@]ERLANG_LIB_VER_$1[@],\$(ERLANG_LIB_VER_$1),g'"
|
|
AC_SUBST([ERLANG_LIB_VER_SUBST])
|
|
]) # ERLANG_SUBST_LIB_VER
|
|
|
|
AC_DEFUN([ERLANG_VERSION_CHECK],
|
|
[ AC_MSG_CHECKING([Erlang/OTP version])
|
|
cat > conftest.erl <<EOF
|
|
-module(conftest).
|
|
-export([[start/0]]).
|
|
|
|
start() ->
|
|
ERTS = erlang:system_info(version),
|
|
RequiredMin = "$1",
|
|
RequiredMax = "$2",
|
|
Status =
|
|
case {string:tokens(RequiredMin, " "),
|
|
string:tokens(RequiredMax, " ")} of
|
|
{[[MinStr | _]], [[MaxStr | _]]} ->
|
|
case check(ERTS, {MinStr, MaxStr}) of
|
|
less ->
|
|
list_to_binary([[ERTS, " found, ", RequiredMin, " required"]]);
|
|
greater ->
|
|
list_to_binary([[ERTS, " found, ", RequiredMax, " or earlier required"]]);
|
|
ok ->
|
|
<<"ok">>
|
|
end;
|
|
_ ->
|
|
list_to_binary([[ERTS, " found, ", RequiredMin, " required"]])
|
|
end,
|
|
file:write_file("conftest.out", Status),
|
|
halt().
|
|
|
|
check(CurStr, {MinStr, MaxStr}) ->
|
|
Cur = parse(CurStr),
|
|
Min = parse(MinStr),
|
|
Max = parse(MaxStr),
|
|
case {less_or_equal(Min, Cur), less_or_equal(Cur, Max)} of
|
|
{false, true} -> less;
|
|
{true, true} -> ok;
|
|
{true, false} -> greater
|
|
end.
|
|
|
|
parse(Version) ->
|
|
lists:map(fun(A) -> {Int,[[]]} = string:to_integer(A), Int end,
|
|
string:tokens(Version, ".")).
|
|
|
|
less_or_equal([[]], [[]]) ->
|
|
true;
|
|
less_or_equal([[Left| Rl]], [[Right| Rr]]) ->
|
|
case {Left < Right, Left == Right} of
|
|
{true, _} ->
|
|
true;
|
|
{false, false} ->
|
|
false;
|
|
{false, true} ->
|
|
less_or_equal(Rl, Rr)
|
|
end.
|
|
|
|
EOF
|
|
|
|
$ERLC conftest.erl || AC_MSG_ERROR(["Could not compile Erlang/OTP version check program using '$ERLC'"])
|
|
|
|
if ! $ERL -s conftest -noshell -o ! -f conftest.out ; then
|
|
AC_MSG_ERROR(["Could not run Erlang/OTP version check program using '$ERL'"])
|
|
fi
|
|
|
|
if test "x`cat conftest.out`" != "xok"; then
|
|
AC_MSG_RESULT([failed])
|
|
X="`cat conftest.out`"
|
|
if test "[$3]" == "warn"; then
|
|
AC_MSG_WARN([$X])
|
|
else
|
|
AC_MSG_FAILURE([$X])
|
|
fi
|
|
else
|
|
AC_MSG_RESULT([ok])
|
|
fi
|
|
]) dnl ERLANG_VERSION_CHECK
|