diff --git a/capture_opts.c b/capture_opts.c index 2c77a29ef8..92a5e1cea8 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -986,9 +986,18 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_ if (strcmp(optarg_str_p, "none") == 0) { ; } else if (strcmp(optarg_str_p, "gzip") == 0) { +#ifdef HAVE_ZLIB ; +#else + cmdarg_err("'gzip' compression is not supported"); + return 1; +#endif } else { +#ifdef HAVE_ZLIB cmdarg_err("parameter of --compress-type can be 'none' or 'gzip'"); +#else + cmdarg_err("parameter of --compress-type can only be 'none'"); +#endif return 1; } capture_opts->compress_type = g_strdup(optarg_str_p); diff --git a/ringbuffer.c b/ringbuffer.c index c22de5eeef..ec99c6871b 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -124,6 +124,7 @@ static void CleanupOldCap(gchar* name) g_mutex_unlock(&rb_data.mutex); } +#ifdef HAVE_ZLIB /* * compress capture file */ @@ -200,6 +201,7 @@ static int ringbuf_start_compress_file(rb_file* rfile) g_thread_new("exec_compress", &exec_compress_thread, name); return 0; } +#endif /* * create the next filename and open a new binary file with that name @@ -216,9 +218,11 @@ static int ringbuf_open_file(rb_file *rfile, int *err) /* remove old file (if any, so ignore error) */ ws_unlink(rfile->name); } +#ifdef HAVE_ZLIB else if (rb_data.compress_type != NULL && strcmp(rb_data.compress_type, "gzip") == 0) { ringbuf_start_compress_file(rfile); } +#endif g_free(rfile->name); } diff --git a/ui/qt/capture_options_dialog.cpp b/ui/qt/capture_options_dialog.cpp index e4311ddbda..a44d1dfc58 100644 --- a/ui/qt/capture_options_dialog.cpp +++ b/ui/qt/capture_options_dialog.cpp @@ -549,7 +549,11 @@ void CaptureOptionsDialog::on_gbNewFileAuto_toggled(bool checked) ui->stopMBComboBox->setEnabled(checked?false:true); ui->gbCompression->setEnabled(checked); ui->rbCompressionNone->setEnabled(checked); +#ifdef HAVE_ZLIB ui->rbCompressionGzip->setEnabled(checked); +#else + ui->rbCompressionGzip->setEnabled(false); +#endif } void CaptureOptionsDialog::on_cbUpdatePacketsRT_toggled(bool checked)