Assorted build system fixes for C++/Python/Java bindings.