Added threading library to link dependencies.

Since the GLX backend now uses explicit pthread calls, linking needs to
be explicit as well.
Restored explicit linking for threading test.