re-write build script
link with pthreads on linux