AC_MSG_ERROR("inotifywait required");
fi
+AC_ARG_VAR(SEEDER_DOMAIN,[hostname from which seeder is serving])
+
dnl disable memcheck if valgrind not found
if test "x$enable_memcheck" != "xno"; then
if test -z "$VALGRIND"; then
AC_MSG_RESULT(no)
fi
-AC_ARG_VAR(SEEDER_DOMAIN,[hostname from which seeder is serving])
-
AM_CONDITIONAL([ENABLE_MEMCHECK],[test x$enable_memcheck = xyes])
+dnl Enable debug
+AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [use compiler flags and macros suited for debugging (default is no)])],
+ [enable_debug=$enableval],
+ [enable_debug=no])
+
+AC_MSG_CHECKING([if debugging])
+if test x$enable_debug != xno; then
+ AC_MSG_RESULT(yes)
+ CFLAGS="-ggdb -O0"
+ CXXFLAGS="-ggdb -O0"
+else
+ AC_MSG_RESULT(no)
+fi
+
+AM_CONDITIONAL([ENABLE_DEBUG],[test x$enable_debug = xyes])
# Checks for programs.
AC_PROG_CC
return 1;
}
+static struct option long_options[] = {
+ {"verbose", no_argument, 0, 'v'},
+ {0,0,0,0}
+};
+
int main(int argc, char **argv) try {
+ char c;
+ bool verbose_flag = false;
+
+ while(1) {
+ int option_index = 0;
+
+ if((c = getopt_long(argc,argv,"v",long_options,&option_index))==-1) { break; }
+
+ switch(c) {
+ case 0:
+ break;
+ case 'v':
+ verbose_flag = true;
+ std::cerr << "verbose mode enabled" << std::endl;
+
+ break;
+ case '?':
+ default:
+ std::cerr << "invalid option" << std::endl;
+ return EXIT_FAILURE;
+ }
+ }
+
if(setup_signal_handler()<0) { return EXIT_FAILURE; }
std::cout << "creating required directories" << std::endl;
settings.set_int(lt::settings_pack::active_limit,-1);
settings.set_str(lt::settings_pack::listen_interfaces,"0.0.0.0:6881,[::]:6881");
settings.set_str(lt::settings_pack::user_agent,PACKAGE_STRING);
-// settings.set_int(lt::settings_pack::alert_mask,(lt::alert::session_log_notification + lt::alert::torrent_log_notification));
+
+ if(verbose_flag) {
+ settings.set_int(lt::settings_pack::alert_mask, lt::alert::all_categories
+ & ~(lt::alert::dht_notification
+ + lt::alert::piece_progress_notification
+ + lt::alert::block_progress_notification
+ + lt::alert::progress_notification
+ + lt::alert::stats_notification
+ + lt::alert::session_log_notification
+ + lt::alert::torrent_log_notification
+ + lt::alert::peer_log_notification
+ + lt::alert::dht_log_notification
+ + lt::alert::picker_log_notification
+ ));
+ }
+
lt::session session(settings);
init(session);