detect pthreads and add proper linking flags if they are found. patch by caro from irc
Changed paths: