autogen.sh: Support running from outside the source directory
Initial steps towards supporting out-of-tree builds.