nghttpx: Show warning if certain feature is not compiled in

This commit is contained in:
Tatsuhiro Tsujikawa 2015-09-06 16:59:57 +09:00
parent 6d46249b7b
commit c30d252f94
2 changed files with 15 additions and 6 deletions

View File

@ -1946,11 +1946,7 @@ int main(int argc, char **argv) {
cmdcfgs.emplace_back(SHRPX_OPT_INSECURE, "yes"); cmdcfgs.emplace_back(SHRPX_OPT_INSECURE, "yes");
break; break;
case 'n': case 'n':
#ifdef NOTHREADS
LOG(WARN) << "Threading disabled at build time, no threads created.";
#else
cmdcfgs.emplace_back(SHRPX_OPT_WORKERS, optarg); cmdcfgs.emplace_back(SHRPX_OPT_WORKERS, optarg);
#endif // NOTHREADS
break; break;
case 'o': case 'o':
cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_FRAME_DEBUG, "yes"); cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_FRAME_DEBUG, "yes");

View File

@ -1373,7 +1373,12 @@ int parse_config(const char *opt, const char *optarg,
return 0; return 0;
} }
case SHRPX_OPTID_WORKERS: case SHRPX_OPTID_WORKERS:
#ifdef NOTHREADS
LOG(WARN) << "Threading disabled at build time, no threads created.";
return 0;
#else // !NOTHREADS
return parse_uint(&mod_config()->num_worker, opt, optarg); return parse_uint(&mod_config()->num_worker, opt, optarg);
#endif // !NOTHREADS
case SHRPX_OPTID_HTTP2_MAX_CONCURRENT_STREAMS: case SHRPX_OPTID_HTTP2_MAX_CONCURRENT_STREAMS:
return parse_uint(&mod_config()->http2_max_concurrent_streams, opt, optarg); return parse_uint(&mod_config()->http2_max_concurrent_streams, opt, optarg);
case SHRPX_OPTID_LOG_LEVEL: case SHRPX_OPTID_LOG_LEVEL:
@ -1949,12 +1954,20 @@ int parse_config(const char *opt, const char *optarg,
return parse_uint(&mod_config()->tls_ticket_key_memcached_max_fail, opt, return parse_uint(&mod_config()->tls_ticket_key_memcached_max_fail, opt,
optarg); optarg);
case SHRPX_OPTID_REQUEST_PHASE_FILE: case SHRPX_OPTID_REQUEST_PHASE_FILE:
#ifdef HAVE_MRUBY
mod_config()->request_phase_file = strcopy(optarg); mod_config()->request_phase_file = strcopy(optarg);
#else // !HAVE_MRUBY
LOG(WARN) << opt
<< ": ignored because mruby support is disabled at build time.";
#endif // !HAVE_MRUBY
return 0; return 0;
case SHRPX_OPTID_RESPONSE_PHASE_FILE: case SHRPX_OPTID_RESPONSE_PHASE_FILE:
#ifdef HAVE_MRUBY
mod_config()->response_phase_file = strcopy(optarg); mod_config()->response_phase_file = strcopy(optarg);
#else // !HAVE_MRUBY
LOG(WARN) << opt
<< ": ignored because mruby support is disabled at build time.";
#endif // !HAVE_MRUBY
return 0; return 0;
case SHRPX_OPTID_CONF: case SHRPX_OPTID_CONF:
LOG(WARN) << "conf: ignored"; LOG(WARN) << "conf: ignored";