diff options
author | Kenneth Heafield <github@kheafield.com> | 2013-01-23 17:28:15 +0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2013-01-23 17:28:15 +0400 |
commit | 22bf1c77e9866f5010708b288a33957a24627481 (patch) | |
tree | 4df804903162b94a1246e1c34e899bde430ba60f /lm | |
parent | 4cc23d233d96108a1469368acbfd91c2d04e66cc (diff) |
Ales Tamchyna patch for ancient Boost.
Diffstat (limited to 'lm')
-rw-r--r-- | lm/builder/lmplz_main.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lm/builder/lmplz_main.cc b/lm/builder/lmplz_main.cc index 90b9dca2d..8b4953ba2 100644 --- a/lm/builder/lmplz_main.cc +++ b/lm/builder/lmplz_main.cc @@ -6,6 +6,7 @@ #include <iostream> #include <boost/program_options.hpp> +#include <boost/version.hpp> namespace { class SizeNotify { @@ -33,7 +34,11 @@ int main(int argc, char *argv[]) { lm::builder::PipelineConfig pipeline; options.add_options() - ("order,o", po::value<std::size_t>(&pipeline.order)->required(), "Order of the model") + ("order,o", po::value<std::size_t>(&pipeline.order) +#if BOOST_VERSION >= 104200 + ->required() +#endif + , "Order of the model") ("interpolate_unigrams", po::bool_switch(&pipeline.initial_probs.interpolate_unigrams), "Interpolate the unigrams (default: emulate SRILM by not interpolating)") ("temp_prefix,T", po::value<std::string>(&pipeline.sort.temp_prefix)->default_value("/tmp/lm"), "Temporary file prefix") ("memory,S", SizeOption(pipeline.sort.total_memory, util::GuessPhysicalMemory() ? "80%" : "1G"), "Sorting memory") @@ -68,6 +73,14 @@ int main(int argc, char *argv[]) { po::store(po::parse_command_line(argc, argv, options), vm); po::notify(vm); + // required() appeared in Boost 1.42.0. +#if BOOST_VERSION < 104200 + if (!vm.count("order")) { + std::cerr << "the option '--order' is required but missing" << std::endl; + return 1; + } +#endif + util::NormalizeTempPrefix(pipeline.sort.temp_prefix); lm::builder::InitialProbabilitiesConfig &initial = pipeline.initial_probs; |