Install headers before build.

This way running the build multiple times will always use
headers from the same location.  Otherwise they would first get
used from the source tree and then from destdir.
Running checkout multiple times is no longer a problem.

Preserve the ability to not checkout if the first parameter is
"nocheckout"; might be useful e.g. if you have local mods in
the source trees.