add pthread library when pthread is compiled with threads