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.

Unfortunately, I don't know how to handle those.

With this patch, we can do:

```sh
./autogen.sh
mkdir build
cd build
../configure -enable-lua --enable-tcl --disable-perl --disable-python --disable-ruby
make
```