build: allow out-of-tree build

Building out of the tree is convenient because we there it does not
pollute VCS status and make it convenient to clean everything by just
removing the build directory.

Currently, the build won't work with Perl, Python and Ruby bindings.
Merge pull request #383 from vincentbernat/fix/out-of-tree-build

build: allow out-of-tree build