Enable API documentation generation automatically when possible

I can't think of any reason why not to enable it automatically when Doxygen is found, but here's a PR in case I missed an obvious reason.

Will merge in a few days if there's no objection.