From 0eaab78f67f96cb0a33e2447a39ff5664859fc5b Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Thu, 2 May 2013 18:15:03 +1000 Subject: [PATCH] Add --enable-debug compile option --- config.rebar.in | 22 --------- configure | 20 ++++++++- configure.ac | 11 ++++- rebar.config.script => rebar.config.script.in | 45 ++++++++++++++----- 4 files changed, 62 insertions(+), 36 deletions(-) delete mode 100644 config.rebar.in rename rebar.config.script => rebar.config.script.in (74%) diff --git a/config.rebar.in b/config.rebar.in deleted file mode 100644 index fc3331715..000000000 --- a/config.rebar.in +++ /dev/null @@ -1,22 +0,0 @@ -%% Macros -{roster_gateway_workaround, @roster_gateway_workaround@}. -{flash_hack, @flash_hack@}. -{transient_supervisors, @transient_supervisors@}. -{full_xml, @full_xml@}. -{nif, @nif@}. -{db_type, @db_type@}. - -%% Dependencies -{mysql, @mysql@}. -{pgsql, @pgsql@}. -{pam, @pam@}. -{zlib, @zlib@}. -{stun, @stun@}. -{riak, @riak@}. -{json, @json@}. -{iconv, @iconv@}. - -%% Local Variables: -%% mode: erlang -%% End: -%% vim: set filetype=erlang tabstop=8: diff --git a/configure b/configure index bc24c4b81..216784267 100755 --- a/configure +++ b/configure @@ -561,6 +561,7 @@ ac_default_prefix=/ ac_subst_vars='LTLIBOBJS LIBOBJS INSTALLUSER +debug iconv json riak @@ -644,6 +645,7 @@ enable_stun enable_riak enable_json enable_iconv +enable_debug enable_user ' ac_precious_vars='build_alias @@ -1287,6 +1289,7 @@ Optional Features: --enable-riak enable Riak support (default: no) --enable-json enable JSON support for mod_bosh (default: no) --enable-iconv enable iconv support (default: no) + --enable-debug enable debug information (default: yes) --enable-user[[[=USER]]] allow this system user to start ejabberd (default: no) @@ -2613,7 +2616,20 @@ fi -ac_config_files="$ac_config_files Makefile config.rebar src/ejabberd.app.src rel/reltool.config" +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; case "${enableval}" in + yes) debug=true ;; + no) debug=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-debug" "$LINENO" 5 ;; +esac +else + debug=true +fi + + + +ac_config_files="$ac_config_files Makefile rebar.config.script src/ejabberd.app.src rel/reltool.config" ENABLEUSER="" @@ -3339,7 +3355,7 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "config.rebar") CONFIG_FILES="$CONFIG_FILES config.rebar" ;; + "rebar.config.script") CONFIG_FILES="$CONFIG_FILES rebar.config.script" ;; "src/ejabberd.app.src") CONFIG_FILES="$CONFIG_FILES src/ejabberd.app.src" ;; "rel/reltool.config") CONFIG_FILES="$CONFIG_FILES rel/reltool.config" ;; diff --git a/configure.ac b/configure.ac index a70b2b924..e44414e0c 100644 --- a/configure.ac +++ b/configure.ac @@ -174,8 +174,17 @@ AC_ARG_ENABLE(iconv, esac],[iconv=false]) AC_SUBST(iconv) +AC_ARG_ENABLE(debug, +[AC_HELP_STRING([--enable-debug], [enable debug information (default: yes)])], +[case "${enableval}" in + yes) debug=true ;; + no) debug=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; +esac],[debug=true]) +AC_SUBST(debug) + AC_CONFIG_FILES([Makefile - config.rebar + rebar.config.script src/ejabberd.app.src rel/reltool.config]) diff --git a/rebar.config.script b/rebar.config.script.in similarity index 74% rename from rebar.config.script rename to rebar.config.script.in index 4bca701d2..8c83c6b05 100644 --- a/rebar.config.script +++ b/rebar.config.script.in @@ -6,12 +6,25 @@ %%% @end %%% Created : 1 May 2013 by Evgeniy Khramtsov %%%------------------------------------------------------------------- -Cfg = case file:consult("config.rebar") of - {ok, Terms} -> - Terms; - {error, _} -> - [] - end, +Cfg = [%% Macros + {roster_gateway_workaround, @roster_gateway_workaround@}, + {flash_hack, @flash_hack@}, + {transient_supervisors, @transient_supervisors@}, + {full_xml, @full_xml@}, + {nif, @nif@}, + {db_type, @db_type@}, + {debug, @debug@}, + + %% Dependencies + {mysql, @mysql@}, + {pgsql, @pgsql@}, + {pam, @pam@}, + {zlib, @zlib@}, + {stun, @stun@}, + {riak, @riak@}, + {json, @json@}, + {iconv, @iconv@}], + Macros = lists:flatmap( fun({roster_gateway_workaround, true}) -> [{d, 'ROSTER_GATEWAY_WORKAROUND'}]; @@ -28,13 +41,21 @@ Macros = lists:flatmap( (_) -> [] end, Cfg), -Head = [{erl_opts, [debug_info, - {i, "include"}, - {i, "deps/logger/include"}, - {i, "deps/xml/include"} - | Macros]}, + +DebugInfo = case lists:keysearch(debug, 1, Cfg) of + {value, {debug, true}} -> + [debug_info]; + _ -> + [] + end, + +Head = [{erl_opts, [{i, "include"}, + {i, filename:join(["deps", "logger", "include"])}, + {i, filename:join(["deps", "xml", "include"])}] + ++ Macros ++ DebugInfo}, {src_dirs, [asn1, src]}, {sub_dirs, ["rel"]}], + Deps = [{logger, ".*", {git, "git://github.com/processone/p1_logger"}}, {tls, ".*", {git, "git://github.com/processone/tls"}}, {stringprep, ".*", {git, "git://github.com/processone/stringprep"}}, @@ -42,6 +63,7 @@ Deps = [{logger, ".*", {git, "git://github.com/processone/p1_logger"}}, {lhttpc, ".*", {git, "git://github.com/esl/lhttpc"}}, %%{xml, ".*", {git, "git://github.com/processone/xml"}}, {xmlrpc, ".*", {git, "git://github.com/etnt/xmlrpc"}}], + CfgDeps = lists:flatmap( fun({mysql, true}) -> [{mysql, ".*", {git, "git://github.com/processone/mysql"}}]; @@ -62,6 +84,7 @@ CfgDeps = lists:flatmap( (_) -> [] end, Cfg), + Head ++ [{deps, Deps ++ CfgDeps}]. %% Local Variables: