Allow running autogen.h from a different directory

This is useful when the build directory is separate from the source
directory.