Add configure script and simplify Makefile

Loosely based on the configure script used by x264

TODO
  Support cross-compilation and out of tree builds
Cleanup gitignore
Fix compilation with --enable-debug