Use boost::program_options to parse arguments.

Fixes #3536
Fixes #3184