Check for dl and pthreads for the JACK driver

When not using SDL, we need to explicitly check for, and link
with dl and pthreads for dlopen(), pthread_mutex_trylock() etc,
which are needed by the JACK driver.

Closes #132.