Use -pthread instead of -lpthread on FreeBSD