Patch by David Bolen.
when building in a separate object tree. More people should build this way. This may still fail if the source is unwritable, I haven't tested that yet.
It includes required changes in Makefile.pre.in and configure.ac among other files.