25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Introduce --enable-stun and --enable-sip configure options

STUN/TURN and SIP is not compiled by default anymore.
Use --enable-stun, --enable-sip or --enable-all to enable them.
This commit is contained in:
Evgeniy Khramtsov 2017-05-23 13:12:48 +03:00
parent 6e8895f9e9
commit 69de1780a0
8 changed files with 86 additions and 7 deletions

View File

@ -101,10 +101,10 @@ AC_ARG_ENABLE(mssql,
esac],[db_type=generic]) esac],[db_type=generic])
AC_ARG_ENABLE(all, AC_ARG_ENABLE(all,
[AC_HELP_STRING([--enable-all], [same as --enable-odbc --enable-mysql --enable-pgsql --enable-sqlite --enable-pam --enable-zlib --enable-riak --enable-redis --enable-elixir --enable-iconv --enable-debug --enable-tools (useful for Dialyzer checks, default: no)])], [AC_HELP_STRING([--enable-all], [same as --enable-odbc --enable-mysql --enable-pgsql --enable-sqlite --enable-pam --enable-zlib --enable-riak --enable-redis --enable-elixir --enable-iconv --enable-stun --enable-sip --enable-debug --enable-tools (useful for Dialyzer checks, default: no)])],
[case "${enableval}" in [case "${enableval}" in
yes) odbc=true mysql=true pgsql=true sqlite=true pam=true zlib=true riak=true redis=true elixir=true iconv=true debug=true tools=true ;; yes) odbc=true mysql=true pgsql=true sqlite=true pam=true zlib=true riak=true redis=true elixir=true iconv=true stun=true sip=true debug=true tools=true ;;
no) odbc=false mysql=false pgsql=false sqlite=false pam=false zlib=false riak=false redis=false elixir=false iconv=false debug=false tools=false ;; no) odbc=false mysql=false pgsql=false sqlite=false pam=false zlib=false riak=false redis=false elixir=false iconv=false stun=false sip=false debug=false tools=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-all) ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-all) ;;
esac],[]) esac],[])
@ -212,6 +212,22 @@ AC_ARG_ENABLE(latest_deps,
*) AC_MSG_ERROR(bad value ${enableval} for --enable-latest-deps) ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-latest-deps) ;;
esac],[if test "x$latest_deps" = "x"; then latest_deps=false; fi]) esac],[if test "x$latest_deps" = "x"; then latest_deps=false; fi])
AC_ARG_ENABLE(stun,
[AC_HELP_STRING([--enable-stun], [enable STUN/TURN support (default: no)])],
[case "${enableval}" in
yes) stun=true ;;
no) stun=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-stun) ;;
esac],[if test "x$stun" = "x"; then stun=false; fi])
AC_ARG_ENABLE(sip,
[AC_HELP_STRING([--enable-sip], [enable SIP support (default: no)])],
[case "${enableval}" in
yes) sip=true ;;
no) sip=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-sip) ;;
esac],[if test "x$sip" = "x"; then sip=false; fi])
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
vars.config vars.config
src/ejabberd.app.src]) src/ejabberd.app.src])
@ -253,6 +269,8 @@ AC_SUBST(riak)
AC_SUBST(redis) AC_SUBST(redis)
AC_SUBST(elixir) AC_SUBST(elixir)
AC_SUBST(iconv) AC_SUBST(iconv)
AC_SUBST(stun)
AC_SUBST(sip)
AC_SUBST(debug) AC_SUBST(debug)
AC_SUBST(tools) AC_SUBST(tools)
AC_SUBST(latest_deps) AC_SUBST(latest_deps)

View File

@ -25,12 +25,12 @@
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.8"}}}, {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.8"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}}, {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}},
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "e8dbfec277e7eb27b8130b13873b969cc346fafc"}}, {xmpp, ".*", {git, "https://github.com/processone/xmpp", "e8dbfec277e7eb27b8130b13873b969cc346fafc"}},
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.10"}}},
{esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.11"}}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.9"}}}, {fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.9"}}},
{jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}}, {jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},
{p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.1"}}}, {p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.1"}}},
{luerl, ".*", {git, "https://github.com/rvirding/luerl", {tag, "v0.2"}}}, {luerl, ".*", {git, "https://github.com/rvirding/luerl", {tag, "v0.2"}}},
{if_var_true, stun, {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.10"}}}},
{if_var_true, sip, {esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.11"}}}},
{if_var_true, mysql, {p1_mysql, ".*", {git, "https://github.com/processone/p1_mysql", {if_var_true, mysql, {p1_mysql, ".*", {git, "https://github.com/processone/p1_mysql",
"31e035b"}}}, "31e035b"}}},
{if_var_true, pgsql, {p1_pgsql, ".*", {git, "https://github.com/processone/p1_pgsql", {if_var_true, pgsql, {p1_pgsql, ".*", {git, "https://github.com/processone/p1_pgsql",
@ -84,6 +84,8 @@
{i, "deps/p1_utils/include"}, {i, "deps/p1_utils/include"},
{if_var_false, debug, no_debug_info}, {if_var_false, debug, no_debug_info},
{if_var_true, debug, debug_info}, {if_var_true, debug, debug_info},
{if_var_true, sip, {d, 'SIP'}},
{if_var_true, stun, {d, 'STUN'}},
{if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATWAY_WORKAROUND'}}, {if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATWAY_WORKAROUND'}},
{if_var_match, db_type, mssql, {d, 'mssql'}}, {if_var_match, db_type, mssql, {d, 'mssql'}},
{if_var_true, elixir, {d, 'ELIXIR_ENABLED'}}, {if_var_true, elixir, {d, 'ELIXIR_ENABLED'}},
@ -146,7 +148,7 @@
{post_hook_configure, [{"fast_tls", []}, {post_hook_configure, [{"fast_tls", []},
{"stringprep", []}, {"stringprep", []},
{"fast_yaml", []}, {"fast_yaml", []},
{"esip", []}, {if_var_true, sip, {"esip", []}},
{"fast_xml", [{if_var_true, full_xml, "--enable-full-xml"}]}, {"fast_xml", [{if_var_true, full_xml, "--enable-full-xml"}]},
{if_var_true, pam, {"epam", []}}, {if_var_true, pam, {"epam", []}},
{if_var_true, zlib, {"ezlib", []}}, {if_var_true, zlib, {"ezlib", []}},

View File

@ -22,6 +22,21 @@
%%%------------------------------------------------------------------- %%%-------------------------------------------------------------------
-module(ejabberd_sip). -module(ejabberd_sip).
-ifndef(SIP).
-include("logger.hrl").
-export([socket_type/0, start/2, listen_opt_type/1]).
log_error() ->
?CRITICAL_MSG("ejabberd is not compiled with SIP support", []).
socket_type() ->
log_error(),
raw.
listen_opt_type(_) ->
log_error(),
[].
start(_, _) ->
log_error(),
{error, sip_not_compiled}.
-else.
%% API %% API
-export([tcp_init/2, udp_init/2, udp_recv/5, start/2, -export([tcp_init/2, udp_init/2, udp_recv/5, start/2,
socket_type/0, listen_opt_type/1]). socket_type/0, listen_opt_type/1]).
@ -59,3 +74,4 @@ listen_opt_type(_) ->
%%%=================================================================== %%%===================================================================
%%% Internal functions %%% Internal functions
%%%=================================================================== %%%===================================================================
-endif.

View File

@ -27,6 +27,21 @@
-protocol({rfc, 5766}). -protocol({rfc, 5766}).
-protocol({xep, 176, '1.0'}). -protocol({xep, 176, '1.0'}).
-ifndef(STUN).
-include("logger.hrl").
-export([socket_type/0, start/2, listen_opt_type/1]).
log_error() ->
?CRITICAL_MSG("ejabberd is not compiled with STUN/TURN support", []).
socket_type() ->
log_error(),
raw.
listen_opt_type(_) ->
log_error(),
[].
start(_, _) ->
log_error(),
{error, sip_not_compiled}.
-else.
-export([tcp_init/2, udp_init/2, udp_recv/5, start/2, -export([tcp_init/2, udp_init/2, udp_recv/5, start/2,
socket_type/0, listen_opt_type/1]). socket_type/0, listen_opt_type/1]).
@ -138,3 +153,4 @@ listen_opt_type(_) ->
[shaper, auth_type, auth_realm, tls, certfile, turn_min_port, [shaper, auth_type, auth_realm, tls, certfile, turn_min_port,
turn_max_port, turn_max_allocations, turn_max_permissions, turn_max_port, turn_max_allocations, turn_max_permissions,
server_name]. server_name].
-endif.

View File

@ -25,6 +25,20 @@
-module(mod_sip). -module(mod_sip).
-protocol({rfc, 3261}). -protocol({rfc, 3261}).
-include("logger.hrl").
-ifndef(SIP).
-export([start/2, stop/1, depends/2, mod_opt_type/1]).
start(_, _) ->
?CRITICAL_MSG("ejabberd is not compiled with SIP support", []),
{error, sip_not_compiled}.
stop(_) ->
ok.
depends(_, _) ->
[].
mod_opt_type(_) ->
[].
-else.
-behaviour(gen_mod). -behaviour(gen_mod).
-behaviour(esip). -behaviour(esip).
@ -37,7 +51,6 @@
locate/1, mod_opt_type/1, depends/2]). locate/1, mod_opt_type/1, depends/2]).
-include("ejabberd.hrl"). -include("ejabberd.hrl").
-include("logger.hrl").
-include_lib("esip/include/esip.hrl"). -include_lib("esip/include/esip.hrl").
%%%=================================================================== %%%===================================================================
@ -350,3 +363,5 @@ mod_opt_type(via) ->
mod_opt_type(_) -> mod_opt_type(_) ->
[always_record_route, flow_timeout_tcp, [always_record_route, flow_timeout_tcp,
flow_timeout_udp, record_route, routes, via]. flow_timeout_udp, record_route, routes, via].
-endif.

View File

@ -24,6 +24,9 @@
%%%------------------------------------------------------------------- %%%-------------------------------------------------------------------
-module(mod_sip_proxy). -module(mod_sip_proxy).
-ifndef(SIP).
-export([]).
-else.
-define(GEN_FSM, p1_fsm). -define(GEN_FSM, p1_fsm).
-behaviour(?GEN_FSM). -behaviour(?GEN_FSM).
@ -424,3 +427,5 @@ safe_nameprep(S) ->
error -> S; error -> S;
S1 -> S1 S1 -> S1
end. end.
-endif.

View File

@ -24,6 +24,9 @@
%%%------------------------------------------------------------------- %%%-------------------------------------------------------------------
-module(mod_sip_registrar). -module(mod_sip_registrar).
-ifndef(SIP).
-export([]).
-else.
-ifndef(GEN_SERVER). -ifndef(GEN_SERVER).
-define(GEN_SERVER, gen_server). -define(GEN_SERVER, gen_server).
-endif. -endif.
@ -580,3 +583,5 @@ process_ping(SIPSocket) ->
(_, Acc) -> (_, Acc) ->
Acc Acc
end, ErrResponse, Sessions). end, ErrResponse, Sessions).
-endif.

View File

@ -40,6 +40,8 @@
{redis, @redis@}. {redis, @redis@}.
{elixir, @elixir@}. {elixir, @elixir@}.
{iconv, @iconv@}. {iconv, @iconv@}.
{stun, @stun@}.
{sip, @sip@}.
%% Version %% Version
{vsn, "@PACKAGE_VERSION@"}. {vsn, "@PACKAGE_VERSION@"}.