Fix missing pthread linkage on Ubuntu.

We use libtool, which will by default add a "-nostdlib" option. This
option will disable the "-pthread" option, with the result that
"-lpthread" isn't added (which normally would be the case when
"-pthread" is used).
On most distros this seems to be handled anyway (patched libtool?), but
not on Ubuntu. To work against this we'll force "-lpthread" if we're
building on Linux.

For more info, see
https://bugzilla.redhat.com/show_bug.cgi?id=661333
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555