New configure/build system

The configure.inc script and much of the layout of the other files
has been borrowed from tvheadend.