Add more missing #includes
Copy and rework gen_makefiles.pl from Lucy source

'make test' should build and run the tests now.
Regenerate Makefiles
Add sample configure scripts