Added support for GNU readline at the REPL

Implemented both cursor movement and command history at the REPL with a
conditional compilation target using GNU readline.

This change also required a large rewrite of CMakeLists.txt (which was
broken anyway) and some small changes to the Makefile.
Merge pull request #6 from o-jay/master

Added support for GNU readline at the REPL