core: Make Doxygen usage optional

Patch by Ben Kohler to solve Gentoo bug 486126.