Portability: detect right way to build with pthreads