Update build system

Sync with changes in libtoxcore (i.e. use pkg-config for finding the core library).

Also added a better search for ncurses.